@@ -7,225 +7,225 @@ |
||
| 7 | 7 | use Wordlift\Jsonld\Jsonld_Service; |
| 8 | 8 | |
| 9 | 9 | class Sync_Service { |
| 10 | - const JSONLD_HASH = '_wl_jsonld_hash'; |
|
| 11 | - const SYNCED_GMT = '_wl_synced_gmt'; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var \Wordlift_Log_Service |
|
| 15 | - */ |
|
| 16 | - private $log; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @var Api_Service |
|
| 20 | - */ |
|
| 21 | - private $api_service; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @var Jsonld_Service |
|
| 25 | - */ |
|
| 26 | - private $jsonld_service; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var Sync_Background_Process |
|
| 30 | - */ |
|
| 31 | - private $sync_background_process; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The number of posts processed in one call. |
|
| 35 | - * |
|
| 36 | - * @var int The batch size. |
|
| 37 | - */ |
|
| 38 | - private $batch_size; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var Sync_Object_Adapter_Factory |
|
| 42 | - */ |
|
| 43 | - private $sync_object_adapter_factory; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var Sync_Service |
|
| 47 | - */ |
|
| 48 | - private static $instance; |
|
| 49 | - private $entity_service; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Constructor. |
|
| 53 | - * |
|
| 54 | - * @param Api_Service $api_service The {@link Api_Service} used to communicate with the remote APIs. |
|
| 55 | - * @param Sync_Object_Adapter_Factory $sync_object_adapter_factory |
|
| 56 | - * @param Jsonld_Service $jsonld_service |
|
| 57 | - * @param \Wordlift_Entity_Service $entity_service |
|
| 58 | - */ |
|
| 59 | - public function __construct( $api_service, $sync_object_adapter_factory, $jsonld_service, $entity_service ) { |
|
| 60 | - |
|
| 61 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 62 | - |
|
| 63 | - $this->api_service = $api_service; |
|
| 64 | - $this->sync_object_adapter_factory = $sync_object_adapter_factory; |
|
| 65 | - $this->jsonld_service = $jsonld_service; |
|
| 66 | - $this->entity_service = $entity_service; |
|
| 67 | - $this->batch_size = 10; |
|
| 68 | - |
|
| 69 | - // You need to initialize this early, otherwise the Background Process isn't registered in AJAX calls. |
|
| 10 | + const JSONLD_HASH = '_wl_jsonld_hash'; |
|
| 11 | + const SYNCED_GMT = '_wl_synced_gmt'; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var \Wordlift_Log_Service |
|
| 15 | + */ |
|
| 16 | + private $log; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @var Api_Service |
|
| 20 | + */ |
|
| 21 | + private $api_service; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @var Jsonld_Service |
|
| 25 | + */ |
|
| 26 | + private $jsonld_service; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var Sync_Background_Process |
|
| 30 | + */ |
|
| 31 | + private $sync_background_process; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The number of posts processed in one call. |
|
| 35 | + * |
|
| 36 | + * @var int The batch size. |
|
| 37 | + */ |
|
| 38 | + private $batch_size; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var Sync_Object_Adapter_Factory |
|
| 42 | + */ |
|
| 43 | + private $sync_object_adapter_factory; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var Sync_Service |
|
| 47 | + */ |
|
| 48 | + private static $instance; |
|
| 49 | + private $entity_service; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Constructor. |
|
| 53 | + * |
|
| 54 | + * @param Api_Service $api_service The {@link Api_Service} used to communicate with the remote APIs. |
|
| 55 | + * @param Sync_Object_Adapter_Factory $sync_object_adapter_factory |
|
| 56 | + * @param Jsonld_Service $jsonld_service |
|
| 57 | + * @param \Wordlift_Entity_Service $entity_service |
|
| 58 | + */ |
|
| 59 | + public function __construct( $api_service, $sync_object_adapter_factory, $jsonld_service, $entity_service ) { |
|
| 60 | + |
|
| 61 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 62 | + |
|
| 63 | + $this->api_service = $api_service; |
|
| 64 | + $this->sync_object_adapter_factory = $sync_object_adapter_factory; |
|
| 65 | + $this->jsonld_service = $jsonld_service; |
|
| 66 | + $this->entity_service = $entity_service; |
|
| 67 | + $this->batch_size = 10; |
|
| 68 | + |
|
| 69 | + // You need to initialize this early, otherwise the Background Process isn't registered in AJAX calls. |
|
| 70 | 70 | // $this->sync_background_process = new Sync_Background_Process( $this );; |
| 71 | 71 | |
| 72 | - // Exclude the JSONLD_HASH meta key from those that require a resync. |
|
| 73 | - add_filter( 'wl_dataset__sync_hooks__ignored_meta_keys', function ( $args ) { |
|
| 74 | - $args[] = Sync_Service::JSONLD_HASH; |
|
| 75 | - $args[] = Sync_Service::SYNCED_GMT; |
|
| 76 | - |
|
| 77 | - return $args; |
|
| 78 | - } ); |
|
| 79 | - |
|
| 80 | - self::$instance = $this; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - public static function get_instance() { |
|
| 84 | - return self::$instance; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * @param int $type |
|
| 89 | - * @param int $object_id |
|
| 90 | - * |
|
| 91 | - * @return array|false |
|
| 92 | - * @throws Exception |
|
| 93 | - */ |
|
| 94 | - public function sync_one( $type, $object_id ) { |
|
| 95 | - |
|
| 96 | - $object = $this->sync_object_adapter_factory->create( $type, $object_id ); |
|
| 97 | - |
|
| 98 | - return $this->sync_many( array( $object ) ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * @param $type string Post or User. |
|
| 103 | - * @param $object_id int Post or User id |
|
| 104 | - * @param $uri string Entity uri , This needs to be supplied before deletion, if we |
|
| 105 | - * get it from meta it might not be available. |
|
| 106 | - * |
|
| 107 | - * @return bool |
|
| 108 | - */ |
|
| 109 | - public function delete_one( $type, $object_id, $uri ) { |
|
| 110 | - // Entity URL isn't set, bail out. |
|
| 111 | - if ( empty( $uri ) ) { |
|
| 112 | - return false; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $response = $this->api_service->request( |
|
| 116 | - 'DELETE', sprintf( '/middleware/dataset?uri=%s', rawurlencode( $uri ) ) ); |
|
| 117 | - |
|
| 118 | - // Update the sync date in case of success, otherwise log an error. |
|
| 119 | - if ( ! $response->is_success() ) { |
|
| 120 | - return false; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - return true; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * @param Sync_Object_Adapter[] $objects |
|
| 128 | - * @param bool $force Force synchronization even if the json-ld hash hasn't changed. |
|
| 129 | - * |
|
| 130 | - * @return bool |
|
| 131 | - * @throws Exception |
|
| 132 | - */ |
|
| 133 | - public function sync_many( $objects, $force = false ) { |
|
| 134 | - |
|
| 135 | - $hashes = array(); |
|
| 136 | - $payloads = array(); |
|
| 137 | - foreach ( $objects as $object ) { |
|
| 138 | - // Bail out if no payload. |
|
| 139 | - $payload_as_string = $this->get_payload_as_string( $object ); |
|
| 140 | - if ( empty( $payload_as_string ) ) { |
|
| 141 | - continue; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $new_hash = sha1( $payload_as_string ); |
|
| 145 | - $old_hash = $object->get_meta( self::JSONLD_HASH, true ); |
|
| 146 | - // JSON-LD hasn't changed, bail out. |
|
| 147 | - if ( ! $force && $new_hash === $old_hash ) { |
|
| 148 | - continue; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - // Collect the hashes and the payloads. |
|
| 152 | - $hashes[] = array( $object, $new_hash ); |
|
| 153 | - $payloads[] = $payload_as_string; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - // Bail out if payloads are empty. |
|
| 157 | - if ( empty( $payloads ) ) { |
|
| 158 | - return false; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - $response = $this->api_service->request( |
|
| 162 | - 'POST', '/middleware/dataset/batch', |
|
| 163 | - array( 'Content-Type' => 'application/json', ), |
|
| 164 | - // Put the payload in a JSON array w/o decoding/encoding again. |
|
| 165 | - '[ ' . implode( ', ', $payloads ) . ' ]' ); |
|
| 166 | - |
|
| 167 | - // Update the sync date in case of success, otherwise log an error. |
|
| 168 | - if ( ! $response->is_success() ) { |
|
| 169 | - return false; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - // If successful update the hashes and sync'ed datetime. |
|
| 173 | - foreach ( $hashes as $hash ) { |
|
| 174 | - $object = $hash[0]; |
|
| 175 | - $new_hash = $hash[1]; |
|
| 176 | - $object->update_meta( self::JSONLD_HASH, $new_hash ); |
|
| 177 | - $object->update_meta( self::SYNCED_GMT, current_time( 'mysql', true ) ); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return true; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * @param Sync_Object_Adapter $object |
|
| 185 | - * |
|
| 186 | - * @return false|string |
|
| 187 | - * @throws Exception |
|
| 188 | - */ |
|
| 189 | - private function get_payload_as_string( $object ) { |
|
| 190 | - $type = $object->get_type(); |
|
| 191 | - $object_id = $object->get_object_id(); |
|
| 192 | - |
|
| 193 | - $jsonld_as_string = wp_json_encode( apply_filters( 'wl_dataset__sync_service__sync_item__jsonld', |
|
| 194 | - $this->jsonld_service->get( $type, $object_id ), $type, $object_id ) ); |
|
| 195 | - $uri = $this->entity_service->get_uri( $object_id, $type ); |
|
| 196 | - |
|
| 197 | - // Entity URL isn't set, bail out. |
|
| 198 | - if ( empty( $uri ) ) { |
|
| 199 | - return false; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - return wp_json_encode( array( |
|
| 203 | - 'uri' => $uri, |
|
| 204 | - 'model' => $jsonld_as_string, |
|
| 205 | - 'private' => ! $object->is_public(), |
|
| 206 | - ) ); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * @param $post_id |
|
| 211 | - * |
|
| 212 | - * @todo Complete the delete item. |
|
| 213 | - */ |
|
| 214 | - public function delete_item( $post_id ) { |
|
| 215 | - $uri = get_post_meta( $post_id, 'entity_url', true ); |
|
| 216 | - // Make a request to the remote endpoint. |
|
| 217 | - $response = $this->api_service->request( |
|
| 218 | - 'DELETE', '/middleware/dataset?uri=' . rawurlencode( $uri ), |
|
| 219 | - array( 'Content-Type' => 'application/ld+json', ) ); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - public function get_batch_size() { |
|
| 223 | - |
|
| 224 | - return $this->batch_size; |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - public function delete_all() { |
|
| 228 | - $this->api_service->request( 'DELETE', '/middleware/dataset/all' ); |
|
| 229 | - } |
|
| 72 | + // Exclude the JSONLD_HASH meta key from those that require a resync. |
|
| 73 | + add_filter( 'wl_dataset__sync_hooks__ignored_meta_keys', function ( $args ) { |
|
| 74 | + $args[] = Sync_Service::JSONLD_HASH; |
|
| 75 | + $args[] = Sync_Service::SYNCED_GMT; |
|
| 76 | + |
|
| 77 | + return $args; |
|
| 78 | + } ); |
|
| 79 | + |
|
| 80 | + self::$instance = $this; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + public static function get_instance() { |
|
| 84 | + return self::$instance; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * @param int $type |
|
| 89 | + * @param int $object_id |
|
| 90 | + * |
|
| 91 | + * @return array|false |
|
| 92 | + * @throws Exception |
|
| 93 | + */ |
|
| 94 | + public function sync_one( $type, $object_id ) { |
|
| 95 | + |
|
| 96 | + $object = $this->sync_object_adapter_factory->create( $type, $object_id ); |
|
| 97 | + |
|
| 98 | + return $this->sync_many( array( $object ) ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * @param $type string Post or User. |
|
| 103 | + * @param $object_id int Post or User id |
|
| 104 | + * @param $uri string Entity uri , This needs to be supplied before deletion, if we |
|
| 105 | + * get it from meta it might not be available. |
|
| 106 | + * |
|
| 107 | + * @return bool |
|
| 108 | + */ |
|
| 109 | + public function delete_one( $type, $object_id, $uri ) { |
|
| 110 | + // Entity URL isn't set, bail out. |
|
| 111 | + if ( empty( $uri ) ) { |
|
| 112 | + return false; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $response = $this->api_service->request( |
|
| 116 | + 'DELETE', sprintf( '/middleware/dataset?uri=%s', rawurlencode( $uri ) ) ); |
|
| 117 | + |
|
| 118 | + // Update the sync date in case of success, otherwise log an error. |
|
| 119 | + if ( ! $response->is_success() ) { |
|
| 120 | + return false; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + return true; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * @param Sync_Object_Adapter[] $objects |
|
| 128 | + * @param bool $force Force synchronization even if the json-ld hash hasn't changed. |
|
| 129 | + * |
|
| 130 | + * @return bool |
|
| 131 | + * @throws Exception |
|
| 132 | + */ |
|
| 133 | + public function sync_many( $objects, $force = false ) { |
|
| 134 | + |
|
| 135 | + $hashes = array(); |
|
| 136 | + $payloads = array(); |
|
| 137 | + foreach ( $objects as $object ) { |
|
| 138 | + // Bail out if no payload. |
|
| 139 | + $payload_as_string = $this->get_payload_as_string( $object ); |
|
| 140 | + if ( empty( $payload_as_string ) ) { |
|
| 141 | + continue; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $new_hash = sha1( $payload_as_string ); |
|
| 145 | + $old_hash = $object->get_meta( self::JSONLD_HASH, true ); |
|
| 146 | + // JSON-LD hasn't changed, bail out. |
|
| 147 | + if ( ! $force && $new_hash === $old_hash ) { |
|
| 148 | + continue; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + // Collect the hashes and the payloads. |
|
| 152 | + $hashes[] = array( $object, $new_hash ); |
|
| 153 | + $payloads[] = $payload_as_string; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + // Bail out if payloads are empty. |
|
| 157 | + if ( empty( $payloads ) ) { |
|
| 158 | + return false; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + $response = $this->api_service->request( |
|
| 162 | + 'POST', '/middleware/dataset/batch', |
|
| 163 | + array( 'Content-Type' => 'application/json', ), |
|
| 164 | + // Put the payload in a JSON array w/o decoding/encoding again. |
|
| 165 | + '[ ' . implode( ', ', $payloads ) . ' ]' ); |
|
| 166 | + |
|
| 167 | + // Update the sync date in case of success, otherwise log an error. |
|
| 168 | + if ( ! $response->is_success() ) { |
|
| 169 | + return false; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + // If successful update the hashes and sync'ed datetime. |
|
| 173 | + foreach ( $hashes as $hash ) { |
|
| 174 | + $object = $hash[0]; |
|
| 175 | + $new_hash = $hash[1]; |
|
| 176 | + $object->update_meta( self::JSONLD_HASH, $new_hash ); |
|
| 177 | + $object->update_meta( self::SYNCED_GMT, current_time( 'mysql', true ) ); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @param Sync_Object_Adapter $object |
|
| 185 | + * |
|
| 186 | + * @return false|string |
|
| 187 | + * @throws Exception |
|
| 188 | + */ |
|
| 189 | + private function get_payload_as_string( $object ) { |
|
| 190 | + $type = $object->get_type(); |
|
| 191 | + $object_id = $object->get_object_id(); |
|
| 192 | + |
|
| 193 | + $jsonld_as_string = wp_json_encode( apply_filters( 'wl_dataset__sync_service__sync_item__jsonld', |
|
| 194 | + $this->jsonld_service->get( $type, $object_id ), $type, $object_id ) ); |
|
| 195 | + $uri = $this->entity_service->get_uri( $object_id, $type ); |
|
| 196 | + |
|
| 197 | + // Entity URL isn't set, bail out. |
|
| 198 | + if ( empty( $uri ) ) { |
|
| 199 | + return false; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + return wp_json_encode( array( |
|
| 203 | + 'uri' => $uri, |
|
| 204 | + 'model' => $jsonld_as_string, |
|
| 205 | + 'private' => ! $object->is_public(), |
|
| 206 | + ) ); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * @param $post_id |
|
| 211 | + * |
|
| 212 | + * @todo Complete the delete item. |
|
| 213 | + */ |
|
| 214 | + public function delete_item( $post_id ) { |
|
| 215 | + $uri = get_post_meta( $post_id, 'entity_url', true ); |
|
| 216 | + // Make a request to the remote endpoint. |
|
| 217 | + $response = $this->api_service->request( |
|
| 218 | + 'DELETE', '/middleware/dataset?uri=' . rawurlencode( $uri ), |
|
| 219 | + array( 'Content-Type' => 'application/ld+json', ) ); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + public function get_batch_size() { |
|
| 223 | + |
|
| 224 | + return $this->batch_size; |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + public function delete_all() { |
|
| 228 | + $this->api_service->request( 'DELETE', '/middleware/dataset/all' ); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | 231 | } |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | * @param Jsonld_Service $jsonld_service |
| 57 | 57 | * @param \Wordlift_Entity_Service $entity_service |
| 58 | 58 | */ |
| 59 | - public function __construct( $api_service, $sync_object_adapter_factory, $jsonld_service, $entity_service ) { |
|
| 59 | + public function __construct($api_service, $sync_object_adapter_factory, $jsonld_service, $entity_service) { |
|
| 60 | 60 | |
| 61 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 61 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 62 | 62 | |
| 63 | 63 | $this->api_service = $api_service; |
| 64 | 64 | $this->sync_object_adapter_factory = $sync_object_adapter_factory; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // $this->sync_background_process = new Sync_Background_Process( $this );; |
| 71 | 71 | |
| 72 | 72 | // Exclude the JSONLD_HASH meta key from those that require a resync. |
| 73 | - add_filter( 'wl_dataset__sync_hooks__ignored_meta_keys', function ( $args ) { |
|
| 73 | + add_filter('wl_dataset__sync_hooks__ignored_meta_keys', function($args) { |
|
| 74 | 74 | $args[] = Sync_Service::JSONLD_HASH; |
| 75 | 75 | $args[] = Sync_Service::SYNCED_GMT; |
| 76 | 76 | |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | * @return array|false |
| 92 | 92 | * @throws Exception |
| 93 | 93 | */ |
| 94 | - public function sync_one( $type, $object_id ) { |
|
| 94 | + public function sync_one($type, $object_id) { |
|
| 95 | 95 | |
| 96 | - $object = $this->sync_object_adapter_factory->create( $type, $object_id ); |
|
| 96 | + $object = $this->sync_object_adapter_factory->create($type, $object_id); |
|
| 97 | 97 | |
| 98 | - return $this->sync_many( array( $object ) ); |
|
| 98 | + return $this->sync_many(array($object)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -106,17 +106,17 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return bool |
| 108 | 108 | */ |
| 109 | - public function delete_one( $type, $object_id, $uri ) { |
|
| 109 | + public function delete_one($type, $object_id, $uri) { |
|
| 110 | 110 | // Entity URL isn't set, bail out. |
| 111 | - if ( empty( $uri ) ) { |
|
| 111 | + if (empty($uri)) { |
|
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $response = $this->api_service->request( |
| 116 | - 'DELETE', sprintf( '/middleware/dataset?uri=%s', rawurlencode( $uri ) ) ); |
|
| 116 | + 'DELETE', sprintf('/middleware/dataset?uri=%s', rawurlencode($uri)) ); |
|
| 117 | 117 | |
| 118 | 118 | // Update the sync date in case of success, otherwise log an error. |
| 119 | - if ( ! $response->is_success() ) { |
|
| 119 | + if ( ! $response->is_success()) { |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -130,51 +130,51 @@ discard block |
||
| 130 | 130 | * @return bool |
| 131 | 131 | * @throws Exception |
| 132 | 132 | */ |
| 133 | - public function sync_many( $objects, $force = false ) { |
|
| 133 | + public function sync_many($objects, $force = false) { |
|
| 134 | 134 | |
| 135 | 135 | $hashes = array(); |
| 136 | 136 | $payloads = array(); |
| 137 | - foreach ( $objects as $object ) { |
|
| 137 | + foreach ($objects as $object) { |
|
| 138 | 138 | // Bail out if no payload. |
| 139 | - $payload_as_string = $this->get_payload_as_string( $object ); |
|
| 140 | - if ( empty( $payload_as_string ) ) { |
|
| 139 | + $payload_as_string = $this->get_payload_as_string($object); |
|
| 140 | + if (empty($payload_as_string)) { |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $new_hash = sha1( $payload_as_string ); |
|
| 145 | - $old_hash = $object->get_meta( self::JSONLD_HASH, true ); |
|
| 144 | + $new_hash = sha1($payload_as_string); |
|
| 145 | + $old_hash = $object->get_meta(self::JSONLD_HASH, true); |
|
| 146 | 146 | // JSON-LD hasn't changed, bail out. |
| 147 | - if ( ! $force && $new_hash === $old_hash ) { |
|
| 147 | + if ( ! $force && $new_hash === $old_hash) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Collect the hashes and the payloads. |
| 152 | - $hashes[] = array( $object, $new_hash ); |
|
| 152 | + $hashes[] = array($object, $new_hash); |
|
| 153 | 153 | $payloads[] = $payload_as_string; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // Bail out if payloads are empty. |
| 157 | - if ( empty( $payloads ) ) { |
|
| 157 | + if (empty($payloads)) { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $response = $this->api_service->request( |
| 162 | 162 | 'POST', '/middleware/dataset/batch', |
| 163 | - array( 'Content-Type' => 'application/json', ), |
|
| 163 | + array('Content-Type' => 'application/json',), |
|
| 164 | 164 | // Put the payload in a JSON array w/o decoding/encoding again. |
| 165 | - '[ ' . implode( ', ', $payloads ) . ' ]' ); |
|
| 165 | + '[ '.implode(', ', $payloads).' ]' ); |
|
| 166 | 166 | |
| 167 | 167 | // Update the sync date in case of success, otherwise log an error. |
| 168 | - if ( ! $response->is_success() ) { |
|
| 168 | + if ( ! $response->is_success()) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // If successful update the hashes and sync'ed datetime. |
| 173 | - foreach ( $hashes as $hash ) { |
|
| 173 | + foreach ($hashes as $hash) { |
|
| 174 | 174 | $object = $hash[0]; |
| 175 | 175 | $new_hash = $hash[1]; |
| 176 | - $object->update_meta( self::JSONLD_HASH, $new_hash ); |
|
| 177 | - $object->update_meta( self::SYNCED_GMT, current_time( 'mysql', true ) ); |
|
| 176 | + $object->update_meta(self::JSONLD_HASH, $new_hash); |
|
| 177 | + $object->update_meta(self::SYNCED_GMT, current_time('mysql', true)); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return true; |
@@ -186,24 +186,24 @@ discard block |
||
| 186 | 186 | * @return false|string |
| 187 | 187 | * @throws Exception |
| 188 | 188 | */ |
| 189 | - private function get_payload_as_string( $object ) { |
|
| 189 | + private function get_payload_as_string($object) { |
|
| 190 | 190 | $type = $object->get_type(); |
| 191 | 191 | $object_id = $object->get_object_id(); |
| 192 | 192 | |
| 193 | - $jsonld_as_string = wp_json_encode( apply_filters( 'wl_dataset__sync_service__sync_item__jsonld', |
|
| 194 | - $this->jsonld_service->get( $type, $object_id ), $type, $object_id ) ); |
|
| 195 | - $uri = $this->entity_service->get_uri( $object_id, $type ); |
|
| 193 | + $jsonld_as_string = wp_json_encode(apply_filters('wl_dataset__sync_service__sync_item__jsonld', |
|
| 194 | + $this->jsonld_service->get($type, $object_id), $type, $object_id)); |
|
| 195 | + $uri = $this->entity_service->get_uri($object_id, $type); |
|
| 196 | 196 | |
| 197 | 197 | // Entity URL isn't set, bail out. |
| 198 | - if ( empty( $uri ) ) { |
|
| 198 | + if (empty($uri)) { |
|
| 199 | 199 | return false; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - return wp_json_encode( array( |
|
| 202 | + return wp_json_encode(array( |
|
| 203 | 203 | 'uri' => $uri, |
| 204 | 204 | 'model' => $jsonld_as_string, |
| 205 | 205 | 'private' => ! $object->is_public(), |
| 206 | - ) ); |
|
| 206 | + )); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -211,12 +211,12 @@ discard block |
||
| 211 | 211 | * |
| 212 | 212 | * @todo Complete the delete item. |
| 213 | 213 | */ |
| 214 | - public function delete_item( $post_id ) { |
|
| 215 | - $uri = get_post_meta( $post_id, 'entity_url', true ); |
|
| 214 | + public function delete_item($post_id) { |
|
| 215 | + $uri = get_post_meta($post_id, 'entity_url', true); |
|
| 216 | 216 | // Make a request to the remote endpoint. |
| 217 | 217 | $response = $this->api_service->request( |
| 218 | - 'DELETE', '/middleware/dataset?uri=' . rawurlencode( $uri ), |
|
| 219 | - array( 'Content-Type' => 'application/ld+json', ) ); |
|
| 218 | + 'DELETE', '/middleware/dataset?uri='.rawurlencode($uri), |
|
| 219 | + array('Content-Type' => 'application/ld+json',) ); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function get_batch_size() { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function delete_all() { |
| 228 | - $this->api_service->request( 'DELETE', '/middleware/dataset/all' ); |
|
| 228 | + $this->api_service->request('DELETE', '/middleware/dataset/all'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | } |
@@ -5,118 +5,118 @@ |
||
| 5 | 5 | use Wordlift\Object_Type_Enum; |
| 6 | 6 | |
| 7 | 7 | class Sync_Post_Hooks extends Abstract_Sync_Hooks { |
| 8 | - /** |
|
| 9 | - * @var \Wordlift_Log_Service |
|
| 10 | - */ |
|
| 11 | - private $log; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var Sync_Service |
|
| 15 | - */ |
|
| 16 | - private $sync_service; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @var Sync_Object_Adapter_Factory |
|
| 20 | - */ |
|
| 21 | - private $sync_object_factory; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Sync_Post_Hooks constructor. |
|
| 25 | - * |
|
| 26 | - * @param Sync_Service $sync_service |
|
| 27 | - * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | - */ |
|
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | - parent::__construct(); |
|
| 31 | - |
|
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | - |
|
| 34 | - $this->sync_service = $sync_service; |
|
| 35 | - $this->sync_object_factory = $sync_object_factory; |
|
| 36 | - |
|
| 37 | - $this->register_hooks(); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - private function register_hooks() { |
|
| 41 | - /** |
|
| 42 | - * Register hooks for post and meta. |
|
| 43 | - */ |
|
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | - |
|
| 49 | - // running this on delete_post wouldnt work because at that time |
|
| 50 | - // entity_url would be deleted, so we cant delete this item from KG. |
|
| 51 | - add_action( 'before_delete_post', array( $this, 'delete_post' ) ); |
|
| 52 | - |
|
| 53 | - // Remove post when its trashed. |
|
| 54 | - add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 55 | - // Save the post when its untrashed. |
|
| 56 | - add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - public function save_post( $post_id ) { |
|
| 62 | - |
|
| 63 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 64 | - return; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $this->sync( $post_id ); |
|
| 68 | - |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 72 | - |
|
| 73 | - if ( in_array( $meta_key, |
|
| 74 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 75 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 76 | - array( |
|
| 77 | - '_pingme', |
|
| 78 | - '_encloseme', |
|
| 79 | - 'entity_url', |
|
| 80 | - ) ) ) ) |
|
| 81 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 82 | - ) { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $this->sync( $post_id ); |
|
| 87 | - |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - private function sync( $post_id ) { |
|
| 91 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function do_sync( $post_id ) { |
|
| 95 | - try { |
|
| 96 | - $post = get_post( $post_id ); |
|
| 97 | - if ( ! isset( $post ) ) { |
|
| 98 | - return; |
|
| 99 | - } |
|
| 100 | - $this->sync_service->sync_many( array( |
|
| 101 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 102 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 103 | - ) ); |
|
| 104 | - } catch ( \Exception $e ) { |
|
| 105 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - public function delete_post( $post_id ) { |
|
| 111 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - public function do_delete( $post_id ) { |
|
| 115 | - try { |
|
| 116 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id, get_post_meta( $post_id, 'entity_url', true ) ); |
|
| 117 | - } catch ( \Exception $e ) { |
|
| 118 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 119 | - } |
|
| 120 | - } |
|
| 8 | + /** |
|
| 9 | + * @var \Wordlift_Log_Service |
|
| 10 | + */ |
|
| 11 | + private $log; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var Sync_Service |
|
| 15 | + */ |
|
| 16 | + private $sync_service; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @var Sync_Object_Adapter_Factory |
|
| 20 | + */ |
|
| 21 | + private $sync_object_factory; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Sync_Post_Hooks constructor. |
|
| 25 | + * |
|
| 26 | + * @param Sync_Service $sync_service |
|
| 27 | + * @param Sync_Object_Adapter_Factory $sync_object_factory |
|
| 28 | + */ |
|
| 29 | + function __construct( $sync_service, $sync_object_factory ) { |
|
| 30 | + parent::__construct(); |
|
| 31 | + |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 33 | + |
|
| 34 | + $this->sync_service = $sync_service; |
|
| 35 | + $this->sync_object_factory = $sync_object_factory; |
|
| 36 | + |
|
| 37 | + $this->register_hooks(); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + private function register_hooks() { |
|
| 41 | + /** |
|
| 42 | + * Register hooks for post and meta. |
|
| 43 | + */ |
|
| 44 | + add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | + add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | + add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | + add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 48 | + |
|
| 49 | + // running this on delete_post wouldnt work because at that time |
|
| 50 | + // entity_url would be deleted, so we cant delete this item from KG. |
|
| 51 | + add_action( 'before_delete_post', array( $this, 'delete_post' ) ); |
|
| 52 | + |
|
| 53 | + // Remove post when its trashed. |
|
| 54 | + add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 55 | + // Save the post when its untrashed. |
|
| 56 | + add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + public function save_post( $post_id ) { |
|
| 62 | + |
|
| 63 | + if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $this->sync( $post_id ); |
|
| 68 | + |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 72 | + |
|
| 73 | + if ( in_array( $meta_key, |
|
| 74 | + apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 75 | + apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 76 | + array( |
|
| 77 | + '_pingme', |
|
| 78 | + '_encloseme', |
|
| 79 | + 'entity_url', |
|
| 80 | + ) ) ) ) |
|
| 81 | + || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 82 | + ) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $this->sync( $post_id ); |
|
| 87 | + |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + private function sync( $post_id ) { |
|
| 91 | + $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function do_sync( $post_id ) { |
|
| 95 | + try { |
|
| 96 | + $post = get_post( $post_id ); |
|
| 97 | + if ( ! isset( $post ) ) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | + $this->sync_service->sync_many( array( |
|
| 101 | + $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 102 | + $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 103 | + ) ); |
|
| 104 | + } catch ( \Exception $e ) { |
|
| 105 | + $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + public function delete_post( $post_id ) { |
|
| 111 | + $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + public function do_delete( $post_id ) { |
|
| 115 | + try { |
|
| 116 | + $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id, get_post_meta( $post_id, 'entity_url', true ) ); |
|
| 117 | + } catch ( \Exception $e ) { |
|
| 118 | + $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @param Sync_Service $sync_service |
| 27 | 27 | * @param Sync_Object_Adapter_Factory $sync_object_factory |
| 28 | 28 | */ |
| 29 | - function __construct( $sync_service, $sync_object_factory ) { |
|
| 29 | + function __construct($sync_service, $sync_object_factory) { |
|
| 30 | 30 | parent::__construct(); |
| 31 | 31 | |
| 32 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 32 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 33 | 33 | |
| 34 | 34 | $this->sync_service = $sync_service; |
| 35 | 35 | $this->sync_object_factory = $sync_object_factory; |
@@ -41,81 +41,81 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Register hooks for post and meta. |
| 43 | 43 | */ |
| 44 | - add_action( 'save_post', array( $this, 'save_post' ) ); |
|
| 45 | - add_action( 'added_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 46 | - add_action( 'updated_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 47 | - add_action( 'deleted_post_meta', array( $this, 'changed_post_meta' ), 10, 4 ); |
|
| 44 | + add_action('save_post', array($this, 'save_post')); |
|
| 45 | + add_action('added_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 46 | + add_action('updated_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 47 | + add_action('deleted_post_meta', array($this, 'changed_post_meta'), 10, 4); |
|
| 48 | 48 | |
| 49 | 49 | // running this on delete_post wouldnt work because at that time |
| 50 | 50 | // entity_url would be deleted, so we cant delete this item from KG. |
| 51 | - add_action( 'before_delete_post', array( $this, 'delete_post' ) ); |
|
| 51 | + add_action('before_delete_post', array($this, 'delete_post')); |
|
| 52 | 52 | |
| 53 | 53 | // Remove post when its trashed. |
| 54 | - add_action( 'trashed_post', array( $this, 'delete_post' ) ); |
|
| 54 | + add_action('trashed_post', array($this, 'delete_post')); |
|
| 55 | 55 | // Save the post when its untrashed. |
| 56 | - add_action( 'untrashed_post', array( $this, 'save_post' ) ); |
|
| 56 | + add_action('untrashed_post', array($this, 'save_post')); |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function save_post( $post_id ) { |
|
| 61 | + public function save_post($post_id) { |
|
| 62 | 62 | |
| 63 | - if ( ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 63 | + if ( ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types())) { |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->sync( $post_id ); |
|
| 67 | + $this->sync($post_id); |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function changed_post_meta( $meta_id, $post_id, $meta_key, $_meta_value ) { |
|
| 71 | + public function changed_post_meta($meta_id, $post_id, $meta_key, $_meta_value) { |
|
| 72 | 72 | |
| 73 | - if ( in_array( $meta_key, |
|
| 74 | - apply_filters( 'wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 75 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 73 | + if (in_array($meta_key, |
|
| 74 | + apply_filters('wl_dataset__sync_post_hooks__ignored_meta_keys', |
|
| 75 | + apply_filters('wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 76 | 76 | array( |
| 77 | 77 | '_pingme', |
| 78 | 78 | '_encloseme', |
| 79 | 79 | 'entity_url', |
| 80 | - ) ) ) ) |
|
| 81 | - || ! in_array( get_post_type( $post_id ), \Wordlift_Entity_Service::valid_entity_post_types() ) |
|
| 80 | + )))) |
|
| 81 | + || ! in_array(get_post_type($post_id), \Wordlift_Entity_Service::valid_entity_post_types()) |
|
| 82 | 82 | ) { |
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $this->sync( $post_id ); |
|
| 86 | + $this->sync($post_id); |
|
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - private function sync( $post_id ) { |
|
| 91 | - $this->enqueue( array( 'do_sync', $post_id ) ); |
|
| 90 | + private function sync($post_id) { |
|
| 91 | + $this->enqueue(array('do_sync', $post_id)); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function do_sync( $post_id ) { |
|
| 94 | + public function do_sync($post_id) { |
|
| 95 | 95 | try { |
| 96 | - $post = get_post( $post_id ); |
|
| 97 | - if ( ! isset( $post ) ) { |
|
| 96 | + $post = get_post($post_id); |
|
| 97 | + if ( ! isset($post)) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | - $this->sync_service->sync_many( array( |
|
| 101 | - $this->sync_object_factory->create( Object_Type_Enum::POST, $post_id ), |
|
| 102 | - $this->sync_object_factory->create( Object_Type_Enum::USER, $post->post_author ) |
|
| 103 | - ) ); |
|
| 104 | - } catch ( \Exception $e ) { |
|
| 105 | - $this->log->error( "An error occurred while trying to sync post $post_id: " . $e->getMessage(), $e ); |
|
| 100 | + $this->sync_service->sync_many(array( |
|
| 101 | + $this->sync_object_factory->create(Object_Type_Enum::POST, $post_id), |
|
| 102 | + $this->sync_object_factory->create(Object_Type_Enum::USER, $post->post_author) |
|
| 103 | + )); |
|
| 104 | + } catch (\Exception $e) { |
|
| 105 | + $this->log->error("An error occurred while trying to sync post $post_id: ".$e->getMessage(), $e); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function delete_post( $post_id ) { |
|
| 111 | - $this->enqueue( array( 'do_delete', $post_id ) ); |
|
| 110 | + public function delete_post($post_id) { |
|
| 111 | + $this->enqueue(array('do_delete', $post_id)); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function do_delete( $post_id ) { |
|
| 114 | + public function do_delete($post_id) { |
|
| 115 | 115 | try { |
| 116 | - $this->sync_service->delete_one( Object_Type_Enum::POST, $post_id, get_post_meta( $post_id, 'entity_url', true ) ); |
|
| 117 | - } catch ( \Exception $e ) { |
|
| 118 | - $this->log->error( "An error occurred while trying to delete post $post_id: " . $e->getMessage(), $e ); |
|
| 116 | + $this->sync_service->delete_one(Object_Type_Enum::POST, $post_id, get_post_meta($post_id, 'entity_url', true)); |
|
| 117 | + } catch (\Exception $e) { |
|
| 118 | + $this->log->error("An error occurred while trying to delete post $post_id: ".$e->getMessage(), $e); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -5,99 +5,99 @@ |
||
| 5 | 5 | use Wordlift\Object_Type_Enum; |
| 6 | 6 | |
| 7 | 7 | class Sync_User_Hooks extends Abstract_Sync_Hooks { |
| 8 | - /** |
|
| 9 | - * @var \Wordlift_Log_Service |
|
| 10 | - */ |
|
| 11 | - private $log; |
|
| 12 | - |
|
| 13 | - /** |
|
| 14 | - * @var Sync_Service |
|
| 15 | - */ |
|
| 16 | - private $sync_service; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Sync_User_Hooks constructor. |
|
| 20 | - * |
|
| 21 | - * @param Sync_Service $sync_service |
|
| 22 | - */ |
|
| 23 | - function __construct( Sync_Service $sync_service ) { |
|
| 24 | - parent::__construct(); |
|
| 25 | - |
|
| 26 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 27 | - |
|
| 28 | - $this->sync_service = $sync_service; |
|
| 29 | - |
|
| 30 | - $this->register_hooks(); |
|
| 31 | - |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - private function register_hooks() { |
|
| 35 | - /** |
|
| 36 | - * Register hooks for user and meta. |
|
| 37 | - */ |
|
| 38 | - add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | - add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | - add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | - add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | - add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | - add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function changed_user( $user_id ) { |
|
| 48 | - |
|
| 49 | - $this->sync( $user_id ); |
|
| 50 | - |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 54 | - |
|
| 55 | - if ( in_array( $meta_key, |
|
| 56 | - apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | - array( |
|
| 59 | - 'rich_editing', |
|
| 60 | - 'comment_shortcuts', |
|
| 61 | - 'admin_color', |
|
| 62 | - 'use_ssl', |
|
| 63 | - 'show_admin_bar_front', |
|
| 64 | - 'wptests_capabilities', |
|
| 65 | - 'wptests_user_level', |
|
| 66 | - 'dismissed_wp_pointers', |
|
| 67 | - 'entity_url', |
|
| 68 | - ) ) ) ) ) { |
|
| 69 | - return; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $this->sync( $user_id ); |
|
| 73 | - |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - private function sync( $user_id ) { |
|
| 77 | - $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - public function do_sync( $user_id ) { |
|
| 81 | - |
|
| 82 | - try { |
|
| 83 | - $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | - } catch ( \Exception $e ) { |
|
| 85 | - $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function delete_user( $user_id ) { |
|
| 91 | - $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function do_delete( $user_id ) { |
|
| 95 | - try { |
|
| 96 | - $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id, get_user_meta( $user_id, 'entity_url', true ) ); |
|
| 97 | - } catch ( \Exception $e ) { |
|
| 98 | - $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - } |
|
| 8 | + /** |
|
| 9 | + * @var \Wordlift_Log_Service |
|
| 10 | + */ |
|
| 11 | + private $log; |
|
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @var Sync_Service |
|
| 15 | + */ |
|
| 16 | + private $sync_service; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Sync_User_Hooks constructor. |
|
| 20 | + * |
|
| 21 | + * @param Sync_Service $sync_service |
|
| 22 | + */ |
|
| 23 | + function __construct( Sync_Service $sync_service ) { |
|
| 24 | + parent::__construct(); |
|
| 25 | + |
|
| 26 | + $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 27 | + |
|
| 28 | + $this->sync_service = $sync_service; |
|
| 29 | + |
|
| 30 | + $this->register_hooks(); |
|
| 31 | + |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + private function register_hooks() { |
|
| 35 | + /** |
|
| 36 | + * Register hooks for user and meta. |
|
| 37 | + */ |
|
| 38 | + add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | + add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | + add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | + add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | + add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | + add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function changed_user( $user_id ) { |
|
| 48 | + |
|
| 49 | + $this->sync( $user_id ); |
|
| 50 | + |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 54 | + |
|
| 55 | + if ( in_array( $meta_key, |
|
| 56 | + apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | + apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | + array( |
|
| 59 | + 'rich_editing', |
|
| 60 | + 'comment_shortcuts', |
|
| 61 | + 'admin_color', |
|
| 62 | + 'use_ssl', |
|
| 63 | + 'show_admin_bar_front', |
|
| 64 | + 'wptests_capabilities', |
|
| 65 | + 'wptests_user_level', |
|
| 66 | + 'dismissed_wp_pointers', |
|
| 67 | + 'entity_url', |
|
| 68 | + ) ) ) ) ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $this->sync( $user_id ); |
|
| 73 | + |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + private function sync( $user_id ) { |
|
| 77 | + $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + public function do_sync( $user_id ) { |
|
| 81 | + |
|
| 82 | + try { |
|
| 83 | + $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | + } catch ( \Exception $e ) { |
|
| 85 | + $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function delete_user( $user_id ) { |
|
| 91 | + $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function do_delete( $user_id ) { |
|
| 95 | + try { |
|
| 96 | + $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id, get_user_meta( $user_id, 'entity_url', true ) ); |
|
| 97 | + } catch ( \Exception $e ) { |
|
| 98 | + $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @param Sync_Service $sync_service |
| 22 | 22 | */ |
| 23 | - function __construct( Sync_Service $sync_service ) { |
|
| 23 | + function __construct(Sync_Service $sync_service) { |
|
| 24 | 24 | parent::__construct(); |
| 25 | 25 | |
| 26 | - $this->log = \Wordlift_Log_Service::get_logger( get_class() ); |
|
| 26 | + $this->log = \Wordlift_Log_Service::get_logger(get_class()); |
|
| 27 | 27 | |
| 28 | 28 | $this->sync_service = $sync_service; |
| 29 | 29 | |
@@ -35,26 +35,26 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Register hooks for user and meta. |
| 37 | 37 | */ |
| 38 | - add_action( 'user_register', array( $this, 'changed_user' ) ); |
|
| 39 | - add_action( 'profile_update', array( $this, 'changed_user' ) ); |
|
| 40 | - add_action( 'added_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 41 | - add_action( 'updated_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 42 | - add_action( 'deleted_user_meta', array( $this, 'changed_user_meta' ), 10, 3 ); |
|
| 43 | - add_action( 'delete_user', array( $this, 'delete_user' ) ); |
|
| 38 | + add_action('user_register', array($this, 'changed_user')); |
|
| 39 | + add_action('profile_update', array($this, 'changed_user')); |
|
| 40 | + add_action('added_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 41 | + add_action('updated_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 42 | + add_action('deleted_user_meta', array($this, 'changed_user_meta'), 10, 3); |
|
| 43 | + add_action('delete_user', array($this, 'delete_user')); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function changed_user( $user_id ) { |
|
| 47 | + public function changed_user($user_id) { |
|
| 48 | 48 | |
| 49 | - $this->sync( $user_id ); |
|
| 49 | + $this->sync($user_id); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function changed_user_meta( $meta_id, $user_id, $meta_key ) { |
|
| 53 | + public function changed_user_meta($meta_id, $user_id, $meta_key) { |
|
| 54 | 54 | |
| 55 | - if ( in_array( $meta_key, |
|
| 56 | - apply_filters( 'wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | - apply_filters( 'wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 55 | + if (in_array($meta_key, |
|
| 56 | + apply_filters('wl_dataset__sync_user_hooks__ignored_meta_keys', |
|
| 57 | + apply_filters('wl_dataset__sync_hooks__ignored_meta_keys', |
|
| 58 | 58 | array( |
| 59 | 59 | 'rich_editing', |
| 60 | 60 | 'comment_shortcuts', |
@@ -65,37 +65,37 @@ discard block |
||
| 65 | 65 | 'wptests_user_level', |
| 66 | 66 | 'dismissed_wp_pointers', |
| 67 | 67 | 'entity_url', |
| 68 | - ) ) ) ) ) { |
|
| 68 | + ))))) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->sync( $user_id ); |
|
| 72 | + $this->sync($user_id); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - private function sync( $user_id ) { |
|
| 77 | - $this->enqueue( array( 'do_sync', $user_id ) ); |
|
| 76 | + private function sync($user_id) { |
|
| 77 | + $this->enqueue(array('do_sync', $user_id)); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function do_sync( $user_id ) { |
|
| 80 | + public function do_sync($user_id) { |
|
| 81 | 81 | |
| 82 | 82 | try { |
| 83 | - $this->sync_service->sync_one( Object_Type_Enum::USER, (int) $user_id ); |
|
| 84 | - } catch ( \Exception $e ) { |
|
| 85 | - $this->log->error( "An error occurred while trying to sync user $user_id: " . $e->getMessage(), $e ); |
|
| 83 | + $this->sync_service->sync_one(Object_Type_Enum::USER, (int) $user_id); |
|
| 84 | + } catch (\Exception $e) { |
|
| 85 | + $this->log->error("An error occurred while trying to sync user $user_id: ".$e->getMessage(), $e); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function delete_user( $user_id ) { |
|
| 91 | - $this->enqueue( array( 'do_delete', $user_id ) ); |
|
| 90 | + public function delete_user($user_id) { |
|
| 91 | + $this->enqueue(array('do_delete', $user_id)); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function do_delete( $user_id ) { |
|
| 94 | + public function do_delete($user_id) { |
|
| 95 | 95 | try { |
| 96 | - $this->sync_service->delete_one( Object_Type_Enum::USER, $user_id, get_user_meta( $user_id, 'entity_url', true ) ); |
|
| 97 | - } catch ( \Exception $e ) { |
|
| 98 | - $this->log->error( "An error occurred while trying to delete user $user_id: " . $e->getMessage(), $e ); |
|
| 96 | + $this->sync_service->delete_one(Object_Type_Enum::USER, $user_id, get_user_meta($user_id, 'entity_url', true)); |
|
| 97 | + } catch (\Exception $e) { |
|
| 98 | + $this->log->error("An error occurred while trying to delete user $user_id: ".$e->getMessage(), $e); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | } |
@@ -10,15 +10,15 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Loader extends Default_Loader { |
| 12 | 12 | |
| 13 | - public function init_all_dependencies() { |
|
| 14 | - new Rest_Field(); |
|
| 15 | - } |
|
| 13 | + public function init_all_dependencies() { |
|
| 14 | + new Rest_Field(); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - protected function get_feature_slug() { |
|
| 18 | - return 'add-synonyms'; |
|
| 19 | - } |
|
| 17 | + protected function get_feature_slug() { |
|
| 18 | + return 'add-synonyms'; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - protected function get_feature_default_value() { |
|
| 22 | - return true; |
|
| 23 | - } |
|
| 21 | + protected function get_feature_default_value() { |
|
| 22 | + return true; |
|
| 23 | + } |
|
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -14,89 +14,89 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Wordlift_Entity_Type_Taxonomy_Service { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The WordPress taxonomy name. |
|
| 19 | - * |
|
| 20 | - * @since 1.0.0 |
|
| 21 | - */ |
|
| 22 | - const TAXONOMY_NAME = 'wl_entity_type'; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Register the taxonomies. |
|
| 26 | - * |
|
| 27 | - * @since 3.23.6 we hook to `wp_get_object_terms` to ensure that a term is returned when a post is queries for the |
|
| 28 | - * `wl_entity_type` taxonomy. |
|
| 29 | - * @since 3.18.0 |
|
| 30 | - */ |
|
| 31 | - public function init() { |
|
| 32 | - |
|
| 33 | - $labels = array( |
|
| 34 | - 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | - 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | - 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | - 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | - 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | - 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | - 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | - 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | - 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | - 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | - 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 45 | - ); |
|
| 46 | - |
|
| 47 | - // Take away GUI for taxonomy editing. |
|
| 48 | - // TODO: read capabilities when editing of the WL <-> schema.org mapping is possible. |
|
| 49 | - $capabilities = array( |
|
| 50 | - // We enable editors to change the title/description of terms: |
|
| 51 | - // |
|
| 52 | - // @see https://github.com/insideout10/wordlift-plugin/issues/398. |
|
| 53 | - 'manage_terms' => 'manage_options', |
|
| 54 | - 'edit_terms' => 'wl_entity_type_edit_term', |
|
| 55 | - 'delete_terms' => 'wl_entity_type_delete_term', |
|
| 56 | - 'assign_terms' => 'edit_posts', |
|
| 57 | - ); |
|
| 58 | - |
|
| 59 | - $args = array( |
|
| 60 | - 'labels' => $labels, |
|
| 61 | - 'capabilities' => $capabilities, |
|
| 62 | - 'hierarchical' => true, |
|
| 63 | - 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | - 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 65 | - 'show_in_quick_edit' => false, |
|
| 66 | - 'publicly_queryable' => false |
|
| 67 | - ); |
|
| 68 | - |
|
| 69 | - /* |
|
| 17 | + /** |
|
| 18 | + * The WordPress taxonomy name. |
|
| 19 | + * |
|
| 20 | + * @since 1.0.0 |
|
| 21 | + */ |
|
| 22 | + const TAXONOMY_NAME = 'wl_entity_type'; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Register the taxonomies. |
|
| 26 | + * |
|
| 27 | + * @since 3.23.6 we hook to `wp_get_object_terms` to ensure that a term is returned when a post is queries for the |
|
| 28 | + * `wl_entity_type` taxonomy. |
|
| 29 | + * @since 3.18.0 |
|
| 30 | + */ |
|
| 31 | + public function init() { |
|
| 32 | + |
|
| 33 | + $labels = array( |
|
| 34 | + 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | + 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | + 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | + 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | + 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | + 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | + 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | + 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | + 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | + 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | + 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 45 | + ); |
|
| 46 | + |
|
| 47 | + // Take away GUI for taxonomy editing. |
|
| 48 | + // TODO: read capabilities when editing of the WL <-> schema.org mapping is possible. |
|
| 49 | + $capabilities = array( |
|
| 50 | + // We enable editors to change the title/description of terms: |
|
| 51 | + // |
|
| 52 | + // @see https://github.com/insideout10/wordlift-plugin/issues/398. |
|
| 53 | + 'manage_terms' => 'manage_options', |
|
| 54 | + 'edit_terms' => 'wl_entity_type_edit_term', |
|
| 55 | + 'delete_terms' => 'wl_entity_type_delete_term', |
|
| 56 | + 'assign_terms' => 'edit_posts', |
|
| 57 | + ); |
|
| 58 | + |
|
| 59 | + $args = array( |
|
| 60 | + 'labels' => $labels, |
|
| 61 | + 'capabilities' => $capabilities, |
|
| 62 | + 'hierarchical' => true, |
|
| 63 | + 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | + 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 65 | + 'show_in_quick_edit' => false, |
|
| 66 | + 'publicly_queryable' => false |
|
| 67 | + ); |
|
| 68 | + |
|
| 69 | + /* |
|
| 70 | 70 | * If `All Entity Types` is enabled, use the new metabox. |
| 71 | 71 | * |
| 72 | 72 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 73 | 73 | * @since 3.20.0 |
| 74 | 74 | */ |
| 75 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 76 | - $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 77 | - 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
|
| 78 | - 'render' |
|
| 79 | - ) : false; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - register_taxonomy( |
|
| 83 | - self::TAXONOMY_NAME, // Taxonomy name. |
|
| 84 | - Wordlift_Entity_Service::valid_entity_post_types(), // Taxonomy post types. |
|
| 85 | - $args // Taxonomy args. |
|
| 86 | - ); |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Register meta wl_entities_gutenberg for use in Gutenberg |
|
| 90 | - */ |
|
| 91 | - register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 92 | - 'show_in_rest' => true, |
|
| 93 | - 'single' => true, |
|
| 94 | - 'type' => 'string', |
|
| 95 | - ) ); |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Register meta _wl_alt_label for use in Gutenberg |
|
| 99 | - */ |
|
| 75 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 76 | + $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 77 | + 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
|
| 78 | + 'render' |
|
| 79 | + ) : false; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + register_taxonomy( |
|
| 83 | + self::TAXONOMY_NAME, // Taxonomy name. |
|
| 84 | + Wordlift_Entity_Service::valid_entity_post_types(), // Taxonomy post types. |
|
| 85 | + $args // Taxonomy args. |
|
| 86 | + ); |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Register meta wl_entities_gutenberg for use in Gutenberg |
|
| 90 | + */ |
|
| 91 | + register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 92 | + 'show_in_rest' => true, |
|
| 93 | + 'single' => true, |
|
| 94 | + 'type' => 'string', |
|
| 95 | + ) ); |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Register meta _wl_alt_label for use in Gutenberg |
|
| 99 | + */ |
|
| 100 | 100 | // register_meta( 'post', Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, array( |
| 101 | 101 | // 'object_subtype' => '', |
| 102 | 102 | // 'show_in_rest' => true, |
@@ -107,104 +107,104 @@ discard block |
||
| 107 | 107 | // } |
| 108 | 108 | // ) ); |
| 109 | 109 | |
| 110 | - // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
|
| 111 | - // query for synonyms in Block Editor. |
|
| 112 | - add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | - if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | - if ( ! isset( $args['supports'] ) ) { |
|
| 115 | - $args['supports'] = array(); |
|
| 116 | - } |
|
| 117 | - $args['supports'][] = 'custom-fields'; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - return $args; |
|
| 121 | - }, 10, 2 ); |
|
| 122 | - |
|
| 123 | - // Add filter to change the metabox CSS class. |
|
| 124 | - add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 125 | - |
|
| 126 | - // Add a filter to preset the object term if none is set. |
|
| 127 | - // |
|
| 128 | - // DO NOT hook to `wp_get_object_terms`, because `wp_get_object_terms` returns imploded values for SQL queries. |
|
| 129 | - // |
|
| 130 | - // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
|
| 131 | - // @since 3.23.6 |
|
| 132 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
|
| 136 | - * @since 3.30.1 |
|
| 137 | - */ |
|
| 138 | - add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 139 | - |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Hook to the `get_object_terms` filter. |
|
| 144 | - * |
|
| 145 | - * We check if our taxonomy is requested and whether a term has been returned. If no term has been returned we |
|
| 146 | - * preset `Article` for posts/pages and 'Thing' for everything else and we query the terms again. |
|
| 147 | - * |
|
| 148 | - * @param array $terms Array of terms for the given object or objects. |
|
| 149 | - * @param int[] $object_ids Array of object IDs for which terms were retrieved. |
|
| 150 | - * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. |
|
| 151 | - * @param array $args Array of arguments for retrieving terms for the given |
|
| 152 | - * object(s). See get_object_terms() for details. |
|
| 153 | - * |
|
| 154 | - * @return array|WP_Error |
|
| 155 | - * @since 3.23.6 |
|
| 156 | - */ |
|
| 157 | - public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 158 | - // Get our entity type. |
|
| 159 | - $entity_type = self::TAXONOMY_NAME; |
|
| 160 | - |
|
| 161 | - // Check if this is a query for our entity type, that no terms have been found and that we have an article |
|
| 162 | - // term to preset in case. |
|
| 163 | - if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | - || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | - || ! empty( $terms ) |
|
| 166 | - || ! term_exists( 'article', $entity_type ) |
|
| 167 | - || ! term_exists( 'thing', $entity_type ) ) { |
|
| 168 | - |
|
| 169 | - // Return the input value. |
|
| 170 | - return $terms; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // Avoid nested calls in case of issues. |
|
| 174 | - remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 175 | - |
|
| 176 | - // Set the default term for all the queried object. |
|
| 177 | - foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | - $post_type = get_post_type( $object_id ); |
|
| 179 | - if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 180 | - // Set the term to article for posts and pages, or to thing for everything else. |
|
| 181 | - $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | - foreach ( $uris as $uri ) { |
|
| 183 | - // set the uri based on post type. |
|
| 184 | - if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 185 | - $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
|
| 186 | - 'http://schema.org/Thing' : 'http://schema.org/Article'; |
|
| 187 | - } |
|
| 188 | - Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // Finally return the object terms. |
|
| 194 | - $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 195 | - |
|
| 196 | - // Re-enable nested calls in case of issues. |
|
| 197 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 198 | - |
|
| 199 | - return $terms; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | - if ( $tax === self::TAXONOMY_NAME ) { |
|
| 204 | - return true; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - return $exclude; |
|
| 208 | - } |
|
| 110 | + // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
|
| 111 | + // query for synonyms in Block Editor. |
|
| 112 | + add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | + if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | + if ( ! isset( $args['supports'] ) ) { |
|
| 115 | + $args['supports'] = array(); |
|
| 116 | + } |
|
| 117 | + $args['supports'][] = 'custom-fields'; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + return $args; |
|
| 121 | + }, 10, 2 ); |
|
| 122 | + |
|
| 123 | + // Add filter to change the metabox CSS class. |
|
| 124 | + add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 125 | + |
|
| 126 | + // Add a filter to preset the object term if none is set. |
|
| 127 | + // |
|
| 128 | + // DO NOT hook to `wp_get_object_terms`, because `wp_get_object_terms` returns imploded values for SQL queries. |
|
| 129 | + // |
|
| 130 | + // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
|
| 131 | + // @since 3.23.6 |
|
| 132 | + add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
|
| 136 | + * @since 3.30.1 |
|
| 137 | + */ |
|
| 138 | + add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 139 | + |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Hook to the `get_object_terms` filter. |
|
| 144 | + * |
|
| 145 | + * We check if our taxonomy is requested and whether a term has been returned. If no term has been returned we |
|
| 146 | + * preset `Article` for posts/pages and 'Thing' for everything else and we query the terms again. |
|
| 147 | + * |
|
| 148 | + * @param array $terms Array of terms for the given object or objects. |
|
| 149 | + * @param int[] $object_ids Array of object IDs for which terms were retrieved. |
|
| 150 | + * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. |
|
| 151 | + * @param array $args Array of arguments for retrieving terms for the given |
|
| 152 | + * object(s). See get_object_terms() for details. |
|
| 153 | + * |
|
| 154 | + * @return array|WP_Error |
|
| 155 | + * @since 3.23.6 |
|
| 156 | + */ |
|
| 157 | + public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 158 | + // Get our entity type. |
|
| 159 | + $entity_type = self::TAXONOMY_NAME; |
|
| 160 | + |
|
| 161 | + // Check if this is a query for our entity type, that no terms have been found and that we have an article |
|
| 162 | + // term to preset in case. |
|
| 163 | + if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | + || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | + || ! empty( $terms ) |
|
| 166 | + || ! term_exists( 'article', $entity_type ) |
|
| 167 | + || ! term_exists( 'thing', $entity_type ) ) { |
|
| 168 | + |
|
| 169 | + // Return the input value. |
|
| 170 | + return $terms; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // Avoid nested calls in case of issues. |
|
| 174 | + remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 175 | + |
|
| 176 | + // Set the default term for all the queried object. |
|
| 177 | + foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | + $post_type = get_post_type( $object_id ); |
|
| 179 | + if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 180 | + // Set the term to article for posts and pages, or to thing for everything else. |
|
| 181 | + $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | + foreach ( $uris as $uri ) { |
|
| 183 | + // set the uri based on post type. |
|
| 184 | + if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 185 | + $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
|
| 186 | + 'http://schema.org/Thing' : 'http://schema.org/Article'; |
|
| 187 | + } |
|
| 188 | + Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // Finally return the object terms. |
|
| 194 | + $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 195 | + |
|
| 196 | + // Re-enable nested calls in case of issues. |
|
| 197 | + add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 198 | + |
|
| 199 | + return $terms; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | + if ( $tax === self::TAXONOMY_NAME ) { |
|
| 204 | + return true; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + return $exclude; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | 210 | } |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | public function init() { |
| 32 | 32 | |
| 33 | 33 | $labels = array( |
| 34 | - 'name' => _x( 'Entity Types', 'taxonomy general name', 'wordlift' ), |
|
| 35 | - 'singular_name' => _x( 'Entity Type', 'taxonomy singular name', 'wordlift' ), |
|
| 36 | - 'search_items' => __( 'Search Entity Types', 'wordlift' ), |
|
| 37 | - 'all_items' => __( 'All Entity Types', 'wordlift' ), |
|
| 38 | - 'parent_item' => __( 'Parent Entity Type', 'wordlift' ), |
|
| 39 | - 'parent_item_colon' => __( 'Parent Entity Type:', 'wordlift' ), |
|
| 40 | - 'edit_item' => __( 'Edit Entity Type', 'wordlift' ), |
|
| 41 | - 'update_item' => __( 'Update Entity Type', 'wordlift' ), |
|
| 42 | - 'add_new_item' => __( 'Add New Entity Type', 'wordlift' ), |
|
| 43 | - 'new_item_name' => __( 'New Entity Type', 'wordlift' ), |
|
| 44 | - 'menu_name' => __( 'Entity Types', 'wordlift' ), |
|
| 34 | + 'name' => _x('Entity Types', 'taxonomy general name', 'wordlift'), |
|
| 35 | + 'singular_name' => _x('Entity Type', 'taxonomy singular name', 'wordlift'), |
|
| 36 | + 'search_items' => __('Search Entity Types', 'wordlift'), |
|
| 37 | + 'all_items' => __('All Entity Types', 'wordlift'), |
|
| 38 | + 'parent_item' => __('Parent Entity Type', 'wordlift'), |
|
| 39 | + 'parent_item_colon' => __('Parent Entity Type:', 'wordlift'), |
|
| 40 | + 'edit_item' => __('Edit Entity Type', 'wordlift'), |
|
| 41 | + 'update_item' => __('Update Entity Type', 'wordlift'), |
|
| 42 | + 'add_new_item' => __('Add New Entity Type', 'wordlift'), |
|
| 43 | + 'new_item_name' => __('New Entity Type', 'wordlift'), |
|
| 44 | + 'menu_name' => __('Entity Types', 'wordlift'), |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | // Take away GUI for taxonomy editing. |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | 'labels' => $labels, |
| 61 | 61 | 'capabilities' => $capabilities, |
| 62 | 62 | 'hierarchical' => true, |
| 63 | - 'show_admin_column' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 64 | - 'show_in_rest' => apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ), |
|
| 63 | + 'show_admin_column' => apply_filters('wl_feature__enable__entity-types-taxonomy', true), |
|
| 64 | + 'show_in_rest' => apply_filters('wl_feature__enable__entity-types-taxonomy', true), |
|
| 65 | 65 | 'show_in_quick_edit' => false, |
| 66 | 66 | 'publicly_queryable' => false |
| 67 | 67 | ); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 73 | 73 | * @since 3.20.0 |
| 74 | 74 | */ |
| 75 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 76 | - $args['meta_box_cb'] = apply_filters( 'wl_feature__enable__entity-types-taxonomy', true ) ? array( |
|
| 75 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 76 | + $args['meta_box_cb'] = apply_filters('wl_feature__enable__entity-types-taxonomy', true) ? array( |
|
| 77 | 77 | 'Wordlift_Admin_Schemaorg_Taxonomy_Metabox', |
| 78 | 78 | 'render' |
| 79 | 79 | ) : false; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Register meta wl_entities_gutenberg for use in Gutenberg |
| 90 | 90 | */ |
| 91 | - register_meta( 'post', 'wl_entities_gutenberg', array( |
|
| 91 | + register_meta('post', 'wl_entities_gutenberg', array( |
|
| 92 | 92 | 'show_in_rest' => true, |
| 93 | 93 | 'single' => true, |
| 94 | 94 | 'type' => 'string', |
| 95 | - ) ); |
|
| 95 | + )); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Register meta _wl_alt_label for use in Gutenberg |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // see #1364: add custom fields support for CPTs that are valid entity post types in order to be able to |
| 111 | 111 | // query for synonyms in Block Editor. |
| 112 | - add_filter( 'register_post_type_args', function ( $args, $post_type ) { |
|
| 113 | - if ( in_array( $post_type, Wordlift_Entity_Service::valid_entity_post_types() ) ) { |
|
| 114 | - if ( ! isset( $args['supports'] ) ) { |
|
| 112 | + add_filter('register_post_type_args', function($args, $post_type) { |
|
| 113 | + if (in_array($post_type, Wordlift_Entity_Service::valid_entity_post_types())) { |
|
| 114 | + if ( ! isset($args['supports'])) { |
|
| 115 | 115 | $args['supports'] = array(); |
| 116 | 116 | } |
| 117 | 117 | $args['supports'][] = 'custom-fields'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return $args; |
| 121 | - }, 10, 2 ); |
|
| 121 | + }, 10, 2); |
|
| 122 | 122 | |
| 123 | 123 | // Add filter to change the metabox CSS class. |
| 124 | - add_filter( 'postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class' ); |
|
| 124 | + add_filter('postbox_classes_entity_wl_entity_typediv', 'wl_admin_metaboxes_add_css_class'); |
|
| 125 | 125 | |
| 126 | 126 | // Add a filter to preset the object term if none is set. |
| 127 | 127 | // |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | // |
| 130 | 130 | // @see https://github.com/insideout10/wordlift-plugin/issues/995 |
| 131 | 131 | // @since 3.23.6 |
| 132 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 132 | + add_filter('get_object_terms', array($this, 'get_object_terms'), 10, 4); |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Exclude sitemap creation for wl_entity_type taxonomy in Yoast |
| 136 | 136 | * @since 3.30.1 |
| 137 | 137 | */ |
| 138 | - add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'wpseo_sitemap_exclude_taxonomy' ), 10, 2 ); |
|
| 138 | + add_filter('wpseo_sitemap_exclude_taxonomy', array($this, 'wpseo_sitemap_exclude_taxonomy'), 10, 2); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
@@ -154,53 +154,53 @@ discard block |
||
| 154 | 154 | * @return array|WP_Error |
| 155 | 155 | * @since 3.23.6 |
| 156 | 156 | */ |
| 157 | - public function get_object_terms( $terms, $object_ids, $taxonomies, $args ) { |
|
| 157 | + public function get_object_terms($terms, $object_ids, $taxonomies, $args) { |
|
| 158 | 158 | // Get our entity type. |
| 159 | 159 | $entity_type = self::TAXONOMY_NAME; |
| 160 | 160 | |
| 161 | 161 | // Check if this is a query for our entity type, that no terms have been found and that we have an article |
| 162 | 162 | // term to preset in case. |
| 163 | - if ( ! taxonomy_exists( $entity_type ) |
|
| 164 | - || array( $entity_type ) !== (array) $taxonomies |
|
| 165 | - || ! empty( $terms ) |
|
| 166 | - || ! term_exists( 'article', $entity_type ) |
|
| 167 | - || ! term_exists( 'thing', $entity_type ) ) { |
|
| 163 | + if ( ! taxonomy_exists($entity_type) |
|
| 164 | + || array($entity_type) !== (array) $taxonomies |
|
| 165 | + || ! empty($terms) |
|
| 166 | + || ! term_exists('article', $entity_type) |
|
| 167 | + || ! term_exists('thing', $entity_type)) { |
|
| 168 | 168 | |
| 169 | 169 | // Return the input value. |
| 170 | 170 | return $terms; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Avoid nested calls in case of issues. |
| 174 | - remove_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10 ); |
|
| 174 | + remove_filter('get_object_terms', array($this, 'get_object_terms'), 10); |
|
| 175 | 175 | |
| 176 | 176 | // Set the default term for all the queried object. |
| 177 | - foreach ( (array) $object_ids as $object_id ) { |
|
| 178 | - $post_type = get_post_type( $object_id ); |
|
| 179 | - if ( Wordlift_Entity_Type_Service::is_valid_entity_post_type( $post_type ) ) { |
|
| 177 | + foreach ((array) $object_ids as $object_id) { |
|
| 178 | + $post_type = get_post_type($object_id); |
|
| 179 | + if (Wordlift_Entity_Type_Service::is_valid_entity_post_type($post_type)) { |
|
| 180 | 180 | // Set the term to article for posts and pages, or to thing for everything else. |
| 181 | - $uris = Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ); |
|
| 182 | - foreach ( $uris as $uri ) { |
|
| 181 | + $uris = Wordlift_Entity_Type_Adapter::get_entity_types($post_type); |
|
| 182 | + foreach ($uris as $uri) { |
|
| 183 | 183 | // set the uri based on post type. |
| 184 | - if ( $uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing' ) { |
|
| 184 | + if ($uri === 'http://schema.org/Article' || $uri === 'http://schema.org/Thing') { |
|
| 185 | 185 | $uri = Wordlift_Entity_Service::TYPE_NAME === $post_type ? |
| 186 | 186 | 'http://schema.org/Thing' : 'http://schema.org/Article'; |
| 187 | 187 | } |
| 188 | - Wordlift_Entity_Type_Service::get_instance()->set( $object_id, $uri ); |
|
| 188 | + Wordlift_Entity_Type_Service::get_instance()->set($object_id, $uri); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Finally return the object terms. |
| 194 | - $terms = wp_get_object_terms( $object_ids, $taxonomies, $args ); |
|
| 194 | + $terms = wp_get_object_terms($object_ids, $taxonomies, $args); |
|
| 195 | 195 | |
| 196 | 196 | // Re-enable nested calls in case of issues. |
| 197 | - add_filter( 'get_object_terms', array( $this, 'get_object_terms' ), 10, 4 ); |
|
| 197 | + add_filter('get_object_terms', array($this, 'get_object_terms'), 10, 4); |
|
| 198 | 198 | |
| 199 | 199 | return $terms; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function wpseo_sitemap_exclude_taxonomy( $exclude, $tax ) { |
|
| 203 | - if ( $tax === self::TAXONOMY_NAME ) { |
|
| 202 | + public function wpseo_sitemap_exclude_taxonomy($exclude, $tax) { |
|
| 203 | + if ($tax === self::TAXONOMY_NAME) { |
|
| 204 | 204 | return true; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -6,68 +6,68 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Rest_Field { |
| 8 | 8 | |
| 9 | - public function __construct() { |
|
| 10 | - add_action( 'rest_api_init', array( $this, 'register_rest_field' ) ); |
|
| 11 | - } |
|
| 9 | + public function __construct() { |
|
| 10 | + add_action( 'rest_api_init', array( $this, 'register_rest_field' ) ); |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function register_rest_field() { |
|
| 13 | + public function register_rest_field() { |
|
| 14 | 14 | |
| 15 | - if ( ! function_exists( 'register_rest_field' ) ) { |
|
| 16 | - return; |
|
| 17 | - } |
|
| 15 | + if ( ! function_exists( 'register_rest_field' ) ) { |
|
| 16 | + return; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 20 | + $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 21 | 21 | |
| 22 | - foreach ( $post_types as $post_type ) { |
|
| 22 | + foreach ( $post_types as $post_type ) { |
|
| 23 | 23 | |
| 24 | - register_rest_field( |
|
| 25 | - $post_type, |
|
| 26 | - \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, |
|
| 27 | - array( |
|
| 28 | - 'get_callback' => array( $this, 'get_value' ), |
|
| 29 | - 'update_callback' => array( $this, 'update_value' ) |
|
| 30 | - ) |
|
| 31 | - ); |
|
| 24 | + register_rest_field( |
|
| 25 | + $post_type, |
|
| 26 | + \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, |
|
| 27 | + array( |
|
| 28 | + 'get_callback' => array( $this, 'get_value' ), |
|
| 29 | + 'update_callback' => array( $this, 'update_value' ) |
|
| 30 | + ) |
|
| 31 | + ); |
|
| 32 | 32 | |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param $meta_values array |
|
| 40 | - * @param $post \WP_Post |
|
| 41 | - * @param $meta_key string |
|
| 42 | - */ |
|
| 43 | - public function update_value( $meta_values, $post, $meta_key ) { |
|
| 38 | + /** |
|
| 39 | + * @param $meta_values array |
|
| 40 | + * @param $post \WP_Post |
|
| 41 | + * @param $meta_key string |
|
| 42 | + */ |
|
| 43 | + public function update_value( $meta_values, $post, $meta_key ) { |
|
| 44 | 44 | |
| 45 | - if ( ! is_array( $meta_values ) ) { |
|
| 46 | - return; |
|
| 47 | - } |
|
| 48 | - delete_post_meta( $post->ID, Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 45 | + if ( ! is_array( $meta_values ) ) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + delete_post_meta( $post->ID, Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 49 | 49 | |
| 50 | - // @todo: check if the keys have to be unique. |
|
| 51 | - $meta_values = array_unique( $meta_values ); |
|
| 50 | + // @todo: check if the keys have to be unique. |
|
| 51 | + $meta_values = array_unique( $meta_values ); |
|
| 52 | 52 | |
| 53 | - foreach ( $meta_values as $item ) { |
|
| 54 | - add_post_meta( $post->ID, \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, $item ); |
|
| 55 | - } |
|
| 56 | - } |
|
| 53 | + foreach ( $meta_values as $item ) { |
|
| 54 | + add_post_meta( $post->ID, \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, $item ); |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @param $post array Post array. |
|
| 60 | - * |
|
| 61 | - * @return array|mixed |
|
| 62 | - */ |
|
| 63 | - public function get_value( $post ) { |
|
| 64 | - $data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 65 | - if ( ! is_array( $data ) ) { |
|
| 66 | - return array(); |
|
| 67 | - } |
|
| 58 | + /** |
|
| 59 | + * @param $post array Post array. |
|
| 60 | + * |
|
| 61 | + * @return array|mixed |
|
| 62 | + */ |
|
| 63 | + public function get_value( $post ) { |
|
| 64 | + $data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 65 | + if ( ! is_array( $data ) ) { |
|
| 66 | + return array(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - return $data; |
|
| 70 | - } |
|
| 69 | + return $data; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | \ No newline at end of file |
@@ -7,26 +7,26 @@ discard block |
||
| 7 | 7 | class Rest_Field { |
| 8 | 8 | |
| 9 | 9 | public function __construct() { |
| 10 | - add_action( 'rest_api_init', array( $this, 'register_rest_field' ) ); |
|
| 10 | + add_action('rest_api_init', array($this, 'register_rest_field')); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | public function register_rest_field() { |
| 14 | 14 | |
| 15 | - if ( ! function_exists( 'register_rest_field' ) ) { |
|
| 15 | + if ( ! function_exists('register_rest_field')) { |
|
| 16 | 16 | return; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
| 21 | 21 | |
| 22 | - foreach ( $post_types as $post_type ) { |
|
| 22 | + foreach ($post_types as $post_type) { |
|
| 23 | 23 | |
| 24 | 24 | register_rest_field( |
| 25 | 25 | $post_type, |
| 26 | 26 | \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, |
| 27 | 27 | array( |
| 28 | - 'get_callback' => array( $this, 'get_value' ), |
|
| 29 | - 'update_callback' => array( $this, 'update_value' ) |
|
| 28 | + 'get_callback' => array($this, 'get_value'), |
|
| 29 | + 'update_callback' => array($this, 'update_value') |
|
| 30 | 30 | ) |
| 31 | 31 | ); |
| 32 | 32 | |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | * @param $post \WP_Post |
| 41 | 41 | * @param $meta_key string |
| 42 | 42 | */ |
| 43 | - public function update_value( $meta_values, $post, $meta_key ) { |
|
| 43 | + public function update_value($meta_values, $post, $meta_key) { |
|
| 44 | 44 | |
| 45 | - if ( ! is_array( $meta_values ) ) { |
|
| 45 | + if ( ! is_array($meta_values)) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | - delete_post_meta( $post->ID, Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 48 | + delete_post_meta($post->ID, Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY); |
|
| 49 | 49 | |
| 50 | 50 | // @todo: check if the keys have to be unique. |
| 51 | - $meta_values = array_unique( $meta_values ); |
|
| 51 | + $meta_values = array_unique($meta_values); |
|
| 52 | 52 | |
| 53 | - foreach ( $meta_values as $item ) { |
|
| 54 | - add_post_meta( $post->ID, \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, $item ); |
|
| 53 | + foreach ($meta_values as $item) { |
|
| 54 | + add_post_meta($post->ID, \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY, $item); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return array|mixed |
| 62 | 62 | */ |
| 63 | - public function get_value( $post ) { |
|
| 64 | - $data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY ); |
|
| 65 | - if ( ! is_array( $data ) ) { |
|
| 63 | + public function get_value($post) { |
|
| 64 | + $data = get_post_meta((int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY); |
|
| 65 | + if ( ! is_array($data)) { |
|
| 66 | 66 | return array(); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $this->define_public_hooks(); |
| 776 | 776 | |
| 777 | 777 | // If we're in `WP_CLI` load the related files. |
| 778 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 778 | + if (class_exists('WP_CLI')) { |
|
| 779 | 779 | $this->load_cli_dependencies(); |
| 780 | 780 | } |
| 781 | 781 | |
@@ -816,381 +816,381 @@ discard block |
||
| 816 | 816 | * The class responsible for orchestrating the actions and filters of the |
| 817 | 817 | * core plugin. |
| 818 | 818 | */ |
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 820 | 820 | |
| 821 | 821 | // The class responsible for plugin uninstall. |
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | 825 | * The class responsible for defining internationalization functionality |
| 826 | 826 | * of the plugin. |
| 827 | 827 | */ |
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 829 | 829 | |
| 830 | 830 | /** |
| 831 | 831 | * WordLift's supported languages. |
| 832 | 832 | */ |
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 834 | 834 | |
| 835 | 835 | /** |
| 836 | 836 | * WordLift's supported countries. |
| 837 | 837 | */ |
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * Provide support functions to sanitize data. |
| 842 | 842 | */ |
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 844 | 844 | |
| 845 | 845 | /** Services. */ |
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 847 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 846 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 847 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 848 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 850 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 851 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 852 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 853 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 855 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * The Query builder. |
| 859 | 859 | */ |
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 860 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The Schema service. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * The schema:url property service. |
| 869 | 869 | */ |
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 870 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 871 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 872 | 872 | |
| 873 | 873 | /** |
| 874 | 874 | * The UI service. |
| 875 | 875 | */ |
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 876 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 877 | 877 | |
| 878 | 878 | /** |
| 879 | 879 | * The Thumbnail service. |
| 880 | 880 | */ |
| 881 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 881 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 882 | 882 | |
| 883 | 883 | /** |
| 884 | 884 | * The Entity Types Taxonomy service. |
| 885 | 885 | */ |
| 886 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 886 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 887 | 887 | |
| 888 | 888 | /** |
| 889 | 889 | * The Entity service. |
| 890 | 890 | */ |
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 891 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 892 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 893 | 893 | |
| 894 | 894 | // Add the entity rating service. |
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 895 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 896 | 896 | |
| 897 | 897 | /** |
| 898 | 898 | * The User service. |
| 899 | 899 | */ |
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The Timeline service. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 906 | 906 | |
| 907 | 907 | /** |
| 908 | 908 | * The Topic Taxonomy service. |
| 909 | 909 | */ |
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 910 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 911 | 911 | |
| 912 | 912 | /** |
| 913 | 913 | * The SPARQL service. |
| 914 | 914 | */ |
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 915 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 916 | 916 | |
| 917 | 917 | /** |
| 918 | 918 | * The WordLift import service. |
| 919 | 919 | */ |
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 921 | 921 | |
| 922 | 922 | /** |
| 923 | 923 | * The WordLift URI service. |
| 924 | 924 | */ |
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 925 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 926 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 928 | 928 | |
| 929 | 929 | /** |
| 930 | 930 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 931 | 931 | */ |
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 936 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 933 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 934 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 935 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 936 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 937 | 937 | |
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 939 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 938 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 939 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 940 | 940 | |
| 941 | 941 | /** |
| 942 | 942 | * Load the converters. |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 945 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 946 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 949 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 950 | 950 | |
| 951 | 951 | /** |
| 952 | 952 | * Load cache-related files. |
| 953 | 953 | */ |
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 954 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 955 | 955 | |
| 956 | 956 | /** |
| 957 | 957 | * Load the content filter. |
| 958 | 958 | */ |
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 959 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 960 | 960 | |
| 961 | 961 | /* |
| 962 | 962 | * Load the excerpt helper. |
| 963 | 963 | */ |
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 964 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 965 | 965 | |
| 966 | 966 | /** |
| 967 | 967 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 968 | 968 | * |
| 969 | 969 | * @since 3.8.0 |
| 970 | 970 | */ |
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 972 | 972 | |
| 973 | 973 | // The Publisher Service and the AJAX adapter. |
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 976 | 976 | |
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 977 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 978 | 978 | |
| 979 | 979 | /** |
| 980 | 980 | * Load the WordLift key validation service. |
| 981 | 981 | */ |
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 983 | 983 | |
| 984 | 984 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 986 | 986 | |
| 987 | 987 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 988 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 989 | 989 | |
| 990 | 990 | /** Linked Data. */ |
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 996 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 997 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1002 | 1002 | |
| 1003 | 1003 | /** Linked Data Rendition. */ |
| 1004 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1004 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1007 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1008 | 1008 | |
| 1009 | 1009 | /** Services. */ |
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1010 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1011 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 1012 | 1012 | |
| 1013 | 1013 | /** Adapters. */ |
| 1014 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1018 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1014 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1015 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1016 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1017 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1018 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1019 | 1019 | |
| 1020 | 1020 | /** Async Tasks. */ |
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1022 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1021 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1022 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1023 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1024 | 1024 | |
| 1025 | 1025 | /** Autocomplete. */ |
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1026 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1027 | 1027 | |
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1028 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1029 | 1029 | |
| 1030 | 1030 | /** Analytics */ |
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1031 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | 1034 | * The class responsible for defining all actions that occur in the admin area. |
| 1035 | 1035 | */ |
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | 1039 | * The class to customize the entity list admin page. |
| 1040 | 1040 | */ |
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | /** |
| 1044 | 1044 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1045 | 1045 | */ |
| 1046 | 1046 | global $wp_version; |
| 1047 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1047 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 1048 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1049 | 1049 | } else { |
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1050 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
| 1054 | 1054 | * The Notice service. |
| 1055 | 1055 | */ |
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1056 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * The PrimaShop adapter. |
| 1060 | 1060 | */ |
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | 1064 | * The WordLift Dashboard service. |
| 1065 | 1065 | */ |
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1067 | 1067 | |
| 1068 | 1068 | /** |
| 1069 | 1069 | * The admin 'Install wizard' page. |
| 1070 | 1070 | */ |
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1072 | 1072 | |
| 1073 | 1073 | /** |
| 1074 | 1074 | * The WordLift entity type list admin page controller. |
| 1075 | 1075 | */ |
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1077 | 1077 | |
| 1078 | 1078 | /** |
| 1079 | 1079 | * The WordLift entity type settings admin page controller. |
| 1080 | 1080 | */ |
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1082 | 1082 | |
| 1083 | 1083 | /** |
| 1084 | 1084 | * The admin 'Download Your Data' page. |
| 1085 | 1085 | */ |
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * The admin 'WordLift Settings' page. |
| 1090 | 1090 | */ |
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1100 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1105 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1091 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1092 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1093 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1094 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1095 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1096 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1097 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1098 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1099 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1100 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1101 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1102 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1103 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1104 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1105 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1106 | 1106 | |
| 1107 | 1107 | /** Admin Pages */ |
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1108 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1109 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1110 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1111 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1112 | 1112 | |
| 1113 | 1113 | /** |
| 1114 | 1114 | * The class responsible for defining all actions that occur in the public-facing |
| 1115 | 1115 | * side of the site. |
| 1116 | 1116 | */ |
| 1117 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1117 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1118 | 1118 | |
| 1119 | 1119 | /** |
| 1120 | 1120 | * The shortcode abstract class. |
| 1121 | 1121 | */ |
| 1122 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1122 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1123 | 1123 | |
| 1124 | 1124 | /** |
| 1125 | 1125 | * The Timeline shortcode. |
| 1126 | 1126 | */ |
| 1127 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1127 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1128 | 1128 | |
| 1129 | 1129 | /** |
| 1130 | 1130 | * The Navigator shortcode. |
| 1131 | 1131 | */ |
| 1132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1132 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1133 | 1133 | |
| 1134 | 1134 | /** |
| 1135 | 1135 | * The Products Navigator shortcode. |
| 1136 | 1136 | */ |
| 1137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1137 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1138 | 1138 | |
| 1139 | 1139 | /** |
| 1140 | 1140 | * The chord shortcode. |
| 1141 | 1141 | */ |
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1142 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1143 | 1143 | |
| 1144 | 1144 | /** |
| 1145 | 1145 | * The geomap shortcode. |
| 1146 | 1146 | */ |
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1147 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | 1150 | * The entity cloud shortcode. |
| 1151 | 1151 | */ |
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1152 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1153 | 1153 | |
| 1154 | 1154 | /** |
| 1155 | 1155 | * The entity glossary shortcode. |
| 1156 | 1156 | */ |
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1158 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1157 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1158 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1159 | 1159 | |
| 1160 | 1160 | /** |
| 1161 | 1161 | * Faceted Search shortcode. |
| 1162 | 1162 | */ |
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1163 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1164 | 1164 | |
| 1165 | 1165 | /** |
| 1166 | 1166 | * The ShareThis service. |
| 1167 | 1167 | */ |
| 1168 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1168 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1169 | 1169 | |
| 1170 | 1170 | /** |
| 1171 | 1171 | * The SEO service. |
| 1172 | 1172 | */ |
| 1173 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1173 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1174 | 1174 | |
| 1175 | 1175 | /** |
| 1176 | 1176 | * The AMP service. |
| 1177 | 1177 | */ |
| 1178 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1178 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1179 | 1179 | |
| 1180 | 1180 | /** Widgets */ |
| 1181 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1182 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1183 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1181 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1182 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1183 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php'; |
|
| 1184 | 1184 | |
| 1185 | 1185 | /* |
| 1186 | 1186 | * Schema.org Services. |
| 1187 | 1187 | * |
| 1188 | 1188 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1189 | 1189 | */ |
| 1190 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1191 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1193 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1190 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1191 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1192 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1193 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1194 | 1194 | new Wordlift_Schemaorg_Sync_Service(); |
| 1195 | 1195 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1196 | 1196 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1206,25 +1206,25 @@ discard block |
||
| 1206 | 1206 | |
| 1207 | 1207 | // Instantiate a global logger. |
| 1208 | 1208 | global $wl_logger; |
| 1209 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1209 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1210 | 1210 | |
| 1211 | 1211 | // Load the `wl-api` end-point. |
| 1212 | 1212 | new Wordlift_Http_Api(); |
| 1213 | 1213 | |
| 1214 | 1214 | // Load the Install Service. |
| 1215 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1215 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 1216 | 1216 | $this->install_service = new Wordlift_Install_Service(); |
| 1217 | 1217 | |
| 1218 | 1218 | /** Services. */ |
| 1219 | 1219 | // Create the configuration service. |
| 1220 | 1220 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1221 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1221 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1222 | 1222 | |
| 1223 | 1223 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1224 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1224 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1225 | 1225 | |
| 1226 | 1226 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1227 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1227 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1228 | 1228 | |
| 1229 | 1229 | // Create an instance of the UI service. |
| 1230 | 1230 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1233,30 +1233,30 @@ discard block |
||
| 1233 | 1233 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1234 | 1234 | |
| 1235 | 1235 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1236 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1236 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1237 | 1237 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1238 | 1238 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1239 | 1239 | |
| 1240 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1241 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1242 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1243 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1240 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1241 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1242 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1243 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1244 | 1244 | |
| 1245 | 1245 | // Instantiate the JSON-LD service. |
| 1246 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1246 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1247 | 1247 | |
| 1248 | 1248 | /** Linked Data. */ |
| 1249 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1250 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1249 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1250 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1251 | 1251 | |
| 1252 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1252 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1253 | 1253 | |
| 1254 | 1254 | // Create a new instance of the Redirect service. |
| 1255 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1256 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1255 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1256 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1257 | 1257 | |
| 1258 | 1258 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1259 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1259 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1260 | 1260 | |
| 1261 | 1261 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1262 | 1262 | |
@@ -1270,36 +1270,36 @@ discard block |
||
| 1270 | 1270 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1271 | 1271 | |
| 1272 | 1272 | // Create an import service instance to hook later to WP's import function. |
| 1273 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1273 | + $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()); |
|
| 1274 | 1274 | |
| 1275 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1275 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1276 | 1276 | |
| 1277 | 1277 | // Create the entity rating service. |
| 1278 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1278 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1279 | 1279 | |
| 1280 | 1280 | // Create entity list customization (wp-admin/edit.php). |
| 1281 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1281 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1282 | 1282 | |
| 1283 | 1283 | // Create a new instance of the Redirect service. |
| 1284 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1284 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1285 | 1285 | |
| 1286 | 1286 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1287 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1288 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1289 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1287 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1288 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1289 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1290 | 1290 | |
| 1291 | 1291 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1292 | 1292 | |
| 1293 | 1293 | // Instantiate the JSON-LD service. |
| 1294 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1295 | - $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 ); |
|
| 1296 | - $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 ); |
|
| 1297 | - $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 ); |
|
| 1298 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1294 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1295 | + $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); |
|
| 1296 | + $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); |
|
| 1297 | + $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); |
|
| 1298 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1299 | 1299 | |
| 1300 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1301 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1302 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1300 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1301 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache); |
|
| 1302 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1303 | 1303 | |
| 1304 | 1304 | /* |
| 1305 | 1305 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
@@ -1308,30 +1308,30 @@ discard block |
||
| 1308 | 1308 | * |
| 1309 | 1309 | * @since 3.20.0 |
| 1310 | 1310 | */ |
| 1311 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1312 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1311 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1312 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1313 | 1313 | $jsonld_service = new Jsonld_Service( |
| 1314 | 1314 | $this->jsonld_service, |
| 1315 | 1315 | $term_jsonld_adapter, |
| 1316 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1317 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1316 | + new Jsonld_User_Service($this->user_service) ); |
|
| 1317 | + new Jsonld_Endpoint($jsonld_service, $this->entity_uri_service); |
|
| 1318 | 1318 | |
| 1319 | 1319 | // Prints the JSON-LD in the head. |
| 1320 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1320 | + new Jsonld_Adapter($this->jsonld_service); |
|
| 1321 | 1321 | |
| 1322 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1322 | + new Jsonld_By_Id_Endpoint($this->jsonld_service, $this->entity_uri_service); |
|
| 1323 | 1323 | |
| 1324 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1325 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1324 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1325 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1326 | 1326 | // Creating Faq Content filter service. |
| 1327 | 1327 | $this->faq_content_filter_service = new Faq_Content_Filter(); |
| 1328 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1329 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1330 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1331 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1328 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1329 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1330 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1331 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->entity_service); |
|
| 1332 | 1332 | |
| 1333 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1334 | - $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1333 | + $this->loader->add_action('enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks'); |
|
| 1334 | + $this->loader->add_action('admin_enqueue_scripts', $this, 'add_wl_enabled_blocks'); |
|
| 1335 | 1335 | |
| 1336 | 1336 | /** |
| 1337 | 1337 | * Filter: wl_feature__enable__blocks. |
@@ -1341,15 +1341,15 @@ discard block |
||
| 1341 | 1341 | * @return bool |
| 1342 | 1342 | * @since 3.27.6 |
| 1343 | 1343 | */ |
| 1344 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1344 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1345 | 1345 | // Initialize the short-codes. |
| 1346 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1346 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
| 1347 | 1347 | new Wordlift_Chord_Shortcode(); |
| 1348 | 1348 | new Wordlift_Geomap_Shortcode(); |
| 1349 | 1349 | new Wordlift_Timeline_Shortcode(); |
| 1350 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1351 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1352 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1350 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service, $this->entity_service); |
|
| 1351 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1352 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1362,18 +1362,18 @@ discard block |
||
| 1362 | 1362 | new Wordlift_Seo_Service(); |
| 1363 | 1363 | |
| 1364 | 1364 | // Initialize the AMP service. |
| 1365 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1365 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1366 | 1366 | |
| 1367 | 1367 | /** Services. */ |
| 1368 | 1368 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1369 | 1369 | new Wordlift_Image_Service(); |
| 1370 | 1370 | |
| 1371 | 1371 | /** Adapters. */ |
| 1372 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1373 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1374 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1372 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1373 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1374 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1375 | 1375 | //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
| 1376 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1376 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1377 | 1377 | |
| 1378 | 1378 | /* |
| 1379 | 1379 | * Exclude our public js from WP-Rocket. |
@@ -1391,9 +1391,9 @@ discard block |
||
| 1391 | 1391 | ); |
| 1392 | 1392 | |
| 1393 | 1393 | $that = $this; |
| 1394 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1395 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1396 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1394 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1395 | + if ( ! apply_filters('wl_feature__enable__dataset-ng', false)) { |
|
| 1396 | + new Wordlift_Linked_Data_Service($that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service); |
|
| 1397 | 1397 | new Wordlift_Sparql_Query_Async_Task(); |
| 1398 | 1398 | new Wordlift_Push_References_Async_Task(); |
| 1399 | 1399 | } |
@@ -1408,14 +1408,14 @@ discard block |
||
| 1408 | 1408 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1409 | 1409 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1410 | 1410 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1411 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1412 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1411 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1412 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1413 | 1413 | |
| 1414 | - $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 ); |
|
| 1415 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1414 | + $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); |
|
| 1415 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1416 | 1416 | |
| 1417 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1418 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1417 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1418 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1419 | 1419 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1420 | 1420 | |
| 1421 | 1421 | // Pages. |
@@ -1426,9 +1426,9 @@ discard block |
||
| 1426 | 1426 | * |
| 1427 | 1427 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1428 | 1428 | */ |
| 1429 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1430 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1431 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1429 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1430 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1431 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1432 | 1432 | } |
| 1433 | 1433 | new Wordlift_Entity_Type_Admin_Service(); |
| 1434 | 1434 | |
@@ -1442,23 +1442,23 @@ discard block |
||
| 1442 | 1442 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1443 | 1443 | |
| 1444 | 1444 | /* WordPress Admin. */ |
| 1445 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1446 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1445 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1446 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1447 | 1447 | |
| 1448 | 1448 | // Create an instance of the install wizard. |
| 1449 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1449 | + $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); |
|
| 1450 | 1450 | |
| 1451 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1451 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1452 | 1452 | |
| 1453 | 1453 | // User Profile. |
| 1454 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1454 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1455 | 1455 | |
| 1456 | 1456 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1457 | 1457 | |
| 1458 | 1458 | // Load the debug service if WP is in debug mode. |
| 1459 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1461 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1459 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1460 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1461 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | // Remote Image Service. |
@@ -1471,12 +1471,12 @@ discard block |
||
| 1471 | 1471 | * |
| 1472 | 1472 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1473 | 1473 | */ |
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1476 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1474 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1475 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1476 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1477 | 1477 | |
| 1478 | 1478 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1479 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1479 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1480 | 1480 | |
| 1481 | 1481 | /* |
| 1482 | 1482 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1485,8 +1485,8 @@ discard block |
||
| 1485 | 1485 | * |
| 1486 | 1486 | * @since 3.20.0 |
| 1487 | 1487 | */ |
| 1488 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1489 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1488 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1489 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1490 | 1490 | |
| 1491 | 1491 | /* |
| 1492 | 1492 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1495,8 +1495,8 @@ discard block |
||
| 1495 | 1495 | * |
| 1496 | 1496 | * @since 3.20.0 |
| 1497 | 1497 | */ |
| 1498 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1499 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1498 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1499 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1500 | 1500 | |
| 1501 | 1501 | /* |
| 1502 | 1502 | * Load the Mappings JSON-LD post processing. |
@@ -1510,11 +1510,11 @@ discard block |
||
| 1510 | 1510 | // Taxonomy term rule validator for validating rules for term pages. |
| 1511 | 1511 | new Taxonomy_Term_Rule_Validator(); |
| 1512 | 1512 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1513 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1514 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1515 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1513 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1514 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1515 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1516 | 1516 | |
| 1517 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1517 | + new Url_To_Entity_Transform_Function($this->entity_uri_service); |
|
| 1518 | 1518 | new Taxonomy_To_Terms_Transform_Function(); |
| 1519 | 1519 | new Post_Id_To_Entity_Transform_Function(); |
| 1520 | 1520 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | * Intiailize the acf group data formatter. |
| 1525 | 1525 | */ |
| 1526 | 1526 | new Acf_Group_Formatter(); |
| 1527 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1527 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1528 | 1528 | |
| 1529 | 1529 | /** |
| 1530 | 1530 | * @since 3.26.0 |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | /* |
| 1546 | 1546 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1547 | 1547 | */ |
| 1548 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1548 | + $entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service); |
|
| 1549 | 1549 | new Analysis_Response_Ops_Factory( |
| 1550 | 1550 | $this->entity_uri_service, |
| 1551 | 1551 | $this->entity_service, |
@@ -1555,11 +1555,11 @@ discard block |
||
| 1555 | 1555 | ); |
| 1556 | 1556 | |
| 1557 | 1557 | /** WL Autocomplete. */ |
| 1558 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1558 | + $autocomplete_service = new All_Autocomplete_Service(array( |
|
| 1559 | 1559 | new Local_Autocomplete_Service(), |
| 1560 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1561 | - ) ); |
|
| 1562 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1560 | + new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service), |
|
| 1561 | + )); |
|
| 1562 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1563 | 1563 | |
| 1564 | 1564 | /** |
| 1565 | 1565 | * @since 3.27.2 |
@@ -1568,10 +1568,10 @@ discard block |
||
| 1568 | 1568 | */ |
| 1569 | 1569 | new Recipe_Maker_Post_Type_Hook(); |
| 1570 | 1570 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1571 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1572 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1573 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1574 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1571 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1572 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1573 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1574 | + new Yoast_Jsonld($recipe_maker_validation_service); |
|
| 1575 | 1575 | |
| 1576 | 1576 | /** |
| 1577 | 1577 | * @since 3.27.4 |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | * @since 3.27.8 |
| 1583 | 1583 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
| 1584 | 1584 | */ |
| 1585 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1585 | + new Key_Validation_Notice($this->key_validation_service, $this->configuration_service); |
|
| 1586 | 1586 | /** |
| 1587 | 1587 | * @since 3.28.0 |
| 1588 | 1588 | * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | * @since 3.29.0 |
| 1594 | 1594 | * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
| 1595 | 1595 | */ |
| 1596 | - new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1596 | + new Entity_Rest_Service($this->entity_type_service); |
|
| 1597 | 1597 | |
| 1598 | 1598 | /** |
| 1599 | 1599 | * Expand author in to references. |
@@ -1601,13 +1601,13 @@ discard block |
||
| 1601 | 1601 | * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
| 1602 | 1602 | */ |
| 1603 | 1603 | |
| 1604 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1604 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1605 | 1605 | |
| 1606 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1607 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1606 | + if (apply_filters('wl_feature__enable__article-wrapper', false)) { |
|
| 1607 | + new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter); |
|
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1610 | + if (apply_filters('wl_feature__enable__match-terms', false)) { |
|
| 1611 | 1611 | $vocabulary_loader = new Vocabulary_Loader(); |
| 1612 | 1612 | $vocabulary_loader->init_vocabulary(); |
| 1613 | 1613 | } |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | * @since 3.31.5 |
| 1631 | 1631 | * Create configuration endpoint for webapp to configure. |
| 1632 | 1632 | */ |
| 1633 | - new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1633 | + new Config($this->admin_setup, $this->key_validation_service, $this->configuration_service); |
|
| 1634 | 1634 | /** |
| 1635 | 1635 | * @since 3.31.7 |
| 1636 | 1636 | * Remove duplicate videoobject. |
@@ -1650,9 +1650,9 @@ discard block |
||
| 1650 | 1650 | private function set_locale() { |
| 1651 | 1651 | |
| 1652 | 1652 | $plugin_i18n = new Wordlift_i18n(); |
| 1653 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1653 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1654 | 1654 | |
| 1655 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1655 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1656 | 1656 | |
| 1657 | 1657 | } |
| 1658 | 1658 | |
@@ -1673,29 +1673,29 @@ discard block |
||
| 1673 | 1673 | $this->user_service |
| 1674 | 1674 | ); |
| 1675 | 1675 | |
| 1676 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1677 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1676 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1677 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1678 | 1678 | |
| 1679 | 1679 | // Hook the init action to taxonomy services. |
| 1680 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1681 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1680 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1681 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1682 | 1682 | |
| 1683 | 1683 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1684 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1684 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1685 | 1685 | |
| 1686 | 1686 | // Hook the added_post_meta action to the Thumbnail service. |
| 1687 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1687 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1688 | 1688 | |
| 1689 | 1689 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1690 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1690 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1691 | 1691 | |
| 1692 | 1692 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1693 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1693 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1694 | 1694 | |
| 1695 | 1695 | // Register custom allowed redirect hosts. |
| 1696 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1696 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1697 | 1697 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1698 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1698 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1699 | 1699 | |
| 1700 | 1700 | /* |
| 1701 | 1701 | * The old dashboard is replaced with dashboard v2. |
@@ -1713,46 +1713,46 @@ discard block |
||
| 1713 | 1713 | |
| 1714 | 1714 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1715 | 1715 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1716 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1717 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1716 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1717 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1718 | 1718 | |
| 1719 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1720 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1719 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1720 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1721 | 1721 | |
| 1722 | 1722 | // Entity listing customization (wp-admin/edit.php) |
| 1723 | 1723 | // Add custom columns. |
| 1724 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1724 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1725 | 1725 | // no explicit entity as it prevents handling of other post types. |
| 1726 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1726 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1727 | 1727 | // Add 4W selection. |
| 1728 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1729 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1730 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1731 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1728 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1729 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1730 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1731 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1732 | 1732 | |
| 1733 | 1733 | /* |
| 1734 | 1734 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1735 | 1735 | * |
| 1736 | 1736 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1737 | 1737 | */ |
| 1738 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1739 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1738 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1739 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1743 | 1743 | // entities. |
| 1744 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1744 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1745 | 1745 | |
| 1746 | 1746 | // Filter imported post meta. |
| 1747 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1747 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1748 | 1748 | |
| 1749 | 1749 | // Notify the import service when an import starts and ends. |
| 1750 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1751 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1750 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1751 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1752 | 1752 | |
| 1753 | 1753 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1754 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1755 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1754 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1755 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1756 | 1756 | |
| 1757 | 1757 | /** |
| 1758 | 1758 | * Filter: wl_feature__enable__settings-download. |
@@ -1762,34 +1762,34 @@ discard block |
||
| 1762 | 1762 | * @return bool |
| 1763 | 1763 | * @since 3.27.6 |
| 1764 | 1764 | */ |
| 1765 | - $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1765 | + $this->features_registry->register_feature_from_slug('settings-download', true, array( |
|
| 1766 | 1766 | $this, |
| 1767 | 1767 | 'register_screens' |
| 1768 | - ) ); |
|
| 1768 | + )); |
|
| 1769 | 1769 | |
| 1770 | 1770 | |
| 1771 | 1771 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1772 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1772 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1773 | 1773 | |
| 1774 | 1774 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1775 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1776 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1777 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1775 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1776 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1777 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1778 | 1778 | |
| 1779 | 1779 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1780 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1780 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1781 | 1781 | |
| 1782 | 1782 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1783 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1783 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1784 | 1784 | |
| 1785 | 1785 | // Hook the `admin_init` function to the Admin Setup. |
| 1786 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1786 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1787 | 1787 | |
| 1788 | 1788 | // Hook the admin_init to the settings page. |
| 1789 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1790 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1789 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1790 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1791 | 1791 | |
| 1792 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1792 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1793 | 1793 | |
| 1794 | 1794 | // Hook the menu creation on the general wordlift menu creation. |
| 1795 | 1795 | /** |
@@ -1802,18 +1802,18 @@ discard block |
||
| 1802 | 1802 | * |
| 1803 | 1803 | * Since 3.30.0 this feature is registered using registry. |
| 1804 | 1804 | */ |
| 1805 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1806 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1807 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1805 | + add_action('plugins_loaded', function() use ($that) { |
|
| 1806 | + if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) { |
|
| 1807 | + add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2); |
|
| 1808 | 1808 | } |
| 1809 | 1809 | } ); |
| 1810 | 1810 | |
| 1811 | 1811 | // Hook key update. |
| 1812 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1813 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1812 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1813 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1814 | 1814 | |
| 1815 | 1815 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1816 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1816 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1817 | 1817 | |
| 1818 | 1818 | /* |
| 1819 | 1819 | * Remove the Analytics Settings link from the plugin page. |
@@ -1824,25 +1824,25 @@ discard block |
||
| 1824 | 1824 | // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1825 | 1825 | |
| 1826 | 1826 | // Hook the AJAX `wl_publisher` action name. |
| 1827 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1827 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1828 | 1828 | |
| 1829 | 1829 | // Hook row actions for the entity type list admin. |
| 1830 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1830 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1831 | 1831 | |
| 1832 | 1832 | /** Ajax actions. */ |
| 1833 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1833 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1834 | 1834 | |
| 1835 | 1835 | // Hook capabilities manipulation to allow access to entity type admin |
| 1836 | 1836 | // page on WordPress versions before 4.7. |
| 1837 | 1837 | global $wp_version; |
| 1838 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1839 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1838 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1839 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1842 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1843 | 1843 | |
| 1844 | 1844 | /** Adapters. */ |
| 1845 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1845 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1846 | 1846 | /** |
| 1847 | 1847 | * Disabling Faq temporarily. |
| 1848 | 1848 | * Load the tinymce editor button on the tool bar. |
@@ -1853,54 +1853,54 @@ discard block |
||
| 1853 | 1853 | //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1854 | 1854 | |
| 1855 | 1855 | |
| 1856 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1857 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1858 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1856 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1857 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1858 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1859 | 1859 | /** |
| 1860 | 1860 | * @since 3.26.0 |
| 1861 | 1861 | */ |
| 1862 | 1862 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1863 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1863 | + $this->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1864 | 1864 | // Adding Rest route for the post excerpt |
| 1865 | 1865 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1866 | 1866 | |
| 1867 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1868 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1867 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1868 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1869 | 1869 | |
| 1870 | 1870 | // Handle the autocomplete request. |
| 1871 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1871 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1872 | 1872 | $this->autocomplete_adapter, |
| 1873 | 1873 | 'wl_autocomplete', |
| 1874 | - ) ); |
|
| 1875 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1874 | + )); |
|
| 1875 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1876 | 1876 | $this->autocomplete_adapter, |
| 1877 | 1877 | 'wl_autocomplete', |
| 1878 | - ) ); |
|
| 1878 | + )); |
|
| 1879 | 1879 | |
| 1880 | 1880 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1881 | - if ( is_multisite() ) { |
|
| 1882 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1881 | + if (is_multisite()) { |
|
| 1882 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1883 | 1883 | } |
| 1884 | 1884 | |
| 1885 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1885 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1886 | 1886 | |
| 1887 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1888 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1889 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1887 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1888 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1889 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1890 | 1890 | |
| 1891 | 1891 | /** |
| 1892 | 1892 | * Always allow the `wordlift/classification` block. |
| 1893 | 1893 | * |
| 1894 | 1894 | * @since 3.23.0 |
| 1895 | 1895 | */ |
| 1896 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1896 | + add_filter('allowed_block_types', function($value) { |
|
| 1897 | 1897 | |
| 1898 | - if ( true === $value ) { |
|
| 1898 | + if (true === $value) { |
|
| 1899 | 1899 | return $value; |
| 1900 | 1900 | } |
| 1901 | 1901 | |
| 1902 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1903 | - }, PHP_INT_MAX ); |
|
| 1902 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1903 | + }, PHP_INT_MAX); |
|
| 1904 | 1904 | |
| 1905 | 1905 | /** |
| 1906 | 1906 | * @since 3.27.7 |
@@ -1918,58 +1918,58 @@ discard block |
||
| 1918 | 1918 | */ |
| 1919 | 1919 | private function define_public_hooks() { |
| 1920 | 1920 | |
| 1921 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1921 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1922 | 1922 | |
| 1923 | 1923 | // Register the entity post type. |
| 1924 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1924 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1925 | 1925 | |
| 1926 | 1926 | // Bind the link generation and handling hooks to the entity link service. |
| 1927 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1928 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1927 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1928 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1929 | 1929 | // $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 ); |
| 1930 | 1930 | // $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 ); |
| 1931 | 1931 | |
| 1932 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1933 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1934 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1932 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1933 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1934 | + $this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts'); |
|
| 1935 | 1935 | |
| 1936 | 1936 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1937 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1937 | + $this->loader->add_filter('the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1938 | 1938 | // Hook the content filter service to add entity links. |
| 1939 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1940 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1939 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1940 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | 1943 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1944 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1944 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1945 | 1945 | |
| 1946 | 1946 | // Hook the ShareThis service. |
| 1947 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1948 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1947 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1948 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1949 | 1949 | |
| 1950 | 1950 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1951 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1951 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1952 | 1952 | |
| 1953 | 1953 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1954 | 1954 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1955 | 1955 | // to categories. |
| 1956 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1956 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1957 | 1957 | |
| 1958 | 1958 | /* |
| 1959 | 1959 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1960 | 1960 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1961 | 1961 | * order of start time. |
| 1962 | 1962 | */ |
| 1963 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1963 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1964 | 1964 | |
| 1965 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1965 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1966 | 1966 | |
| 1967 | 1967 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1968 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1968 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1969 | 1969 | |
| 1970 | 1970 | // Analytics Script Frontend. |
| 1971 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1972 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1971 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1972 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | } |
@@ -2022,11 +2022,11 @@ discard block |
||
| 2022 | 2022 | */ |
| 2023 | 2023 | private function load_cli_dependencies() { |
| 2024 | 2024 | |
| 2025 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2025 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2026 | 2026 | |
| 2027 | - $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 ); |
|
| 2027 | + $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); |
|
| 2028 | 2028 | |
| 2029 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2029 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 2030 | 2030 | |
| 2031 | 2031 | } |
| 2032 | 2032 | |
@@ -2051,7 +2051,7 @@ discard block |
||
| 2051 | 2051 | * @since 3.27.6 |
| 2052 | 2052 | */ |
| 2053 | 2053 | |
| 2054 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2054 | + wp_register_script('wl_enabled_blocks', false); |
|
| 2055 | 2055 | |
| 2056 | 2056 | $enabled_blocks = array(); |
| 2057 | 2057 | |
@@ -2059,13 +2059,13 @@ discard block |
||
| 2059 | 2059 | * Filter name: wl_feature_enable__product_navigator |
| 2060 | 2060 | * @since 3.30.0 |
| 2061 | 2061 | */ |
| 2062 | - if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2062 | + if (apply_filters('wl_feature_enable__product-navigator', true)) { |
|
| 2063 | 2063 | $enabled_blocks[] = 'wordlift/products-navigator'; |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2066 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 2067 | 2067 | // To intimate JS |
| 2068 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2068 | + $enabled_blocks = array_merge($enabled_blocks, array( |
|
| 2069 | 2069 | 'wordlift/navigator', |
| 2070 | 2070 | 'wordlift/chord', |
| 2071 | 2071 | 'wordlift/geomap', |
@@ -2073,11 +2073,11 @@ discard block |
||
| 2073 | 2073 | 'wordlift/cloud', |
| 2074 | 2074 | 'wordlift/vocabulary', |
| 2075 | 2075 | 'wordlift/faceted-search' |
| 2076 | - ) ); |
|
| 2076 | + )); |
|
| 2077 | 2077 | } |
| 2078 | 2078 | |
| 2079 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2080 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2079 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 2080 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 2081 | 2081 | } |
| 2082 | 2082 | |
| 2083 | 2083 | /** |
@@ -2085,11 +2085,11 @@ discard block |
||
| 2085 | 2085 | */ |
| 2086 | 2086 | public function register_screens() { |
| 2087 | 2087 | // Hook the menu to the Download Your Data page. |
| 2088 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2089 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2088 | + if (apply_filters('wl_feature__enable__settings-download', true)) { |
|
| 2089 | + add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0); |
|
| 2090 | 2090 | } |
| 2091 | - add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2092 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2091 | + add_action('admin_menu', array($this->status_page, 'admin_menu'), 100, 0); |
|
| 2092 | + add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0); |
|
| 2093 | 2093 | |
| 2094 | 2094 | } |
| 2095 | 2095 | |
@@ -78,1628 +78,1628 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | class Wordlift { |
| 80 | 80 | |
| 81 | - //<editor-fold desc="## FIELDS"> |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 85 | - * the plugin. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @access protected |
|
| 89 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 90 | - */ |
|
| 91 | - protected $loader; |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * The unique identifier of this plugin. |
|
| 95 | - * |
|
| 96 | - * @since 1.0.0 |
|
| 97 | - * @access protected |
|
| 98 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 99 | - */ |
|
| 100 | - protected $plugin_name; |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * The current version of the plugin. |
|
| 104 | - * |
|
| 105 | - * @since 1.0.0 |
|
| 106 | - * @access protected |
|
| 107 | - * @var string $version The current version of the plugin. |
|
| 108 | - */ |
|
| 109 | - protected $version; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 113 | - * |
|
| 114 | - * @since 3.12.0 |
|
| 115 | - * @access protected |
|
| 116 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 117 | - */ |
|
| 118 | - protected $tinymce_adapter; |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * The {@link Faq_Tinymce_Adapter} instance |
|
| 122 | - * @since 3.26.0 |
|
| 123 | - * @access protected |
|
| 124 | - * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 125 | - */ |
|
| 126 | - //protected $faq_tinymce_adapter; |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * The Thumbnail service. |
|
| 130 | - * |
|
| 131 | - * @since 3.1.5 |
|
| 132 | - * @access private |
|
| 133 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 134 | - */ |
|
| 135 | - private $thumbnail_service; |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * The UI service. |
|
| 139 | - * |
|
| 140 | - * @since 3.2.0 |
|
| 141 | - * @access private |
|
| 142 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 143 | - */ |
|
| 144 | - private $ui_service; |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * The Schema service. |
|
| 148 | - * |
|
| 149 | - * @since 3.3.0 |
|
| 150 | - * @access protected |
|
| 151 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 152 | - */ |
|
| 153 | - protected $schema_service; |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * The Entity service. |
|
| 157 | - * |
|
| 158 | - * @since 3.1.0 |
|
| 159 | - * @access protected |
|
| 160 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 161 | - */ |
|
| 162 | - protected $entity_service; |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * The Topic Taxonomy service. |
|
| 166 | - * |
|
| 167 | - * @since 3.5.0 |
|
| 168 | - * @access private |
|
| 169 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 170 | - */ |
|
| 171 | - private $topic_taxonomy_service; |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * The Entity Types Taxonomy service. |
|
| 175 | - * |
|
| 176 | - * @since 3.18.0 |
|
| 177 | - * @access private |
|
| 178 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 179 | - */ |
|
| 180 | - private $entity_types_taxonomy_service; |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * The User service. |
|
| 184 | - * |
|
| 185 | - * @since 3.1.7 |
|
| 186 | - * @access protected |
|
| 187 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 188 | - */ |
|
| 189 | - protected $user_service; |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * The Timeline service. |
|
| 193 | - * |
|
| 194 | - * @since 3.1.0 |
|
| 195 | - * @access private |
|
| 196 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 197 | - */ |
|
| 198 | - private $timeline_service; |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * The Redirect service. |
|
| 202 | - * |
|
| 203 | - * @since 3.2.0 |
|
| 204 | - * @access private |
|
| 205 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 206 | - */ |
|
| 207 | - private $redirect_service; |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * The Notice service. |
|
| 211 | - * |
|
| 212 | - * @since 3.3.0 |
|
| 213 | - * @access private |
|
| 214 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 215 | - */ |
|
| 216 | - private $notice_service; |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * The Entity list customization. |
|
| 220 | - * |
|
| 221 | - * @since 3.3.0 |
|
| 222 | - * @access protected |
|
| 223 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 224 | - */ |
|
| 225 | - protected $entity_list_service; |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * The Entity Types Taxonomy Walker. |
|
| 229 | - * |
|
| 230 | - * @since 3.1.0 |
|
| 231 | - * @access private |
|
| 232 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 233 | - */ |
|
| 234 | - private $entity_types_taxonomy_walker; |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * The ShareThis service. |
|
| 238 | - * |
|
| 239 | - * @since 3.2.0 |
|
| 240 | - * @access private |
|
| 241 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 242 | - */ |
|
| 243 | - private $sharethis_service; |
|
| 244 | - |
|
| 245 | - /** |
|
| 246 | - * The PrimaShop adapter. |
|
| 247 | - * |
|
| 248 | - * @since 3.2.3 |
|
| 249 | - * @access private |
|
| 250 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 251 | - */ |
|
| 252 | - private $primashop_adapter; |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * The WordLift Dashboard adapter. |
|
| 256 | - * |
|
| 257 | - * @since 3.4.0 |
|
| 258 | - * @access private |
|
| 259 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 260 | - */ |
|
| 261 | - private $dashboard_service; |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * The entity type service. |
|
| 265 | - * |
|
| 266 | - * @since 3.6.0 |
|
| 267 | - * @access private |
|
| 268 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 269 | - */ |
|
| 270 | - private $entity_post_type_service; |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 274 | - * |
|
| 275 | - * @since 3.6.0 |
|
| 276 | - * @access private |
|
| 277 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 278 | - */ |
|
| 279 | - private $entity_link_service; |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 283 | - * |
|
| 284 | - * @since 3.6.0 |
|
| 285 | - * @access protected |
|
| 286 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 287 | - */ |
|
| 288 | - protected $sparql_service; |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * A {@link Wordlift_Import_Service} instance. |
|
| 292 | - * |
|
| 293 | - * @since 3.6.0 |
|
| 294 | - * @access private |
|
| 295 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 296 | - */ |
|
| 297 | - private $import_service; |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 301 | - * |
|
| 302 | - * @since 3.6.0 |
|
| 303 | - * @access private |
|
| 304 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 305 | - */ |
|
| 306 | - private $rebuild_service; |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 310 | - * |
|
| 311 | - * @since 3.7.0 |
|
| 312 | - * @access protected |
|
| 313 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 314 | - */ |
|
| 315 | - protected $jsonld_service; |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 319 | - * |
|
| 320 | - * @since 3.14.0 |
|
| 321 | - * @access protected |
|
| 322 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 323 | - */ |
|
| 324 | - protected $jsonld_website_converter; |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 328 | - * |
|
| 329 | - * @since 3.7.0 |
|
| 330 | - * @access private |
|
| 331 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 332 | - */ |
|
| 333 | - private $property_factory; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The 'Download Your Data' page. |
|
| 337 | - * |
|
| 338 | - * @since 3.6.0 |
|
| 339 | - * @access private |
|
| 340 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 341 | - */ |
|
| 342 | - private $download_your_data_page; |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * The 'WordLift Settings' page. |
|
| 346 | - * |
|
| 347 | - * @since 3.11.0 |
|
| 348 | - * @access protected |
|
| 349 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 350 | - */ |
|
| 351 | - protected $settings_page; |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * The install wizard page. |
|
| 355 | - * |
|
| 356 | - * @since 3.9.0 |
|
| 357 | - * @access private |
|
| 358 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 359 | - */ |
|
| 360 | - public $admin_setup; |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 364 | - * linking of entities to their pages. |
|
| 365 | - * |
|
| 366 | - * @since 3.8.0 |
|
| 367 | - * @access private |
|
| 368 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 369 | - */ |
|
| 370 | - private $content_filter_service; |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * The Faq Content filter service |
|
| 374 | - * @since 3.26.0 |
|
| 375 | - * @access private |
|
| 376 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 377 | - */ |
|
| 378 | - private $faq_content_filter_service; |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 382 | - * |
|
| 383 | - * @since 3.9.0 |
|
| 384 | - * @access private |
|
| 385 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 386 | - */ |
|
| 387 | - private $key_validation_service; |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 391 | - * |
|
| 392 | - * @since 3.10.0 |
|
| 393 | - * @access private |
|
| 394 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 395 | - */ |
|
| 396 | - private $rating_service; |
|
| 397 | - |
|
| 398 | - /** |
|
| 399 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 400 | - * |
|
| 401 | - * @since 3.10.0 |
|
| 402 | - * @access protected |
|
| 403 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 404 | - */ |
|
| 405 | - protected $post_to_jsonld_converter; |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 409 | - * |
|
| 410 | - * @since 3.10.0 |
|
| 411 | - * @access protected |
|
| 412 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 413 | - */ |
|
| 414 | - protected $configuration_service; |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * A {@link Wordlift_Install_Service} instance. |
|
| 418 | - * |
|
| 419 | - * @since 3.18.0 |
|
| 420 | - * @access protected |
|
| 421 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 422 | - */ |
|
| 423 | - protected $install_service; |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 427 | - * |
|
| 428 | - * @since 3.10.0 |
|
| 429 | - * @access protected |
|
| 430 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 431 | - */ |
|
| 432 | - protected $entity_type_service; |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 436 | - * |
|
| 437 | - * @since 3.10.0 |
|
| 438 | - * @access protected |
|
| 439 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 440 | - */ |
|
| 441 | - protected $entity_post_to_jsonld_converter; |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 445 | - * |
|
| 446 | - * @since 3.10.0 |
|
| 447 | - * @access protected |
|
| 448 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 449 | - */ |
|
| 450 | - protected $postid_to_jsonld_converter; |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 454 | - * |
|
| 455 | - * @since 3.9.8 |
|
| 456 | - * @access private |
|
| 457 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 458 | - */ |
|
| 459 | - private $status_page; |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 463 | - * |
|
| 464 | - * @since 3.11.0 |
|
| 465 | - * @access protected |
|
| 466 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 467 | - */ |
|
| 468 | - protected $category_taxonomy_service; |
|
| 469 | - |
|
| 470 | - /** |
|
| 471 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 472 | - * |
|
| 473 | - * @since 3.11.0 |
|
| 474 | - * @access protected |
|
| 475 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 476 | - */ |
|
| 477 | - protected $entity_page_service; |
|
| 478 | - |
|
| 479 | - /** |
|
| 480 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | - * |
|
| 482 | - * @since 3.11.0 |
|
| 483 | - * @access protected |
|
| 484 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | - */ |
|
| 486 | - protected $settings_page_action_link; |
|
| 487 | - |
|
| 488 | - /** |
|
| 489 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 490 | - * |
|
| 491 | - * @since 3.11.0 |
|
| 492 | - * @access protected |
|
| 493 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 494 | - */ |
|
| 495 | - protected $analytics_settings_page_action_link; |
|
| 496 | - |
|
| 497 | - /** |
|
| 498 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 499 | - * |
|
| 500 | - * @since 3.11.0 |
|
| 501 | - * @access protected |
|
| 502 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 503 | - */ |
|
| 504 | - protected $analytics_connect; |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 508 | - * |
|
| 509 | - * @since 3.11.0 |
|
| 510 | - * @access protected |
|
| 511 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 512 | - */ |
|
| 513 | - protected $publisher_ajax_adapter; |
|
| 514 | - |
|
| 515 | - /** |
|
| 516 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 517 | - * |
|
| 518 | - * @since 3.11.0 |
|
| 519 | - * @access protected |
|
| 520 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 521 | - */ |
|
| 522 | - protected $input_element; |
|
| 523 | - |
|
| 524 | - /** |
|
| 525 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 526 | - * |
|
| 527 | - * @since 3.13.0 |
|
| 528 | - * @access protected |
|
| 529 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 530 | - */ |
|
| 531 | - protected $radio_input_element; |
|
| 532 | - |
|
| 533 | - /** |
|
| 534 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 535 | - * |
|
| 536 | - * @since 3.11.0 |
|
| 537 | - * @access protected |
|
| 538 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 539 | - */ |
|
| 540 | - protected $language_select_element; |
|
| 541 | - |
|
| 542 | - /** |
|
| 543 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 544 | - * |
|
| 545 | - * @since 3.18.0 |
|
| 546 | - * @access protected |
|
| 547 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 548 | - */ |
|
| 549 | - protected $country_select_element; |
|
| 550 | - |
|
| 551 | - /** |
|
| 552 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 553 | - * |
|
| 554 | - * @since 3.11.0 |
|
| 555 | - * @access protected |
|
| 556 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 557 | - */ |
|
| 558 | - protected $publisher_element; |
|
| 559 | - |
|
| 560 | - /** |
|
| 561 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 562 | - * |
|
| 563 | - * @since 3.11.0 |
|
| 564 | - * @access protected |
|
| 565 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 566 | - */ |
|
| 567 | - protected $select2_element; |
|
| 568 | - |
|
| 569 | - /** |
|
| 570 | - * The controller for the entity type list admin page |
|
| 571 | - * |
|
| 572 | - * @since 3.11.0 |
|
| 573 | - * @access private |
|
| 574 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 575 | - */ |
|
| 576 | - private $entity_type_admin_page; |
|
| 577 | - |
|
| 578 | - /** |
|
| 579 | - * The controller for the entity type settings admin page |
|
| 580 | - * |
|
| 581 | - * @since 3.11.0 |
|
| 582 | - * @access private |
|
| 583 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 584 | - */ |
|
| 585 | - private $entity_type_settings_admin_page; |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 589 | - * |
|
| 590 | - * @since 3.11.0 |
|
| 591 | - * @access protected |
|
| 592 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 593 | - */ |
|
| 594 | - protected $related_entities_cloud_widget; |
|
| 595 | - |
|
| 596 | - /** |
|
| 597 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 598 | - * |
|
| 599 | - * @since 3.14.0 |
|
| 600 | - * @access protected |
|
| 601 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 602 | - */ |
|
| 603 | - protected $author_element; |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 607 | - * |
|
| 608 | - * @since 3.12.0 |
|
| 609 | - * @access protected |
|
| 610 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 611 | - */ |
|
| 612 | - protected $sample_data_service; |
|
| 613 | - |
|
| 614 | - /** |
|
| 615 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 616 | - * |
|
| 617 | - * @since 3.12.0 |
|
| 618 | - * @access protected |
|
| 619 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 620 | - */ |
|
| 621 | - protected $sample_data_ajax_adapter; |
|
| 622 | - |
|
| 623 | - /** |
|
| 624 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 625 | - * |
|
| 626 | - * @since 3.14.3 |
|
| 627 | - * @access private |
|
| 628 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 629 | - */ |
|
| 630 | - private $relation_rebuild_service; |
|
| 631 | - |
|
| 632 | - /** |
|
| 633 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 634 | - * |
|
| 635 | - * @since 3.14.3 |
|
| 636 | - * @access private |
|
| 637 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 638 | - */ |
|
| 639 | - private $relation_rebuild_adapter; |
|
| 640 | - |
|
| 641 | - /** |
|
| 642 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 643 | - * |
|
| 644 | - * @since 3.18.0 |
|
| 645 | - * @access private |
|
| 646 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 647 | - */ |
|
| 648 | - private $reference_rebuild_service; |
|
| 649 | - |
|
| 650 | - /** |
|
| 651 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 652 | - * |
|
| 653 | - * @since 3.16.0 |
|
| 654 | - * @access protected |
|
| 655 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 656 | - */ |
|
| 657 | - protected $google_analytics_export_service; |
|
| 658 | - |
|
| 659 | - /** |
|
| 660 | - * {@link Wordlift}'s singleton instance. |
|
| 661 | - * |
|
| 662 | - * @since 3.15.0 |
|
| 663 | - * @access protected |
|
| 664 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 665 | - */ |
|
| 666 | - protected $entity_type_adapter; |
|
| 667 | - |
|
| 668 | - /** |
|
| 669 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 670 | - * |
|
| 671 | - * @since 3.15.0 |
|
| 672 | - * @access protected |
|
| 673 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 674 | - */ |
|
| 675 | - protected $storage_factory; |
|
| 676 | - |
|
| 677 | - /** |
|
| 678 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 679 | - * |
|
| 680 | - * @since 3.15.0 |
|
| 681 | - * @access protected |
|
| 682 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 683 | - */ |
|
| 684 | - protected $rendition_factory; |
|
| 685 | - |
|
| 686 | - /** |
|
| 687 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 688 | - * |
|
| 689 | - * @since 3.15.0 |
|
| 690 | - * @access private |
|
| 691 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 692 | - */ |
|
| 693 | - private $autocomplete_adapter; |
|
| 694 | - |
|
| 695 | - /** |
|
| 696 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 697 | - * |
|
| 698 | - * @since 3.15.0 |
|
| 699 | - * @access protected |
|
| 700 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 701 | - */ |
|
| 702 | - protected $relation_service; |
|
| 703 | - |
|
| 704 | - /** |
|
| 705 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 706 | - * |
|
| 707 | - * @since 3.16.0 |
|
| 708 | - * @access protected |
|
| 709 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 710 | - * |
|
| 711 | - */ |
|
| 712 | - protected $cached_postid_to_jsonld_converter; |
|
| 713 | - |
|
| 714 | - /** |
|
| 715 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 716 | - * |
|
| 717 | - * @since 3.16.3 |
|
| 718 | - * @access protected |
|
| 719 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 720 | - */ |
|
| 721 | - protected $entity_uri_service; |
|
| 722 | - |
|
| 723 | - /** |
|
| 724 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 725 | - * |
|
| 726 | - * @since 3.19.0 |
|
| 727 | - * @access protected |
|
| 728 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 729 | - */ |
|
| 730 | - protected $publisher_service; |
|
| 731 | - |
|
| 732 | - /** |
|
| 733 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 734 | - * |
|
| 735 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 736 | - */ |
|
| 737 | - protected $context_cards_service; |
|
| 738 | - |
|
| 739 | - /** |
|
| 740 | - * {@link Wordlift}'s singleton instance. |
|
| 741 | - * |
|
| 742 | - * @since 3.11.2 |
|
| 743 | - * @access private |
|
| 744 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 745 | - */ |
|
| 746 | - private static $instance; |
|
| 747 | - |
|
| 748 | - /** |
|
| 749 | - * A singleton instance of features registry. |
|
| 750 | - * @since 3.30.0 |
|
| 751 | - * @var Features_Registry |
|
| 752 | - */ |
|
| 753 | - private $features_registry; |
|
| 754 | - |
|
| 755 | - //</editor-fold> |
|
| 756 | - |
|
| 757 | - /** |
|
| 758 | - * Define the core functionality of the plugin. |
|
| 759 | - * |
|
| 760 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 761 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 762 | - * the public-facing side of the site. |
|
| 763 | - * |
|
| 764 | - * @since 1.0.0 |
|
| 765 | - */ |
|
| 766 | - public function __construct() { |
|
| 767 | - |
|
| 768 | - self::$instance = $this; |
|
| 769 | - |
|
| 770 | - $this->plugin_name = 'wordlift'; |
|
| 771 | - $this->version = '3.31.7'; |
|
| 772 | - $this->load_dependencies(); |
|
| 773 | - $this->set_locale(); |
|
| 774 | - $this->define_admin_hooks(); |
|
| 775 | - $this->define_public_hooks(); |
|
| 776 | - |
|
| 777 | - // If we're in `WP_CLI` load the related files. |
|
| 778 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 779 | - $this->load_cli_dependencies(); |
|
| 780 | - } |
|
| 781 | - |
|
| 782 | - } |
|
| 783 | - |
|
| 784 | - /** |
|
| 785 | - * Get the singleton instance. |
|
| 786 | - * |
|
| 787 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 788 | - * @since 3.11.2 |
|
| 789 | - * |
|
| 790 | - */ |
|
| 791 | - public static function get_instance() { |
|
| 792 | - |
|
| 793 | - return self::$instance; |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * Load the required dependencies for this plugin. |
|
| 798 | - * |
|
| 799 | - * Include the following files that make up the plugin: |
|
| 800 | - * |
|
| 801 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 802 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 803 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 804 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 805 | - * |
|
| 806 | - * Create an instance of the loader which will be used to register the hooks |
|
| 807 | - * with WordPress. |
|
| 808 | - * |
|
| 809 | - * @throws Exception |
|
| 810 | - * @since 1.0.0 |
|
| 811 | - * @access private |
|
| 812 | - */ |
|
| 813 | - private function load_dependencies() { |
|
| 814 | - |
|
| 815 | - /** |
|
| 816 | - * The class responsible for orchestrating the actions and filters of the |
|
| 817 | - * core plugin. |
|
| 818 | - */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 820 | - |
|
| 821 | - // The class responsible for plugin uninstall. |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * The class responsible for defining internationalization functionality |
|
| 826 | - * of the plugin. |
|
| 827 | - */ |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * WordLift's supported languages. |
|
| 832 | - */ |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 834 | - |
|
| 835 | - /** |
|
| 836 | - * WordLift's supported countries. |
|
| 837 | - */ |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 839 | - |
|
| 840 | - /** |
|
| 841 | - * Provide support functions to sanitize data. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 844 | - |
|
| 845 | - /** Services. */ |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 847 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 848 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 852 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 853 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * The Query builder. |
|
| 859 | - */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The Schema service. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The schema:url property service. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 872 | - |
|
| 873 | - /** |
|
| 874 | - * The UI service. |
|
| 875 | - */ |
|
| 876 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 877 | - |
|
| 878 | - /** |
|
| 879 | - * The Thumbnail service. |
|
| 880 | - */ |
|
| 881 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 882 | - |
|
| 883 | - /** |
|
| 884 | - * The Entity Types Taxonomy service. |
|
| 885 | - */ |
|
| 886 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 887 | - |
|
| 888 | - /** |
|
| 889 | - * The Entity service. |
|
| 890 | - */ |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 893 | - |
|
| 894 | - // Add the entity rating service. |
|
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 896 | - |
|
| 897 | - /** |
|
| 898 | - * The User service. |
|
| 899 | - */ |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The Timeline service. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 906 | - |
|
| 907 | - /** |
|
| 908 | - * The Topic Taxonomy service. |
|
| 909 | - */ |
|
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 911 | - |
|
| 912 | - /** |
|
| 913 | - * The SPARQL service. |
|
| 914 | - */ |
|
| 915 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 916 | - |
|
| 917 | - /** |
|
| 918 | - * The WordLift import service. |
|
| 919 | - */ |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 921 | - |
|
| 922 | - /** |
|
| 923 | - * The WordLift URI service. |
|
| 924 | - */ |
|
| 925 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 926 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 928 | - |
|
| 929 | - /** |
|
| 930 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 931 | - */ |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 936 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 937 | - |
|
| 938 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 939 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 940 | - |
|
| 941 | - /** |
|
| 942 | - * Load the converters. |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 950 | - |
|
| 951 | - /** |
|
| 952 | - * Load cache-related files. |
|
| 953 | - */ |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 955 | - |
|
| 956 | - /** |
|
| 957 | - * Load the content filter. |
|
| 958 | - */ |
|
| 959 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 960 | - |
|
| 961 | - /* |
|
| 81 | + //<editor-fold desc="## FIELDS"> |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 85 | + * the plugin. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @access protected |
|
| 89 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 90 | + */ |
|
| 91 | + protected $loader; |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * The unique identifier of this plugin. |
|
| 95 | + * |
|
| 96 | + * @since 1.0.0 |
|
| 97 | + * @access protected |
|
| 98 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 99 | + */ |
|
| 100 | + protected $plugin_name; |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * The current version of the plugin. |
|
| 104 | + * |
|
| 105 | + * @since 1.0.0 |
|
| 106 | + * @access protected |
|
| 107 | + * @var string $version The current version of the plugin. |
|
| 108 | + */ |
|
| 109 | + protected $version; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 113 | + * |
|
| 114 | + * @since 3.12.0 |
|
| 115 | + * @access protected |
|
| 116 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 117 | + */ |
|
| 118 | + protected $tinymce_adapter; |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * The {@link Faq_Tinymce_Adapter} instance |
|
| 122 | + * @since 3.26.0 |
|
| 123 | + * @access protected |
|
| 124 | + * @var Faq_Tinymce_Adapter $faq_tinymce_adapter . |
|
| 125 | + */ |
|
| 126 | + //protected $faq_tinymce_adapter; |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * The Thumbnail service. |
|
| 130 | + * |
|
| 131 | + * @since 3.1.5 |
|
| 132 | + * @access private |
|
| 133 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 134 | + */ |
|
| 135 | + private $thumbnail_service; |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * The UI service. |
|
| 139 | + * |
|
| 140 | + * @since 3.2.0 |
|
| 141 | + * @access private |
|
| 142 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 143 | + */ |
|
| 144 | + private $ui_service; |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * The Schema service. |
|
| 148 | + * |
|
| 149 | + * @since 3.3.0 |
|
| 150 | + * @access protected |
|
| 151 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 152 | + */ |
|
| 153 | + protected $schema_service; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * The Entity service. |
|
| 157 | + * |
|
| 158 | + * @since 3.1.0 |
|
| 159 | + * @access protected |
|
| 160 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 161 | + */ |
|
| 162 | + protected $entity_service; |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * The Topic Taxonomy service. |
|
| 166 | + * |
|
| 167 | + * @since 3.5.0 |
|
| 168 | + * @access private |
|
| 169 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 170 | + */ |
|
| 171 | + private $topic_taxonomy_service; |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * The Entity Types Taxonomy service. |
|
| 175 | + * |
|
| 176 | + * @since 3.18.0 |
|
| 177 | + * @access private |
|
| 178 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 179 | + */ |
|
| 180 | + private $entity_types_taxonomy_service; |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * The User service. |
|
| 184 | + * |
|
| 185 | + * @since 3.1.7 |
|
| 186 | + * @access protected |
|
| 187 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 188 | + */ |
|
| 189 | + protected $user_service; |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * The Timeline service. |
|
| 193 | + * |
|
| 194 | + * @since 3.1.0 |
|
| 195 | + * @access private |
|
| 196 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 197 | + */ |
|
| 198 | + private $timeline_service; |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * The Redirect service. |
|
| 202 | + * |
|
| 203 | + * @since 3.2.0 |
|
| 204 | + * @access private |
|
| 205 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 206 | + */ |
|
| 207 | + private $redirect_service; |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * The Notice service. |
|
| 211 | + * |
|
| 212 | + * @since 3.3.0 |
|
| 213 | + * @access private |
|
| 214 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 215 | + */ |
|
| 216 | + private $notice_service; |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * The Entity list customization. |
|
| 220 | + * |
|
| 221 | + * @since 3.3.0 |
|
| 222 | + * @access protected |
|
| 223 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 224 | + */ |
|
| 225 | + protected $entity_list_service; |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * The Entity Types Taxonomy Walker. |
|
| 229 | + * |
|
| 230 | + * @since 3.1.0 |
|
| 231 | + * @access private |
|
| 232 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 233 | + */ |
|
| 234 | + private $entity_types_taxonomy_walker; |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * The ShareThis service. |
|
| 238 | + * |
|
| 239 | + * @since 3.2.0 |
|
| 240 | + * @access private |
|
| 241 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 242 | + */ |
|
| 243 | + private $sharethis_service; |
|
| 244 | + |
|
| 245 | + /** |
|
| 246 | + * The PrimaShop adapter. |
|
| 247 | + * |
|
| 248 | + * @since 3.2.3 |
|
| 249 | + * @access private |
|
| 250 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 251 | + */ |
|
| 252 | + private $primashop_adapter; |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * The WordLift Dashboard adapter. |
|
| 256 | + * |
|
| 257 | + * @since 3.4.0 |
|
| 258 | + * @access private |
|
| 259 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 260 | + */ |
|
| 261 | + private $dashboard_service; |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * The entity type service. |
|
| 265 | + * |
|
| 266 | + * @since 3.6.0 |
|
| 267 | + * @access private |
|
| 268 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 269 | + */ |
|
| 270 | + private $entity_post_type_service; |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 274 | + * |
|
| 275 | + * @since 3.6.0 |
|
| 276 | + * @access private |
|
| 277 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 278 | + */ |
|
| 279 | + private $entity_link_service; |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 283 | + * |
|
| 284 | + * @since 3.6.0 |
|
| 285 | + * @access protected |
|
| 286 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 287 | + */ |
|
| 288 | + protected $sparql_service; |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * A {@link Wordlift_Import_Service} instance. |
|
| 292 | + * |
|
| 293 | + * @since 3.6.0 |
|
| 294 | + * @access private |
|
| 295 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 296 | + */ |
|
| 297 | + private $import_service; |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 301 | + * |
|
| 302 | + * @since 3.6.0 |
|
| 303 | + * @access private |
|
| 304 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 305 | + */ |
|
| 306 | + private $rebuild_service; |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 310 | + * |
|
| 311 | + * @since 3.7.0 |
|
| 312 | + * @access protected |
|
| 313 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 314 | + */ |
|
| 315 | + protected $jsonld_service; |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 319 | + * |
|
| 320 | + * @since 3.14.0 |
|
| 321 | + * @access protected |
|
| 322 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 323 | + */ |
|
| 324 | + protected $jsonld_website_converter; |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 328 | + * |
|
| 329 | + * @since 3.7.0 |
|
| 330 | + * @access private |
|
| 331 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 332 | + */ |
|
| 333 | + private $property_factory; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The 'Download Your Data' page. |
|
| 337 | + * |
|
| 338 | + * @since 3.6.0 |
|
| 339 | + * @access private |
|
| 340 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 341 | + */ |
|
| 342 | + private $download_your_data_page; |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * The 'WordLift Settings' page. |
|
| 346 | + * |
|
| 347 | + * @since 3.11.0 |
|
| 348 | + * @access protected |
|
| 349 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 350 | + */ |
|
| 351 | + protected $settings_page; |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * The install wizard page. |
|
| 355 | + * |
|
| 356 | + * @since 3.9.0 |
|
| 357 | + * @access private |
|
| 358 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 359 | + */ |
|
| 360 | + public $admin_setup; |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 364 | + * linking of entities to their pages. |
|
| 365 | + * |
|
| 366 | + * @since 3.8.0 |
|
| 367 | + * @access private |
|
| 368 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 369 | + */ |
|
| 370 | + private $content_filter_service; |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * The Faq Content filter service |
|
| 374 | + * @since 3.26.0 |
|
| 375 | + * @access private |
|
| 376 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 377 | + */ |
|
| 378 | + private $faq_content_filter_service; |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 382 | + * |
|
| 383 | + * @since 3.9.0 |
|
| 384 | + * @access private |
|
| 385 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 386 | + */ |
|
| 387 | + private $key_validation_service; |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 391 | + * |
|
| 392 | + * @since 3.10.0 |
|
| 393 | + * @access private |
|
| 394 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 395 | + */ |
|
| 396 | + private $rating_service; |
|
| 397 | + |
|
| 398 | + /** |
|
| 399 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 400 | + * |
|
| 401 | + * @since 3.10.0 |
|
| 402 | + * @access protected |
|
| 403 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 404 | + */ |
|
| 405 | + protected $post_to_jsonld_converter; |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 409 | + * |
|
| 410 | + * @since 3.10.0 |
|
| 411 | + * @access protected |
|
| 412 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 413 | + */ |
|
| 414 | + protected $configuration_service; |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * A {@link Wordlift_Install_Service} instance. |
|
| 418 | + * |
|
| 419 | + * @since 3.18.0 |
|
| 420 | + * @access protected |
|
| 421 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 422 | + */ |
|
| 423 | + protected $install_service; |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 427 | + * |
|
| 428 | + * @since 3.10.0 |
|
| 429 | + * @access protected |
|
| 430 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 431 | + */ |
|
| 432 | + protected $entity_type_service; |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 436 | + * |
|
| 437 | + * @since 3.10.0 |
|
| 438 | + * @access protected |
|
| 439 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 440 | + */ |
|
| 441 | + protected $entity_post_to_jsonld_converter; |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 445 | + * |
|
| 446 | + * @since 3.10.0 |
|
| 447 | + * @access protected |
|
| 448 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 449 | + */ |
|
| 450 | + protected $postid_to_jsonld_converter; |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 454 | + * |
|
| 455 | + * @since 3.9.8 |
|
| 456 | + * @access private |
|
| 457 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 458 | + */ |
|
| 459 | + private $status_page; |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 463 | + * |
|
| 464 | + * @since 3.11.0 |
|
| 465 | + * @access protected |
|
| 466 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 467 | + */ |
|
| 468 | + protected $category_taxonomy_service; |
|
| 469 | + |
|
| 470 | + /** |
|
| 471 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 472 | + * |
|
| 473 | + * @since 3.11.0 |
|
| 474 | + * @access protected |
|
| 475 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 476 | + */ |
|
| 477 | + protected $entity_page_service; |
|
| 478 | + |
|
| 479 | + /** |
|
| 480 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 481 | + * |
|
| 482 | + * @since 3.11.0 |
|
| 483 | + * @access protected |
|
| 484 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 485 | + */ |
|
| 486 | + protected $settings_page_action_link; |
|
| 487 | + |
|
| 488 | + /** |
|
| 489 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 490 | + * |
|
| 491 | + * @since 3.11.0 |
|
| 492 | + * @access protected |
|
| 493 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 494 | + */ |
|
| 495 | + protected $analytics_settings_page_action_link; |
|
| 496 | + |
|
| 497 | + /** |
|
| 498 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 499 | + * |
|
| 500 | + * @since 3.11.0 |
|
| 501 | + * @access protected |
|
| 502 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 503 | + */ |
|
| 504 | + protected $analytics_connect; |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 508 | + * |
|
| 509 | + * @since 3.11.0 |
|
| 510 | + * @access protected |
|
| 511 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 512 | + */ |
|
| 513 | + protected $publisher_ajax_adapter; |
|
| 514 | + |
|
| 515 | + /** |
|
| 516 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 517 | + * |
|
| 518 | + * @since 3.11.0 |
|
| 519 | + * @access protected |
|
| 520 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 521 | + */ |
|
| 522 | + protected $input_element; |
|
| 523 | + |
|
| 524 | + /** |
|
| 525 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 526 | + * |
|
| 527 | + * @since 3.13.0 |
|
| 528 | + * @access protected |
|
| 529 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 530 | + */ |
|
| 531 | + protected $radio_input_element; |
|
| 532 | + |
|
| 533 | + /** |
|
| 534 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 535 | + * |
|
| 536 | + * @since 3.11.0 |
|
| 537 | + * @access protected |
|
| 538 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 539 | + */ |
|
| 540 | + protected $language_select_element; |
|
| 541 | + |
|
| 542 | + /** |
|
| 543 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 544 | + * |
|
| 545 | + * @since 3.18.0 |
|
| 546 | + * @access protected |
|
| 547 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 548 | + */ |
|
| 549 | + protected $country_select_element; |
|
| 550 | + |
|
| 551 | + /** |
|
| 552 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 553 | + * |
|
| 554 | + * @since 3.11.0 |
|
| 555 | + * @access protected |
|
| 556 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 557 | + */ |
|
| 558 | + protected $publisher_element; |
|
| 559 | + |
|
| 560 | + /** |
|
| 561 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 562 | + * |
|
| 563 | + * @since 3.11.0 |
|
| 564 | + * @access protected |
|
| 565 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 566 | + */ |
|
| 567 | + protected $select2_element; |
|
| 568 | + |
|
| 569 | + /** |
|
| 570 | + * The controller for the entity type list admin page |
|
| 571 | + * |
|
| 572 | + * @since 3.11.0 |
|
| 573 | + * @access private |
|
| 574 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 575 | + */ |
|
| 576 | + private $entity_type_admin_page; |
|
| 577 | + |
|
| 578 | + /** |
|
| 579 | + * The controller for the entity type settings admin page |
|
| 580 | + * |
|
| 581 | + * @since 3.11.0 |
|
| 582 | + * @access private |
|
| 583 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 584 | + */ |
|
| 585 | + private $entity_type_settings_admin_page; |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 589 | + * |
|
| 590 | + * @since 3.11.0 |
|
| 591 | + * @access protected |
|
| 592 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 593 | + */ |
|
| 594 | + protected $related_entities_cloud_widget; |
|
| 595 | + |
|
| 596 | + /** |
|
| 597 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 598 | + * |
|
| 599 | + * @since 3.14.0 |
|
| 600 | + * @access protected |
|
| 601 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 602 | + */ |
|
| 603 | + protected $author_element; |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 607 | + * |
|
| 608 | + * @since 3.12.0 |
|
| 609 | + * @access protected |
|
| 610 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 611 | + */ |
|
| 612 | + protected $sample_data_service; |
|
| 613 | + |
|
| 614 | + /** |
|
| 615 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 616 | + * |
|
| 617 | + * @since 3.12.0 |
|
| 618 | + * @access protected |
|
| 619 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 620 | + */ |
|
| 621 | + protected $sample_data_ajax_adapter; |
|
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 625 | + * |
|
| 626 | + * @since 3.14.3 |
|
| 627 | + * @access private |
|
| 628 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 629 | + */ |
|
| 630 | + private $relation_rebuild_service; |
|
| 631 | + |
|
| 632 | + /** |
|
| 633 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 634 | + * |
|
| 635 | + * @since 3.14.3 |
|
| 636 | + * @access private |
|
| 637 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 638 | + */ |
|
| 639 | + private $relation_rebuild_adapter; |
|
| 640 | + |
|
| 641 | + /** |
|
| 642 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 643 | + * |
|
| 644 | + * @since 3.18.0 |
|
| 645 | + * @access private |
|
| 646 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 647 | + */ |
|
| 648 | + private $reference_rebuild_service; |
|
| 649 | + |
|
| 650 | + /** |
|
| 651 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 652 | + * |
|
| 653 | + * @since 3.16.0 |
|
| 654 | + * @access protected |
|
| 655 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 656 | + */ |
|
| 657 | + protected $google_analytics_export_service; |
|
| 658 | + |
|
| 659 | + /** |
|
| 660 | + * {@link Wordlift}'s singleton instance. |
|
| 661 | + * |
|
| 662 | + * @since 3.15.0 |
|
| 663 | + * @access protected |
|
| 664 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 665 | + */ |
|
| 666 | + protected $entity_type_adapter; |
|
| 667 | + |
|
| 668 | + /** |
|
| 669 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 670 | + * |
|
| 671 | + * @since 3.15.0 |
|
| 672 | + * @access protected |
|
| 673 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 674 | + */ |
|
| 675 | + protected $storage_factory; |
|
| 676 | + |
|
| 677 | + /** |
|
| 678 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 679 | + * |
|
| 680 | + * @since 3.15.0 |
|
| 681 | + * @access protected |
|
| 682 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 683 | + */ |
|
| 684 | + protected $rendition_factory; |
|
| 685 | + |
|
| 686 | + /** |
|
| 687 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 688 | + * |
|
| 689 | + * @since 3.15.0 |
|
| 690 | + * @access private |
|
| 691 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 692 | + */ |
|
| 693 | + private $autocomplete_adapter; |
|
| 694 | + |
|
| 695 | + /** |
|
| 696 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 697 | + * |
|
| 698 | + * @since 3.15.0 |
|
| 699 | + * @access protected |
|
| 700 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 701 | + */ |
|
| 702 | + protected $relation_service; |
|
| 703 | + |
|
| 704 | + /** |
|
| 705 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 706 | + * |
|
| 707 | + * @since 3.16.0 |
|
| 708 | + * @access protected |
|
| 709 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 710 | + * |
|
| 711 | + */ |
|
| 712 | + protected $cached_postid_to_jsonld_converter; |
|
| 713 | + |
|
| 714 | + /** |
|
| 715 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 716 | + * |
|
| 717 | + * @since 3.16.3 |
|
| 718 | + * @access protected |
|
| 719 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 720 | + */ |
|
| 721 | + protected $entity_uri_service; |
|
| 722 | + |
|
| 723 | + /** |
|
| 724 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 725 | + * |
|
| 726 | + * @since 3.19.0 |
|
| 727 | + * @access protected |
|
| 728 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 729 | + */ |
|
| 730 | + protected $publisher_service; |
|
| 731 | + |
|
| 732 | + /** |
|
| 733 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 734 | + * |
|
| 735 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 736 | + */ |
|
| 737 | + protected $context_cards_service; |
|
| 738 | + |
|
| 739 | + /** |
|
| 740 | + * {@link Wordlift}'s singleton instance. |
|
| 741 | + * |
|
| 742 | + * @since 3.11.2 |
|
| 743 | + * @access private |
|
| 744 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 745 | + */ |
|
| 746 | + private static $instance; |
|
| 747 | + |
|
| 748 | + /** |
|
| 749 | + * A singleton instance of features registry. |
|
| 750 | + * @since 3.30.0 |
|
| 751 | + * @var Features_Registry |
|
| 752 | + */ |
|
| 753 | + private $features_registry; |
|
| 754 | + |
|
| 755 | + //</editor-fold> |
|
| 756 | + |
|
| 757 | + /** |
|
| 758 | + * Define the core functionality of the plugin. |
|
| 759 | + * |
|
| 760 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 761 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 762 | + * the public-facing side of the site. |
|
| 763 | + * |
|
| 764 | + * @since 1.0.0 |
|
| 765 | + */ |
|
| 766 | + public function __construct() { |
|
| 767 | + |
|
| 768 | + self::$instance = $this; |
|
| 769 | + |
|
| 770 | + $this->plugin_name = 'wordlift'; |
|
| 771 | + $this->version = '3.31.7'; |
|
| 772 | + $this->load_dependencies(); |
|
| 773 | + $this->set_locale(); |
|
| 774 | + $this->define_admin_hooks(); |
|
| 775 | + $this->define_public_hooks(); |
|
| 776 | + |
|
| 777 | + // If we're in `WP_CLI` load the related files. |
|
| 778 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 779 | + $this->load_cli_dependencies(); |
|
| 780 | + } |
|
| 781 | + |
|
| 782 | + } |
|
| 783 | + |
|
| 784 | + /** |
|
| 785 | + * Get the singleton instance. |
|
| 786 | + * |
|
| 787 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 788 | + * @since 3.11.2 |
|
| 789 | + * |
|
| 790 | + */ |
|
| 791 | + public static function get_instance() { |
|
| 792 | + |
|
| 793 | + return self::$instance; |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * Load the required dependencies for this plugin. |
|
| 798 | + * |
|
| 799 | + * Include the following files that make up the plugin: |
|
| 800 | + * |
|
| 801 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 802 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 803 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 804 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 805 | + * |
|
| 806 | + * Create an instance of the loader which will be used to register the hooks |
|
| 807 | + * with WordPress. |
|
| 808 | + * |
|
| 809 | + * @throws Exception |
|
| 810 | + * @since 1.0.0 |
|
| 811 | + * @access private |
|
| 812 | + */ |
|
| 813 | + private function load_dependencies() { |
|
| 814 | + |
|
| 815 | + /** |
|
| 816 | + * The class responsible for orchestrating the actions and filters of the |
|
| 817 | + * core plugin. |
|
| 818 | + */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 820 | + |
|
| 821 | + // The class responsible for plugin uninstall. |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * The class responsible for defining internationalization functionality |
|
| 826 | + * of the plugin. |
|
| 827 | + */ |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * WordLift's supported languages. |
|
| 832 | + */ |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 834 | + |
|
| 835 | + /** |
|
| 836 | + * WordLift's supported countries. |
|
| 837 | + */ |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * Provide support functions to sanitize data. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 844 | + |
|
| 845 | + /** Services. */ |
|
| 846 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 847 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 848 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 850 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 851 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 852 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 853 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * The Query builder. |
|
| 859 | + */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The Schema service. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The schema:url property service. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 871 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 872 | + |
|
| 873 | + /** |
|
| 874 | + * The UI service. |
|
| 875 | + */ |
|
| 876 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 877 | + |
|
| 878 | + /** |
|
| 879 | + * The Thumbnail service. |
|
| 880 | + */ |
|
| 881 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 882 | + |
|
| 883 | + /** |
|
| 884 | + * The Entity Types Taxonomy service. |
|
| 885 | + */ |
|
| 886 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 887 | + |
|
| 888 | + /** |
|
| 889 | + * The Entity service. |
|
| 890 | + */ |
|
| 891 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 892 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 893 | + |
|
| 894 | + // Add the entity rating service. |
|
| 895 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 896 | + |
|
| 897 | + /** |
|
| 898 | + * The User service. |
|
| 899 | + */ |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The Timeline service. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 906 | + |
|
| 907 | + /** |
|
| 908 | + * The Topic Taxonomy service. |
|
| 909 | + */ |
|
| 910 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 911 | + |
|
| 912 | + /** |
|
| 913 | + * The SPARQL service. |
|
| 914 | + */ |
|
| 915 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 916 | + |
|
| 917 | + /** |
|
| 918 | + * The WordLift import service. |
|
| 919 | + */ |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 921 | + |
|
| 922 | + /** |
|
| 923 | + * The WordLift URI service. |
|
| 924 | + */ |
|
| 925 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 926 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 928 | + |
|
| 929 | + /** |
|
| 930 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 931 | + */ |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 934 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 935 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 936 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 937 | + |
|
| 938 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 939 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 940 | + |
|
| 941 | + /** |
|
| 942 | + * Load the converters. |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 945 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 946 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 949 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 950 | + |
|
| 951 | + /** |
|
| 952 | + * Load cache-related files. |
|
| 953 | + */ |
|
| 954 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 955 | + |
|
| 956 | + /** |
|
| 957 | + * Load the content filter. |
|
| 958 | + */ |
|
| 959 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 960 | + |
|
| 961 | + /* |
|
| 962 | 962 | * Load the excerpt helper. |
| 963 | 963 | */ |
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 965 | - |
|
| 966 | - /** |
|
| 967 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 968 | - * |
|
| 969 | - * @since 3.8.0 |
|
| 970 | - */ |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 972 | - |
|
| 973 | - // The Publisher Service and the AJAX adapter. |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 976 | - |
|
| 977 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 978 | - |
|
| 979 | - /** |
|
| 980 | - * Load the WordLift key validation service. |
|
| 981 | - */ |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 983 | - |
|
| 984 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 986 | - |
|
| 987 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 989 | - |
|
| 990 | - /** Linked Data. */ |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 996 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 997 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1002 | - |
|
| 1003 | - /** Linked Data Rendition. */ |
|
| 1004 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1007 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1008 | - |
|
| 1009 | - /** Services. */ |
|
| 1010 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1012 | - |
|
| 1013 | - /** Adapters. */ |
|
| 1014 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1015 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1017 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1018 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1019 | - |
|
| 1020 | - /** Async Tasks. */ |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1022 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1024 | - |
|
| 1025 | - /** Autocomplete. */ |
|
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1027 | - |
|
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1029 | - |
|
| 1030 | - /** Analytics */ |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1032 | - |
|
| 1033 | - /** |
|
| 1034 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1035 | - */ |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1037 | - |
|
| 1038 | - /** |
|
| 1039 | - * The class to customize the entity list admin page. |
|
| 1040 | - */ |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1042 | - |
|
| 1043 | - /** |
|
| 1044 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1045 | - */ |
|
| 1046 | - global $wp_version; |
|
| 1047 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1049 | - } else { |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1051 | - } |
|
| 1052 | - |
|
| 1053 | - /** |
|
| 1054 | - * The Notice service. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The PrimaShop adapter. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The WordLift Dashboard service. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1067 | - |
|
| 1068 | - /** |
|
| 1069 | - * The admin 'Install wizard' page. |
|
| 1070 | - */ |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1072 | - |
|
| 1073 | - /** |
|
| 1074 | - * The WordLift entity type list admin page controller. |
|
| 1075 | - */ |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1077 | - |
|
| 1078 | - /** |
|
| 1079 | - * The WordLift entity type settings admin page controller. |
|
| 1080 | - */ |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1082 | - |
|
| 1083 | - /** |
|
| 1084 | - * The admin 'Download Your Data' page. |
|
| 1085 | - */ |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1087 | - |
|
| 1088 | - /** |
|
| 1089 | - * The admin 'WordLift Settings' page. |
|
| 1090 | - */ |
|
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1093 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1095 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1096 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1098 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1100 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1101 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1103 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1105 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1106 | - |
|
| 1107 | - /** Admin Pages */ |
|
| 1108 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1112 | - |
|
| 1113 | - /** |
|
| 1114 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1115 | - * side of the site. |
|
| 1116 | - */ |
|
| 1117 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1118 | - |
|
| 1119 | - /** |
|
| 1120 | - * The shortcode abstract class. |
|
| 1121 | - */ |
|
| 1122 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1123 | - |
|
| 1124 | - /** |
|
| 1125 | - * The Timeline shortcode. |
|
| 1126 | - */ |
|
| 1127 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1128 | - |
|
| 1129 | - /** |
|
| 1130 | - * The Navigator shortcode. |
|
| 1131 | - */ |
|
| 1132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1133 | - |
|
| 1134 | - /** |
|
| 1135 | - * The Products Navigator shortcode. |
|
| 1136 | - */ |
|
| 1137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1138 | - |
|
| 1139 | - /** |
|
| 1140 | - * The chord shortcode. |
|
| 1141 | - */ |
|
| 1142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * The geomap shortcode. |
|
| 1146 | - */ |
|
| 1147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1148 | - |
|
| 1149 | - /** |
|
| 1150 | - * The entity cloud shortcode. |
|
| 1151 | - */ |
|
| 1152 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1153 | - |
|
| 1154 | - /** |
|
| 1155 | - * The entity glossary shortcode. |
|
| 1156 | - */ |
|
| 1157 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1158 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1159 | - |
|
| 1160 | - /** |
|
| 1161 | - * Faceted Search shortcode. |
|
| 1162 | - */ |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1164 | - |
|
| 1165 | - /** |
|
| 1166 | - * The ShareThis service. |
|
| 1167 | - */ |
|
| 1168 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1169 | - |
|
| 1170 | - /** |
|
| 1171 | - * The SEO service. |
|
| 1172 | - */ |
|
| 1173 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1174 | - |
|
| 1175 | - /** |
|
| 1176 | - * The AMP service. |
|
| 1177 | - */ |
|
| 1178 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1179 | - |
|
| 1180 | - /** Widgets */ |
|
| 1181 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1182 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1183 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1184 | - |
|
| 1185 | - /* |
|
| 964 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 965 | + |
|
| 966 | + /** |
|
| 967 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 968 | + * |
|
| 969 | + * @since 3.8.0 |
|
| 970 | + */ |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 972 | + |
|
| 973 | + // The Publisher Service and the AJAX adapter. |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 976 | + |
|
| 977 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 978 | + |
|
| 979 | + /** |
|
| 980 | + * Load the WordLift key validation service. |
|
| 981 | + */ |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 983 | + |
|
| 984 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 986 | + |
|
| 987 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 989 | + |
|
| 990 | + /** Linked Data. */ |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 996 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 997 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 1002 | + |
|
| 1003 | + /** Linked Data Rendition. */ |
|
| 1004 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 1007 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 1008 | + |
|
| 1009 | + /** Services. */ |
|
| 1010 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 1012 | + |
|
| 1013 | + /** Adapters. */ |
|
| 1014 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 1015 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 1017 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 1018 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 1019 | + |
|
| 1020 | + /** Async Tasks. */ |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 1022 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1023 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1024 | + |
|
| 1025 | + /** Autocomplete. */ |
|
| 1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1027 | + |
|
| 1028 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1029 | + |
|
| 1030 | + /** Analytics */ |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1035 | + */ |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1037 | + |
|
| 1038 | + /** |
|
| 1039 | + * The class to customize the entity list admin page. |
|
| 1040 | + */ |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1042 | + |
|
| 1043 | + /** |
|
| 1044 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1045 | + */ |
|
| 1046 | + global $wp_version; |
|
| 1047 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 1048 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1049 | + } else { |
|
| 1050 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 1051 | + } |
|
| 1052 | + |
|
| 1053 | + /** |
|
| 1054 | + * The Notice service. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The PrimaShop adapter. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The WordLift Dashboard service. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1067 | + |
|
| 1068 | + /** |
|
| 1069 | + * The admin 'Install wizard' page. |
|
| 1070 | + */ |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1072 | + |
|
| 1073 | + /** |
|
| 1074 | + * The WordLift entity type list admin page controller. |
|
| 1075 | + */ |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1077 | + |
|
| 1078 | + /** |
|
| 1079 | + * The WordLift entity type settings admin page controller. |
|
| 1080 | + */ |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1082 | + |
|
| 1083 | + /** |
|
| 1084 | + * The admin 'Download Your Data' page. |
|
| 1085 | + */ |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1087 | + |
|
| 1088 | + /** |
|
| 1089 | + * The admin 'WordLift Settings' page. |
|
| 1090 | + */ |
|
| 1091 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1093 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1095 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1096 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1097 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1098 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1099 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1100 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1101 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1102 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1103 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1104 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1105 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1106 | + |
|
| 1107 | + /** Admin Pages */ |
|
| 1108 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1109 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1110 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1112 | + |
|
| 1113 | + /** |
|
| 1114 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1115 | + * side of the site. |
|
| 1116 | + */ |
|
| 1117 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1118 | + |
|
| 1119 | + /** |
|
| 1120 | + * The shortcode abstract class. |
|
| 1121 | + */ |
|
| 1122 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1123 | + |
|
| 1124 | + /** |
|
| 1125 | + * The Timeline shortcode. |
|
| 1126 | + */ |
|
| 1127 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1128 | + |
|
| 1129 | + /** |
|
| 1130 | + * The Navigator shortcode. |
|
| 1131 | + */ |
|
| 1132 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1133 | + |
|
| 1134 | + /** |
|
| 1135 | + * The Products Navigator shortcode. |
|
| 1136 | + */ |
|
| 1137 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 1138 | + |
|
| 1139 | + /** |
|
| 1140 | + * The chord shortcode. |
|
| 1141 | + */ |
|
| 1142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * The geomap shortcode. |
|
| 1146 | + */ |
|
| 1147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1148 | + |
|
| 1149 | + /** |
|
| 1150 | + * The entity cloud shortcode. |
|
| 1151 | + */ |
|
| 1152 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1153 | + |
|
| 1154 | + /** |
|
| 1155 | + * The entity glossary shortcode. |
|
| 1156 | + */ |
|
| 1157 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1158 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1159 | + |
|
| 1160 | + /** |
|
| 1161 | + * Faceted Search shortcode. |
|
| 1162 | + */ |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1164 | + |
|
| 1165 | + /** |
|
| 1166 | + * The ShareThis service. |
|
| 1167 | + */ |
|
| 1168 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1169 | + |
|
| 1170 | + /** |
|
| 1171 | + * The SEO service. |
|
| 1172 | + */ |
|
| 1173 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1174 | + |
|
| 1175 | + /** |
|
| 1176 | + * The AMP service. |
|
| 1177 | + */ |
|
| 1178 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1179 | + |
|
| 1180 | + /** Widgets */ |
|
| 1181 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1182 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1183 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php'; |
|
| 1184 | + |
|
| 1185 | + /* |
|
| 1186 | 1186 | * Schema.org Services. |
| 1187 | 1187 | * |
| 1188 | 1188 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1189 | 1189 | */ |
| 1190 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1191 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1192 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1193 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1194 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1195 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1196 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1197 | - } else { |
|
| 1198 | - $schemaorg_property_service = null; |
|
| 1199 | - } |
|
| 1200 | - |
|
| 1201 | - $this->loader = new Wordlift_Loader(); |
|
| 1202 | - /** |
|
| 1203 | - * @since 3.30.0 |
|
| 1204 | - */ |
|
| 1205 | - $this->features_registry = Features_Registry::get_instance(); |
|
| 1190 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1191 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1192 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1193 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1194 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1195 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1196 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1197 | + } else { |
|
| 1198 | + $schemaorg_property_service = null; |
|
| 1199 | + } |
|
| 1200 | + |
|
| 1201 | + $this->loader = new Wordlift_Loader(); |
|
| 1202 | + /** |
|
| 1203 | + * @since 3.30.0 |
|
| 1204 | + */ |
|
| 1205 | + $this->features_registry = Features_Registry::get_instance(); |
|
| 1206 | 1206 | |
| 1207 | - // Instantiate a global logger. |
|
| 1208 | - global $wl_logger; |
|
| 1209 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1207 | + // Instantiate a global logger. |
|
| 1208 | + global $wl_logger; |
|
| 1209 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1210 | 1210 | |
| 1211 | - // Load the `wl-api` end-point. |
|
| 1212 | - new Wordlift_Http_Api(); |
|
| 1211 | + // Load the `wl-api` end-point. |
|
| 1212 | + new Wordlift_Http_Api(); |
|
| 1213 | 1213 | |
| 1214 | - // Load the Install Service. |
|
| 1215 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1216 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1214 | + // Load the Install Service. |
|
| 1215 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 1216 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1217 | 1217 | |
| 1218 | - /** Services. */ |
|
| 1219 | - // Create the configuration service. |
|
| 1220 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1221 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1218 | + /** Services. */ |
|
| 1219 | + // Create the configuration service. |
|
| 1220 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1221 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1222 | 1222 | |
| 1223 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1224 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1223 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1224 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1225 | 1225 | |
| 1226 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1227 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1226 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1227 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1228 | 1228 | |
| 1229 | - // Create an instance of the UI service. |
|
| 1230 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1229 | + // Create an instance of the UI service. |
|
| 1230 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1231 | 1231 | |
| 1232 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1233 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1232 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1233 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1234 | 1234 | |
| 1235 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1236 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1237 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1238 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1235 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1236 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1237 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1238 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1239 | 1239 | |
| 1240 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1241 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1242 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1243 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1240 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1241 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1242 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1243 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1244 | 1244 | |
| 1245 | - // Instantiate the JSON-LD service. |
|
| 1246 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1245 | + // Instantiate the JSON-LD service. |
|
| 1246 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1247 | 1247 | |
| 1248 | - /** Linked Data. */ |
|
| 1249 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1250 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1248 | + /** Linked Data. */ |
|
| 1249 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1250 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1251 | 1251 | |
| 1252 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1252 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1253 | 1253 | |
| 1254 | - // Create a new instance of the Redirect service. |
|
| 1255 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1256 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1254 | + // Create a new instance of the Redirect service. |
|
| 1255 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1256 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1257 | 1257 | |
| 1258 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1259 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1258 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1259 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1260 | 1260 | |
| 1261 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1261 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1262 | 1262 | |
| 1263 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1264 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1263 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1264 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1265 | 1265 | |
| 1266 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1267 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1266 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1267 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1268 | 1268 | |
| 1269 | - // Create an instance of the PrimaShop adapter. |
|
| 1270 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1269 | + // Create an instance of the PrimaShop adapter. |
|
| 1270 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1271 | 1271 | |
| 1272 | - // Create an import service instance to hook later to WP's import function. |
|
| 1273 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 1272 | + // Create an import service instance to hook later to WP's import function. |
|
| 1273 | + $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() ); |
|
| 1274 | 1274 | |
| 1275 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1275 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1276 | 1276 | |
| 1277 | - // Create the entity rating service. |
|
| 1278 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1277 | + // Create the entity rating service. |
|
| 1278 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1279 | 1279 | |
| 1280 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1281 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1280 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1281 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1282 | 1282 | |
| 1283 | - // Create a new instance of the Redirect service. |
|
| 1284 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1283 | + // Create a new instance of the Redirect service. |
|
| 1284 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1285 | 1285 | |
| 1286 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1287 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1288 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1289 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1286 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1287 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1288 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1289 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1290 | 1290 | |
| 1291 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1291 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1292 | 1292 | |
| 1293 | - // Instantiate the JSON-LD service. |
|
| 1294 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1295 | - $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 ); |
|
| 1296 | - $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 ); |
|
| 1297 | - $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 ); |
|
| 1298 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1293 | + // Instantiate the JSON-LD service. |
|
| 1294 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1295 | + $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 ); |
|
| 1296 | + $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 ); |
|
| 1297 | + $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 ); |
|
| 1298 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1299 | 1299 | |
| 1300 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1301 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1302 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1300 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1301 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache ); |
|
| 1302 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1303 | 1303 | |
| 1304 | - /* |
|
| 1304 | + /* |
|
| 1305 | 1305 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1306 | 1306 | * |
| 1307 | 1307 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1308 | 1308 | * |
| 1309 | 1309 | * @since 3.20.0 |
| 1310 | 1310 | */ |
| 1311 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1312 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1313 | - $jsonld_service = new Jsonld_Service( |
|
| 1314 | - $this->jsonld_service, |
|
| 1315 | - $term_jsonld_adapter, |
|
| 1316 | - new Jsonld_User_Service( $this->user_service ) ); |
|
| 1317 | - new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1318 | - |
|
| 1319 | - // Prints the JSON-LD in the head. |
|
| 1320 | - new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1321 | - |
|
| 1322 | - new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1323 | - |
|
| 1324 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1325 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1326 | - // Creating Faq Content filter service. |
|
| 1327 | - $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1328 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1329 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1330 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1331 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1332 | - |
|
| 1333 | - $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1334 | - $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1335 | - |
|
| 1336 | - /** |
|
| 1337 | - * Filter: wl_feature__enable__blocks. |
|
| 1338 | - * |
|
| 1339 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1340 | - * |
|
| 1341 | - * @return bool |
|
| 1342 | - * @since 3.27.6 |
|
| 1343 | - */ |
|
| 1344 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1345 | - // Initialize the short-codes. |
|
| 1346 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1347 | - new Wordlift_Chord_Shortcode(); |
|
| 1348 | - new Wordlift_Geomap_Shortcode(); |
|
| 1349 | - new Wordlift_Timeline_Shortcode(); |
|
| 1350 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1351 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1352 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1353 | - } |
|
| 1354 | - |
|
| 1355 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1356 | - |
|
| 1357 | - |
|
| 1358 | - // Initialize the Context Cards Service |
|
| 1359 | - $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1360 | - |
|
| 1361 | - // Initialize the SEO service. |
|
| 1362 | - new Wordlift_Seo_Service(); |
|
| 1363 | - |
|
| 1364 | - // Initialize the AMP service. |
|
| 1365 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1366 | - |
|
| 1367 | - /** Services. */ |
|
| 1368 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1369 | - new Wordlift_Image_Service(); |
|
| 1370 | - |
|
| 1371 | - /** Adapters. */ |
|
| 1372 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1373 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1374 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1375 | - //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1376 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1377 | - |
|
| 1378 | - /* |
|
| 1311 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1312 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1313 | + $jsonld_service = new Jsonld_Service( |
|
| 1314 | + $this->jsonld_service, |
|
| 1315 | + $term_jsonld_adapter, |
|
| 1316 | + new Jsonld_User_Service( $this->user_service ) ); |
|
| 1317 | + new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service ); |
|
| 1318 | + |
|
| 1319 | + // Prints the JSON-LD in the head. |
|
| 1320 | + new Jsonld_Adapter( $this->jsonld_service ); |
|
| 1321 | + |
|
| 1322 | + new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service ); |
|
| 1323 | + |
|
| 1324 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1325 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1326 | + // Creating Faq Content filter service. |
|
| 1327 | + $this->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1328 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1329 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1330 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1331 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->entity_service ); |
|
| 1332 | + |
|
| 1333 | + $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' ); |
|
| 1334 | + $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' ); |
|
| 1335 | + |
|
| 1336 | + /** |
|
| 1337 | + * Filter: wl_feature__enable__blocks. |
|
| 1338 | + * |
|
| 1339 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1340 | + * |
|
| 1341 | + * @return bool |
|
| 1342 | + * @since 3.27.6 |
|
| 1343 | + */ |
|
| 1344 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1345 | + // Initialize the short-codes. |
|
| 1346 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1347 | + new Wordlift_Chord_Shortcode(); |
|
| 1348 | + new Wordlift_Geomap_Shortcode(); |
|
| 1349 | + new Wordlift_Timeline_Shortcode(); |
|
| 1350 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service ); |
|
| 1351 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1352 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1353 | + } |
|
| 1354 | + |
|
| 1355 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1356 | + |
|
| 1357 | + |
|
| 1358 | + // Initialize the Context Cards Service |
|
| 1359 | + $this->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1360 | + |
|
| 1361 | + // Initialize the SEO service. |
|
| 1362 | + new Wordlift_Seo_Service(); |
|
| 1363 | + |
|
| 1364 | + // Initialize the AMP service. |
|
| 1365 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1366 | + |
|
| 1367 | + /** Services. */ |
|
| 1368 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1369 | + new Wordlift_Image_Service(); |
|
| 1370 | + |
|
| 1371 | + /** Adapters. */ |
|
| 1372 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1373 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1374 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1375 | + //$this->faq_tinymce_adapter = new Faq_Tinymce_Adapter(); |
|
| 1376 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1377 | + |
|
| 1378 | + /* |
|
| 1379 | 1379 | * Exclude our public js from WP-Rocket. |
| 1380 | 1380 | * |
| 1381 | 1381 | * @since 3.19.4 |
| 1382 | 1382 | * |
| 1383 | 1383 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1384 | 1384 | */ |
| 1385 | - new Wordlift_WpRocket_Adapter(); |
|
| 1386 | - |
|
| 1387 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1388 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1389 | - $this->sparql_service, |
|
| 1390 | - $uri_service |
|
| 1391 | - ); |
|
| 1392 | - |
|
| 1393 | - $that = $this; |
|
| 1394 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1395 | - if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1396 | - new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1397 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1398 | - new Wordlift_Push_References_Async_Task(); |
|
| 1399 | - } |
|
| 1400 | - } ); |
|
| 1401 | - |
|
| 1402 | - /** WordPress Admin UI. */ |
|
| 1403 | - |
|
| 1404 | - // UI elements. |
|
| 1405 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1406 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1407 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1408 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1409 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1410 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1411 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1412 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1413 | - |
|
| 1414 | - $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 ); |
|
| 1415 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1416 | - |
|
| 1417 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1418 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1419 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1420 | - |
|
| 1421 | - // Pages. |
|
| 1422 | - /* |
|
| 1385 | + new Wordlift_WpRocket_Adapter(); |
|
| 1386 | + |
|
| 1387 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1388 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1389 | + $this->sparql_service, |
|
| 1390 | + $uri_service |
|
| 1391 | + ); |
|
| 1392 | + |
|
| 1393 | + $that = $this; |
|
| 1394 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1395 | + if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) { |
|
| 1396 | + new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service ); |
|
| 1397 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1398 | + new Wordlift_Push_References_Async_Task(); |
|
| 1399 | + } |
|
| 1400 | + } ); |
|
| 1401 | + |
|
| 1402 | + /** WordPress Admin UI. */ |
|
| 1403 | + |
|
| 1404 | + // UI elements. |
|
| 1405 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1406 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1407 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1408 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1409 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1410 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1411 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1412 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1413 | + |
|
| 1414 | + $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 ); |
|
| 1415 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1416 | + |
|
| 1417 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1418 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1419 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1420 | + |
|
| 1421 | + // Pages. |
|
| 1422 | + /* |
|
| 1423 | 1423 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1424 | 1424 | * |
| 1425 | 1425 | * @since 3.20.3 |
| 1426 | 1426 | * |
| 1427 | 1427 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1428 | 1428 | */ |
| 1429 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1430 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1431 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1432 | - } |
|
| 1433 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1429 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1430 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1431 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1432 | + } |
|
| 1433 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1434 | 1434 | |
| 1435 | - // create an instance of the entity type list admin page controller. |
|
| 1436 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1435 | + // create an instance of the entity type list admin page controller. |
|
| 1436 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1437 | 1437 | |
| 1438 | - // create an instance of the entity type setting admin page controller. |
|
| 1439 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1438 | + // create an instance of the entity type setting admin page controller. |
|
| 1439 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1440 | 1440 | |
| 1441 | - /** Widgets */ |
|
| 1442 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1441 | + /** Widgets */ |
|
| 1442 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1443 | 1443 | |
| 1444 | - /* WordPress Admin. */ |
|
| 1445 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1446 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1444 | + /* WordPress Admin. */ |
|
| 1445 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1446 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1447 | 1447 | |
| 1448 | - // Create an instance of the install wizard. |
|
| 1449 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1448 | + // Create an instance of the install wizard. |
|
| 1449 | + $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 ); |
|
| 1450 | 1450 | |
| 1451 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1451 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1452 | 1452 | |
| 1453 | - // User Profile. |
|
| 1454 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1453 | + // User Profile. |
|
| 1454 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1455 | 1455 | |
| 1456 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1456 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1457 | 1457 | |
| 1458 | - // Load the debug service if WP is in debug mode. |
|
| 1459 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1461 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1462 | - } |
|
| 1458 | + // Load the debug service if WP is in debug mode. |
|
| 1459 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1460 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1461 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1462 | + } |
|
| 1463 | 1463 | |
| 1464 | - // Remote Image Service. |
|
| 1465 | - new Wordlift_Remote_Image_Service(); |
|
| 1464 | + // Remote Image Service. |
|
| 1465 | + new Wordlift_Remote_Image_Service(); |
|
| 1466 | 1466 | |
| 1467 | - /* |
|
| 1467 | + /* |
|
| 1468 | 1468 | * Provides mappings between post types and entity types. |
| 1469 | 1469 | * |
| 1470 | 1470 | * @since 3.20.0 |
| 1471 | 1471 | * |
| 1472 | 1472 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1473 | 1473 | */ |
| 1474 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1476 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1474 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1475 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1476 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1477 | 1477 | |
| 1478 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1479 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1478 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1479 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1480 | 1480 | |
| 1481 | - /* |
|
| 1481 | + /* |
|
| 1482 | 1482 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1483 | 1483 | * |
| 1484 | 1484 | * Eventually Batch Actions will become Batch Operations. |
| 1485 | 1485 | * |
| 1486 | 1486 | * @since 3.20.0 |
| 1487 | 1487 | */ |
| 1488 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1489 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1488 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1489 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1490 | 1490 | |
| 1491 | - /* |
|
| 1491 | + /* |
|
| 1492 | 1492 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1493 | 1493 | * |
| 1494 | 1494 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1495 | 1495 | * |
| 1496 | 1496 | * @since 3.20.0 |
| 1497 | 1497 | */ |
| 1498 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1499 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1498 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1499 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1500 | 1500 | |
| 1501 | - /* |
|
| 1501 | + /* |
|
| 1502 | 1502 | * Load the Mappings JSON-LD post processing. |
| 1503 | 1503 | * |
| 1504 | 1504 | * @since 3.25.0 |
| 1505 | 1505 | */ |
| 1506 | 1506 | |
| 1507 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1508 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1509 | - new Post_Type_Rule_Validator(); |
|
| 1510 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1511 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1512 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1513 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1514 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1515 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1516 | - |
|
| 1517 | - new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1518 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1519 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1520 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1521 | - |
|
| 1522 | - /** |
|
| 1523 | - * @since 3.27.1 |
|
| 1524 | - * Intiailize the acf group data formatter. |
|
| 1525 | - */ |
|
| 1526 | - new Acf_Group_Formatter(); |
|
| 1527 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1528 | - |
|
| 1529 | - /** |
|
| 1530 | - * @since 3.26.0 |
|
| 1531 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1532 | - */ |
|
| 1533 | - // new Faq_To_Jsonld_Converter(); |
|
| 1534 | - /* |
|
| 1507 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1508 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1509 | + new Post_Type_Rule_Validator(); |
|
| 1510 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1511 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1512 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1513 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1514 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1515 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1516 | + |
|
| 1517 | + new Url_To_Entity_Transform_Function( $this->entity_uri_service ); |
|
| 1518 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1519 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1520 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1521 | + |
|
| 1522 | + /** |
|
| 1523 | + * @since 3.27.1 |
|
| 1524 | + * Intiailize the acf group data formatter. |
|
| 1525 | + */ |
|
| 1526 | + new Acf_Group_Formatter(); |
|
| 1527 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1528 | + |
|
| 1529 | + /** |
|
| 1530 | + * @since 3.26.0 |
|
| 1531 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1532 | + */ |
|
| 1533 | + // new Faq_To_Jsonld_Converter(); |
|
| 1534 | + /* |
|
| 1535 | 1535 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1536 | 1536 | * end-point. |
| 1537 | 1537 | * |
| 1538 | 1538 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1539 | 1539 | * @since 3.24.4 |
| 1540 | 1540 | */ |
| 1541 | - new Templates_Ajax_Endpoint(); |
|
| 1542 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1543 | - //Faq_Rest_Controller::register_routes(); |
|
| 1541 | + new Templates_Ajax_Endpoint(); |
|
| 1542 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1543 | + //Faq_Rest_Controller::register_routes(); |
|
| 1544 | 1544 | |
| 1545 | - /* |
|
| 1545 | + /* |
|
| 1546 | 1546 | * Create a singleton for the Analysis_Response_Ops_Factory. |
| 1547 | 1547 | */ |
| 1548 | - $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1549 | - new Analysis_Response_Ops_Factory( |
|
| 1550 | - $this->entity_uri_service, |
|
| 1551 | - $this->entity_service, |
|
| 1552 | - $this->entity_type_service, |
|
| 1553 | - $this->storage_factory->post_images(), |
|
| 1554 | - $entity_helper |
|
| 1555 | - ); |
|
| 1556 | - |
|
| 1557 | - /** WL Autocomplete. */ |
|
| 1558 | - $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1559 | - new Local_Autocomplete_Service(), |
|
| 1560 | - new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1561 | - ) ); |
|
| 1562 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1563 | - |
|
| 1564 | - /** |
|
| 1565 | - * @since 3.27.2 |
|
| 1566 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1567 | - * as default entity type to the wprm_recipe CPT. |
|
| 1568 | - */ |
|
| 1569 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1570 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1571 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1572 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1573 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1574 | - new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1575 | - |
|
| 1576 | - /** |
|
| 1577 | - * @since 3.27.4 |
|
| 1578 | - * Add the faq duplicate markup hook. |
|
| 1579 | - */ |
|
| 1580 | - new Faq_Duplicate_Markup_Remover(); |
|
| 1581 | - /** |
|
| 1582 | - * @since 3.27.8 |
|
| 1583 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1584 | - */ |
|
| 1585 | - new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1586 | - /** |
|
| 1587 | - * @since 3.28.0 |
|
| 1588 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1589 | - */ |
|
| 1590 | - new Entity_No_Index_Flag(); |
|
| 1591 | - |
|
| 1592 | - /** |
|
| 1593 | - * @since 3.29.0 |
|
| 1594 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1595 | - */ |
|
| 1596 | - new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1597 | - |
|
| 1598 | - /** |
|
| 1599 | - * Expand author in to references. |
|
| 1600 | - * @since 3.30.0 |
|
| 1601 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1602 | - */ |
|
| 1603 | - |
|
| 1604 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1605 | - |
|
| 1606 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1607 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1608 | - } |
|
| 1609 | - |
|
| 1610 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1611 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1612 | - $vocabulary_loader->init_vocabulary(); |
|
| 1613 | - } |
|
| 1614 | - |
|
| 1615 | - } ); |
|
| 1616 | - |
|
| 1617 | - /** |
|
| 1618 | - * @since 3.30.0 |
|
| 1619 | - * Add a checkbox to user option screen for wordlift admin. |
|
| 1620 | - */ |
|
| 1621 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1622 | - $wordlift_admin_checkbox->connect_hook(); |
|
| 1623 | - /** |
|
| 1624 | - * @since 3.31.0 |
|
| 1625 | - * Init loader class for videoobject. |
|
| 1626 | - */ |
|
| 1627 | - $videoobject_loader = new Loader(); |
|
| 1628 | - $videoobject_loader->init_feature(); |
|
| 1629 | - /** |
|
| 1630 | - * @since 3.31.5 |
|
| 1631 | - * Create configuration endpoint for webapp to configure. |
|
| 1632 | - */ |
|
| 1633 | - new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1634 | - /** |
|
| 1635 | - * @since 3.31.7 |
|
| 1636 | - * Remove duplicate videoobject. |
|
| 1637 | - */ |
|
| 1638 | - new Videoobject_Duplicate_Remover(); |
|
| 1639 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1640 | - $synonym_loader->init_feature(); |
|
| 1641 | - } |
|
| 1642 | - |
|
| 1643 | - /** |
|
| 1644 | - * Define the locale for this plugin for internationalization. |
|
| 1645 | - * |
|
| 1646 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1647 | - * with WordPress. |
|
| 1648 | - * |
|
| 1649 | - * @since 1.0.0 |
|
| 1650 | - * @access private |
|
| 1651 | - */ |
|
| 1652 | - private function set_locale() { |
|
| 1653 | - |
|
| 1654 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1655 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1656 | - |
|
| 1657 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1658 | - |
|
| 1659 | - } |
|
| 1660 | - |
|
| 1661 | - /** |
|
| 1662 | - * Register all of the hooks related to the admin area functionality |
|
| 1663 | - * of the plugin. |
|
| 1664 | - * |
|
| 1665 | - * @since 1.0.0 |
|
| 1666 | - * @access private |
|
| 1667 | - */ |
|
| 1668 | - private function define_admin_hooks() { |
|
| 1669 | - $that = $this; |
|
| 1670 | - $plugin_admin = new Wordlift_Admin( |
|
| 1671 | - $this->get_plugin_name(), |
|
| 1672 | - $this->get_version(), |
|
| 1673 | - $this->configuration_service, |
|
| 1674 | - $this->notice_service, |
|
| 1675 | - $this->user_service |
|
| 1676 | - ); |
|
| 1677 | - |
|
| 1678 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1679 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1680 | - |
|
| 1681 | - // Hook the init action to taxonomy services. |
|
| 1682 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1683 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1684 | - |
|
| 1685 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1686 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1687 | - |
|
| 1688 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1689 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1690 | - |
|
| 1691 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1692 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1693 | - |
|
| 1694 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1695 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1696 | - |
|
| 1697 | - // Register custom allowed redirect hosts. |
|
| 1698 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1699 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1700 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1701 | - |
|
| 1702 | - /* |
|
| 1548 | + $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service ); |
|
| 1549 | + new Analysis_Response_Ops_Factory( |
|
| 1550 | + $this->entity_uri_service, |
|
| 1551 | + $this->entity_service, |
|
| 1552 | + $this->entity_type_service, |
|
| 1553 | + $this->storage_factory->post_images(), |
|
| 1554 | + $entity_helper |
|
| 1555 | + ); |
|
| 1556 | + |
|
| 1557 | + /** WL Autocomplete. */ |
|
| 1558 | + $autocomplete_service = new All_Autocomplete_Service( array( |
|
| 1559 | + new Local_Autocomplete_Service(), |
|
| 1560 | + new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ), |
|
| 1561 | + ) ); |
|
| 1562 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1563 | + |
|
| 1564 | + /** |
|
| 1565 | + * @since 3.27.2 |
|
| 1566 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1567 | + * as default entity type to the wprm_recipe CPT. |
|
| 1568 | + */ |
|
| 1569 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1570 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1571 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1572 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1573 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1574 | + new Yoast_Jsonld( $recipe_maker_validation_service ); |
|
| 1575 | + |
|
| 1576 | + /** |
|
| 1577 | + * @since 3.27.4 |
|
| 1578 | + * Add the faq duplicate markup hook. |
|
| 1579 | + */ |
|
| 1580 | + new Faq_Duplicate_Markup_Remover(); |
|
| 1581 | + /** |
|
| 1582 | + * @since 3.27.8 |
|
| 1583 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1584 | + */ |
|
| 1585 | + new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service ); |
|
| 1586 | + /** |
|
| 1587 | + * @since 3.28.0 |
|
| 1588 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1589 | + */ |
|
| 1590 | + new Entity_No_Index_Flag(); |
|
| 1591 | + |
|
| 1592 | + /** |
|
| 1593 | + * @since 3.29.0 |
|
| 1594 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1595 | + */ |
|
| 1596 | + new Entity_Rest_Service( $this->entity_type_service ); |
|
| 1597 | + |
|
| 1598 | + /** |
|
| 1599 | + * Expand author in to references. |
|
| 1600 | + * @since 3.30.0 |
|
| 1601 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1602 | + */ |
|
| 1603 | + |
|
| 1604 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1605 | + |
|
| 1606 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1607 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1608 | + } |
|
| 1609 | + |
|
| 1610 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1611 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1612 | + $vocabulary_loader->init_vocabulary(); |
|
| 1613 | + } |
|
| 1614 | + |
|
| 1615 | + } ); |
|
| 1616 | + |
|
| 1617 | + /** |
|
| 1618 | + * @since 3.30.0 |
|
| 1619 | + * Add a checkbox to user option screen for wordlift admin. |
|
| 1620 | + */ |
|
| 1621 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1622 | + $wordlift_admin_checkbox->connect_hook(); |
|
| 1623 | + /** |
|
| 1624 | + * @since 3.31.0 |
|
| 1625 | + * Init loader class for videoobject. |
|
| 1626 | + */ |
|
| 1627 | + $videoobject_loader = new Loader(); |
|
| 1628 | + $videoobject_loader->init_feature(); |
|
| 1629 | + /** |
|
| 1630 | + * @since 3.31.5 |
|
| 1631 | + * Create configuration endpoint for webapp to configure. |
|
| 1632 | + */ |
|
| 1633 | + new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service ); |
|
| 1634 | + /** |
|
| 1635 | + * @since 3.31.7 |
|
| 1636 | + * Remove duplicate videoobject. |
|
| 1637 | + */ |
|
| 1638 | + new Videoobject_Duplicate_Remover(); |
|
| 1639 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1640 | + $synonym_loader->init_feature(); |
|
| 1641 | + } |
|
| 1642 | + |
|
| 1643 | + /** |
|
| 1644 | + * Define the locale for this plugin for internationalization. |
|
| 1645 | + * |
|
| 1646 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1647 | + * with WordPress. |
|
| 1648 | + * |
|
| 1649 | + * @since 1.0.0 |
|
| 1650 | + * @access private |
|
| 1651 | + */ |
|
| 1652 | + private function set_locale() { |
|
| 1653 | + |
|
| 1654 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1655 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1656 | + |
|
| 1657 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1658 | + |
|
| 1659 | + } |
|
| 1660 | + |
|
| 1661 | + /** |
|
| 1662 | + * Register all of the hooks related to the admin area functionality |
|
| 1663 | + * of the plugin. |
|
| 1664 | + * |
|
| 1665 | + * @since 1.0.0 |
|
| 1666 | + * @access private |
|
| 1667 | + */ |
|
| 1668 | + private function define_admin_hooks() { |
|
| 1669 | + $that = $this; |
|
| 1670 | + $plugin_admin = new Wordlift_Admin( |
|
| 1671 | + $this->get_plugin_name(), |
|
| 1672 | + $this->get_version(), |
|
| 1673 | + $this->configuration_service, |
|
| 1674 | + $this->notice_service, |
|
| 1675 | + $this->user_service |
|
| 1676 | + ); |
|
| 1677 | + |
|
| 1678 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1679 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1680 | + |
|
| 1681 | + // Hook the init action to taxonomy services. |
|
| 1682 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1683 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1684 | + |
|
| 1685 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1686 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1687 | + |
|
| 1688 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1689 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1690 | + |
|
| 1691 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1692 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1693 | + |
|
| 1694 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1695 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1696 | + |
|
| 1697 | + // Register custom allowed redirect hosts. |
|
| 1698 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1699 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1700 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1701 | + |
|
| 1702 | + /* |
|
| 1703 | 1703 | * The old dashboard is replaced with dashboard v2. |
| 1704 | 1704 | * |
| 1705 | 1705 | * The old dashboard service is still loaded because its functions are used. |
@@ -1708,391 +1708,391 @@ discard block |
||
| 1708 | 1708 | * |
| 1709 | 1709 | * @since 3.20.0 |
| 1710 | 1710 | */ |
| 1711 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1712 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1713 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1714 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1715 | - |
|
| 1716 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1717 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1718 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1719 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1720 | - |
|
| 1721 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1722 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1723 | - |
|
| 1724 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1725 | - // Add custom columns. |
|
| 1726 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1727 | - // no explicit entity as it prevents handling of other post types. |
|
| 1728 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1729 | - // Add 4W selection. |
|
| 1730 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1731 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1732 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1733 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1734 | - |
|
| 1735 | - /* |
|
| 1711 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1712 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1713 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1714 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1715 | + |
|
| 1716 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1717 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1718 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1719 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1720 | + |
|
| 1721 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1722 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1723 | + |
|
| 1724 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1725 | + // Add custom columns. |
|
| 1726 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1727 | + // no explicit entity as it prevents handling of other post types. |
|
| 1728 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1729 | + // Add 4W selection. |
|
| 1730 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1731 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1732 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1733 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1734 | + |
|
| 1735 | + /* |
|
| 1736 | 1736 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1737 | 1737 | * |
| 1738 | 1738 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1739 | 1739 | */ |
| 1740 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1741 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1742 | - } |
|
| 1743 | - |
|
| 1744 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1745 | - // entities. |
|
| 1746 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1747 | - |
|
| 1748 | - // Filter imported post meta. |
|
| 1749 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1750 | - |
|
| 1751 | - // Notify the import service when an import starts and ends. |
|
| 1752 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1753 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1754 | - |
|
| 1755 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1756 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1757 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1758 | - |
|
| 1759 | - /** |
|
| 1760 | - * Filter: wl_feature__enable__settings-download. |
|
| 1761 | - * |
|
| 1762 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1763 | - * |
|
| 1764 | - * @return bool |
|
| 1765 | - * @since 3.27.6 |
|
| 1766 | - */ |
|
| 1767 | - $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1768 | - $this, |
|
| 1769 | - 'register_screens' |
|
| 1770 | - ) ); |
|
| 1771 | - |
|
| 1772 | - |
|
| 1773 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1774 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1775 | - |
|
| 1776 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1777 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1778 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1779 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1780 | - |
|
| 1781 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1782 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1783 | - |
|
| 1784 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1785 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1786 | - |
|
| 1787 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1788 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1789 | - |
|
| 1790 | - // Hook the admin_init to the settings page. |
|
| 1791 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1792 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1793 | - |
|
| 1794 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1795 | - |
|
| 1796 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1797 | - /** |
|
| 1798 | - * Filter: wl_feature__enable__screens. |
|
| 1799 | - * |
|
| 1800 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1801 | - * |
|
| 1802 | - * @return bool |
|
| 1803 | - * @since 3.27.6 |
|
| 1804 | - * |
|
| 1805 | - * Since 3.30.0 this feature is registered using registry. |
|
| 1806 | - */ |
|
| 1807 | - add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1808 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1809 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1810 | - } |
|
| 1811 | - } ); |
|
| 1812 | - |
|
| 1813 | - // Hook key update. |
|
| 1814 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1815 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1816 | - |
|
| 1817 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1818 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1819 | - |
|
| 1820 | - /* |
|
| 1740 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1741 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1742 | + } |
|
| 1743 | + |
|
| 1744 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1745 | + // entities. |
|
| 1746 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1747 | + |
|
| 1748 | + // Filter imported post meta. |
|
| 1749 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1750 | + |
|
| 1751 | + // Notify the import service when an import starts and ends. |
|
| 1752 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1753 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1754 | + |
|
| 1755 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1756 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1757 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1758 | + |
|
| 1759 | + /** |
|
| 1760 | + * Filter: wl_feature__enable__settings-download. |
|
| 1761 | + * |
|
| 1762 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1763 | + * |
|
| 1764 | + * @return bool |
|
| 1765 | + * @since 3.27.6 |
|
| 1766 | + */ |
|
| 1767 | + $this->features_registry->register_feature_from_slug( 'settings-download', true, array( |
|
| 1768 | + $this, |
|
| 1769 | + 'register_screens' |
|
| 1770 | + ) ); |
|
| 1771 | + |
|
| 1772 | + |
|
| 1773 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1774 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1775 | + |
|
| 1776 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1777 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1778 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1779 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1780 | + |
|
| 1781 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1782 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1783 | + |
|
| 1784 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1785 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1786 | + |
|
| 1787 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1788 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1789 | + |
|
| 1790 | + // Hook the admin_init to the settings page. |
|
| 1791 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1792 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1793 | + |
|
| 1794 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1795 | + |
|
| 1796 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1797 | + /** |
|
| 1798 | + * Filter: wl_feature__enable__screens. |
|
| 1799 | + * |
|
| 1800 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1801 | + * |
|
| 1802 | + * @return bool |
|
| 1803 | + * @since 3.27.6 |
|
| 1804 | + * |
|
| 1805 | + * Since 3.30.0 this feature is registered using registry. |
|
| 1806 | + */ |
|
| 1807 | + add_action( 'plugins_loaded', function () use ( $that ) { |
|
| 1808 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1809 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1810 | + } |
|
| 1811 | + } ); |
|
| 1812 | + |
|
| 1813 | + // Hook key update. |
|
| 1814 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1815 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1816 | + |
|
| 1817 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1818 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1819 | + |
|
| 1820 | + /* |
|
| 1821 | 1821 | * Remove the Analytics Settings link from the plugin page. |
| 1822 | 1822 | * |
| 1823 | 1823 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1824 | 1824 | * @since 3.21.1 |
| 1825 | 1825 | */ |
| 1826 | - // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1827 | - |
|
| 1828 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1829 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1830 | - |
|
| 1831 | - // Hook row actions for the entity type list admin. |
|
| 1832 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1833 | - |
|
| 1834 | - /** Ajax actions. */ |
|
| 1835 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1836 | - |
|
| 1837 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1838 | - // page on WordPress versions before 4.7. |
|
| 1839 | - global $wp_version; |
|
| 1840 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1841 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1842 | - } |
|
| 1843 | - |
|
| 1844 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1845 | - |
|
| 1846 | - /** Adapters. */ |
|
| 1847 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1848 | - /** |
|
| 1849 | - * Disabling Faq temporarily. |
|
| 1850 | - * Load the tinymce editor button on the tool bar. |
|
| 1851 | - * @since 3.26.0 |
|
| 1852 | - */ |
|
| 1853 | - //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1854 | - //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1855 | - //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1856 | - |
|
| 1857 | - |
|
| 1858 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1859 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1860 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1861 | - /** |
|
| 1862 | - * @since 3.26.0 |
|
| 1863 | - */ |
|
| 1864 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1865 | - $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1866 | - // Adding Rest route for the post excerpt |
|
| 1867 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1868 | - |
|
| 1869 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1870 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1871 | - |
|
| 1872 | - // Handle the autocomplete request. |
|
| 1873 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1874 | - $this->autocomplete_adapter, |
|
| 1875 | - 'wl_autocomplete', |
|
| 1876 | - ) ); |
|
| 1877 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1878 | - $this->autocomplete_adapter, |
|
| 1879 | - 'wl_autocomplete', |
|
| 1880 | - ) ); |
|
| 1881 | - |
|
| 1882 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1883 | - if ( is_multisite() ) { |
|
| 1884 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1885 | - } |
|
| 1886 | - |
|
| 1887 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1888 | - |
|
| 1889 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1890 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1891 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1892 | - |
|
| 1893 | - /** |
|
| 1894 | - * Always allow the `wordlift/classification` block. |
|
| 1895 | - * |
|
| 1896 | - * @since 3.23.0 |
|
| 1897 | - */ |
|
| 1898 | - add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1899 | - |
|
| 1900 | - if ( true === $value ) { |
|
| 1901 | - return $value; |
|
| 1902 | - } |
|
| 1903 | - |
|
| 1904 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1905 | - }, PHP_INT_MAX ); |
|
| 1906 | - |
|
| 1907 | - /** |
|
| 1908 | - * @since 3.27.7 |
|
| 1909 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1910 | - */ |
|
| 1911 | - new Top_Entities(); |
|
| 1912 | - } |
|
| 1913 | - |
|
| 1914 | - /** |
|
| 1915 | - * Register all of the hooks related to the public-facing functionality |
|
| 1916 | - * of the plugin. |
|
| 1917 | - * |
|
| 1918 | - * @since 1.0.0 |
|
| 1919 | - * @access private |
|
| 1920 | - */ |
|
| 1921 | - private function define_public_hooks() { |
|
| 1922 | - |
|
| 1923 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1924 | - |
|
| 1925 | - // Register the entity post type. |
|
| 1926 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1927 | - |
|
| 1928 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1929 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1930 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1931 | - // $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 ); |
|
| 1932 | - // $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 ); |
|
| 1933 | - |
|
| 1934 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1935 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1936 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1937 | - |
|
| 1938 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1939 | - $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1940 | - // Hook the content filter service to add entity links. |
|
| 1941 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1942 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1943 | - } |
|
| 1944 | - |
|
| 1945 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1946 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1947 | - |
|
| 1948 | - // Hook the ShareThis service. |
|
| 1949 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1950 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1951 | - |
|
| 1952 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1953 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1954 | - |
|
| 1955 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1956 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1957 | - // to categories. |
|
| 1958 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1959 | - |
|
| 1960 | - /* |
|
| 1826 | + // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1827 | + |
|
| 1828 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1829 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1830 | + |
|
| 1831 | + // Hook row actions for the entity type list admin. |
|
| 1832 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1833 | + |
|
| 1834 | + /** Ajax actions. */ |
|
| 1835 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1836 | + |
|
| 1837 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1838 | + // page on WordPress versions before 4.7. |
|
| 1839 | + global $wp_version; |
|
| 1840 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1841 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1842 | + } |
|
| 1843 | + |
|
| 1844 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1845 | + |
|
| 1846 | + /** Adapters. */ |
|
| 1847 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1848 | + /** |
|
| 1849 | + * Disabling Faq temporarily. |
|
| 1850 | + * Load the tinymce editor button on the tool bar. |
|
| 1851 | + * @since 3.26.0 |
|
| 1852 | + */ |
|
| 1853 | + //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1854 | + //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1855 | + //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1856 | + |
|
| 1857 | + |
|
| 1858 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1859 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1860 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1861 | + /** |
|
| 1862 | + * @since 3.26.0 |
|
| 1863 | + */ |
|
| 1864 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1865 | + $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1866 | + // Adding Rest route for the post excerpt |
|
| 1867 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1868 | + |
|
| 1869 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1870 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1871 | + |
|
| 1872 | + // Handle the autocomplete request. |
|
| 1873 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1874 | + $this->autocomplete_adapter, |
|
| 1875 | + 'wl_autocomplete', |
|
| 1876 | + ) ); |
|
| 1877 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1878 | + $this->autocomplete_adapter, |
|
| 1879 | + 'wl_autocomplete', |
|
| 1880 | + ) ); |
|
| 1881 | + |
|
| 1882 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1883 | + if ( is_multisite() ) { |
|
| 1884 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1885 | + } |
|
| 1886 | + |
|
| 1887 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1888 | + |
|
| 1889 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1890 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1891 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1892 | + |
|
| 1893 | + /** |
|
| 1894 | + * Always allow the `wordlift/classification` block. |
|
| 1895 | + * |
|
| 1896 | + * @since 3.23.0 |
|
| 1897 | + */ |
|
| 1898 | + add_filter( 'allowed_block_types', function ( $value ) { |
|
| 1899 | + |
|
| 1900 | + if ( true === $value ) { |
|
| 1901 | + return $value; |
|
| 1902 | + } |
|
| 1903 | + |
|
| 1904 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1905 | + }, PHP_INT_MAX ); |
|
| 1906 | + |
|
| 1907 | + /** |
|
| 1908 | + * @since 3.27.7 |
|
| 1909 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1910 | + */ |
|
| 1911 | + new Top_Entities(); |
|
| 1912 | + } |
|
| 1913 | + |
|
| 1914 | + /** |
|
| 1915 | + * Register all of the hooks related to the public-facing functionality |
|
| 1916 | + * of the plugin. |
|
| 1917 | + * |
|
| 1918 | + * @since 1.0.0 |
|
| 1919 | + * @access private |
|
| 1920 | + */ |
|
| 1921 | + private function define_public_hooks() { |
|
| 1922 | + |
|
| 1923 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1924 | + |
|
| 1925 | + // Register the entity post type. |
|
| 1926 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1927 | + |
|
| 1928 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1929 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1930 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1931 | + // $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 ); |
|
| 1932 | + // $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 ); |
|
| 1933 | + |
|
| 1934 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1935 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1936 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' ); |
|
| 1937 | + |
|
| 1938 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1939 | + $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1940 | + // Hook the content filter service to add entity links. |
|
| 1941 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1942 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1943 | + } |
|
| 1944 | + |
|
| 1945 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1946 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1947 | + |
|
| 1948 | + // Hook the ShareThis service. |
|
| 1949 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1950 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1951 | + |
|
| 1952 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1953 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1954 | + |
|
| 1955 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1956 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1957 | + // to categories. |
|
| 1958 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1959 | + |
|
| 1960 | + /* |
|
| 1961 | 1961 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1962 | 1962 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1963 | 1963 | * order of start time. |
| 1964 | 1964 | */ |
| 1965 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1966 | - |
|
| 1967 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1968 | - |
|
| 1969 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1970 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1971 | - |
|
| 1972 | - // Analytics Script Frontend. |
|
| 1973 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1974 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1975 | - } |
|
| 1976 | - |
|
| 1977 | - } |
|
| 1978 | - |
|
| 1979 | - /** |
|
| 1980 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1981 | - * |
|
| 1982 | - * @since 1.0.0 |
|
| 1983 | - */ |
|
| 1984 | - public function run() { |
|
| 1985 | - $this->loader->run(); |
|
| 1986 | - } |
|
| 1987 | - |
|
| 1988 | - /** |
|
| 1989 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1990 | - * WordPress and to define internationalization functionality. |
|
| 1991 | - * |
|
| 1992 | - * @return string The name of the plugin. |
|
| 1993 | - * @since 1.0.0 |
|
| 1994 | - */ |
|
| 1995 | - public function get_plugin_name() { |
|
| 1996 | - return $this->plugin_name; |
|
| 1997 | - } |
|
| 1998 | - |
|
| 1999 | - /** |
|
| 2000 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 2001 | - * |
|
| 2002 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 2003 | - * @since 1.0.0 |
|
| 2004 | - */ |
|
| 2005 | - public function get_loader() { |
|
| 2006 | - return $this->loader; |
|
| 2007 | - } |
|
| 2008 | - |
|
| 2009 | - /** |
|
| 2010 | - * Retrieve the version number of the plugin. |
|
| 2011 | - * |
|
| 2012 | - * @return string The version number of the plugin. |
|
| 2013 | - * @since 1.0.0 |
|
| 2014 | - */ |
|
| 2015 | - public function get_version() { |
|
| 2016 | - return $this->version; |
|
| 2017 | - } |
|
| 2018 | - |
|
| 2019 | - /** |
|
| 2020 | - * Load dependencies for WP-CLI. |
|
| 2021 | - * |
|
| 2022 | - * @throws Exception |
|
| 2023 | - * @since 3.18.0 |
|
| 2024 | - */ |
|
| 2025 | - private function load_cli_dependencies() { |
|
| 2026 | - |
|
| 2027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2028 | - |
|
| 2029 | - $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 ); |
|
| 2030 | - |
|
| 2031 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2032 | - |
|
| 2033 | - } |
|
| 2034 | - |
|
| 2035 | - /** |
|
| 2036 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 2037 | - * |
|
| 2038 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 2039 | - * @since 3.20.0 |
|
| 2040 | - */ |
|
| 2041 | - public function get_dashboard_service() { |
|
| 2042 | - |
|
| 2043 | - return $this->dashboard_service; |
|
| 2044 | - } |
|
| 2045 | - |
|
| 2046 | - public function add_wl_enabled_blocks() { |
|
| 2047 | - /** |
|
| 2048 | - * Filter: wl_feature__enable__blocks. |
|
| 2049 | - * |
|
| 2050 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 2051 | - * |
|
| 2052 | - * @return bool |
|
| 2053 | - * @since 3.27.6 |
|
| 2054 | - */ |
|
| 2055 | - |
|
| 2056 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2057 | - |
|
| 2058 | - $enabled_blocks = array(); |
|
| 2059 | - |
|
| 2060 | - /** |
|
| 2061 | - * Filter name: wl_feature_enable__product_navigator |
|
| 2062 | - * @since 3.30.0 |
|
| 2063 | - */ |
|
| 2064 | - if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2065 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 2066 | - } |
|
| 2067 | - |
|
| 2068 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2069 | - // To intimate JS |
|
| 2070 | - $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2071 | - 'wordlift/navigator', |
|
| 2072 | - 'wordlift/chord', |
|
| 2073 | - 'wordlift/geomap', |
|
| 2074 | - 'wordlift/timeline', |
|
| 2075 | - 'wordlift/cloud', |
|
| 2076 | - 'wordlift/vocabulary', |
|
| 2077 | - 'wordlift/faceted-search' |
|
| 2078 | - ) ); |
|
| 2079 | - } |
|
| 2080 | - |
|
| 2081 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2082 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2083 | - } |
|
| 2084 | - |
|
| 2085 | - /** |
|
| 2086 | - * Register screens based on the filter. |
|
| 2087 | - */ |
|
| 2088 | - public function register_screens() { |
|
| 2089 | - // Hook the menu to the Download Your Data page. |
|
| 2090 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2091 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2092 | - } |
|
| 2093 | - add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2094 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2095 | - |
|
| 2096 | - } |
|
| 1965 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1966 | + |
|
| 1967 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1968 | + |
|
| 1969 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1970 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1971 | + |
|
| 1972 | + // Analytics Script Frontend. |
|
| 1973 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1974 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1975 | + } |
|
| 1976 | + |
|
| 1977 | + } |
|
| 1978 | + |
|
| 1979 | + /** |
|
| 1980 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1981 | + * |
|
| 1982 | + * @since 1.0.0 |
|
| 1983 | + */ |
|
| 1984 | + public function run() { |
|
| 1985 | + $this->loader->run(); |
|
| 1986 | + } |
|
| 1987 | + |
|
| 1988 | + /** |
|
| 1989 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1990 | + * WordPress and to define internationalization functionality. |
|
| 1991 | + * |
|
| 1992 | + * @return string The name of the plugin. |
|
| 1993 | + * @since 1.0.0 |
|
| 1994 | + */ |
|
| 1995 | + public function get_plugin_name() { |
|
| 1996 | + return $this->plugin_name; |
|
| 1997 | + } |
|
| 1998 | + |
|
| 1999 | + /** |
|
| 2000 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 2001 | + * |
|
| 2002 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 2003 | + * @since 1.0.0 |
|
| 2004 | + */ |
|
| 2005 | + public function get_loader() { |
|
| 2006 | + return $this->loader; |
|
| 2007 | + } |
|
| 2008 | + |
|
| 2009 | + /** |
|
| 2010 | + * Retrieve the version number of the plugin. |
|
| 2011 | + * |
|
| 2012 | + * @return string The version number of the plugin. |
|
| 2013 | + * @since 1.0.0 |
|
| 2014 | + */ |
|
| 2015 | + public function get_version() { |
|
| 2016 | + return $this->version; |
|
| 2017 | + } |
|
| 2018 | + |
|
| 2019 | + /** |
|
| 2020 | + * Load dependencies for WP-CLI. |
|
| 2021 | + * |
|
| 2022 | + * @throws Exception |
|
| 2023 | + * @since 3.18.0 |
|
| 2024 | + */ |
|
| 2025 | + private function load_cli_dependencies() { |
|
| 2026 | + |
|
| 2027 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 2028 | + |
|
| 2029 | + $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 ); |
|
| 2030 | + |
|
| 2031 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 2032 | + |
|
| 2033 | + } |
|
| 2034 | + |
|
| 2035 | + /** |
|
| 2036 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 2037 | + * |
|
| 2038 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 2039 | + * @since 3.20.0 |
|
| 2040 | + */ |
|
| 2041 | + public function get_dashboard_service() { |
|
| 2042 | + |
|
| 2043 | + return $this->dashboard_service; |
|
| 2044 | + } |
|
| 2045 | + |
|
| 2046 | + public function add_wl_enabled_blocks() { |
|
| 2047 | + /** |
|
| 2048 | + * Filter: wl_feature__enable__blocks. |
|
| 2049 | + * |
|
| 2050 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 2051 | + * |
|
| 2052 | + * @return bool |
|
| 2053 | + * @since 3.27.6 |
|
| 2054 | + */ |
|
| 2055 | + |
|
| 2056 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 2057 | + |
|
| 2058 | + $enabled_blocks = array(); |
|
| 2059 | + |
|
| 2060 | + /** |
|
| 2061 | + * Filter name: wl_feature_enable__product_navigator |
|
| 2062 | + * @since 3.30.0 |
|
| 2063 | + */ |
|
| 2064 | + if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) { |
|
| 2065 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 2066 | + } |
|
| 2067 | + |
|
| 2068 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 2069 | + // To intimate JS |
|
| 2070 | + $enabled_blocks = array_merge( $enabled_blocks, array( |
|
| 2071 | + 'wordlift/navigator', |
|
| 2072 | + 'wordlift/chord', |
|
| 2073 | + 'wordlift/geomap', |
|
| 2074 | + 'wordlift/timeline', |
|
| 2075 | + 'wordlift/cloud', |
|
| 2076 | + 'wordlift/vocabulary', |
|
| 2077 | + 'wordlift/faceted-search' |
|
| 2078 | + ) ); |
|
| 2079 | + } |
|
| 2080 | + |
|
| 2081 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 2082 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 2083 | + } |
|
| 2084 | + |
|
| 2085 | + /** |
|
| 2086 | + * Register screens based on the filter. |
|
| 2087 | + */ |
|
| 2088 | + public function register_screens() { |
|
| 2089 | + // Hook the menu to the Download Your Data page. |
|
| 2090 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 2091 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 2092 | + } |
|
| 2093 | + add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 ); |
|
| 2094 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 2095 | + |
|
| 2096 | + } |
|
| 2097 | 2097 | |
| 2098 | 2098 | } |
@@ -10,50 +10,50 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Videoobject_Duplicate_Remover { |
| 12 | 12 | |
| 13 | - public function __construct() { |
|
| 14 | - add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 15 | - } |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * @param $jsonld array The final jsonld. |
|
| 19 | - * @param $post_id int The post id. |
|
| 20 | - * |
|
| 21 | - * @return array Filtered jsonld. |
|
| 22 | - */ |
|
| 23 | - public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 24 | - |
|
| 25 | - if ( ! is_array( $jsonld ) |
|
| 26 | - || ! count( $jsonld ) > 1 |
|
| 27 | - || ! array_key_exists( 0, $jsonld ) ) { |
|
| 28 | - // Return early if there are no referenced entities. |
|
| 29 | - return $jsonld; |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - $post_jsonld = array_shift( $jsonld ); |
|
| 33 | - |
|
| 34 | - // we need to loop through all the items and remove the faq markup. |
|
| 35 | - foreach ( $jsonld as $key => &$value ) { |
|
| 36 | - if ( ! array_key_exists( '@type', $value ) ) { |
|
| 37 | - continue; |
|
| 38 | - } |
|
| 39 | - $type = $value['@type']; |
|
| 40 | - |
|
| 41 | - if ( ( is_string( $type ) && $type !== 'Article' ) |
|
| 42 | - || ( is_array( $type ) && ! in_array( 'Article', $type ) ) ) { |
|
| 43 | - continue; |
|
| 44 | - } |
|
| 45 | - // Video doesnt exist, dont try to remove it. |
|
| 46 | - if ( ! array_key_exists( 'video', $value ) ) { |
|
| 47 | - continue; |
|
| 48 | - } |
|
| 49 | - unset( $jsonld[ $key ]['video'] ); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - // Add the post jsonld to front of jsonld array. |
|
| 53 | - array_unshift( $jsonld, $post_jsonld ); |
|
| 54 | - |
|
| 55 | - return $jsonld; |
|
| 56 | - } |
|
| 13 | + public function __construct() { |
|
| 14 | + add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * @param $jsonld array The final jsonld. |
|
| 19 | + * @param $post_id int The post id. |
|
| 20 | + * |
|
| 21 | + * @return array Filtered jsonld. |
|
| 22 | + */ |
|
| 23 | + public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 24 | + |
|
| 25 | + if ( ! is_array( $jsonld ) |
|
| 26 | + || ! count( $jsonld ) > 1 |
|
| 27 | + || ! array_key_exists( 0, $jsonld ) ) { |
|
| 28 | + // Return early if there are no referenced entities. |
|
| 29 | + return $jsonld; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + $post_jsonld = array_shift( $jsonld ); |
|
| 33 | + |
|
| 34 | + // we need to loop through all the items and remove the faq markup. |
|
| 35 | + foreach ( $jsonld as $key => &$value ) { |
|
| 36 | + if ( ! array_key_exists( '@type', $value ) ) { |
|
| 37 | + continue; |
|
| 38 | + } |
|
| 39 | + $type = $value['@type']; |
|
| 40 | + |
|
| 41 | + if ( ( is_string( $type ) && $type !== 'Article' ) |
|
| 42 | + || ( is_array( $type ) && ! in_array( 'Article', $type ) ) ) { |
|
| 43 | + continue; |
|
| 44 | + } |
|
| 45 | + // Video doesnt exist, dont try to remove it. |
|
| 46 | + if ( ! array_key_exists( 'video', $value ) ) { |
|
| 47 | + continue; |
|
| 48 | + } |
|
| 49 | + unset( $jsonld[ $key ]['video'] ); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + // Add the post jsonld to front of jsonld array. |
|
| 53 | + array_unshift( $jsonld, $post_jsonld ); |
|
| 54 | + |
|
| 55 | + return $jsonld; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | class Videoobject_Duplicate_Remover { |
| 12 | 12 | |
| 13 | 13 | public function __construct() { |
| 14 | - add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 ); |
|
| 14 | + add_filter('wl_after_get_jsonld', array($this, 'wl_after_get_jsonld'), 10, 2); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return array Filtered jsonld. |
| 22 | 22 | */ |
| 23 | - public function wl_after_get_jsonld( $jsonld, $post_id ) { |
|
| 23 | + public function wl_after_get_jsonld($jsonld, $post_id) { |
|
| 24 | 24 | |
| 25 | - if ( ! is_array( $jsonld ) |
|
| 26 | - || ! count( $jsonld ) > 1 |
|
| 27 | - || ! array_key_exists( 0, $jsonld ) ) { |
|
| 25 | + if ( ! is_array($jsonld) |
|
| 26 | + || ! count($jsonld) > 1 |
|
| 27 | + || ! array_key_exists(0, $jsonld)) { |
|
| 28 | 28 | // Return early if there are no referenced entities. |
| 29 | 29 | return $jsonld; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $post_jsonld = array_shift( $jsonld ); |
|
| 32 | + $post_jsonld = array_shift($jsonld); |
|
| 33 | 33 | |
| 34 | 34 | // we need to loop through all the items and remove the faq markup. |
| 35 | - foreach ( $jsonld as $key => &$value ) { |
|
| 36 | - if ( ! array_key_exists( '@type', $value ) ) { |
|
| 35 | + foreach ($jsonld as $key => &$value) { |
|
| 36 | + if ( ! array_key_exists('@type', $value)) { |
|
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | $type = $value['@type']; |
| 40 | 40 | |
| 41 | - if ( ( is_string( $type ) && $type !== 'Article' ) |
|
| 42 | - || ( is_array( $type ) && ! in_array( 'Article', $type ) ) ) { |
|
| 41 | + if ((is_string($type) && $type !== 'Article') |
|
| 42 | + || (is_array($type) && ! in_array('Article', $type))) { |
|
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | // Video doesnt exist, dont try to remove it. |
| 46 | - if ( ! array_key_exists( 'video', $value ) ) { |
|
| 46 | + if ( ! array_key_exists('video', $value)) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | - unset( $jsonld[ $key ]['video'] ); |
|
| 49 | + unset($jsonld[$key]['video']); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Add the post jsonld to front of jsonld array. |
| 53 | - array_unshift( $jsonld, $post_jsonld ); |
|
| 53 | + array_unshift($jsonld, $post_jsonld); |
|
| 54 | 54 | |
| 55 | 55 | return $jsonld; |
| 56 | 56 | } |