@@ -25,217 +25,217 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Wordlift_Entity_Link_Service { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * The entity type service. |
|
| 30 | - * |
|
| 31 | - * @since 3.6.0 |
|
| 32 | - * @access private |
|
| 33 | - * @var Wordlift_Entity_Post_Type_Service $entity_type_service The entity type service. |
|
| 34 | - */ |
|
| 35 | - private $entity_type_service; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * The entity post type slug. |
|
| 39 | - * |
|
| 40 | - * @since 3.6.0 |
|
| 41 | - * @access private |
|
| 42 | - * @var string $slug The entity post type slug. |
|
| 43 | - */ |
|
| 44 | - private $slug; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * A logger instance. |
|
| 48 | - * |
|
| 49 | - * @since 3.6.0 |
|
| 50 | - * @access private |
|
| 51 | - * @var Wordlift_Log_Service |
|
| 52 | - */ |
|
| 53 | - private $log; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Wordlift_Entity_Link_Service constructor. |
|
| 57 | - * |
|
| 58 | - * @since 3.6.0 |
|
| 59 | - * |
|
| 60 | - * @param Wordlift_Entity_Post_Type_Service $entity_type_service |
|
| 61 | - * @param string $slug The entity post type slug. |
|
| 62 | - */ |
|
| 63 | - public function __construct( $entity_type_service, $slug ) { |
|
| 64 | - |
|
| 65 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Link_Service' ); |
|
| 66 | - |
|
| 67 | - $this->entity_type_service = $entity_type_service; |
|
| 68 | - $this->slug = $slug; |
|
| 69 | - |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Intercept link generation to posts in order to customize links to entities. |
|
| 74 | - * |
|
| 75 | - * @since 3.6.0 |
|
| 76 | - * |
|
| 77 | - * @param string $post_link The post's permalink. |
|
| 78 | - * @param WP_Post $post The post in question. |
|
| 79 | - * @param bool $leavename Whether to keep the post name. |
|
| 80 | - * @param bool $sample Is it a sample permalink. |
|
| 81 | - * |
|
| 82 | - * @return string The link to the post. |
|
| 83 | - */ |
|
| 84 | - public function post_type_link( $post_link, $post, $leavename, $sample ) { |
|
| 85 | - |
|
| 86 | - // Return the post link if this is not our post type. |
|
| 87 | - if ( ! empty( $this->slug ) || $this->entity_type_service->get_post_type() !== get_post_type( $post ) ) { |
|
| 88 | - return $post_link; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - // Replace /slug/post_name/ with /post_name/ |
|
| 92 | - // The slug comes from the Entity Type Service since that service is responsible for registering the default |
|
| 93 | - // slug. |
|
| 94 | - return str_replace( "/{$this->entity_type_service->get_slug()}/$post->post_name/", "/$post->post_name/", $post_link ); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Alter the query to look for our own custom type. |
|
| 99 | - * |
|
| 100 | - * @since 3.6.0 |
|
| 101 | - * |
|
| 102 | - * @param WP_Query $query |
|
| 103 | - */ |
|
| 104 | - public function pre_get_posts( $query ) { |
|
| 105 | - |
|
| 106 | - // If a slug has been set, we don't need to alter the query. |
|
| 107 | - if ( ! empty( $this->slug ) ) { |
|
| 108 | - return; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - // Check if it's a query we should extend with our own custom post type. |
|
| 112 | - // |
|
| 113 | - // The `$query->query` count could be > 2 if the preview parameter is passed too. |
|
| 114 | - // |
|
| 115 | - // See https://github.com/insideout10/wordlift-plugin/issues/439 |
|
| 116 | - if ( ! $query->is_main_query() || 2 > count( $query->query ) || ! isset( $query->query['page'] ) || empty( $query->query['name'] ) ) { |
|
| 117 | - return; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - // Add our own post type to the query. |
|
| 121 | - $post_types = '' === $query->get( 'post_type' ) |
|
| 122 | - ? Wordlift_Entity_Service::valid_entity_post_types() |
|
| 123 | - : array_merge( (array) $query->get( 'post_type' ), (array) $this->entity_type_service->get_post_type() ); |
|
| 124 | - $query->set( 'post_type', $post_types ); |
|
| 125 | - |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Hook to WordPress' wp_unique_post_slug_is_bad_flat_slug filter. This is called when a page is saved. |
|
| 130 | - * |
|
| 131 | - * @since 3.6.0 |
|
| 132 | - * |
|
| 133 | - * @param bool $bad_slug Whether the post slug would be bad as a flat slug. |
|
| 134 | - * @param string $slug The post slug. |
|
| 135 | - * @param string $post_type Post type. |
|
| 136 | - * |
|
| 137 | - * @return bool Whether the slug is bad. |
|
| 138 | - */ |
|
| 139 | - public function wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ) { |
|
| 140 | - |
|
| 141 | - // The list of post types that might have conflicting slugs. |
|
| 142 | - $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 143 | - |
|
| 144 | - // Ignore post types different from the ones we need to check. |
|
| 145 | - if ( ! in_array( $post_type, $post_types ) ) { |
|
| 146 | - return $bad_slug; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - $exists = $this->slug_exists( $slug, $post_types ); |
|
| 150 | - |
|
| 151 | - $this->log->debug( "Checking if a slug exists [ post type :: $post_type ][ slug :: $slug ][ exists :: " . ( $exists ? 'yes' : 'no' ) . ' ]' ); |
|
| 152 | - |
|
| 153 | - return $exists; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Hook to WordPress' wp_unique_post_slug_is_bad_hierarchical_slug filter. This is called when a page is saved. |
|
| 158 | - * |
|
| 159 | - * @since 3.6.0 |
|
| 160 | - * |
|
| 161 | - * @param bool $bad_slug Whether the post slug would be bad as a flat slug. |
|
| 162 | - * @param string $slug The post slug. |
|
| 163 | - * @param string $post_type Post type. |
|
| 164 | - * @param int $post_parent |
|
| 165 | - * |
|
| 166 | - * @return bool Whether the slug is bad. |
|
| 167 | - */ |
|
| 168 | - public function wp_unique_post_slug_is_bad_hierarchical_slug( $bad_slug, $slug, $post_type, $post_parent ) { |
|
| 169 | - |
|
| 170 | - // We only care about pages here. |
|
| 171 | - if ( 'page' !== $post_type ) { |
|
| 172 | - return $bad_slug; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - // We redirect the call to the flat hook, this means that this check is going to solve also the 6-years old issue |
|
| 176 | - // about overlapping slugs among pages and posts: |
|
| 177 | - // https://core.trac.wordpress.org/ticket/13459 |
|
| 178 | - return $this->wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Check whether a slug exists already for the specified post types. |
|
| 183 | - * |
|
| 184 | - * @since 3.6.0 |
|
| 185 | - * |
|
| 186 | - * @param string $slug The slug. |
|
| 187 | - * @param array $post_types An array of post types. |
|
| 188 | - * |
|
| 189 | - * @return bool True if the slug exists, otherwise false. |
|
| 190 | - */ |
|
| 191 | - private function slug_exists( $slug, $post_types ) { |
|
| 192 | - global $wpdb; |
|
| 193 | - |
|
| 194 | - // Loop through all post types and check |
|
| 195 | - // whether they have archive pages and if |
|
| 196 | - // the archive slug matches the post slug. |
|
| 197 | - // |
|
| 198 | - // Note that the condition below checks only post types used by WordLift. |
|
| 199 | - // We don't check other post types for archive pages, |
|
| 200 | - // because this is a job of WordPress. |
|
| 201 | - // |
|
| 202 | - // There is a open ticket that should solve this, when it's merged: |
|
| 203 | - // https://core.trac.wordpress.org/ticket/13459 |
|
| 204 | - foreach ( $post_types as $post_type ) { |
|
| 205 | - |
|
| 206 | - // Get the post type object for current post type. |
|
| 207 | - $post_type_object = get_post_type_object( $post_type ); |
|
| 208 | - |
|
| 209 | - if ( |
|
| 210 | - // Check whetherthe post type object is not empty. |
|
| 211 | - ! empty( $post_type_object ) && |
|
| 212 | - // And the post type has archive page. |
|
| 213 | - $post_type_object->has_archive && |
|
| 214 | - // And `rewrite` options exists.. |
|
| 215 | - ! empty( $post_type_object->rewrite ) && |
|
| 216 | - // And the `rewrite` slug property is not empty. |
|
| 217 | - ! empty( $post_type_object->rewrite['slug'] ) && |
|
| 218 | - // And if the rewrite slug equals to the slug. |
|
| 219 | - $post_type_object->rewrite['slug'] === $slug |
|
| 220 | - ) { |
|
| 221 | - // Return true which means that the slug is already in use. |
|
| 222 | - return true; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - // Post slugs must be unique across all posts. |
|
| 228 | - $check_sql = $wpdb->prepare( |
|
| 229 | - "SELECT post_name |
|
| 28 | + /** |
|
| 29 | + * The entity type service. |
|
| 30 | + * |
|
| 31 | + * @since 3.6.0 |
|
| 32 | + * @access private |
|
| 33 | + * @var Wordlift_Entity_Post_Type_Service $entity_type_service The entity type service. |
|
| 34 | + */ |
|
| 35 | + private $entity_type_service; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * The entity post type slug. |
|
| 39 | + * |
|
| 40 | + * @since 3.6.0 |
|
| 41 | + * @access private |
|
| 42 | + * @var string $slug The entity post type slug. |
|
| 43 | + */ |
|
| 44 | + private $slug; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * A logger instance. |
|
| 48 | + * |
|
| 49 | + * @since 3.6.0 |
|
| 50 | + * @access private |
|
| 51 | + * @var Wordlift_Log_Service |
|
| 52 | + */ |
|
| 53 | + private $log; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Wordlift_Entity_Link_Service constructor. |
|
| 57 | + * |
|
| 58 | + * @since 3.6.0 |
|
| 59 | + * |
|
| 60 | + * @param Wordlift_Entity_Post_Type_Service $entity_type_service |
|
| 61 | + * @param string $slug The entity post type slug. |
|
| 62 | + */ |
|
| 63 | + public function __construct( $entity_type_service, $slug ) { |
|
| 64 | + |
|
| 65 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Link_Service' ); |
|
| 66 | + |
|
| 67 | + $this->entity_type_service = $entity_type_service; |
|
| 68 | + $this->slug = $slug; |
|
| 69 | + |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Intercept link generation to posts in order to customize links to entities. |
|
| 74 | + * |
|
| 75 | + * @since 3.6.0 |
|
| 76 | + * |
|
| 77 | + * @param string $post_link The post's permalink. |
|
| 78 | + * @param WP_Post $post The post in question. |
|
| 79 | + * @param bool $leavename Whether to keep the post name. |
|
| 80 | + * @param bool $sample Is it a sample permalink. |
|
| 81 | + * |
|
| 82 | + * @return string The link to the post. |
|
| 83 | + */ |
|
| 84 | + public function post_type_link( $post_link, $post, $leavename, $sample ) { |
|
| 85 | + |
|
| 86 | + // Return the post link if this is not our post type. |
|
| 87 | + if ( ! empty( $this->slug ) || $this->entity_type_service->get_post_type() !== get_post_type( $post ) ) { |
|
| 88 | + return $post_link; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + // Replace /slug/post_name/ with /post_name/ |
|
| 92 | + // The slug comes from the Entity Type Service since that service is responsible for registering the default |
|
| 93 | + // slug. |
|
| 94 | + return str_replace( "/{$this->entity_type_service->get_slug()}/$post->post_name/", "/$post->post_name/", $post_link ); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Alter the query to look for our own custom type. |
|
| 99 | + * |
|
| 100 | + * @since 3.6.0 |
|
| 101 | + * |
|
| 102 | + * @param WP_Query $query |
|
| 103 | + */ |
|
| 104 | + public function pre_get_posts( $query ) { |
|
| 105 | + |
|
| 106 | + // If a slug has been set, we don't need to alter the query. |
|
| 107 | + if ( ! empty( $this->slug ) ) { |
|
| 108 | + return; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + // Check if it's a query we should extend with our own custom post type. |
|
| 112 | + // |
|
| 113 | + // The `$query->query` count could be > 2 if the preview parameter is passed too. |
|
| 114 | + // |
|
| 115 | + // See https://github.com/insideout10/wordlift-plugin/issues/439 |
|
| 116 | + if ( ! $query->is_main_query() || 2 > count( $query->query ) || ! isset( $query->query['page'] ) || empty( $query->query['name'] ) ) { |
|
| 117 | + return; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + // Add our own post type to the query. |
|
| 121 | + $post_types = '' === $query->get( 'post_type' ) |
|
| 122 | + ? Wordlift_Entity_Service::valid_entity_post_types() |
|
| 123 | + : array_merge( (array) $query->get( 'post_type' ), (array) $this->entity_type_service->get_post_type() ); |
|
| 124 | + $query->set( 'post_type', $post_types ); |
|
| 125 | + |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Hook to WordPress' wp_unique_post_slug_is_bad_flat_slug filter. This is called when a page is saved. |
|
| 130 | + * |
|
| 131 | + * @since 3.6.0 |
|
| 132 | + * |
|
| 133 | + * @param bool $bad_slug Whether the post slug would be bad as a flat slug. |
|
| 134 | + * @param string $slug The post slug. |
|
| 135 | + * @param string $post_type Post type. |
|
| 136 | + * |
|
| 137 | + * @return bool Whether the slug is bad. |
|
| 138 | + */ |
|
| 139 | + public function wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ) { |
|
| 140 | + |
|
| 141 | + // The list of post types that might have conflicting slugs. |
|
| 142 | + $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
|
| 143 | + |
|
| 144 | + // Ignore post types different from the ones we need to check. |
|
| 145 | + if ( ! in_array( $post_type, $post_types ) ) { |
|
| 146 | + return $bad_slug; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + $exists = $this->slug_exists( $slug, $post_types ); |
|
| 150 | + |
|
| 151 | + $this->log->debug( "Checking if a slug exists [ post type :: $post_type ][ slug :: $slug ][ exists :: " . ( $exists ? 'yes' : 'no' ) . ' ]' ); |
|
| 152 | + |
|
| 153 | + return $exists; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Hook to WordPress' wp_unique_post_slug_is_bad_hierarchical_slug filter. This is called when a page is saved. |
|
| 158 | + * |
|
| 159 | + * @since 3.6.0 |
|
| 160 | + * |
|
| 161 | + * @param bool $bad_slug Whether the post slug would be bad as a flat slug. |
|
| 162 | + * @param string $slug The post slug. |
|
| 163 | + * @param string $post_type Post type. |
|
| 164 | + * @param int $post_parent |
|
| 165 | + * |
|
| 166 | + * @return bool Whether the slug is bad. |
|
| 167 | + */ |
|
| 168 | + public function wp_unique_post_slug_is_bad_hierarchical_slug( $bad_slug, $slug, $post_type, $post_parent ) { |
|
| 169 | + |
|
| 170 | + // We only care about pages here. |
|
| 171 | + if ( 'page' !== $post_type ) { |
|
| 172 | + return $bad_slug; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + // We redirect the call to the flat hook, this means that this check is going to solve also the 6-years old issue |
|
| 176 | + // about overlapping slugs among pages and posts: |
|
| 177 | + // https://core.trac.wordpress.org/ticket/13459 |
|
| 178 | + return $this->wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Check whether a slug exists already for the specified post types. |
|
| 183 | + * |
|
| 184 | + * @since 3.6.0 |
|
| 185 | + * |
|
| 186 | + * @param string $slug The slug. |
|
| 187 | + * @param array $post_types An array of post types. |
|
| 188 | + * |
|
| 189 | + * @return bool True if the slug exists, otherwise false. |
|
| 190 | + */ |
|
| 191 | + private function slug_exists( $slug, $post_types ) { |
|
| 192 | + global $wpdb; |
|
| 193 | + |
|
| 194 | + // Loop through all post types and check |
|
| 195 | + // whether they have archive pages and if |
|
| 196 | + // the archive slug matches the post slug. |
|
| 197 | + // |
|
| 198 | + // Note that the condition below checks only post types used by WordLift. |
|
| 199 | + // We don't check other post types for archive pages, |
|
| 200 | + // because this is a job of WordPress. |
|
| 201 | + // |
|
| 202 | + // There is a open ticket that should solve this, when it's merged: |
|
| 203 | + // https://core.trac.wordpress.org/ticket/13459 |
|
| 204 | + foreach ( $post_types as $post_type ) { |
|
| 205 | + |
|
| 206 | + // Get the post type object for current post type. |
|
| 207 | + $post_type_object = get_post_type_object( $post_type ); |
|
| 208 | + |
|
| 209 | + if ( |
|
| 210 | + // Check whetherthe post type object is not empty. |
|
| 211 | + ! empty( $post_type_object ) && |
|
| 212 | + // And the post type has archive page. |
|
| 213 | + $post_type_object->has_archive && |
|
| 214 | + // And `rewrite` options exists.. |
|
| 215 | + ! empty( $post_type_object->rewrite ) && |
|
| 216 | + // And the `rewrite` slug property is not empty. |
|
| 217 | + ! empty( $post_type_object->rewrite['slug'] ) && |
|
| 218 | + // And if the rewrite slug equals to the slug. |
|
| 219 | + $post_type_object->rewrite['slug'] === $slug |
|
| 220 | + ) { |
|
| 221 | + // Return true which means that the slug is already in use. |
|
| 222 | + return true; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + // Post slugs must be unique across all posts. |
|
| 228 | + $check_sql = $wpdb->prepare( |
|
| 229 | + "SELECT post_name |
|
| 230 | 230 | FROM $wpdb->posts |
| 231 | 231 | WHERE post_name = %s |
| 232 | 232 | AND post_type IN ('" . implode( "', '", array_map( 'esc_sql', $post_types ) ) . "') |
| 233 | 233 | LIMIT 1 |
| 234 | 234 | ", |
| 235 | - $slug |
|
| 236 | - ); |
|
| 235 | + $slug |
|
| 236 | + ); |
|
| 237 | 237 | |
| 238 | - return null !== $wpdb->get_var( $check_sql ); |
|
| 239 | - } |
|
| 238 | + return null !== $wpdb->get_var( $check_sql ); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param Wordlift_Entity_Post_Type_Service $entity_type_service |
| 61 | 61 | * @param string $slug The entity post type slug. |
| 62 | 62 | */ |
| 63 | - public function __construct( $entity_type_service, $slug ) { |
|
| 63 | + public function __construct($entity_type_service, $slug) { |
|
| 64 | 64 | |
| 65 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Link_Service' ); |
|
| 65 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Link_Service'); |
|
| 66 | 66 | |
| 67 | 67 | $this->entity_type_service = $entity_type_service; |
| 68 | 68 | $this->slug = $slug; |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return string The link to the post. |
| 83 | 83 | */ |
| 84 | - public function post_type_link( $post_link, $post, $leavename, $sample ) { |
|
| 84 | + public function post_type_link($post_link, $post, $leavename, $sample) { |
|
| 85 | 85 | |
| 86 | 86 | // Return the post link if this is not our post type. |
| 87 | - if ( ! empty( $this->slug ) || $this->entity_type_service->get_post_type() !== get_post_type( $post ) ) { |
|
| 87 | + if ( ! empty($this->slug) || $this->entity_type_service->get_post_type() !== get_post_type($post)) { |
|
| 88 | 88 | return $post_link; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Replace /slug/post_name/ with /post_name/ |
| 92 | 92 | // The slug comes from the Entity Type Service since that service is responsible for registering the default |
| 93 | 93 | // slug. |
| 94 | - return str_replace( "/{$this->entity_type_service->get_slug()}/$post->post_name/", "/$post->post_name/", $post_link ); |
|
| 94 | + return str_replace("/{$this->entity_type_service->get_slug()}/$post->post_name/", "/$post->post_name/", $post_link); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param WP_Query $query |
| 103 | 103 | */ |
| 104 | - public function pre_get_posts( $query ) { |
|
| 104 | + public function pre_get_posts($query) { |
|
| 105 | 105 | |
| 106 | 106 | // If a slug has been set, we don't need to alter the query. |
| 107 | - if ( ! empty( $this->slug ) ) { |
|
| 107 | + if ( ! empty($this->slug)) { |
|
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | // The `$query->query` count could be > 2 if the preview parameter is passed too. |
| 114 | 114 | // |
| 115 | 115 | // See https://github.com/insideout10/wordlift-plugin/issues/439 |
| 116 | - if ( ! $query->is_main_query() || 2 > count( $query->query ) || ! isset( $query->query['page'] ) || empty( $query->query['name'] ) ) { |
|
| 116 | + if ( ! $query->is_main_query() || 2 > count($query->query) || ! isset($query->query['page']) || empty($query->query['name'])) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Add our own post type to the query. |
| 121 | - $post_types = '' === $query->get( 'post_type' ) |
|
| 121 | + $post_types = '' === $query->get('post_type') |
|
| 122 | 122 | ? Wordlift_Entity_Service::valid_entity_post_types() |
| 123 | - : array_merge( (array) $query->get( 'post_type' ), (array) $this->entity_type_service->get_post_type() ); |
|
| 124 | - $query->set( 'post_type', $post_types ); |
|
| 123 | + : array_merge((array) $query->get('post_type'), (array) $this->entity_type_service->get_post_type()); |
|
| 124 | + $query->set('post_type', $post_types); |
|
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | |
@@ -136,19 +136,19 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return bool Whether the slug is bad. |
| 138 | 138 | */ |
| 139 | - public function wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ) { |
|
| 139 | + public function wp_unique_post_slug_is_bad_flat_slug($bad_slug, $slug, $post_type) { |
|
| 140 | 140 | |
| 141 | 141 | // The list of post types that might have conflicting slugs. |
| 142 | 142 | $post_types = Wordlift_Entity_Service::valid_entity_post_types(); |
| 143 | 143 | |
| 144 | 144 | // Ignore post types different from the ones we need to check. |
| 145 | - if ( ! in_array( $post_type, $post_types ) ) { |
|
| 145 | + if ( ! in_array($post_type, $post_types)) { |
|
| 146 | 146 | return $bad_slug; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $exists = $this->slug_exists( $slug, $post_types ); |
|
| 149 | + $exists = $this->slug_exists($slug, $post_types); |
|
| 150 | 150 | |
| 151 | - $this->log->debug( "Checking if a slug exists [ post type :: $post_type ][ slug :: $slug ][ exists :: " . ( $exists ? 'yes' : 'no' ) . ' ]' ); |
|
| 151 | + $this->log->debug("Checking if a slug exists [ post type :: $post_type ][ slug :: $slug ][ exists :: ".($exists ? 'yes' : 'no').' ]'); |
|
| 152 | 152 | |
| 153 | 153 | return $exists; |
| 154 | 154 | } |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return bool Whether the slug is bad. |
| 167 | 167 | */ |
| 168 | - public function wp_unique_post_slug_is_bad_hierarchical_slug( $bad_slug, $slug, $post_type, $post_parent ) { |
|
| 168 | + public function wp_unique_post_slug_is_bad_hierarchical_slug($bad_slug, $slug, $post_type, $post_parent) { |
|
| 169 | 169 | |
| 170 | 170 | // We only care about pages here. |
| 171 | - if ( 'page' !== $post_type ) { |
|
| 171 | + if ('page' !== $post_type) { |
|
| 172 | 172 | return $bad_slug; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // We redirect the call to the flat hook, this means that this check is going to solve also the 6-years old issue |
| 176 | 176 | // about overlapping slugs among pages and posts: |
| 177 | 177 | // https://core.trac.wordpress.org/ticket/13459 |
| 178 | - return $this->wp_unique_post_slug_is_bad_flat_slug( $bad_slug, $slug, $post_type ); |
|
| 178 | + return $this->wp_unique_post_slug_is_bad_flat_slug($bad_slug, $slug, $post_type); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @return bool True if the slug exists, otherwise false. |
| 190 | 190 | */ |
| 191 | - private function slug_exists( $slug, $post_types ) { |
|
| 191 | + private function slug_exists($slug, $post_types) { |
|
| 192 | 192 | global $wpdb; |
| 193 | 193 | |
| 194 | 194 | // Loop through all post types and check |
@@ -201,20 +201,20 @@ discard block |
||
| 201 | 201 | // |
| 202 | 202 | // There is a open ticket that should solve this, when it's merged: |
| 203 | 203 | // https://core.trac.wordpress.org/ticket/13459 |
| 204 | - foreach ( $post_types as $post_type ) { |
|
| 204 | + foreach ($post_types as $post_type) { |
|
| 205 | 205 | |
| 206 | 206 | // Get the post type object for current post type. |
| 207 | - $post_type_object = get_post_type_object( $post_type ); |
|
| 207 | + $post_type_object = get_post_type_object($post_type); |
|
| 208 | 208 | |
| 209 | 209 | if ( |
| 210 | 210 | // Check whetherthe post type object is not empty. |
| 211 | - ! empty( $post_type_object ) && |
|
| 211 | + ! empty($post_type_object) && |
|
| 212 | 212 | // And the post type has archive page. |
| 213 | 213 | $post_type_object->has_archive && |
| 214 | 214 | // And `rewrite` options exists.. |
| 215 | - ! empty( $post_type_object->rewrite ) && |
|
| 215 | + ! empty($post_type_object->rewrite) && |
|
| 216 | 216 | // And the `rewrite` slug property is not empty. |
| 217 | - ! empty( $post_type_object->rewrite['slug'] ) && |
|
| 217 | + ! empty($post_type_object->rewrite['slug']) && |
|
| 218 | 218 | // And if the rewrite slug equals to the slug. |
| 219 | 219 | $post_type_object->rewrite['slug'] === $slug |
| 220 | 220 | ) { |
@@ -229,13 +229,13 @@ discard block |
||
| 229 | 229 | "SELECT post_name |
| 230 | 230 | FROM $wpdb->posts |
| 231 | 231 | WHERE post_name = %s |
| 232 | - AND post_type IN ('" . implode( "', '", array_map( 'esc_sql', $post_types ) ) . "') |
|
| 232 | + AND post_type IN ('".implode("', '", array_map('esc_sql', $post_types))."') |
|
| 233 | 233 | LIMIT 1 |
| 234 | 234 | ", |
| 235 | 235 | $slug |
| 236 | 236 | ); |
| 237 | 237 | |
| 238 | - return null !== $wpdb->get_var( $check_sql ); |
|
| 238 | + return null !== $wpdb->get_var($check_sql); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | } |
@@ -28,1585 +28,1585 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift { |
| 30 | 30 | |
| 31 | - //<editor-fold desc="## FIELDS"> |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | - * the plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access protected |
|
| 39 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | - */ |
|
| 41 | - protected $loader; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * The unique identifier of this plugin. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @access protected |
|
| 48 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | - */ |
|
| 50 | - protected $plugin_name; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The current version of the plugin. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - * @access protected |
|
| 57 | - * @var string $version The current version of the plugin. |
|
| 58 | - */ |
|
| 59 | - protected $version; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.12.0 |
|
| 65 | - * @access protected |
|
| 66 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | - */ |
|
| 68 | - protected $tinymce_adapter; |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The Thumbnail service. |
|
| 72 | - * |
|
| 73 | - * @since 3.1.5 |
|
| 74 | - * @access private |
|
| 75 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | - */ |
|
| 77 | - private $thumbnail_service; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The UI service. |
|
| 81 | - * |
|
| 82 | - * @since 3.2.0 |
|
| 83 | - * @access private |
|
| 84 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | - */ |
|
| 86 | - private $ui_service; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * The Schema service. |
|
| 90 | - * |
|
| 91 | - * @since 3.3.0 |
|
| 92 | - * @access protected |
|
| 93 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | - */ |
|
| 95 | - protected $schema_service; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * The Entity service. |
|
| 99 | - * |
|
| 100 | - * @since 3.1.0 |
|
| 101 | - * @access protected |
|
| 102 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | - */ |
|
| 104 | - protected $entity_service; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * The Topic Taxonomy service. |
|
| 108 | - * |
|
| 109 | - * @since 3.5.0 |
|
| 110 | - * @access private |
|
| 111 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | - */ |
|
| 113 | - private $topic_taxonomy_service; |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * The Entity Types Taxonomy service. |
|
| 117 | - * |
|
| 118 | - * @since 3.18.0 |
|
| 119 | - * @access private |
|
| 120 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | - */ |
|
| 122 | - private $entity_types_taxonomy_service; |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * The User service. |
|
| 126 | - * |
|
| 127 | - * @since 3.1.7 |
|
| 128 | - * @access protected |
|
| 129 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | - */ |
|
| 131 | - protected $user_service; |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * The Timeline service. |
|
| 135 | - * |
|
| 136 | - * @since 3.1.0 |
|
| 137 | - * @access private |
|
| 138 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | - */ |
|
| 140 | - private $timeline_service; |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * The Redirect service. |
|
| 144 | - * |
|
| 145 | - * @since 3.2.0 |
|
| 146 | - * @access private |
|
| 147 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | - */ |
|
| 149 | - private $redirect_service; |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * The Notice service. |
|
| 153 | - * |
|
| 154 | - * @since 3.3.0 |
|
| 155 | - * @access private |
|
| 156 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | - */ |
|
| 158 | - private $notice_service; |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * The Entity list customization. |
|
| 162 | - * |
|
| 163 | - * @since 3.3.0 |
|
| 164 | - * @access protected |
|
| 165 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | - */ |
|
| 167 | - protected $entity_list_service; |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Entity Types Taxonomy Walker. |
|
| 171 | - * |
|
| 172 | - * @since 3.1.0 |
|
| 173 | - * @access private |
|
| 174 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | - */ |
|
| 176 | - private $entity_types_taxonomy_walker; |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * The ShareThis service. |
|
| 180 | - * |
|
| 181 | - * @since 3.2.0 |
|
| 182 | - * @access private |
|
| 183 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | - */ |
|
| 185 | - private $sharethis_service; |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * The PrimaShop adapter. |
|
| 189 | - * |
|
| 190 | - * @since 3.2.3 |
|
| 191 | - * @access private |
|
| 192 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | - */ |
|
| 194 | - private $primashop_adapter; |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * The WordLift Dashboard adapter. |
|
| 198 | - * |
|
| 199 | - * @since 3.4.0 |
|
| 200 | - * @access private |
|
| 201 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | - */ |
|
| 203 | - private $dashboard_service; |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * The entity type service. |
|
| 207 | - * |
|
| 208 | - * @since 3.6.0 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | - */ |
|
| 212 | - private $entity_post_type_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | - * |
|
| 217 | - * @since 3.6.0 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_Entity_Link_Service |
|
| 220 | - */ |
|
| 221 | - private $entity_link_service; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access protected |
|
| 228 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | - */ |
|
| 230 | - protected $sparql_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * A {@link Wordlift_Import_Service} instance. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $import_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | - * |
|
| 244 | - * @since 3.6.0 |
|
| 245 | - * @access private |
|
| 246 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | - */ |
|
| 248 | - private $rebuild_service; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | - * |
|
| 253 | - * @since 3.7.0 |
|
| 254 | - * @access protected |
|
| 255 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | - */ |
|
| 257 | - protected $jsonld_service; |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | - * |
|
| 262 | - * @since 3.14.0 |
|
| 263 | - * @access protected |
|
| 264 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | - */ |
|
| 266 | - protected $jsonld_website_converter; |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | - * |
|
| 271 | - * @since 3.7.0 |
|
| 272 | - * @access private |
|
| 273 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | - */ |
|
| 275 | - private $property_factory; |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * The 'Download Your Data' page. |
|
| 279 | - * |
|
| 280 | - * @since 3.6.0 |
|
| 281 | - * @access private |
|
| 282 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | - */ |
|
| 284 | - private $download_your_data_page; |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * The 'WordLift Settings' page. |
|
| 288 | - * |
|
| 289 | - * @since 3.11.0 |
|
| 290 | - * @access protected |
|
| 291 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | - */ |
|
| 293 | - protected $settings_page; |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * The 'WordLift Batch analysis' page. |
|
| 297 | - * |
|
| 298 | - * @since 3.14.0 |
|
| 299 | - * @access protected |
|
| 300 | - * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | - */ |
|
| 302 | - protected $batch_analysis_page; |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * The install wizard page. |
|
| 306 | - * |
|
| 307 | - * @since 3.9.0 |
|
| 308 | - * @access private |
|
| 309 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | - */ |
|
| 311 | - private $admin_setup; |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | - * linking of entities to their pages. |
|
| 316 | - * |
|
| 317 | - * @since 3.8.0 |
|
| 318 | - * @access private |
|
| 319 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | - */ |
|
| 321 | - private $content_filter_service; |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | - * |
|
| 326 | - * @since 3.9.0 |
|
| 327 | - * @access private |
|
| 328 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | - */ |
|
| 330 | - private $key_validation_service; |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | - * |
|
| 335 | - * @since 3.10.0 |
|
| 336 | - * @access private |
|
| 337 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | - */ |
|
| 339 | - private $rating_service; |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | - * |
|
| 344 | - * @since 3.10.0 |
|
| 345 | - * @access protected |
|
| 346 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | - */ |
|
| 348 | - protected $post_to_jsonld_converter; |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | - * |
|
| 353 | - * @since 3.10.0 |
|
| 354 | - * @access protected |
|
| 355 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | - */ |
|
| 357 | - protected $configuration_service; |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * A {@link Wordlift_Install_Service} instance. |
|
| 361 | - * |
|
| 362 | - * @since 3.18.0 |
|
| 363 | - * @access protected |
|
| 364 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | - */ |
|
| 366 | - protected $install_service; |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | - * |
|
| 371 | - * @since 3.10.0 |
|
| 372 | - * @access protected |
|
| 373 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | - */ |
|
| 375 | - protected $entity_type_service; |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | - * |
|
| 380 | - * @since 3.10.0 |
|
| 381 | - * @access protected |
|
| 382 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | - */ |
|
| 384 | - protected $entity_post_to_jsonld_converter; |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | - * |
|
| 389 | - * @since 3.10.0 |
|
| 390 | - * @access protected |
|
| 391 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | - */ |
|
| 393 | - protected $postid_to_jsonld_converter; |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | - * |
|
| 398 | - * @since 3.9.8 |
|
| 399 | - * @access private |
|
| 400 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | - */ |
|
| 402 | - private $status_page; |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | - * |
|
| 407 | - * @since 3.11.0 |
|
| 408 | - * @access protected |
|
| 409 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | - */ |
|
| 411 | - protected $category_taxonomy_service; |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | - * |
|
| 416 | - * @since 3.11.0 |
|
| 417 | - * @access protected |
|
| 418 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | - */ |
|
| 420 | - protected $entity_page_service; |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | - * |
|
| 425 | - * @since 3.11.0 |
|
| 426 | - * @access protected |
|
| 427 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | - */ |
|
| 429 | - protected $settings_page_action_link; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 433 | - * |
|
| 434 | - * @since 3.11.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 437 | - */ |
|
| 438 | - protected $publisher_ajax_adapter; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 442 | - * |
|
| 443 | - * @since 3.11.0 |
|
| 444 | - * @access protected |
|
| 445 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 446 | - */ |
|
| 447 | - protected $input_element; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 451 | - * |
|
| 452 | - * @since 3.13.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 455 | - */ |
|
| 456 | - protected $radio_input_element; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 464 | - */ |
|
| 465 | - protected $language_select_element; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 469 | - * |
|
| 470 | - * @since 3.11.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 473 | - */ |
|
| 474 | - protected $publisher_element; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 482 | - */ |
|
| 483 | - protected $select2_element; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The controller for the entity type list admin page |
|
| 487 | - * |
|
| 488 | - * @since 3.11.0 |
|
| 489 | - * @access private |
|
| 490 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 491 | - */ |
|
| 492 | - private $entity_type_admin_page; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The controller for the entity type settings admin page |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access private |
|
| 499 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 500 | - */ |
|
| 501 | - private $entity_type_settings_admin_page; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 509 | - */ |
|
| 510 | - protected $related_entities_cloud_widget; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 514 | - * |
|
| 515 | - * @since 3.14.0 |
|
| 516 | - * @access protected |
|
| 517 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 518 | - */ |
|
| 519 | - protected $author_element; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 523 | - * |
|
| 524 | - * @since 3.14.0 |
|
| 525 | - * @access protected |
|
| 526 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 527 | - */ |
|
| 528 | - protected $batch_analysis_service; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 532 | - * |
|
| 533 | - * @since 3.12.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 536 | - */ |
|
| 537 | - protected $sample_data_service; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 541 | - * |
|
| 542 | - * @since 3.12.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 545 | - */ |
|
| 546 | - protected $sample_data_ajax_adapter; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 550 | - * |
|
| 551 | - * @since 3.14.2 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 554 | - */ |
|
| 555 | - private $batch_analysis_adapter; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 559 | - * |
|
| 560 | - * @since 3.14.3 |
|
| 561 | - * @access private |
|
| 562 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 563 | - */ |
|
| 564 | - private $relation_rebuild_service; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 568 | - * |
|
| 569 | - * @since 3.14.3 |
|
| 570 | - * @access private |
|
| 571 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 572 | - */ |
|
| 573 | - private $relation_rebuild_adapter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.18.0 |
|
| 579 | - * @access private |
|
| 580 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 581 | - */ |
|
| 582 | - private $reference_rebuild_service; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.16.0 |
|
| 588 | - * @access protected |
|
| 589 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 590 | - */ |
|
| 591 | - protected $google_analytics_export_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * {@link Wordlift}'s singleton instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.15.0 |
|
| 597 | - * @access protected |
|
| 598 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 599 | - */ |
|
| 600 | - protected $entity_type_adapter; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.15.0 |
|
| 606 | - * @access protected |
|
| 607 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 608 | - */ |
|
| 609 | - protected $linked_data_service; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.15.0 |
|
| 615 | - * @access protected |
|
| 616 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 617 | - */ |
|
| 618 | - protected $storage_factory; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.15.0 |
|
| 624 | - * @access protected |
|
| 625 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 626 | - */ |
|
| 627 | - protected $rendition_factory; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.15.0 |
|
| 633 | - * @access private |
|
| 634 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 635 | - */ |
|
| 636 | - private $autocomplete_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.15.0 |
|
| 642 | - * @access private |
|
| 643 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 644 | - */ |
|
| 645 | - private $autocomplete_adapter; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 653 | - */ |
|
| 654 | - protected $relation_service; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.16.0 |
|
| 660 | - * @access protected |
|
| 661 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 662 | - * |
|
| 663 | - */ |
|
| 664 | - protected $cached_postid_to_jsonld_converter; |
|
| 665 | - |
|
| 666 | - /** |
|
| 667 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
| 668 | - * |
|
| 669 | - * @since 3.16.0 |
|
| 670 | - * @access protected |
|
| 671 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 672 | - */ |
|
| 673 | - protected $file_cache_service; |
|
| 674 | - |
|
| 675 | - /** |
|
| 676 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 677 | - * |
|
| 678 | - * @since 3.16.3 |
|
| 679 | - * @access protected |
|
| 680 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 681 | - */ |
|
| 682 | - protected $entity_uri_service; |
|
| 683 | - |
|
| 684 | - /** |
|
| 685 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 686 | - * |
|
| 687 | - * @since 3.19.0 |
|
| 688 | - * @access protected |
|
| 689 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 690 | - */ |
|
| 691 | - protected $publisher_service; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * {@link Wordlift}'s singleton instance. |
|
| 695 | - * |
|
| 696 | - * @since 3.11.2 |
|
| 697 | - * @access private |
|
| 698 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 699 | - */ |
|
| 700 | - private static $instance; |
|
| 701 | - //</editor-fold> |
|
| 702 | - |
|
| 703 | - /** |
|
| 704 | - * Define the core functionality of the plugin. |
|
| 705 | - * |
|
| 706 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 707 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 708 | - * the public-facing side of the site. |
|
| 709 | - * |
|
| 710 | - * @since 1.0.0 |
|
| 711 | - */ |
|
| 712 | - public function __construct() { |
|
| 713 | - |
|
| 714 | - $this->plugin_name = 'wordlift'; |
|
| 715 | - $this->version = '3.19.0-dev'; |
|
| 716 | - $this->load_dependencies(); |
|
| 717 | - $this->set_locale(); |
|
| 718 | - $this->define_admin_hooks(); |
|
| 719 | - $this->define_public_hooks(); |
|
| 720 | - |
|
| 721 | - // If we're in `WP_CLI` load the related files. |
|
| 722 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 723 | - $this->load_cli_dependencies(); |
|
| 724 | - } |
|
| 725 | - |
|
| 726 | - self::$instance = $this; |
|
| 727 | - |
|
| 728 | - } |
|
| 729 | - |
|
| 730 | - /** |
|
| 731 | - * Get the singleton instance. |
|
| 732 | - * |
|
| 733 | - * @since 3.11.2 |
|
| 734 | - * |
|
| 735 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 736 | - */ |
|
| 737 | - public static function get_instance() { |
|
| 738 | - |
|
| 739 | - return self::$instance; |
|
| 740 | - } |
|
| 741 | - |
|
| 742 | - /** |
|
| 743 | - * Load the required dependencies for this plugin. |
|
| 744 | - * |
|
| 745 | - * Include the following files that make up the plugin: |
|
| 746 | - * |
|
| 747 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 748 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 749 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 750 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 751 | - * |
|
| 752 | - * Create an instance of the loader which will be used to register the hooks |
|
| 753 | - * with WordPress. |
|
| 754 | - * |
|
| 755 | - * @since 1.0.0 |
|
| 756 | - * @access private |
|
| 757 | - */ |
|
| 758 | - private function load_dependencies() { |
|
| 759 | - |
|
| 760 | - /** |
|
| 761 | - * The class responsible for orchestrating the actions and filters of the |
|
| 762 | - * core plugin. |
|
| 763 | - */ |
|
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * The class responsible for defining internationalization functionality |
|
| 768 | - * of the plugin. |
|
| 769 | - */ |
|
| 770 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 771 | - |
|
| 772 | - /** |
|
| 773 | - * WordLift's supported languages. |
|
| 774 | - */ |
|
| 775 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 776 | - |
|
| 777 | - /** |
|
| 778 | - * Provide support functions to sanitize data. |
|
| 779 | - */ |
|
| 780 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 781 | - |
|
| 782 | - /** Installs. */ |
|
| 783 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 785 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 787 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 790 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 791 | - |
|
| 792 | - /** Services. */ |
|
| 793 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 796 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 797 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 798 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * The Query builder. |
|
| 805 | - */ |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * The Schema service. |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * The schema:url property service. |
|
| 815 | - */ |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 818 | - |
|
| 819 | - /** |
|
| 820 | - * The UI service. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * The Thumbnail service. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 828 | - |
|
| 829 | - /** |
|
| 830 | - * The Entity Types Taxonomy service. |
|
| 831 | - */ |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 833 | - |
|
| 834 | - /** |
|
| 835 | - * The Entity service. |
|
| 836 | - */ |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 839 | - |
|
| 840 | - // Add the entity rating service. |
|
| 841 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 842 | - |
|
| 843 | - /** |
|
| 844 | - * The User service. |
|
| 845 | - */ |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 847 | - |
|
| 848 | - /** |
|
| 849 | - * The Timeline service. |
|
| 850 | - */ |
|
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 852 | - |
|
| 853 | - /** |
|
| 854 | - * The Topic Taxonomy service. |
|
| 855 | - */ |
|
| 856 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 857 | - |
|
| 858 | - /** |
|
| 859 | - * The SPARQL service. |
|
| 860 | - */ |
|
| 861 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 862 | - |
|
| 863 | - /** |
|
| 864 | - * The WordLift import service. |
|
| 865 | - */ |
|
| 866 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 867 | - |
|
| 868 | - /** |
|
| 869 | - * The WordLift URI service. |
|
| 870 | - */ |
|
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 872 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 877 | - */ |
|
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 880 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 881 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 882 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 883 | - |
|
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 886 | - |
|
| 887 | - /** |
|
| 888 | - * Load the converters. |
|
| 889 | - */ |
|
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 896 | - |
|
| 897 | - /** |
|
| 898 | - * Load cache-related files. |
|
| 899 | - */ |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * Load the content filter. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 906 | - |
|
| 907 | - /* |
|
| 31 | + //<editor-fold desc="## FIELDS"> |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 35 | + * the plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access protected |
|
| 39 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 40 | + */ |
|
| 41 | + protected $loader; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * The unique identifier of this plugin. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @access protected |
|
| 48 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 49 | + */ |
|
| 50 | + protected $plugin_name; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The current version of the plugin. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + * @access protected |
|
| 57 | + * @var string $version The current version of the plugin. |
|
| 58 | + */ |
|
| 59 | + protected $version; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.12.0 |
|
| 65 | + * @access protected |
|
| 66 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 67 | + */ |
|
| 68 | + protected $tinymce_adapter; |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The Thumbnail service. |
|
| 72 | + * |
|
| 73 | + * @since 3.1.5 |
|
| 74 | + * @access private |
|
| 75 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 76 | + */ |
|
| 77 | + private $thumbnail_service; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The UI service. |
|
| 81 | + * |
|
| 82 | + * @since 3.2.0 |
|
| 83 | + * @access private |
|
| 84 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 85 | + */ |
|
| 86 | + private $ui_service; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * The Schema service. |
|
| 90 | + * |
|
| 91 | + * @since 3.3.0 |
|
| 92 | + * @access protected |
|
| 93 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 94 | + */ |
|
| 95 | + protected $schema_service; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * The Entity service. |
|
| 99 | + * |
|
| 100 | + * @since 3.1.0 |
|
| 101 | + * @access protected |
|
| 102 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 103 | + */ |
|
| 104 | + protected $entity_service; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * The Topic Taxonomy service. |
|
| 108 | + * |
|
| 109 | + * @since 3.5.0 |
|
| 110 | + * @access private |
|
| 111 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 112 | + */ |
|
| 113 | + private $topic_taxonomy_service; |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * The Entity Types Taxonomy service. |
|
| 117 | + * |
|
| 118 | + * @since 3.18.0 |
|
| 119 | + * @access private |
|
| 120 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 121 | + */ |
|
| 122 | + private $entity_types_taxonomy_service; |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * The User service. |
|
| 126 | + * |
|
| 127 | + * @since 3.1.7 |
|
| 128 | + * @access protected |
|
| 129 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 130 | + */ |
|
| 131 | + protected $user_service; |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * The Timeline service. |
|
| 135 | + * |
|
| 136 | + * @since 3.1.0 |
|
| 137 | + * @access private |
|
| 138 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 139 | + */ |
|
| 140 | + private $timeline_service; |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * The Redirect service. |
|
| 144 | + * |
|
| 145 | + * @since 3.2.0 |
|
| 146 | + * @access private |
|
| 147 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 148 | + */ |
|
| 149 | + private $redirect_service; |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * The Notice service. |
|
| 153 | + * |
|
| 154 | + * @since 3.3.0 |
|
| 155 | + * @access private |
|
| 156 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 157 | + */ |
|
| 158 | + private $notice_service; |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * The Entity list customization. |
|
| 162 | + * |
|
| 163 | + * @since 3.3.0 |
|
| 164 | + * @access protected |
|
| 165 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 166 | + */ |
|
| 167 | + protected $entity_list_service; |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Entity Types Taxonomy Walker. |
|
| 171 | + * |
|
| 172 | + * @since 3.1.0 |
|
| 173 | + * @access private |
|
| 174 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 175 | + */ |
|
| 176 | + private $entity_types_taxonomy_walker; |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * The ShareThis service. |
|
| 180 | + * |
|
| 181 | + * @since 3.2.0 |
|
| 182 | + * @access private |
|
| 183 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 184 | + */ |
|
| 185 | + private $sharethis_service; |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * The PrimaShop adapter. |
|
| 189 | + * |
|
| 190 | + * @since 3.2.3 |
|
| 191 | + * @access private |
|
| 192 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 193 | + */ |
|
| 194 | + private $primashop_adapter; |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * The WordLift Dashboard adapter. |
|
| 198 | + * |
|
| 199 | + * @since 3.4.0 |
|
| 200 | + * @access private |
|
| 201 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 202 | + */ |
|
| 203 | + private $dashboard_service; |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * The entity type service. |
|
| 207 | + * |
|
| 208 | + * @since 3.6.0 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 211 | + */ |
|
| 212 | + private $entity_post_type_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 216 | + * |
|
| 217 | + * @since 3.6.0 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_Entity_Link_Service |
|
| 220 | + */ |
|
| 221 | + private $entity_link_service; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access protected |
|
| 228 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 229 | + */ |
|
| 230 | + protected $sparql_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * A {@link Wordlift_Import_Service} instance. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $import_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 243 | + * |
|
| 244 | + * @since 3.6.0 |
|
| 245 | + * @access private |
|
| 246 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 247 | + */ |
|
| 248 | + private $rebuild_service; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 252 | + * |
|
| 253 | + * @since 3.7.0 |
|
| 254 | + * @access protected |
|
| 255 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 256 | + */ |
|
| 257 | + protected $jsonld_service; |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 261 | + * |
|
| 262 | + * @since 3.14.0 |
|
| 263 | + * @access protected |
|
| 264 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 265 | + */ |
|
| 266 | + protected $jsonld_website_converter; |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 270 | + * |
|
| 271 | + * @since 3.7.0 |
|
| 272 | + * @access private |
|
| 273 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 274 | + */ |
|
| 275 | + private $property_factory; |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * The 'Download Your Data' page. |
|
| 279 | + * |
|
| 280 | + * @since 3.6.0 |
|
| 281 | + * @access private |
|
| 282 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 283 | + */ |
|
| 284 | + private $download_your_data_page; |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * The 'WordLift Settings' page. |
|
| 288 | + * |
|
| 289 | + * @since 3.11.0 |
|
| 290 | + * @access protected |
|
| 291 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 292 | + */ |
|
| 293 | + protected $settings_page; |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * The 'WordLift Batch analysis' page. |
|
| 297 | + * |
|
| 298 | + * @since 3.14.0 |
|
| 299 | + * @access protected |
|
| 300 | + * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
| 301 | + */ |
|
| 302 | + protected $batch_analysis_page; |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * The install wizard page. |
|
| 306 | + * |
|
| 307 | + * @since 3.9.0 |
|
| 308 | + * @access private |
|
| 309 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 310 | + */ |
|
| 311 | + private $admin_setup; |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 315 | + * linking of entities to their pages. |
|
| 316 | + * |
|
| 317 | + * @since 3.8.0 |
|
| 318 | + * @access private |
|
| 319 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 320 | + */ |
|
| 321 | + private $content_filter_service; |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 325 | + * |
|
| 326 | + * @since 3.9.0 |
|
| 327 | + * @access private |
|
| 328 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 329 | + */ |
|
| 330 | + private $key_validation_service; |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 334 | + * |
|
| 335 | + * @since 3.10.0 |
|
| 336 | + * @access private |
|
| 337 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 338 | + */ |
|
| 339 | + private $rating_service; |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 343 | + * |
|
| 344 | + * @since 3.10.0 |
|
| 345 | + * @access protected |
|
| 346 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 347 | + */ |
|
| 348 | + protected $post_to_jsonld_converter; |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 352 | + * |
|
| 353 | + * @since 3.10.0 |
|
| 354 | + * @access protected |
|
| 355 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 356 | + */ |
|
| 357 | + protected $configuration_service; |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * A {@link Wordlift_Install_Service} instance. |
|
| 361 | + * |
|
| 362 | + * @since 3.18.0 |
|
| 363 | + * @access protected |
|
| 364 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 365 | + */ |
|
| 366 | + protected $install_service; |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 370 | + * |
|
| 371 | + * @since 3.10.0 |
|
| 372 | + * @access protected |
|
| 373 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 374 | + */ |
|
| 375 | + protected $entity_type_service; |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 379 | + * |
|
| 380 | + * @since 3.10.0 |
|
| 381 | + * @access protected |
|
| 382 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 383 | + */ |
|
| 384 | + protected $entity_post_to_jsonld_converter; |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 388 | + * |
|
| 389 | + * @since 3.10.0 |
|
| 390 | + * @access protected |
|
| 391 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 392 | + */ |
|
| 393 | + protected $postid_to_jsonld_converter; |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 397 | + * |
|
| 398 | + * @since 3.9.8 |
|
| 399 | + * @access private |
|
| 400 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 401 | + */ |
|
| 402 | + private $status_page; |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 406 | + * |
|
| 407 | + * @since 3.11.0 |
|
| 408 | + * @access protected |
|
| 409 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 410 | + */ |
|
| 411 | + protected $category_taxonomy_service; |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
| 415 | + * |
|
| 416 | + * @since 3.11.0 |
|
| 417 | + * @access protected |
|
| 418 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 419 | + */ |
|
| 420 | + protected $entity_page_service; |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 424 | + * |
|
| 425 | + * @since 3.11.0 |
|
| 426 | + * @access protected |
|
| 427 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 428 | + */ |
|
| 429 | + protected $settings_page_action_link; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 433 | + * |
|
| 434 | + * @since 3.11.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 437 | + */ |
|
| 438 | + protected $publisher_ajax_adapter; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 442 | + * |
|
| 443 | + * @since 3.11.0 |
|
| 444 | + * @access protected |
|
| 445 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 446 | + */ |
|
| 447 | + protected $input_element; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 451 | + * |
|
| 452 | + * @since 3.13.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 455 | + */ |
|
| 456 | + protected $radio_input_element; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 464 | + */ |
|
| 465 | + protected $language_select_element; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 469 | + * |
|
| 470 | + * @since 3.11.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 473 | + */ |
|
| 474 | + protected $publisher_element; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 482 | + */ |
|
| 483 | + protected $select2_element; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The controller for the entity type list admin page |
|
| 487 | + * |
|
| 488 | + * @since 3.11.0 |
|
| 489 | + * @access private |
|
| 490 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 491 | + */ |
|
| 492 | + private $entity_type_admin_page; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The controller for the entity type settings admin page |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access private |
|
| 499 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 500 | + */ |
|
| 501 | + private $entity_type_settings_admin_page; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 509 | + */ |
|
| 510 | + protected $related_entities_cloud_widget; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 514 | + * |
|
| 515 | + * @since 3.14.0 |
|
| 516 | + * @access protected |
|
| 517 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 518 | + */ |
|
| 519 | + protected $author_element; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 523 | + * |
|
| 524 | + * @since 3.14.0 |
|
| 525 | + * @access protected |
|
| 526 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 527 | + */ |
|
| 528 | + protected $batch_analysis_service; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 532 | + * |
|
| 533 | + * @since 3.12.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 536 | + */ |
|
| 537 | + protected $sample_data_service; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 541 | + * |
|
| 542 | + * @since 3.12.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 545 | + */ |
|
| 546 | + protected $sample_data_ajax_adapter; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 550 | + * |
|
| 551 | + * @since 3.14.2 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 554 | + */ |
|
| 555 | + private $batch_analysis_adapter; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 559 | + * |
|
| 560 | + * @since 3.14.3 |
|
| 561 | + * @access private |
|
| 562 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 563 | + */ |
|
| 564 | + private $relation_rebuild_service; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 568 | + * |
|
| 569 | + * @since 3.14.3 |
|
| 570 | + * @access private |
|
| 571 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 572 | + */ |
|
| 573 | + private $relation_rebuild_adapter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.18.0 |
|
| 579 | + * @access private |
|
| 580 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 581 | + */ |
|
| 582 | + private $reference_rebuild_service; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.16.0 |
|
| 588 | + * @access protected |
|
| 589 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 590 | + */ |
|
| 591 | + protected $google_analytics_export_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * {@link Wordlift}'s singleton instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.15.0 |
|
| 597 | + * @access protected |
|
| 598 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 599 | + */ |
|
| 600 | + protected $entity_type_adapter; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.15.0 |
|
| 606 | + * @access protected |
|
| 607 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 608 | + */ |
|
| 609 | + protected $linked_data_service; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.15.0 |
|
| 615 | + * @access protected |
|
| 616 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 617 | + */ |
|
| 618 | + protected $storage_factory; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.15.0 |
|
| 624 | + * @access protected |
|
| 625 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 626 | + */ |
|
| 627 | + protected $rendition_factory; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.15.0 |
|
| 633 | + * @access private |
|
| 634 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 635 | + */ |
|
| 636 | + private $autocomplete_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.15.0 |
|
| 642 | + * @access private |
|
| 643 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 644 | + */ |
|
| 645 | + private $autocomplete_adapter; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 653 | + */ |
|
| 654 | + protected $relation_service; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.16.0 |
|
| 660 | + * @access protected |
|
| 661 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 662 | + * |
|
| 663 | + */ |
|
| 664 | + protected $cached_postid_to_jsonld_converter; |
|
| 665 | + |
|
| 666 | + /** |
|
| 667 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
| 668 | + * |
|
| 669 | + * @since 3.16.0 |
|
| 670 | + * @access protected |
|
| 671 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 672 | + */ |
|
| 673 | + protected $file_cache_service; |
|
| 674 | + |
|
| 675 | + /** |
|
| 676 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 677 | + * |
|
| 678 | + * @since 3.16.3 |
|
| 679 | + * @access protected |
|
| 680 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 681 | + */ |
|
| 682 | + protected $entity_uri_service; |
|
| 683 | + |
|
| 684 | + /** |
|
| 685 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 686 | + * |
|
| 687 | + * @since 3.19.0 |
|
| 688 | + * @access protected |
|
| 689 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 690 | + */ |
|
| 691 | + protected $publisher_service; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * {@link Wordlift}'s singleton instance. |
|
| 695 | + * |
|
| 696 | + * @since 3.11.2 |
|
| 697 | + * @access private |
|
| 698 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 699 | + */ |
|
| 700 | + private static $instance; |
|
| 701 | + //</editor-fold> |
|
| 702 | + |
|
| 703 | + /** |
|
| 704 | + * Define the core functionality of the plugin. |
|
| 705 | + * |
|
| 706 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 707 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 708 | + * the public-facing side of the site. |
|
| 709 | + * |
|
| 710 | + * @since 1.0.0 |
|
| 711 | + */ |
|
| 712 | + public function __construct() { |
|
| 713 | + |
|
| 714 | + $this->plugin_name = 'wordlift'; |
|
| 715 | + $this->version = '3.19.0-dev'; |
|
| 716 | + $this->load_dependencies(); |
|
| 717 | + $this->set_locale(); |
|
| 718 | + $this->define_admin_hooks(); |
|
| 719 | + $this->define_public_hooks(); |
|
| 720 | + |
|
| 721 | + // If we're in `WP_CLI` load the related files. |
|
| 722 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 723 | + $this->load_cli_dependencies(); |
|
| 724 | + } |
|
| 725 | + |
|
| 726 | + self::$instance = $this; |
|
| 727 | + |
|
| 728 | + } |
|
| 729 | + |
|
| 730 | + /** |
|
| 731 | + * Get the singleton instance. |
|
| 732 | + * |
|
| 733 | + * @since 3.11.2 |
|
| 734 | + * |
|
| 735 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 736 | + */ |
|
| 737 | + public static function get_instance() { |
|
| 738 | + |
|
| 739 | + return self::$instance; |
|
| 740 | + } |
|
| 741 | + |
|
| 742 | + /** |
|
| 743 | + * Load the required dependencies for this plugin. |
|
| 744 | + * |
|
| 745 | + * Include the following files that make up the plugin: |
|
| 746 | + * |
|
| 747 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 748 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 749 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 750 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 751 | + * |
|
| 752 | + * Create an instance of the loader which will be used to register the hooks |
|
| 753 | + * with WordPress. |
|
| 754 | + * |
|
| 755 | + * @since 1.0.0 |
|
| 756 | + * @access private |
|
| 757 | + */ |
|
| 758 | + private function load_dependencies() { |
|
| 759 | + |
|
| 760 | + /** |
|
| 761 | + * The class responsible for orchestrating the actions and filters of the |
|
| 762 | + * core plugin. |
|
| 763 | + */ |
|
| 764 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * The class responsible for defining internationalization functionality |
|
| 768 | + * of the plugin. |
|
| 769 | + */ |
|
| 770 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 771 | + |
|
| 772 | + /** |
|
| 773 | + * WordLift's supported languages. |
|
| 774 | + */ |
|
| 775 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 776 | + |
|
| 777 | + /** |
|
| 778 | + * Provide support functions to sanitize data. |
|
| 779 | + */ |
|
| 780 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 781 | + |
|
| 782 | + /** Installs. */ |
|
| 783 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 784 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 785 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 786 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 787 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 788 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 789 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 790 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 791 | + |
|
| 792 | + /** Services. */ |
|
| 793 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 794 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 796 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 797 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 798 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 799 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 800 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * The Query builder. |
|
| 805 | + */ |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * The Schema service. |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * The schema:url property service. |
|
| 815 | + */ |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * The UI service. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * The Thumbnail service. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 828 | + |
|
| 829 | + /** |
|
| 830 | + * The Entity Types Taxonomy service. |
|
| 831 | + */ |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 833 | + |
|
| 834 | + /** |
|
| 835 | + * The Entity service. |
|
| 836 | + */ |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 839 | + |
|
| 840 | + // Add the entity rating service. |
|
| 841 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 842 | + |
|
| 843 | + /** |
|
| 844 | + * The User service. |
|
| 845 | + */ |
|
| 846 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 847 | + |
|
| 848 | + /** |
|
| 849 | + * The Timeline service. |
|
| 850 | + */ |
|
| 851 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 852 | + |
|
| 853 | + /** |
|
| 854 | + * The Topic Taxonomy service. |
|
| 855 | + */ |
|
| 856 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 857 | + |
|
| 858 | + /** |
|
| 859 | + * The SPARQL service. |
|
| 860 | + */ |
|
| 861 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 862 | + |
|
| 863 | + /** |
|
| 864 | + * The WordLift import service. |
|
| 865 | + */ |
|
| 866 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 867 | + |
|
| 868 | + /** |
|
| 869 | + * The WordLift URI service. |
|
| 870 | + */ |
|
| 871 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 872 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 877 | + */ |
|
| 878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 879 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 880 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 881 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 882 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 883 | + |
|
| 884 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 885 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 886 | + |
|
| 887 | + /** |
|
| 888 | + * Load the converters. |
|
| 889 | + */ |
|
| 890 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 891 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 892 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 894 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 895 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 896 | + |
|
| 897 | + /** |
|
| 898 | + * Load cache-related files. |
|
| 899 | + */ |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * Load the content filter. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 906 | + |
|
| 907 | + /* |
|
| 908 | 908 | * Load the excerpt helper. |
| 909 | 909 | */ |
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 911 | - |
|
| 912 | - /** |
|
| 913 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 914 | - * |
|
| 915 | - * @since 3.8.0 |
|
| 916 | - */ |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 918 | - |
|
| 919 | - // The Publisher Service and the AJAX adapter. |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 922 | - |
|
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 924 | - |
|
| 925 | - /** |
|
| 926 | - * Load the WordLift key validation service. |
|
| 927 | - */ |
|
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 929 | - |
|
| 930 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 932 | - |
|
| 933 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 936 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 937 | - |
|
| 938 | - /** Linked Data. */ |
|
| 939 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 940 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 941 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 942 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 950 | - |
|
| 951 | - /** Linked Data Rendition. */ |
|
| 952 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 956 | - |
|
| 957 | - /** Services. */ |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 959 | - |
|
| 960 | - /** Adapters. */ |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 965 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 966 | - |
|
| 967 | - /** Async Tasks. */ |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 973 | - |
|
| 974 | - /** Async Tasks. */ |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 977 | - |
|
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 979 | - |
|
| 980 | - /** |
|
| 981 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 982 | - */ |
|
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 984 | - |
|
| 985 | - /** |
|
| 986 | - * The class to customize the entity list admin page. |
|
| 987 | - */ |
|
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 989 | - |
|
| 990 | - /** |
|
| 991 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 992 | - */ |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 994 | - |
|
| 995 | - /** |
|
| 996 | - * The Notice service. |
|
| 997 | - */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 999 | - |
|
| 1000 | - /** |
|
| 1001 | - * The PrimaShop adapter. |
|
| 1002 | - */ |
|
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1004 | - |
|
| 1005 | - /** |
|
| 1006 | - * The WordLift Dashboard service. |
|
| 1007 | - */ |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1009 | - |
|
| 1010 | - /** |
|
| 1011 | - * The admin 'Install wizard' page. |
|
| 1012 | - */ |
|
| 1013 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1014 | - |
|
| 1015 | - /** |
|
| 1016 | - * The WordLift entity type list admin page controller. |
|
| 1017 | - */ |
|
| 1018 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1019 | - |
|
| 1020 | - /** |
|
| 1021 | - * The WordLift entity type settings admin page controller. |
|
| 1022 | - */ |
|
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1024 | - |
|
| 1025 | - /** |
|
| 1026 | - * The admin 'Download Your Data' page. |
|
| 1027 | - */ |
|
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1029 | - |
|
| 1030 | - /** |
|
| 1031 | - * The admin 'WordLift Settings' page. |
|
| 1032 | - */ |
|
| 1033 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 1034 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 1037 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 1038 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 1039 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1042 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1043 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1044 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1045 | - |
|
| 1046 | - /** Admin Pages */ |
|
| 1047 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1049 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1051 | - |
|
| 1052 | - /** |
|
| 1053 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1054 | - * side of the site. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The shortcode abstract class. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The Timeline shortcode. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1067 | - |
|
| 1068 | - /** |
|
| 1069 | - * The Navigator shortcode. |
|
| 1070 | - */ |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1072 | - |
|
| 1073 | - /** |
|
| 1074 | - * The chord shortcode. |
|
| 1075 | - */ |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1077 | - |
|
| 1078 | - /** |
|
| 1079 | - * The geomap shortcode. |
|
| 1080 | - */ |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1082 | - |
|
| 1083 | - /** |
|
| 1084 | - * The entity cloud shortcode. |
|
| 1085 | - */ |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1087 | - |
|
| 1088 | - /** |
|
| 1089 | - * The entity glossary shortcode. |
|
| 1090 | - */ |
|
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1093 | - |
|
| 1094 | - /** |
|
| 1095 | - * The ShareThis service. |
|
| 1096 | - */ |
|
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1098 | - |
|
| 1099 | - /** |
|
| 1100 | - * The SEO service. |
|
| 1101 | - */ |
|
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1103 | - |
|
| 1104 | - /** |
|
| 1105 | - * The AMP service. |
|
| 1106 | - */ |
|
| 1107 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1108 | - |
|
| 1109 | - /** Widgets */ |
|
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1112 | - |
|
| 1113 | - $this->loader = new Wordlift_Loader(); |
|
| 1114 | - |
|
| 1115 | - // Instantiate a global logger. |
|
| 1116 | - global $wl_logger; |
|
| 1117 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1118 | - |
|
| 1119 | - // Load the `wl-api` end-point. |
|
| 1120 | - new Wordlift_Http_Api(); |
|
| 1121 | - |
|
| 1122 | - // Load the Install Service. |
|
| 1123 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1124 | - |
|
| 1125 | - /** Services. */ |
|
| 1126 | - // Create the configuration service. |
|
| 1127 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1128 | - |
|
| 1129 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1130 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1131 | - |
|
| 1132 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1133 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1134 | - |
|
| 1135 | - // Create an instance of the UI service. |
|
| 1136 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1137 | - |
|
| 1138 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1139 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1140 | - |
|
| 1141 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1142 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1143 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1144 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1145 | - |
|
| 1146 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1147 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1148 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1149 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1150 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1151 | - |
|
| 1152 | - // Instantiate the JSON-LD service. |
|
| 1153 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1154 | - |
|
| 1155 | - /** Linked Data. */ |
|
| 1156 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1157 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1158 | - |
|
| 1159 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1160 | - |
|
| 1161 | - // Create a new instance of the Redirect service. |
|
| 1162 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 1163 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1164 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1165 | - |
|
| 1166 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1167 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1168 | - |
|
| 1169 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 910 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 911 | + |
|
| 912 | + /** |
|
| 913 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 914 | + * |
|
| 915 | + * @since 3.8.0 |
|
| 916 | + */ |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 918 | + |
|
| 919 | + // The Publisher Service and the AJAX adapter. |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 922 | + |
|
| 923 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 924 | + |
|
| 925 | + /** |
|
| 926 | + * Load the WordLift key validation service. |
|
| 927 | + */ |
|
| 928 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 929 | + |
|
| 930 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 931 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 932 | + |
|
| 933 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 934 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 935 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 936 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 937 | + |
|
| 938 | + /** Linked Data. */ |
|
| 939 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 940 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 941 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 942 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 943 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 945 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 946 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 949 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 950 | + |
|
| 951 | + /** Linked Data Rendition. */ |
|
| 952 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 953 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 954 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 956 | + |
|
| 957 | + /** Services. */ |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 959 | + |
|
| 960 | + /** Adapters. */ |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 964 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 965 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 966 | + |
|
| 967 | + /** Async Tasks. */ |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 973 | + |
|
| 974 | + /** Async Tasks. */ |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 977 | + |
|
| 978 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 979 | + |
|
| 980 | + /** |
|
| 981 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 982 | + */ |
|
| 983 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 984 | + |
|
| 985 | + /** |
|
| 986 | + * The class to customize the entity list admin page. |
|
| 987 | + */ |
|
| 988 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 989 | + |
|
| 990 | + /** |
|
| 991 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 992 | + */ |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 994 | + |
|
| 995 | + /** |
|
| 996 | + * The Notice service. |
|
| 997 | + */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 999 | + |
|
| 1000 | + /** |
|
| 1001 | + * The PrimaShop adapter. |
|
| 1002 | + */ |
|
| 1003 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1004 | + |
|
| 1005 | + /** |
|
| 1006 | + * The WordLift Dashboard service. |
|
| 1007 | + */ |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1009 | + |
|
| 1010 | + /** |
|
| 1011 | + * The admin 'Install wizard' page. |
|
| 1012 | + */ |
|
| 1013 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1014 | + |
|
| 1015 | + /** |
|
| 1016 | + * The WordLift entity type list admin page controller. |
|
| 1017 | + */ |
|
| 1018 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1019 | + |
|
| 1020 | + /** |
|
| 1021 | + * The WordLift entity type settings admin page controller. |
|
| 1022 | + */ |
|
| 1023 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1024 | + |
|
| 1025 | + /** |
|
| 1026 | + * The admin 'Download Your Data' page. |
|
| 1027 | + */ |
|
| 1028 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1029 | + |
|
| 1030 | + /** |
|
| 1031 | + * The admin 'WordLift Settings' page. |
|
| 1032 | + */ |
|
| 1033 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 1034 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 1035 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 1037 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 1038 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 1039 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 1040 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1042 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1043 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1044 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1045 | + |
|
| 1046 | + /** Admin Pages */ |
|
| 1047 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1048 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1049 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1050 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1051 | + |
|
| 1052 | + /** |
|
| 1053 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1054 | + * side of the site. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The shortcode abstract class. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The Timeline shortcode. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1067 | + |
|
| 1068 | + /** |
|
| 1069 | + * The Navigator shortcode. |
|
| 1070 | + */ |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1072 | + |
|
| 1073 | + /** |
|
| 1074 | + * The chord shortcode. |
|
| 1075 | + */ |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1077 | + |
|
| 1078 | + /** |
|
| 1079 | + * The geomap shortcode. |
|
| 1080 | + */ |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1082 | + |
|
| 1083 | + /** |
|
| 1084 | + * The entity cloud shortcode. |
|
| 1085 | + */ |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1087 | + |
|
| 1088 | + /** |
|
| 1089 | + * The entity glossary shortcode. |
|
| 1090 | + */ |
|
| 1091 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1092 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1093 | + |
|
| 1094 | + /** |
|
| 1095 | + * The ShareThis service. |
|
| 1096 | + */ |
|
| 1097 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1098 | + |
|
| 1099 | + /** |
|
| 1100 | + * The SEO service. |
|
| 1101 | + */ |
|
| 1102 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1103 | + |
|
| 1104 | + /** |
|
| 1105 | + * The AMP service. |
|
| 1106 | + */ |
|
| 1107 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1108 | + |
|
| 1109 | + /** Widgets */ |
|
| 1110 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1112 | + |
|
| 1113 | + $this->loader = new Wordlift_Loader(); |
|
| 1114 | + |
|
| 1115 | + // Instantiate a global logger. |
|
| 1116 | + global $wl_logger; |
|
| 1117 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1118 | + |
|
| 1119 | + // Load the `wl-api` end-point. |
|
| 1120 | + new Wordlift_Http_Api(); |
|
| 1121 | + |
|
| 1122 | + // Load the Install Service. |
|
| 1123 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1124 | + |
|
| 1125 | + /** Services. */ |
|
| 1126 | + // Create the configuration service. |
|
| 1127 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1128 | + |
|
| 1129 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1130 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1131 | + |
|
| 1132 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1133 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1134 | + |
|
| 1135 | + // Create an instance of the UI service. |
|
| 1136 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1137 | + |
|
| 1138 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1139 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1140 | + |
|
| 1141 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1142 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1143 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1144 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1170 | 1145 | |
| 1171 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1146 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1147 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1148 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1149 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1150 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1172 | 1151 | |
| 1173 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1174 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1152 | + // Instantiate the JSON-LD service. |
|
| 1153 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1154 | + |
|
| 1155 | + /** Linked Data. */ |
|
| 1156 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1157 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1158 | + |
|
| 1159 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1160 | + |
|
| 1161 | + // Create a new instance of the Redirect service. |
|
| 1162 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 1163 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1164 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1175 | 1165 | |
| 1176 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1177 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1166 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1167 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1168 | + |
|
| 1169 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1170 | + |
|
| 1171 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1178 | 1172 | |
| 1179 | - // Create an instance of the PrimaShop adapter. |
|
| 1180 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1173 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1174 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1175 | + |
|
| 1176 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1177 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1178 | + |
|
| 1179 | + // Create an instance of the PrimaShop adapter. |
|
| 1180 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1181 | 1181 | |
| 1182 | - // Create an import service instance to hook later to WP's import function. |
|
| 1183 | - $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() ); |
|
| 1182 | + // Create an import service instance to hook later to WP's import function. |
|
| 1183 | + $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() ); |
|
| 1184 | 1184 | |
| 1185 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1185 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1186 | 1186 | |
| 1187 | - // Create the entity rating service. |
|
| 1188 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1187 | + // Create the entity rating service. |
|
| 1188 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1189 | 1189 | |
| 1190 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1191 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1190 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1191 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1192 | 1192 | |
| 1193 | - // Create a new instance of the Redirect service. |
|
| 1194 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1193 | + // Create a new instance of the Redirect service. |
|
| 1194 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1195 | 1195 | |
| 1196 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1197 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1198 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1199 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1196 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1197 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1198 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1199 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1200 | 1200 | |
| 1201 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1201 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1202 | 1202 | |
| 1203 | - // Instantiate the JSON-LD service. |
|
| 1204 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1205 | - $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 ); |
|
| 1206 | - $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 ); |
|
| 1207 | - $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 ); |
|
| 1208 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1209 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1210 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1203 | + // Instantiate the JSON-LD service. |
|
| 1204 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1205 | + $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 ); |
|
| 1206 | + $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 ); |
|
| 1207 | + $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 ); |
|
| 1208 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1209 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1210 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1211 | 1211 | |
| 1212 | 1212 | |
| 1213 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1214 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1215 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1216 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1217 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1218 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1213 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1214 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1215 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1216 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1217 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1218 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1219 | 1219 | |
| 1220 | - // Initialize the shortcodes. |
|
| 1221 | - new Wordlift_Navigator_Shortcode(); |
|
| 1222 | - new Wordlift_Chord_Shortcode(); |
|
| 1223 | - new Wordlift_Geomap_Shortcode(); |
|
| 1224 | - new Wordlift_Timeline_Shortcode(); |
|
| 1225 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1226 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1220 | + // Initialize the shortcodes. |
|
| 1221 | + new Wordlift_Navigator_Shortcode(); |
|
| 1222 | + new Wordlift_Chord_Shortcode(); |
|
| 1223 | + new Wordlift_Geomap_Shortcode(); |
|
| 1224 | + new Wordlift_Timeline_Shortcode(); |
|
| 1225 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1226 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1227 | 1227 | |
| 1228 | - // Initialize the SEO service. |
|
| 1229 | - new Wordlift_Seo_Service(); |
|
| 1228 | + // Initialize the SEO service. |
|
| 1229 | + new Wordlift_Seo_Service(); |
|
| 1230 | 1230 | |
| 1231 | - // Initialize the AMP service. |
|
| 1232 | - new Wordlift_AMP_Service(); |
|
| 1231 | + // Initialize the AMP service. |
|
| 1232 | + new Wordlift_AMP_Service(); |
|
| 1233 | 1233 | |
| 1234 | - /** Services. */ |
|
| 1235 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1234 | + /** Services. */ |
|
| 1235 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1236 | 1236 | |
| 1237 | - /** Adapters. */ |
|
| 1238 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1239 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1240 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1241 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1242 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1243 | - |
|
| 1244 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1245 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1246 | - $this->sparql_service, |
|
| 1247 | - $uri_service, |
|
| 1248 | - $this->reference_rebuild_service |
|
| 1249 | - ); |
|
| 1250 | - |
|
| 1251 | - /** Async Tasks. */ |
|
| 1252 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1253 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1254 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1255 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1256 | - new Wordlift_Push_References_Async_Task(); |
|
| 1257 | - |
|
| 1258 | - /** WL Autocomplete. */ |
|
| 1259 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1260 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1261 | - |
|
| 1262 | - /** WordPress Admin UI. */ |
|
| 1263 | - |
|
| 1264 | - // UI elements. |
|
| 1265 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1266 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1267 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1268 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1269 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1270 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1271 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1272 | - |
|
| 1273 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1274 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1275 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1276 | - |
|
| 1277 | - // Pages. |
|
| 1278 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1279 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1280 | - |
|
| 1281 | - // create an instance of the entity type list admin page controller. |
|
| 1282 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1283 | - |
|
| 1284 | - // create an instance of the entity type etting admin page controller. |
|
| 1285 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1286 | - |
|
| 1287 | - /** Widgets */ |
|
| 1288 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1289 | - |
|
| 1290 | - /* WordPress Admin. */ |
|
| 1291 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1292 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1293 | - |
|
| 1294 | - // Create an instance of the install wizard. |
|
| 1295 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1296 | - |
|
| 1297 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1298 | - |
|
| 1299 | - // User Profile. |
|
| 1300 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1301 | - |
|
| 1302 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1303 | - |
|
| 1304 | - // Load the debug service if WP is in debug mode. |
|
| 1305 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1306 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1307 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1308 | - } |
|
| 1309 | - |
|
| 1310 | - // Remote Image Service. |
|
| 1311 | - new Wordlift_Remote_Image_Service(); |
|
| 1312 | - } |
|
| 1313 | - |
|
| 1314 | - /** |
|
| 1315 | - * Define the locale for this plugin for internationalization. |
|
| 1316 | - * |
|
| 1317 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1318 | - * with WordPress. |
|
| 1319 | - * |
|
| 1320 | - * @since 1.0.0 |
|
| 1321 | - * @access private |
|
| 1322 | - */ |
|
| 1323 | - private function set_locale() { |
|
| 1324 | - |
|
| 1325 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1326 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1327 | - |
|
| 1328 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1329 | - |
|
| 1330 | - } |
|
| 1331 | - |
|
| 1332 | - /** |
|
| 1333 | - * Register all of the hooks related to the admin area functionality |
|
| 1334 | - * of the plugin. |
|
| 1335 | - * |
|
| 1336 | - * @since 1.0.0 |
|
| 1337 | - * @access private |
|
| 1338 | - */ |
|
| 1339 | - private function define_admin_hooks() { |
|
| 1340 | - |
|
| 1341 | - $plugin_admin = new Wordlift_Admin( |
|
| 1342 | - $this->get_plugin_name(), |
|
| 1343 | - $this->get_version(), |
|
| 1344 | - $this->configuration_service, |
|
| 1345 | - $this->notice_service, |
|
| 1346 | - $this->user_service |
|
| 1347 | - ); |
|
| 1348 | - |
|
| 1349 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1350 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1351 | - |
|
| 1352 | - // Hook the init action to taxonomy services. |
|
| 1353 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1354 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1355 | - |
|
| 1356 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1357 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1358 | - |
|
| 1359 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1360 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1361 | - |
|
| 1362 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1363 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1364 | - |
|
| 1365 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1366 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1367 | - |
|
| 1368 | - // Register custom allowed redirect hosts. |
|
| 1369 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1370 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1371 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1372 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1373 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1374 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1375 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1376 | - |
|
| 1377 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1378 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1379 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1380 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1381 | - |
|
| 1382 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1383 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1384 | - |
|
| 1385 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1386 | - // Add custom columns. |
|
| 1387 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1388 | - // no explicit entity as it prevents handling of other post types. |
|
| 1389 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1390 | - // Add 4W selection. |
|
| 1391 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1392 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1393 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1394 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1395 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1396 | - |
|
| 1397 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1398 | - // entities. |
|
| 1399 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1400 | - |
|
| 1401 | - // Filter imported post meta. |
|
| 1402 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1403 | - |
|
| 1404 | - // Notify the import service when an import starts and ends. |
|
| 1405 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1406 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1407 | - |
|
| 1408 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1409 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1410 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1411 | - |
|
| 1412 | - // Hook the menu to the Download Your Data page. |
|
| 1413 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1414 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1415 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1416 | - |
|
| 1417 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1418 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1419 | - |
|
| 1420 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1421 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1422 | - |
|
| 1423 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1424 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1425 | - |
|
| 1426 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1427 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1428 | - |
|
| 1429 | - // Hook the admin_init to the settings page. |
|
| 1430 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1431 | - |
|
| 1432 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1433 | - |
|
| 1434 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1435 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1436 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1437 | - // Add the functionality only if a flag is set in wp-config.php . |
|
| 1438 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1439 | - } |
|
| 1440 | - |
|
| 1441 | - // Hook key update. |
|
| 1442 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1443 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1444 | - |
|
| 1445 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1446 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1447 | - |
|
| 1448 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1449 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1450 | - |
|
| 1451 | - // Hook row actions for the entity type list admin. |
|
| 1452 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1453 | - |
|
| 1454 | - /** Ajax actions. */ |
|
| 1455 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1456 | - |
|
| 1457 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1458 | - // page on WordPress versions before 4.7. |
|
| 1459 | - global $wp_version; |
|
| 1460 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1461 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1462 | - } |
|
| 1463 | - |
|
| 1464 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1465 | - |
|
| 1466 | - /** Adapters. */ |
|
| 1467 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1468 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1469 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1470 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1471 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1472 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1473 | - |
|
| 1474 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1475 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1476 | - |
|
| 1477 | - |
|
| 1478 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1479 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1480 | - |
|
| 1481 | - // Handle the autocomplete request. |
|
| 1482 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1483 | - $this->autocomplete_adapter, |
|
| 1484 | - 'wl_autocomplete', |
|
| 1485 | - ) ); |
|
| 1486 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1487 | - $this->autocomplete_adapter, |
|
| 1488 | - 'wl_autocomplete', |
|
| 1489 | - ) ); |
|
| 1490 | - |
|
| 1491 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1492 | - if ( is_multisite() ) { |
|
| 1493 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1494 | - } |
|
| 1237 | + /** Adapters. */ |
|
| 1238 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1239 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1240 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1241 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1242 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1243 | + |
|
| 1244 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1245 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1246 | + $this->sparql_service, |
|
| 1247 | + $uri_service, |
|
| 1248 | + $this->reference_rebuild_service |
|
| 1249 | + ); |
|
| 1250 | + |
|
| 1251 | + /** Async Tasks. */ |
|
| 1252 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1253 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1254 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1255 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1256 | + new Wordlift_Push_References_Async_Task(); |
|
| 1257 | + |
|
| 1258 | + /** WL Autocomplete. */ |
|
| 1259 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1260 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1261 | + |
|
| 1262 | + /** WordPress Admin UI. */ |
|
| 1263 | + |
|
| 1264 | + // UI elements. |
|
| 1265 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1266 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1267 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1268 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1269 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1270 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1271 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1272 | + |
|
| 1273 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1274 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1275 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1276 | + |
|
| 1277 | + // Pages. |
|
| 1278 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1279 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1280 | + |
|
| 1281 | + // create an instance of the entity type list admin page controller. |
|
| 1282 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1283 | + |
|
| 1284 | + // create an instance of the entity type etting admin page controller. |
|
| 1285 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1286 | + |
|
| 1287 | + /** Widgets */ |
|
| 1288 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1289 | + |
|
| 1290 | + /* WordPress Admin. */ |
|
| 1291 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1292 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1293 | + |
|
| 1294 | + // Create an instance of the install wizard. |
|
| 1295 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1296 | + |
|
| 1297 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1298 | + |
|
| 1299 | + // User Profile. |
|
| 1300 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1301 | + |
|
| 1302 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1303 | + |
|
| 1304 | + // Load the debug service if WP is in debug mode. |
|
| 1305 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1306 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1307 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1308 | + } |
|
| 1309 | + |
|
| 1310 | + // Remote Image Service. |
|
| 1311 | + new Wordlift_Remote_Image_Service(); |
|
| 1312 | + } |
|
| 1313 | + |
|
| 1314 | + /** |
|
| 1315 | + * Define the locale for this plugin for internationalization. |
|
| 1316 | + * |
|
| 1317 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1318 | + * with WordPress. |
|
| 1319 | + * |
|
| 1320 | + * @since 1.0.0 |
|
| 1321 | + * @access private |
|
| 1322 | + */ |
|
| 1323 | + private function set_locale() { |
|
| 1324 | + |
|
| 1325 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1326 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1327 | + |
|
| 1328 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1329 | + |
|
| 1330 | + } |
|
| 1331 | + |
|
| 1332 | + /** |
|
| 1333 | + * Register all of the hooks related to the admin area functionality |
|
| 1334 | + * of the plugin. |
|
| 1335 | + * |
|
| 1336 | + * @since 1.0.0 |
|
| 1337 | + * @access private |
|
| 1338 | + */ |
|
| 1339 | + private function define_admin_hooks() { |
|
| 1340 | + |
|
| 1341 | + $plugin_admin = new Wordlift_Admin( |
|
| 1342 | + $this->get_plugin_name(), |
|
| 1343 | + $this->get_version(), |
|
| 1344 | + $this->configuration_service, |
|
| 1345 | + $this->notice_service, |
|
| 1346 | + $this->user_service |
|
| 1347 | + ); |
|
| 1348 | + |
|
| 1349 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1350 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1351 | + |
|
| 1352 | + // Hook the init action to taxonomy services. |
|
| 1353 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1354 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1355 | + |
|
| 1356 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1357 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1358 | + |
|
| 1359 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1360 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1361 | + |
|
| 1362 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1363 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1364 | + |
|
| 1365 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1366 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1367 | + |
|
| 1368 | + // Register custom allowed redirect hosts. |
|
| 1369 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1370 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1371 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1372 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1373 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1374 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1375 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1376 | + |
|
| 1377 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1378 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1379 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1380 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1381 | + |
|
| 1382 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1383 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1384 | + |
|
| 1385 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1386 | + // Add custom columns. |
|
| 1387 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1388 | + // no explicit entity as it prevents handling of other post types. |
|
| 1389 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1390 | + // Add 4W selection. |
|
| 1391 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1392 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1393 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1394 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1395 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1396 | + |
|
| 1397 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1398 | + // entities. |
|
| 1399 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1400 | + |
|
| 1401 | + // Filter imported post meta. |
|
| 1402 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1403 | + |
|
| 1404 | + // Notify the import service when an import starts and ends. |
|
| 1405 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1406 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1407 | + |
|
| 1408 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1409 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1410 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1411 | + |
|
| 1412 | + // Hook the menu to the Download Your Data page. |
|
| 1413 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1414 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1415 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1416 | + |
|
| 1417 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1418 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1419 | + |
|
| 1420 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1421 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1422 | + |
|
| 1423 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1424 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1425 | + |
|
| 1426 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1427 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1428 | + |
|
| 1429 | + // Hook the admin_init to the settings page. |
|
| 1430 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1431 | + |
|
| 1432 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1433 | + |
|
| 1434 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1435 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1436 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1437 | + // Add the functionality only if a flag is set in wp-config.php . |
|
| 1438 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1439 | + } |
|
| 1440 | + |
|
| 1441 | + // Hook key update. |
|
| 1442 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1443 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1444 | + |
|
| 1445 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1446 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1447 | + |
|
| 1448 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1449 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1450 | + |
|
| 1451 | + // Hook row actions for the entity type list admin. |
|
| 1452 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1453 | + |
|
| 1454 | + /** Ajax actions. */ |
|
| 1455 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1456 | + |
|
| 1457 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1458 | + // page on WordPress versions before 4.7. |
|
| 1459 | + global $wp_version; |
|
| 1460 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1461 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1462 | + } |
|
| 1463 | + |
|
| 1464 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1465 | + |
|
| 1466 | + /** Adapters. */ |
|
| 1467 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1468 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1469 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1470 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1471 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1472 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1473 | + |
|
| 1474 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1475 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1476 | + |
|
| 1477 | + |
|
| 1478 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1479 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1480 | + |
|
| 1481 | + // Handle the autocomplete request. |
|
| 1482 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1483 | + $this->autocomplete_adapter, |
|
| 1484 | + 'wl_autocomplete', |
|
| 1485 | + ) ); |
|
| 1486 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1487 | + $this->autocomplete_adapter, |
|
| 1488 | + 'wl_autocomplete', |
|
| 1489 | + ) ); |
|
| 1490 | + |
|
| 1491 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1492 | + if ( is_multisite() ) { |
|
| 1493 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1494 | + } |
|
| 1495 | 1495 | |
| 1496 | - } |
|
| 1496 | + } |
|
| 1497 | 1497 | |
| 1498 | - /** |
|
| 1499 | - * Register all of the hooks related to the public-facing functionality |
|
| 1500 | - * of the plugin. |
|
| 1501 | - * |
|
| 1502 | - * @since 1.0.0 |
|
| 1503 | - * @access private |
|
| 1504 | - */ |
|
| 1505 | - private function define_public_hooks() { |
|
| 1498 | + /** |
|
| 1499 | + * Register all of the hooks related to the public-facing functionality |
|
| 1500 | + * of the plugin. |
|
| 1501 | + * |
|
| 1502 | + * @since 1.0.0 |
|
| 1503 | + * @access private |
|
| 1504 | + */ |
|
| 1505 | + private function define_public_hooks() { |
|
| 1506 | 1506 | |
| 1507 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1507 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1508 | 1508 | |
| 1509 | - // Register the entity post type. |
|
| 1510 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1511 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1509 | + // Register the entity post type. |
|
| 1510 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1511 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1512 | 1512 | |
| 1513 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1514 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1515 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1516 | - $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 ); |
|
| 1517 | - $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 ); |
|
| 1513 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1514 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1515 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1516 | + $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 ); |
|
| 1517 | + $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 ); |
|
| 1518 | 1518 | |
| 1519 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1520 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1519 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1520 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1521 | 1521 | |
| 1522 | - // Hook the content filter service to add entity links. |
|
| 1523 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1524 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1525 | - } |
|
| 1526 | - |
|
| 1527 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1528 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1529 | - |
|
| 1530 | - // Hook the ShareThis service. |
|
| 1531 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1532 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1533 | - |
|
| 1534 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1535 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1536 | - |
|
| 1537 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1538 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1539 | - // to categories. |
|
| 1540 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1541 | - |
|
| 1542 | - /* |
|
| 1522 | + // Hook the content filter service to add entity links. |
|
| 1523 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1524 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1525 | + } |
|
| 1526 | + |
|
| 1527 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1528 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1529 | + |
|
| 1530 | + // Hook the ShareThis service. |
|
| 1531 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1532 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1533 | + |
|
| 1534 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1535 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1536 | + |
|
| 1537 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1538 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1539 | + // to categories. |
|
| 1540 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1541 | + |
|
| 1542 | + /* |
|
| 1543 | 1543 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1544 | 1544 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1545 | 1545 | * order of start time. |
| 1546 | 1546 | */ |
| 1547 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1548 | - |
|
| 1549 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1550 | - |
|
| 1551 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1552 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1553 | - |
|
| 1554 | - } |
|
| 1555 | - |
|
| 1556 | - /** |
|
| 1557 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1558 | - * |
|
| 1559 | - * @since 1.0.0 |
|
| 1560 | - */ |
|
| 1561 | - public function run() { |
|
| 1562 | - $this->loader->run(); |
|
| 1563 | - } |
|
| 1564 | - |
|
| 1565 | - /** |
|
| 1566 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1567 | - * WordPress and to define internationalization functionality. |
|
| 1568 | - * |
|
| 1569 | - * @since 1.0.0 |
|
| 1570 | - * @return string The name of the plugin. |
|
| 1571 | - */ |
|
| 1572 | - public function get_plugin_name() { |
|
| 1573 | - return $this->plugin_name; |
|
| 1574 | - } |
|
| 1575 | - |
|
| 1576 | - /** |
|
| 1577 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1578 | - * |
|
| 1579 | - * @since 1.0.0 |
|
| 1580 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1581 | - */ |
|
| 1582 | - public function get_loader() { |
|
| 1583 | - return $this->loader; |
|
| 1584 | - } |
|
| 1585 | - |
|
| 1586 | - /** |
|
| 1587 | - * Retrieve the version number of the plugin. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.0.0 |
|
| 1590 | - * @return string The version number of the plugin. |
|
| 1591 | - */ |
|
| 1592 | - public function get_version() { |
|
| 1593 | - return $this->version; |
|
| 1594 | - } |
|
| 1595 | - |
|
| 1596 | - /** |
|
| 1597 | - * Load dependencies for WP-CLI. |
|
| 1598 | - * |
|
| 1599 | - * @since 3.18.0 |
|
| 1600 | - * @throws Exception |
|
| 1601 | - */ |
|
| 1602 | - private function load_cli_dependencies() { |
|
| 1603 | - |
|
| 1604 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1605 | - |
|
| 1606 | - $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 ); |
|
| 1607 | - |
|
| 1608 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1609 | - |
|
| 1610 | - } |
|
| 1547 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1548 | + |
|
| 1549 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1550 | + |
|
| 1551 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1552 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1553 | + |
|
| 1554 | + } |
|
| 1555 | + |
|
| 1556 | + /** |
|
| 1557 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1558 | + * |
|
| 1559 | + * @since 1.0.0 |
|
| 1560 | + */ |
|
| 1561 | + public function run() { |
|
| 1562 | + $this->loader->run(); |
|
| 1563 | + } |
|
| 1564 | + |
|
| 1565 | + /** |
|
| 1566 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1567 | + * WordPress and to define internationalization functionality. |
|
| 1568 | + * |
|
| 1569 | + * @since 1.0.0 |
|
| 1570 | + * @return string The name of the plugin. |
|
| 1571 | + */ |
|
| 1572 | + public function get_plugin_name() { |
|
| 1573 | + return $this->plugin_name; |
|
| 1574 | + } |
|
| 1575 | + |
|
| 1576 | + /** |
|
| 1577 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1578 | + * |
|
| 1579 | + * @since 1.0.0 |
|
| 1580 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1581 | + */ |
|
| 1582 | + public function get_loader() { |
|
| 1583 | + return $this->loader; |
|
| 1584 | + } |
|
| 1585 | + |
|
| 1586 | + /** |
|
| 1587 | + * Retrieve the version number of the plugin. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.0.0 |
|
| 1590 | + * @return string The version number of the plugin. |
|
| 1591 | + */ |
|
| 1592 | + public function get_version() { |
|
| 1593 | + return $this->version; |
|
| 1594 | + } |
|
| 1595 | + |
|
| 1596 | + /** |
|
| 1597 | + * Load dependencies for WP-CLI. |
|
| 1598 | + * |
|
| 1599 | + * @since 3.18.0 |
|
| 1600 | + * @throws Exception |
|
| 1601 | + */ |
|
| 1602 | + private function load_cli_dependencies() { |
|
| 1603 | + |
|
| 1604 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1605 | + |
|
| 1606 | + $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 ); |
|
| 1607 | + |
|
| 1608 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1609 | + |
|
| 1610 | + } |
|
| 1611 | 1611 | |
| 1612 | 1612 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $this->define_public_hooks(); |
| 720 | 720 | |
| 721 | 721 | // If we're in `WP_CLI` load the related files. |
| 722 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 722 | + if (class_exists('WP_CLI')) { |
|
| 723 | 723 | $this->load_cli_dependencies(); |
| 724 | 724 | } |
| 725 | 725 | |
@@ -761,360 +761,360 @@ discard block |
||
| 761 | 761 | * The class responsible for orchestrating the actions and filters of the |
| 762 | 762 | * core plugin. |
| 763 | 763 | */ |
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 764 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 765 | 765 | |
| 766 | 766 | /** |
| 767 | 767 | * The class responsible for defining internationalization functionality |
| 768 | 768 | * of the plugin. |
| 769 | 769 | */ |
| 770 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 770 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 771 | 771 | |
| 772 | 772 | /** |
| 773 | 773 | * WordLift's supported languages. |
| 774 | 774 | */ |
| 775 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 775 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 776 | 776 | |
| 777 | 777 | /** |
| 778 | 778 | * Provide support functions to sanitize data. |
| 779 | 779 | */ |
| 780 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 780 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 781 | 781 | |
| 782 | 782 | /** Installs. */ |
| 783 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 785 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 787 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 790 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 783 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install.php'; |
|
| 784 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 785 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-1-0-0.php'; |
|
| 786 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-10-0.php'; |
|
| 787 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-12-0.php'; |
|
| 788 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-14-0.php'; |
|
| 789 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-15-0.php'; |
|
| 790 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-0.php'; |
|
| 791 | 791 | |
| 792 | 792 | /** Services. */ |
| 793 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 796 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 797 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 798 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 793 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 794 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 796 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 797 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 798 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 799 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 800 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | 804 | * The Query builder. |
| 805 | 805 | */ |
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * The Schema service. |
| 810 | 810 | */ |
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | 814 | * The schema:url property service. |
| 815 | 815 | */ |
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 817 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 818 | 818 | |
| 819 | 819 | /** |
| 820 | 820 | * The UI service. |
| 821 | 821 | */ |
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | 825 | * The Thumbnail service. |
| 826 | 826 | */ |
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | 830 | * The Entity Types Taxonomy service. |
| 831 | 831 | */ |
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 832 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 833 | 833 | |
| 834 | 834 | /** |
| 835 | 835 | * The Entity service. |
| 836 | 836 | */ |
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 837 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 839 | 839 | |
| 840 | 840 | // Add the entity rating service. |
| 841 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 841 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 842 | 842 | |
| 843 | 843 | /** |
| 844 | 844 | * The User service. |
| 845 | 845 | */ |
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 846 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 847 | 847 | |
| 848 | 848 | /** |
| 849 | 849 | * The Timeline service. |
| 850 | 850 | */ |
| 851 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 851 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 852 | 852 | |
| 853 | 853 | /** |
| 854 | 854 | * The Topic Taxonomy service. |
| 855 | 855 | */ |
| 856 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 856 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 857 | 857 | |
| 858 | 858 | /** |
| 859 | 859 | * The SPARQL service. |
| 860 | 860 | */ |
| 861 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 861 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 862 | 862 | |
| 863 | 863 | /** |
| 864 | 864 | * The WordLift import service. |
| 865 | 865 | */ |
| 866 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 866 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 867 | 867 | |
| 868 | 868 | /** |
| 869 | 869 | * The WordLift URI service. |
| 870 | 870 | */ |
| 871 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 872 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 871 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 872 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 873 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | 876 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 877 | 877 | */ |
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 879 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 880 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 881 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 882 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 878 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 879 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 880 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 881 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 882 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 883 | 883 | |
| 884 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 885 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 884 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 885 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | 888 | * Load the converters. |
| 889 | 889 | */ |
| 890 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 891 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 892 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 894 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 895 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 890 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 891 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 892 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 894 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 895 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 896 | 896 | |
| 897 | 897 | /** |
| 898 | 898 | * Load cache-related files. |
| 899 | 899 | */ |
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * Load the content filter. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 906 | 906 | |
| 907 | 907 | /* |
| 908 | 908 | * Load the excerpt helper. |
| 909 | 909 | */ |
| 910 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 910 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 911 | 911 | |
| 912 | 912 | /** |
| 913 | 913 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 914 | 914 | * |
| 915 | 915 | * @since 3.8.0 |
| 916 | 916 | */ |
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 918 | 918 | |
| 919 | 919 | // The Publisher Service and the AJAX adapter. |
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 922 | 922 | |
| 923 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 923 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 924 | 924 | |
| 925 | 925 | /** |
| 926 | 926 | * Load the WordLift key validation service. |
| 927 | 927 | */ |
| 928 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 928 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 929 | 929 | |
| 930 | 930 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 931 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 931 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 932 | 932 | |
| 933 | 933 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 934 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 935 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 936 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 934 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 935 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 936 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 937 | 937 | |
| 938 | 938 | /** Linked Data. */ |
| 939 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 940 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 941 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 942 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 943 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 945 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 946 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 949 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 939 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 940 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 941 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 942 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 943 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 945 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 946 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 949 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 950 | 950 | |
| 951 | 951 | /** Linked Data Rendition. */ |
| 952 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 953 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 954 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 952 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 953 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 954 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 956 | 956 | |
| 957 | 957 | /** Services. */ |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 959 | 959 | |
| 960 | 960 | /** Adapters. */ |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 964 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 965 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 964 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 965 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 966 | 966 | |
| 967 | 967 | /** Async Tasks. */ |
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 973 | 973 | |
| 974 | 974 | /** Async Tasks. */ |
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 977 | 977 | |
| 978 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 978 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 979 | 979 | |
| 980 | 980 | /** |
| 981 | 981 | * The class responsible for defining all actions that occur in the admin area. |
| 982 | 982 | */ |
| 983 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 983 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 984 | 984 | |
| 985 | 985 | /** |
| 986 | 986 | * The class to customize the entity list admin page. |
| 987 | 987 | */ |
| 988 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 988 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 989 | 989 | |
| 990 | 990 | /** |
| 991 | 991 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 992 | 992 | */ |
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 994 | 994 | |
| 995 | 995 | /** |
| 996 | 996 | * The Notice service. |
| 997 | 997 | */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 999 | 999 | |
| 1000 | 1000 | /** |
| 1001 | 1001 | * The PrimaShop adapter. |
| 1002 | 1002 | */ |
| 1003 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1003 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1004 | 1004 | |
| 1005 | 1005 | /** |
| 1006 | 1006 | * The WordLift Dashboard service. |
| 1007 | 1007 | */ |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1009 | 1009 | |
| 1010 | 1010 | /** |
| 1011 | 1011 | * The admin 'Install wizard' page. |
| 1012 | 1012 | */ |
| 1013 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1013 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1014 | 1014 | |
| 1015 | 1015 | /** |
| 1016 | 1016 | * The WordLift entity type list admin page controller. |
| 1017 | 1017 | */ |
| 1018 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1018 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1019 | 1019 | |
| 1020 | 1020 | /** |
| 1021 | 1021 | * The WordLift entity type settings admin page controller. |
| 1022 | 1022 | */ |
| 1023 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1023 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1024 | 1024 | |
| 1025 | 1025 | /** |
| 1026 | 1026 | * The admin 'Download Your Data' page. |
| 1027 | 1027 | */ |
| 1028 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1028 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1029 | 1029 | |
| 1030 | 1030 | /** |
| 1031 | 1031 | * The admin 'WordLift Settings' page. |
| 1032 | 1032 | */ |
| 1033 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 1034 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 1035 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 1037 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 1038 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 1039 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 1040 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1042 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1043 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1044 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1033 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php'; |
|
| 1034 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php'; |
|
| 1035 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php'; |
|
| 1037 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php'; |
|
| 1038 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php'; |
|
| 1039 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php'; |
|
| 1040 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php'; |
|
| 1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1042 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1043 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1044 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1045 | 1045 | |
| 1046 | 1046 | /** Admin Pages */ |
| 1047 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1048 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1049 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1050 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1047 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1048 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1049 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1050 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | 1053 | * The class responsible for defining all actions that occur in the public-facing |
| 1054 | 1054 | * side of the site. |
| 1055 | 1055 | */ |
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1056 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * The shortcode abstract class. |
| 1060 | 1060 | */ |
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | 1064 | * The Timeline shortcode. |
| 1065 | 1065 | */ |
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1067 | 1067 | |
| 1068 | 1068 | /** |
| 1069 | 1069 | * The Navigator shortcode. |
| 1070 | 1070 | */ |
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1072 | 1072 | |
| 1073 | 1073 | /** |
| 1074 | 1074 | * The chord shortcode. |
| 1075 | 1075 | */ |
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1077 | 1077 | |
| 1078 | 1078 | /** |
| 1079 | 1079 | * The geomap shortcode. |
| 1080 | 1080 | */ |
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1082 | 1082 | |
| 1083 | 1083 | /** |
| 1084 | 1084 | * The entity cloud shortcode. |
| 1085 | 1085 | */ |
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * The entity glossary shortcode. |
| 1090 | 1090 | */ |
| 1091 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1092 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1091 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1092 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1093 | 1093 | |
| 1094 | 1094 | /** |
| 1095 | 1095 | * The ShareThis service. |
| 1096 | 1096 | */ |
| 1097 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1097 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1098 | 1098 | |
| 1099 | 1099 | /** |
| 1100 | 1100 | * The SEO service. |
| 1101 | 1101 | */ |
| 1102 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1102 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1103 | 1103 | |
| 1104 | 1104 | /** |
| 1105 | 1105 | * The AMP service. |
| 1106 | 1106 | */ |
| 1107 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1107 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1108 | 1108 | |
| 1109 | 1109 | /** Widgets */ |
| 1110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1110 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1111 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1112 | 1112 | |
| 1113 | 1113 | $this->loader = new Wordlift_Loader(); |
| 1114 | 1114 | |
| 1115 | 1115 | // Instantiate a global logger. |
| 1116 | 1116 | global $wl_logger; |
| 1117 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1117 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1118 | 1118 | |
| 1119 | 1119 | // Load the `wl-api` end-point. |
| 1120 | 1120 | new Wordlift_Http_Api(); |
@@ -1127,10 +1127,10 @@ discard block |
||
| 1127 | 1127 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1128 | 1128 | |
| 1129 | 1129 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1130 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1130 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1131 | 1131 | |
| 1132 | 1132 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1133 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1133 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1134 | 1134 | |
| 1135 | 1135 | // Create an instance of the UI service. |
| 1136 | 1136 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1139,34 +1139,34 @@ discard block |
||
| 1139 | 1139 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1140 | 1140 | |
| 1141 | 1141 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1142 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1142 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1143 | 1143 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1144 | 1144 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1145 | 1145 | |
| 1146 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1147 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1148 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1149 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1150 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1146 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1147 | + $this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/'); |
|
| 1148 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1149 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1150 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1151 | 1151 | |
| 1152 | 1152 | // Instantiate the JSON-LD service. |
| 1153 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1153 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1154 | 1154 | |
| 1155 | 1155 | /** Linked Data. */ |
| 1156 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1157 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1156 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1157 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1158 | 1158 | |
| 1159 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1159 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1160 | 1160 | |
| 1161 | 1161 | // Create a new instance of the Redirect service. |
| 1162 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 1163 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1164 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1162 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_service); |
|
| 1163 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1164 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1165 | 1165 | |
| 1166 | 1166 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1167 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1167 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1168 | 1168 | |
| 1169 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1169 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service); |
|
| 1170 | 1170 | |
| 1171 | 1171 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1172 | 1172 | |
@@ -1180,50 +1180,50 @@ discard block |
||
| 1180 | 1180 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1181 | 1181 | |
| 1182 | 1182 | // Create an import service instance to hook later to WP's import function. |
| 1183 | - $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() ); |
|
| 1183 | + $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()); |
|
| 1184 | 1184 | |
| 1185 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1185 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1186 | 1186 | |
| 1187 | 1187 | // Create the entity rating service. |
| 1188 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1188 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1189 | 1189 | |
| 1190 | 1190 | // Create entity list customization (wp-admin/edit.php). |
| 1191 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1191 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1192 | 1192 | |
| 1193 | 1193 | // Create a new instance of the Redirect service. |
| 1194 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1194 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1195 | 1195 | |
| 1196 | 1196 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1197 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1198 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1199 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1197 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1198 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1199 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1200 | 1200 | |
| 1201 | 1201 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1202 | 1202 | |
| 1203 | 1203 | // Instantiate the JSON-LD service. |
| 1204 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1205 | - $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 ); |
|
| 1206 | - $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 ); |
|
| 1207 | - $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 ); |
|
| 1208 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1209 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1210 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1211 | - |
|
| 1212 | - |
|
| 1213 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1214 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1215 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1216 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1217 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1218 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1204 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1205 | + $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); |
|
| 1206 | + $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); |
|
| 1207 | + $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); |
|
| 1208 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1209 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service); |
|
| 1210 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1211 | + |
|
| 1212 | + |
|
| 1213 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1214 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1215 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1216 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1217 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1218 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Initialize the shortcodes. |
| 1221 | 1221 | new Wordlift_Navigator_Shortcode(); |
| 1222 | 1222 | new Wordlift_Chord_Shortcode(); |
| 1223 | 1223 | new Wordlift_Geomap_Shortcode(); |
| 1224 | 1224 | new Wordlift_Timeline_Shortcode(); |
| 1225 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1226 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1225 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1226 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1227 | 1227 | |
| 1228 | 1228 | // Initialize the SEO service. |
| 1229 | 1229 | new Wordlift_Seo_Service(); |
@@ -1235,11 +1235,11 @@ discard block |
||
| 1235 | 1235 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1236 | 1236 | |
| 1237 | 1237 | /** Adapters. */ |
| 1238 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1239 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1240 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1241 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1242 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1238 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1239 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1240 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1241 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service); |
|
| 1242 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1243 | 1243 | |
| 1244 | 1244 | // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
| 1245 | 1245 | $this->rebuild_service = new Wordlift_Rebuild_Service( |
@@ -1256,8 +1256,8 @@ discard block |
||
| 1256 | 1256 | new Wordlift_Push_References_Async_Task(); |
| 1257 | 1257 | |
| 1258 | 1258 | /** WL Autocomplete. */ |
| 1259 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1260 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1259 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service); |
|
| 1260 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service); |
|
| 1261 | 1261 | |
| 1262 | 1262 | /** WordPress Admin UI. */ |
| 1263 | 1263 | |
@@ -1267,15 +1267,15 @@ discard block |
||
| 1267 | 1267 | $this->select2_element = new Wordlift_Admin_Select2_Element(); |
| 1268 | 1268 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1269 | 1269 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1270 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1271 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1270 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1271 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1272 | 1272 | |
| 1273 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1274 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1275 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1273 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 1274 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service); |
|
| 1275 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1276 | 1276 | |
| 1277 | 1277 | // Pages. |
| 1278 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1278 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1279 | 1279 | new Wordlift_Entity_Type_Admin_Service(); |
| 1280 | 1280 | |
| 1281 | 1281 | // create an instance of the entity type list admin page controller. |
@@ -1288,23 +1288,23 @@ discard block |
||
| 1288 | 1288 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1289 | 1289 | |
| 1290 | 1290 | /* WordPress Admin. */ |
| 1291 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1292 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1291 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1292 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1293 | 1293 | |
| 1294 | 1294 | // Create an instance of the install wizard. |
| 1295 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1295 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service); |
|
| 1296 | 1296 | |
| 1297 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1297 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1298 | 1298 | |
| 1299 | 1299 | // User Profile. |
| 1300 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1300 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1301 | 1301 | |
| 1302 | 1302 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1303 | 1303 | |
| 1304 | 1304 | // Load the debug service if WP is in debug mode. |
| 1305 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1306 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1307 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1305 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1306 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1307 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | // Remote Image Service. |
@@ -1323,9 +1323,9 @@ discard block |
||
| 1323 | 1323 | private function set_locale() { |
| 1324 | 1324 | |
| 1325 | 1325 | $plugin_i18n = new Wordlift_i18n(); |
| 1326 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1326 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1327 | 1327 | |
| 1328 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1328 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1329 | 1329 | |
| 1330 | 1330 | } |
| 1331 | 1331 | |
@@ -1346,151 +1346,151 @@ discard block |
||
| 1346 | 1346 | $this->user_service |
| 1347 | 1347 | ); |
| 1348 | 1348 | |
| 1349 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1350 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1349 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1350 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 1351 | 1351 | |
| 1352 | 1352 | // Hook the init action to taxonomy services. |
| 1353 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1354 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1353 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1354 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1355 | 1355 | |
| 1356 | 1356 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1357 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1357 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1358 | 1358 | |
| 1359 | 1359 | // Hook the added_post_meta action to the Thumbnail service. |
| 1360 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1360 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1361 | 1361 | |
| 1362 | 1362 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1363 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1363 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1364 | 1364 | |
| 1365 | 1365 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1366 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1366 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1367 | 1367 | |
| 1368 | 1368 | // Register custom allowed redirect hosts. |
| 1369 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1369 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1370 | 1370 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1371 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1371 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1372 | 1372 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1373 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1373 | + $this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats'); |
|
| 1374 | 1374 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1375 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1375 | + $this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets'); |
|
| 1376 | 1376 | |
| 1377 | 1377 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1378 | 1378 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1379 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1380 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1379 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1380 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1381 | 1381 | |
| 1382 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1383 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1382 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1383 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1384 | 1384 | |
| 1385 | 1385 | // Entity listing customization (wp-admin/edit.php) |
| 1386 | 1386 | // Add custom columns. |
| 1387 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1387 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1388 | 1388 | // no explicit entity as it prevents handling of other post types. |
| 1389 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1389 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1390 | 1390 | // Add 4W selection. |
| 1391 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1392 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1393 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1394 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1395 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1391 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1392 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1393 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1394 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1395 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1396 | 1396 | |
| 1397 | 1397 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1398 | 1398 | // entities. |
| 1399 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1399 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1400 | 1400 | |
| 1401 | 1401 | // Filter imported post meta. |
| 1402 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1402 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1403 | 1403 | |
| 1404 | 1404 | // Notify the import service when an import starts and ends. |
| 1405 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1406 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1405 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1406 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1407 | 1407 | |
| 1408 | 1408 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1409 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1410 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1409 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1410 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1411 | 1411 | |
| 1412 | 1412 | // Hook the menu to the Download Your Data page. |
| 1413 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1414 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1415 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1413 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1414 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1415 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1416 | 1416 | |
| 1417 | 1417 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1418 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1418 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1419 | 1419 | |
| 1420 | 1420 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1421 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1421 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1422 | 1422 | |
| 1423 | 1423 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1424 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1424 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1425 | 1425 | |
| 1426 | 1426 | // Hook the `admin_init` function to the Admin Setup. |
| 1427 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1427 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1428 | 1428 | |
| 1429 | 1429 | // Hook the admin_init to the settings page. |
| 1430 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1430 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1431 | 1431 | |
| 1432 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1432 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1433 | 1433 | |
| 1434 | 1434 | // Hook the menu creation on the general wordlift menu creation. |
| 1435 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1436 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1435 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1436 | + if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) { |
|
| 1437 | 1437 | // Add the functionality only if a flag is set in wp-config.php . |
| 1438 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1438 | + $this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2); |
|
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | // Hook key update. |
| 1442 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1443 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1442 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1443 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1444 | 1444 | |
| 1445 | 1445 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1446 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1446 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1447 | 1447 | |
| 1448 | 1448 | // Hook the AJAX `wl_publisher` action name. |
| 1449 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1449 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1450 | 1450 | |
| 1451 | 1451 | // Hook row actions for the entity type list admin. |
| 1452 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1452 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1453 | 1453 | |
| 1454 | 1454 | /** Ajax actions. */ |
| 1455 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1455 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1456 | 1456 | |
| 1457 | 1457 | // Hook capabilities manipulation to allow access to entity type admin |
| 1458 | 1458 | // page on WordPress versions before 4.7. |
| 1459 | 1459 | global $wp_version; |
| 1460 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1461 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1460 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1461 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1464 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1465 | 1465 | |
| 1466 | 1466 | /** Adapters. */ |
| 1467 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1468 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1469 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1470 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1471 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1472 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1467 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1468 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit'); |
|
| 1469 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts'); |
|
| 1470 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel'); |
|
| 1471 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning'); |
|
| 1472 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1473 | 1473 | |
| 1474 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1475 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1474 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1475 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1476 | 1476 | |
| 1477 | 1477 | |
| 1478 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1479 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1478 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1479 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1480 | 1480 | |
| 1481 | 1481 | // Handle the autocomplete request. |
| 1482 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1482 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1483 | 1483 | $this->autocomplete_adapter, |
| 1484 | 1484 | 'wl_autocomplete', |
| 1485 | - ) ); |
|
| 1486 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1485 | + )); |
|
| 1486 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1487 | 1487 | $this->autocomplete_adapter, |
| 1488 | 1488 | 'wl_autocomplete', |
| 1489 | - ) ); |
|
| 1489 | + )); |
|
| 1490 | 1490 | |
| 1491 | 1491 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1492 | - if ( is_multisite() ) { |
|
| 1493 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1492 | + if (is_multisite()) { |
|
| 1493 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | } |
@@ -1504,52 +1504,52 @@ discard block |
||
| 1504 | 1504 | */ |
| 1505 | 1505 | private function define_public_hooks() { |
| 1506 | 1506 | |
| 1507 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1507 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1508 | 1508 | |
| 1509 | 1509 | // Register the entity post type. |
| 1510 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1511 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1510 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1511 | + $this->loader->add_action('init', $this->install_service, 'install'); |
|
| 1512 | 1512 | |
| 1513 | 1513 | // Bind the link generation and handling hooks to the entity link service. |
| 1514 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1515 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1516 | - $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 ); |
|
| 1517 | - $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 ); |
|
| 1514 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1515 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1516 | + $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); |
|
| 1517 | + $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); |
|
| 1518 | 1518 | |
| 1519 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1520 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1519 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1520 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1521 | 1521 | |
| 1522 | 1522 | // Hook the content filter service to add entity links. |
| 1523 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1524 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1523 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1524 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1528 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1528 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1529 | 1529 | |
| 1530 | 1530 | // Hook the ShareThis service. |
| 1531 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1532 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1531 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1532 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1533 | 1533 | |
| 1534 | 1534 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1535 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1535 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1536 | 1536 | |
| 1537 | 1537 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1538 | 1538 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1539 | 1539 | // to categories. |
| 1540 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1540 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1541 | 1541 | |
| 1542 | 1542 | /* |
| 1543 | 1543 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1544 | 1544 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1545 | 1545 | * order of start time. |
| 1546 | 1546 | */ |
| 1547 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1547 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1548 | 1548 | |
| 1549 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1549 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1550 | 1550 | |
| 1551 | 1551 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1552 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1552 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1553 | 1553 | |
| 1554 | 1554 | } |
| 1555 | 1555 | |
@@ -1601,11 +1601,11 @@ discard block |
||
| 1601 | 1601 | */ |
| 1602 | 1602 | private function load_cli_dependencies() { |
| 1603 | 1603 | |
| 1604 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1604 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1605 | 1605 | |
| 1606 | - $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 ); |
|
| 1606 | + $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); |
|
| 1607 | 1607 | |
| 1608 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1608 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1609 | 1609 | |
| 1610 | 1610 | } |
| 1611 | 1611 | |
@@ -15,256 +15,256 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | - * |
|
| 21 | - * @since 3.10.0 |
|
| 22 | - * @access private |
|
| 23 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | - */ |
|
| 25 | - private $configuration_service; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * A {@link Wordlift_Log_Service} instance. |
|
| 29 | - * |
|
| 30 | - * @since 3.10.0 |
|
| 31 | - * @access private |
|
| 32 | - * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 33 | - */ |
|
| 34 | - private $log; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 38 | - * |
|
| 39 | - * @since 3.10.0 |
|
| 40 | - * |
|
| 41 | - * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 42 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 43 | - * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 44 | - * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 45 | - * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 46 | - */ |
|
| 47 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 48 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 49 | - |
|
| 50 | - $this->configuration_service = $configuration_service; |
|
| 51 | - |
|
| 52 | - // Set a reference to the logger. |
|
| 53 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 58 | - * found while processing the post is set in the $references array. |
|
| 59 | - * |
|
| 60 | - * @since 3.10.0 |
|
| 61 | - * |
|
| 62 | - * @param int $post_id The post id. |
|
| 63 | - * @param array $references An array of entity references. |
|
| 64 | - * |
|
| 65 | - * @return array A JSON-LD array. |
|
| 66 | - */ |
|
| 67 | - public function convert( $post_id, &$references = array() ) { |
|
| 68 | - |
|
| 69 | - // Get the post instance. |
|
| 70 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 71 | - // Post not found. |
|
| 72 | - return null; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 76 | - $jsonld = parent::convert( $post_id, $references ); |
|
| 77 | - |
|
| 78 | - // Get the entity name. |
|
| 79 | - $jsonld['headline'] = $post->post_title; |
|
| 80 | - |
|
| 81 | - // Set the published and modified dates. |
|
| 82 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 83 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 84 | - |
|
| 85 | - // Get the word count for the post. |
|
| 86 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 87 | - $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 88 | - |
|
| 89 | - // Set the publisher. |
|
| 90 | - $this->set_publisher( $jsonld ); |
|
| 91 | - |
|
| 92 | - // Process the references if any. |
|
| 93 | - if ( 0 < count( $references ) ) { |
|
| 94 | - |
|
| 95 | - // Prepare the `about` and `mentions` array. |
|
| 96 | - $about = $mentions = array(); |
|
| 97 | - |
|
| 98 | - // If the entity is in the title, then it should be an `about`. |
|
| 99 | - foreach ( $references as $reference ) { |
|
| 100 | - |
|
| 101 | - // Get the entity labels. |
|
| 102 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 103 | - |
|
| 104 | - // Get the entity URI. |
|
| 105 | - $item = array( |
|
| 106 | - '@id' => $this->entity_service->get_uri( $reference ), |
|
| 107 | - ); |
|
| 108 | - |
|
| 109 | - $escaped_lables = array_map( |
|
| 110 | - function( $value ) { |
|
| 111 | - return preg_quote( $value, '/' ); |
|
| 112 | - }, $labels |
|
| 113 | - ); |
|
| 114 | - |
|
| 115 | - // Check if the labels match any part of the title. |
|
| 116 | - $matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title ); |
|
| 117 | - |
|
| 118 | - // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 119 | - if ( $matches ) { |
|
| 120 | - $about[] = $item; |
|
| 121 | - } else { |
|
| 122 | - $mentions[] = $item; |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - // If we have abouts, assign them to the JSON-LD. |
|
| 127 | - if ( 0 < count( $about ) ) { |
|
| 128 | - $jsonld['about'] = $about; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - // If we have mentions, assign them to the JSON-LD. |
|
| 132 | - if ( 0 < count( $mentions ) ) { |
|
| 133 | - $jsonld['mentions'] = $mentions; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // Finally set the author. |
|
| 138 | - $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Call the `wl_post_jsonld` filter. |
|
| 142 | - * |
|
| 143 | - * @api |
|
| 144 | - * |
|
| 145 | - * @since 3.14.0 |
|
| 146 | - * |
|
| 147 | - * @param array $jsonld The JSON-LD structure. |
|
| 148 | - * @param int $post_id The {@link WP_Post} `id`. |
|
| 149 | - * @param array $references The array of referenced entities. |
|
| 150 | - */ |
|
| 151 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Get the author's JSON-LD fragment. |
|
| 156 | - * |
|
| 157 | - * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 158 | - * the referenced entity if configured for the {@link WP_User}. |
|
| 159 | - * |
|
| 160 | - * @since 3.14.0 |
|
| 161 | - * |
|
| 162 | - * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 163 | - * @param array $references An array of referenced entities. |
|
| 164 | - * |
|
| 165 | - * @return string|array A JSON-LD structure. |
|
| 166 | - */ |
|
| 167 | - private function get_author( $author_id, &$references ) { |
|
| 168 | - |
|
| 169 | - // Get the entity bound to this user. |
|
| 170 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 171 | - |
|
| 172 | - // If there's no entity bound return a simple author structure. |
|
| 173 | - if ( empty( $entity_id ) ) { |
|
| 174 | - |
|
| 175 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 177 | - |
|
| 178 | - return array( |
|
| 179 | - '@type' => 'Person', |
|
| 180 | - '@id' => $author_uri, |
|
| 181 | - 'name' => $author, |
|
| 182 | - ); |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - // Add the author to the references. |
|
| 186 | - $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 187 | - $references[] = $entity_id; |
|
| 188 | - |
|
| 189 | - // Return the JSON-LD for the referenced entity. |
|
| 190 | - return array( |
|
| 191 | - '@id' => $author_uri, |
|
| 192 | - ); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Enrich the provided params array with publisher data, if available. |
|
| 197 | - * |
|
| 198 | - * @since 3.10.0 |
|
| 199 | - * |
|
| 200 | - * @param array $params The parameters array. |
|
| 201 | - */ |
|
| 202 | - protected function set_publisher( &$params ) { |
|
| 203 | - |
|
| 204 | - // If the publisher id isn't set don't do anything. |
|
| 205 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 206 | - return; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - // Get the post instance. |
|
| 210 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 211 | - // Publisher not found. |
|
| 212 | - return; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - // Get the item id. |
|
| 216 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 217 | - |
|
| 218 | - // Get the type. |
|
| 219 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 220 | - |
|
| 221 | - // Get the name. |
|
| 222 | - $name = $post->post_title; |
|
| 223 | - |
|
| 224 | - // Set the publisher data. |
|
| 225 | - $params['publisher'] = array( |
|
| 226 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 227 | - '@id' => $id, |
|
| 228 | - 'name' => $name, |
|
| 229 | - ); |
|
| 230 | - |
|
| 231 | - // Add the sameAs values associated with the publisher. |
|
| 232 | - $storage_factory = Wordlift_Storage_Factory::get_instance(); |
|
| 233 | - $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 234 | - if ( ! empty( $sameas ) ) { |
|
| 235 | - $params['publisher']['sameAs'] = $sameas; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 239 | - // support the logo property. |
|
| 240 | - // |
|
| 241 | - // See http://schema.org/logo. |
|
| 242 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 243 | - return; |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - // Get the logo, WP < 4.4 way: only post ID accepted here. |
|
| 247 | - if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 248 | - return; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - // Get the image URL. |
|
| 252 | - if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, array( 600, 60 ) ) ) { |
|
| 253 | - return; |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - // Copy over some useful properties. |
|
| 257 | - // |
|
| 258 | - // See https://developers.google.com/search/docs/data-types/articles. |
|
| 259 | - $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 260 | - $params['publisher']['logo']['url'] = $attachment[0]; |
|
| 261 | - // If you specify a "width" or "height" value you should leave out |
|
| 262 | - // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 263 | - // |
|
| 264 | - // See https://github.com/insideout10/wordlift-plugin/issues/451. |
|
| 265 | - $params['publisher']['logo']['width'] = $attachment[1]; |
|
| 266 | - $params['publisher']['logo']['height'] = $attachment[2]; |
|
| 267 | - |
|
| 268 | - } |
|
| 18 | + /** |
|
| 19 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | + * |
|
| 21 | + * @since 3.10.0 |
|
| 22 | + * @access private |
|
| 23 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | + */ |
|
| 25 | + private $configuration_service; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * A {@link Wordlift_Log_Service} instance. |
|
| 29 | + * |
|
| 30 | + * @since 3.10.0 |
|
| 31 | + * @access private |
|
| 32 | + * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 33 | + */ |
|
| 34 | + private $log; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 38 | + * |
|
| 39 | + * @since 3.10.0 |
|
| 40 | + * |
|
| 41 | + * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 42 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 43 | + * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 44 | + * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 45 | + * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 46 | + */ |
|
| 47 | + public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 48 | + parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 49 | + |
|
| 50 | + $this->configuration_service = $configuration_service; |
|
| 51 | + |
|
| 52 | + // Set a reference to the logger. |
|
| 53 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 58 | + * found while processing the post is set in the $references array. |
|
| 59 | + * |
|
| 60 | + * @since 3.10.0 |
|
| 61 | + * |
|
| 62 | + * @param int $post_id The post id. |
|
| 63 | + * @param array $references An array of entity references. |
|
| 64 | + * |
|
| 65 | + * @return array A JSON-LD array. |
|
| 66 | + */ |
|
| 67 | + public function convert( $post_id, &$references = array() ) { |
|
| 68 | + |
|
| 69 | + // Get the post instance. |
|
| 70 | + if ( null === $post = get_post( $post_id ) ) { |
|
| 71 | + // Post not found. |
|
| 72 | + return null; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 76 | + $jsonld = parent::convert( $post_id, $references ); |
|
| 77 | + |
|
| 78 | + // Get the entity name. |
|
| 79 | + $jsonld['headline'] = $post->post_title; |
|
| 80 | + |
|
| 81 | + // Set the published and modified dates. |
|
| 82 | + $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 83 | + $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 84 | + |
|
| 85 | + // Get the word count for the post. |
|
| 86 | + $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 87 | + $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 88 | + |
|
| 89 | + // Set the publisher. |
|
| 90 | + $this->set_publisher( $jsonld ); |
|
| 91 | + |
|
| 92 | + // Process the references if any. |
|
| 93 | + if ( 0 < count( $references ) ) { |
|
| 94 | + |
|
| 95 | + // Prepare the `about` and `mentions` array. |
|
| 96 | + $about = $mentions = array(); |
|
| 97 | + |
|
| 98 | + // If the entity is in the title, then it should be an `about`. |
|
| 99 | + foreach ( $references as $reference ) { |
|
| 100 | + |
|
| 101 | + // Get the entity labels. |
|
| 102 | + $labels = $this->entity_service->get_labels( $reference ); |
|
| 103 | + |
|
| 104 | + // Get the entity URI. |
|
| 105 | + $item = array( |
|
| 106 | + '@id' => $this->entity_service->get_uri( $reference ), |
|
| 107 | + ); |
|
| 108 | + |
|
| 109 | + $escaped_lables = array_map( |
|
| 110 | + function( $value ) { |
|
| 111 | + return preg_quote( $value, '/' ); |
|
| 112 | + }, $labels |
|
| 113 | + ); |
|
| 114 | + |
|
| 115 | + // Check if the labels match any part of the title. |
|
| 116 | + $matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title ); |
|
| 117 | + |
|
| 118 | + // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 119 | + if ( $matches ) { |
|
| 120 | + $about[] = $item; |
|
| 121 | + } else { |
|
| 122 | + $mentions[] = $item; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + // If we have abouts, assign them to the JSON-LD. |
|
| 127 | + if ( 0 < count( $about ) ) { |
|
| 128 | + $jsonld['about'] = $about; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + // If we have mentions, assign them to the JSON-LD. |
|
| 132 | + if ( 0 < count( $mentions ) ) { |
|
| 133 | + $jsonld['mentions'] = $mentions; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // Finally set the author. |
|
| 138 | + $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Call the `wl_post_jsonld` filter. |
|
| 142 | + * |
|
| 143 | + * @api |
|
| 144 | + * |
|
| 145 | + * @since 3.14.0 |
|
| 146 | + * |
|
| 147 | + * @param array $jsonld The JSON-LD structure. |
|
| 148 | + * @param int $post_id The {@link WP_Post} `id`. |
|
| 149 | + * @param array $references The array of referenced entities. |
|
| 150 | + */ |
|
| 151 | + return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Get the author's JSON-LD fragment. |
|
| 156 | + * |
|
| 157 | + * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 158 | + * the referenced entity if configured for the {@link WP_User}. |
|
| 159 | + * |
|
| 160 | + * @since 3.14.0 |
|
| 161 | + * |
|
| 162 | + * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 163 | + * @param array $references An array of referenced entities. |
|
| 164 | + * |
|
| 165 | + * @return string|array A JSON-LD structure. |
|
| 166 | + */ |
|
| 167 | + private function get_author( $author_id, &$references ) { |
|
| 168 | + |
|
| 169 | + // Get the entity bound to this user. |
|
| 170 | + $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 171 | + |
|
| 172 | + // If there's no entity bound return a simple author structure. |
|
| 173 | + if ( empty( $entity_id ) ) { |
|
| 174 | + |
|
| 175 | + $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | + $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 177 | + |
|
| 178 | + return array( |
|
| 179 | + '@type' => 'Person', |
|
| 180 | + '@id' => $author_uri, |
|
| 181 | + 'name' => $author, |
|
| 182 | + ); |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + // Add the author to the references. |
|
| 186 | + $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 187 | + $references[] = $entity_id; |
|
| 188 | + |
|
| 189 | + // Return the JSON-LD for the referenced entity. |
|
| 190 | + return array( |
|
| 191 | + '@id' => $author_uri, |
|
| 192 | + ); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Enrich the provided params array with publisher data, if available. |
|
| 197 | + * |
|
| 198 | + * @since 3.10.0 |
|
| 199 | + * |
|
| 200 | + * @param array $params The parameters array. |
|
| 201 | + */ |
|
| 202 | + protected function set_publisher( &$params ) { |
|
| 203 | + |
|
| 204 | + // If the publisher id isn't set don't do anything. |
|
| 205 | + if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 206 | + return; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + // Get the post instance. |
|
| 210 | + if ( null === $post = get_post( $publisher_id ) ) { |
|
| 211 | + // Publisher not found. |
|
| 212 | + return; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + // Get the item id. |
|
| 216 | + $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 217 | + |
|
| 218 | + // Get the type. |
|
| 219 | + $type = $this->entity_type_service->get( $publisher_id ); |
|
| 220 | + |
|
| 221 | + // Get the name. |
|
| 222 | + $name = $post->post_title; |
|
| 223 | + |
|
| 224 | + // Set the publisher data. |
|
| 225 | + $params['publisher'] = array( |
|
| 226 | + '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 227 | + '@id' => $id, |
|
| 228 | + 'name' => $name, |
|
| 229 | + ); |
|
| 230 | + |
|
| 231 | + // Add the sameAs values associated with the publisher. |
|
| 232 | + $storage_factory = Wordlift_Storage_Factory::get_instance(); |
|
| 233 | + $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 234 | + if ( ! empty( $sameas ) ) { |
|
| 235 | + $params['publisher']['sameAs'] = $sameas; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 239 | + // support the logo property. |
|
| 240 | + // |
|
| 241 | + // See http://schema.org/logo. |
|
| 242 | + if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 243 | + return; |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + // Get the logo, WP < 4.4 way: only post ID accepted here. |
|
| 247 | + if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 248 | + return; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + // Get the image URL. |
|
| 252 | + if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, array( 600, 60 ) ) ) { |
|
| 253 | + return; |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + // Copy over some useful properties. |
|
| 257 | + // |
|
| 258 | + // See https://developers.google.com/search/docs/data-types/articles. |
|
| 259 | + $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 260 | + $params['publisher']['logo']['url'] = $attachment[0]; |
|
| 261 | + // If you specify a "width" or "height" value you should leave out |
|
| 262 | + // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 263 | + // |
|
| 264 | + // See https://github.com/insideout10/wordlift-plugin/issues/451. |
|
| 265 | + $params['publisher']['logo']['width'] = $attachment[1]; |
|
| 266 | + $params['publisher']['logo']['height'] = $attachment[2]; |
|
| 267 | + |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | 270 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
| 45 | 45 | * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
| 46 | 46 | */ |
| 47 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) { |
|
| 48 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 47 | + public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service) { |
|
| 48 | + parent::__construct($entity_type_service, $entity_service, $user_service, $attachment_service); |
|
| 49 | 49 | |
| 50 | 50 | $this->configuration_service = $configuration_service; |
| 51 | 51 | |
| 52 | 52 | // Set a reference to the logger. |
| 53 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 53 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -64,59 +64,59 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return array A JSON-LD array. |
| 66 | 66 | */ |
| 67 | - public function convert( $post_id, &$references = array() ) { |
|
| 67 | + public function convert($post_id, &$references = array()) { |
|
| 68 | 68 | |
| 69 | 69 | // Get the post instance. |
| 70 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 70 | + if (null === $post = get_post($post_id)) { |
|
| 71 | 71 | // Post not found. |
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Get the base JSON-LD and the list of entities referenced by this entity. |
| 76 | - $jsonld = parent::convert( $post_id, $references ); |
|
| 76 | + $jsonld = parent::convert($post_id, $references); |
|
| 77 | 77 | |
| 78 | 78 | // Get the entity name. |
| 79 | 79 | $jsonld['headline'] = $post->post_title; |
| 80 | 80 | |
| 81 | 81 | // Set the published and modified dates. |
| 82 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 83 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 82 | + $jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false); |
|
| 83 | + $jsonld['dateModified'] = get_post_modified_time('Y-m-d\TH:i', true, $post, false); |
|
| 84 | 84 | |
| 85 | 85 | // Get the word count for the post. |
| 86 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 86 | + $post_adapter = new Wordlift_Post_Adapter($post_id); |
|
| 87 | 87 | $jsonld['wordCount'] = $post_adapter->word_count(); |
| 88 | 88 | |
| 89 | 89 | // Set the publisher. |
| 90 | - $this->set_publisher( $jsonld ); |
|
| 90 | + $this->set_publisher($jsonld); |
|
| 91 | 91 | |
| 92 | 92 | // Process the references if any. |
| 93 | - if ( 0 < count( $references ) ) { |
|
| 93 | + if (0 < count($references)) { |
|
| 94 | 94 | |
| 95 | 95 | // Prepare the `about` and `mentions` array. |
| 96 | 96 | $about = $mentions = array(); |
| 97 | 97 | |
| 98 | 98 | // If the entity is in the title, then it should be an `about`. |
| 99 | - foreach ( $references as $reference ) { |
|
| 99 | + foreach ($references as $reference) { |
|
| 100 | 100 | |
| 101 | 101 | // Get the entity labels. |
| 102 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 102 | + $labels = $this->entity_service->get_labels($reference); |
|
| 103 | 103 | |
| 104 | 104 | // Get the entity URI. |
| 105 | 105 | $item = array( |
| 106 | - '@id' => $this->entity_service->get_uri( $reference ), |
|
| 106 | + '@id' => $this->entity_service->get_uri($reference), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | 109 | $escaped_lables = array_map( |
| 110 | - function( $value ) { |
|
| 111 | - return preg_quote( $value, '/' ); |
|
| 110 | + function($value) { |
|
| 111 | + return preg_quote($value, '/'); |
|
| 112 | 112 | }, $labels |
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | 115 | // Check if the labels match any part of the title. |
| 116 | - $matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title ); |
|
| 116 | + $matches = 1 === preg_match('/'.implode('|', $escaped_lables).'/', $post->post_title); |
|
| 117 | 117 | |
| 118 | 118 | // If the title matches, assign the entity to the about, otherwise to the mentions. |
| 119 | - if ( $matches ) { |
|
| 119 | + if ($matches) { |
|
| 120 | 120 | $about[] = $item; |
| 121 | 121 | } else { |
| 122 | 122 | $mentions[] = $item; |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // If we have abouts, assign them to the JSON-LD. |
| 127 | - if ( 0 < count( $about ) ) { |
|
| 127 | + if (0 < count($about)) { |
|
| 128 | 128 | $jsonld['about'] = $about; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // If we have mentions, assign them to the JSON-LD. |
| 132 | - if ( 0 < count( $mentions ) ) { |
|
| 132 | + if (0 < count($mentions)) { |
|
| 133 | 133 | $jsonld['mentions'] = $mentions; |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Finally set the author. |
| 138 | - $jsonld['author'] = $this->get_author( $post->post_author, $references ); |
|
| 138 | + $jsonld['author'] = $this->get_author($post->post_author, $references); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Call the `wl_post_jsonld` filter. |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param int $post_id The {@link WP_Post} `id`. |
| 149 | 149 | * @param array $references The array of referenced entities. |
| 150 | 150 | */ |
| 151 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 151 | + return apply_filters('wl_post_jsonld', $jsonld, $post_id, $references); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -164,16 +164,16 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return string|array A JSON-LD structure. |
| 166 | 166 | */ |
| 167 | - private function get_author( $author_id, &$references ) { |
|
| 167 | + private function get_author($author_id, &$references) { |
|
| 168 | 168 | |
| 169 | 169 | // Get the entity bound to this user. |
| 170 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 170 | + $entity_id = $this->user_service->get_entity($author_id); |
|
| 171 | 171 | |
| 172 | 172 | // If there's no entity bound return a simple author structure. |
| 173 | - if ( empty( $entity_id ) ) { |
|
| 173 | + if (empty($entity_id)) { |
|
| 174 | 174 | |
| 175 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 175 | + $author = get_the_author_meta('display_name', $author_id); |
|
| 176 | + $author_uri = $this->user_service->get_uri($author_id); |
|
| 177 | 177 | |
| 178 | 178 | return array( |
| 179 | 179 | '@type' => 'Person', |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Add the author to the references. |
| 186 | - $author_uri = $this->entity_service->get_uri( $entity_id ); |
|
| 186 | + $author_uri = $this->entity_service->get_uri($entity_id); |
|
| 187 | 187 | $references[] = $entity_id; |
| 188 | 188 | |
| 189 | 189 | // Return the JSON-LD for the referenced entity. |
@@ -199,39 +199,39 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @param array $params The parameters array. |
| 201 | 201 | */ |
| 202 | - protected function set_publisher( &$params ) { |
|
| 202 | + protected function set_publisher(&$params) { |
|
| 203 | 203 | |
| 204 | 204 | // If the publisher id isn't set don't do anything. |
| 205 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 205 | + if (null === $publisher_id = $this->configuration_service->get_publisher_id()) { |
|
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // Get the post instance. |
| 210 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 210 | + if (null === $post = get_post($publisher_id)) { |
|
| 211 | 211 | // Publisher not found. |
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // Get the item id. |
| 216 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 216 | + $id = $this->entity_service->get_uri($publisher_id); |
|
| 217 | 217 | |
| 218 | 218 | // Get the type. |
| 219 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 219 | + $type = $this->entity_type_service->get($publisher_id); |
|
| 220 | 220 | |
| 221 | 221 | // Get the name. |
| 222 | 222 | $name = $post->post_title; |
| 223 | 223 | |
| 224 | 224 | // Set the publisher data. |
| 225 | 225 | $params['publisher'] = array( |
| 226 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 226 | + '@type' => $this->relative_to_context($type['uri']), |
|
| 227 | 227 | '@id' => $id, |
| 228 | 228 | 'name' => $name, |
| 229 | 229 | ); |
| 230 | 230 | |
| 231 | 231 | // Add the sameAs values associated with the publisher. |
| 232 | 232 | $storage_factory = Wordlift_Storage_Factory::get_instance(); |
| 233 | - $sameas = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id ); |
|
| 234 | - if ( ! empty( $sameas ) ) { |
|
| 233 | + $sameas = $storage_factory->post_meta(Wordlift_Schema_Service::FIELD_SAME_AS)->get($publisher_id); |
|
| 234 | + if ( ! empty($sameas)) { |
|
| 235 | 235 | $params['publisher']['sameAs'] = $sameas; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -239,17 +239,17 @@ discard block |
||
| 239 | 239 | // support the logo property. |
| 240 | 240 | // |
| 241 | 241 | // See http://schema.org/logo. |
| 242 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 242 | + if ('http://schema.org/Organization' !== $type['uri']) { |
|
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Get the logo, WP < 4.4 way: only post ID accepted here. |
| 247 | - if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 247 | + if ('' === $thumbnail_id = get_post_thumbnail_id($post->ID)) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Get the image URL. |
| 252 | - if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, array( 600, 60 ) ) ) { |
|
| 252 | + if (false === $attachment = wp_get_attachment_image_src($thumbnail_id, array(600, 60))) { |
|
| 253 | 253 | return; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -18,222 +18,222 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Publisher_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.19.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $configuration_service; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.19.0 |
|
| 34 | - * |
|
| 35 | - * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 36 | - */ |
|
| 37 | - public function __construct( $configuration_service ) { |
|
| 38 | - $this->configuration_service = $configuration_service; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Counts the number of potential publishers. |
|
| 43 | - * |
|
| 44 | - * @since 3.11.0 |
|
| 45 | - * |
|
| 46 | - * @return int The number of potential publishers. |
|
| 47 | - */ |
|
| 48 | - public function count() { |
|
| 49 | - |
|
| 50 | - // Search for entities which are either a Person |
|
| 51 | - // or Organization. |
|
| 52 | - |
|
| 53 | - // Get only the ids as all we need is the count. |
|
| 54 | - $entities = get_posts( array( |
|
| 55 | - 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 56 | - 'post_status' => 'publish', |
|
| 57 | - 'posts_per_page' => - 1, |
|
| 58 | - 'tax_query' => array( |
|
| 59 | - array( |
|
| 60 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 61 | - 'field' => 'slug', |
|
| 62 | - 'terms' => array( 'organization', 'person' ), |
|
| 63 | - ), |
|
| 64 | - ), |
|
| 65 | - 'fields' => 'ids', |
|
| 66 | - ) ); |
|
| 67 | - |
|
| 68 | - // Finally return the count. |
|
| 69 | - return count( $entities ); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Search SQL filter for matching against post title only. |
|
| 74 | - * |
|
| 75 | - * @link http://wordpress.stackexchange.com/a/11826/1685 |
|
| 76 | - * |
|
| 77 | - * @since 3.15.0 |
|
| 78 | - * |
|
| 79 | - * @param string $search The search string. |
|
| 80 | - * @param WP_Query $wp_query The {@link WP_Query} instance. |
|
| 81 | - * |
|
| 82 | - * @return array|string An array of results. |
|
| 83 | - */ |
|
| 84 | - public function limit_search_to_title( $search, $wp_query ) { |
|
| 85 | - |
|
| 86 | - // Bail out if the search or the `search_terms` haven't been set. |
|
| 87 | - if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) { |
|
| 88 | - return $search; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - global $wpdb; |
|
| 92 | - |
|
| 93 | - $query_vars = $wp_query->query_vars; |
|
| 94 | - $percent = ! empty( $query_vars['exact'] ) ? '' : '%'; |
|
| 95 | - $search = array(); |
|
| 96 | - |
|
| 97 | - foreach ( (array) $query_vars['search_terms'] as $term ) { |
|
| 98 | - $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent ); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - if ( ! is_user_logged_in() ) { |
|
| 102 | - $search[] = "$wpdb->posts.post_password = ''"; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $search = ' AND ' . implode( ' AND ', $search ); |
|
| 106 | - |
|
| 107 | - return $search; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Query WP for potential publishers, i.e. {@link WP_Post}s which are associated` |
|
| 112 | - * with `wl_entity_type` (taxonomy) terms of `Organization` or `Person`. |
|
| 113 | - * |
|
| 114 | - * @since 3.11.0 |
|
| 115 | - * |
|
| 116 | - * @param string $filter The title filter. |
|
| 117 | - * |
|
| 118 | - * @return array An array of results in a select2 friendly format. |
|
| 119 | - */ |
|
| 120 | - public function query( $filter = '' ) { |
|
| 121 | - |
|
| 122 | - // Search for the filter in the titles only. |
|
| 123 | - add_filter( 'posts_search', array( |
|
| 124 | - $this, |
|
| 125 | - 'limit_search_to_title', |
|
| 126 | - ), 10, 2 ); |
|
| 127 | - |
|
| 128 | - /* |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.19.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $configuration_service; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.19.0 |
|
| 34 | + * |
|
| 35 | + * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 36 | + */ |
|
| 37 | + public function __construct( $configuration_service ) { |
|
| 38 | + $this->configuration_service = $configuration_service; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Counts the number of potential publishers. |
|
| 43 | + * |
|
| 44 | + * @since 3.11.0 |
|
| 45 | + * |
|
| 46 | + * @return int The number of potential publishers. |
|
| 47 | + */ |
|
| 48 | + public function count() { |
|
| 49 | + |
|
| 50 | + // Search for entities which are either a Person |
|
| 51 | + // or Organization. |
|
| 52 | + |
|
| 53 | + // Get only the ids as all we need is the count. |
|
| 54 | + $entities = get_posts( array( |
|
| 55 | + 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 56 | + 'post_status' => 'publish', |
|
| 57 | + 'posts_per_page' => - 1, |
|
| 58 | + 'tax_query' => array( |
|
| 59 | + array( |
|
| 60 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 61 | + 'field' => 'slug', |
|
| 62 | + 'terms' => array( 'organization', 'person' ), |
|
| 63 | + ), |
|
| 64 | + ), |
|
| 65 | + 'fields' => 'ids', |
|
| 66 | + ) ); |
|
| 67 | + |
|
| 68 | + // Finally return the count. |
|
| 69 | + return count( $entities ); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Search SQL filter for matching against post title only. |
|
| 74 | + * |
|
| 75 | + * @link http://wordpress.stackexchange.com/a/11826/1685 |
|
| 76 | + * |
|
| 77 | + * @since 3.15.0 |
|
| 78 | + * |
|
| 79 | + * @param string $search The search string. |
|
| 80 | + * @param WP_Query $wp_query The {@link WP_Query} instance. |
|
| 81 | + * |
|
| 82 | + * @return array|string An array of results. |
|
| 83 | + */ |
|
| 84 | + public function limit_search_to_title( $search, $wp_query ) { |
|
| 85 | + |
|
| 86 | + // Bail out if the search or the `search_terms` haven't been set. |
|
| 87 | + if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) { |
|
| 88 | + return $search; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + global $wpdb; |
|
| 92 | + |
|
| 93 | + $query_vars = $wp_query->query_vars; |
|
| 94 | + $percent = ! empty( $query_vars['exact'] ) ? '' : '%'; |
|
| 95 | + $search = array(); |
|
| 96 | + |
|
| 97 | + foreach ( (array) $query_vars['search_terms'] as $term ) { |
|
| 98 | + $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent ); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + if ( ! is_user_logged_in() ) { |
|
| 102 | + $search[] = "$wpdb->posts.post_password = ''"; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $search = ' AND ' . implode( ' AND ', $search ); |
|
| 106 | + |
|
| 107 | + return $search; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Query WP for potential publishers, i.e. {@link WP_Post}s which are associated` |
|
| 112 | + * with `wl_entity_type` (taxonomy) terms of `Organization` or `Person`. |
|
| 113 | + * |
|
| 114 | + * @since 3.11.0 |
|
| 115 | + * |
|
| 116 | + * @param string $filter The title filter. |
|
| 117 | + * |
|
| 118 | + * @return array An array of results in a select2 friendly format. |
|
| 119 | + */ |
|
| 120 | + public function query( $filter = '' ) { |
|
| 121 | + |
|
| 122 | + // Search for the filter in the titles only. |
|
| 123 | + add_filter( 'posts_search', array( |
|
| 124 | + $this, |
|
| 125 | + 'limit_search_to_title', |
|
| 126 | + ), 10, 2 ); |
|
| 127 | + |
|
| 128 | + /* |
|
| 129 | 129 | * Search for entities which are either a Person |
| 130 | 130 | * or Organization. Sort the results by title in ascending order. |
| 131 | 131 | */ |
| 132 | - $entities = get_posts( array( |
|
| 133 | - 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 134 | - 'post_status' => 'publish', |
|
| 135 | - 'posts_per_page' => - 1, |
|
| 136 | - 'tax_query' => array( |
|
| 137 | - array( |
|
| 138 | - 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 139 | - 'field' => 'slug', |
|
| 140 | - 'terms' => array( 'organization', 'person' ), |
|
| 141 | - ), |
|
| 142 | - ), |
|
| 143 | - 's' => $filter, |
|
| 144 | - 'orderby' => 'title', |
|
| 145 | - 'order' => 'ASC', |
|
| 146 | - ) ); |
|
| 147 | - |
|
| 148 | - // Remove the search filter added before the query. |
|
| 149 | - remove_filter( 'posts_search', array( |
|
| 150 | - $this, |
|
| 151 | - 'limit_search_to_title', |
|
| 152 | - ), 10, 2 ); |
|
| 153 | - |
|
| 154 | - // Set a reference to ourselves to pass to the closure. |
|
| 155 | - $publisher_service = $this; |
|
| 156 | - |
|
| 157 | - // Map the results in a `Select2` compatible array. |
|
| 158 | - return array_map( function ( $entity ) use ( $publisher_service ) { |
|
| 159 | - $type = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 160 | - $thumb_id = get_post_thumbnail_id( $entity->ID ); |
|
| 161 | - |
|
| 162 | - return array( |
|
| 163 | - 'id' => $entity->ID, |
|
| 164 | - 'text' => $entity->post_title, |
|
| 165 | - 'type' => $type[0]->name, |
|
| 166 | - 'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ), |
|
| 167 | - ); |
|
| 168 | - }, $entities ); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Get the thumbnail's URL. |
|
| 173 | - * |
|
| 174 | - * @since 3.11.0 |
|
| 175 | - * |
|
| 176 | - * @param int $attachment_id The attachment id. |
|
| 177 | - * @param string $size The attachment size (default = 'thumbnail'). |
|
| 178 | - * |
|
| 179 | - * @return string|bool The image URL or false if not found. |
|
| 180 | - */ |
|
| 181 | - public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) { |
|
| 182 | - |
|
| 183 | - $image = wp_get_attachment_image_src( $attachment_id, $size ); |
|
| 184 | - |
|
| 185 | - return isset( $image['0'] ) ? $image['0'] : false; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Add additional instructions to featured image metabox |
|
| 190 | - * when the entity type is the publisher. |
|
| 191 | - * |
|
| 192 | - * @since 3.19.0 |
|
| 193 | - * |
|
| 194 | - * @param string $content Current metabox content. |
|
| 195 | - * |
|
| 196 | - * @return string $content metabox content with additional instructions. |
|
| 197 | - */ |
|
| 198 | - public function add_featured_image_instruction( $content ) { |
|
| 199 | - // Get the current post ID. |
|
| 200 | - $post_id = get_the_ID(); |
|
| 201 | - |
|
| 202 | - // Get the publisher id. |
|
| 203 | - $publisher_id = $this->configuration_service->get_publisher_id(); |
|
| 204 | - |
|
| 205 | - |
|
| 206 | - // Bail if for some reason the post id is not set. |
|
| 207 | - if ( |
|
| 208 | - empty( $post_id ) || |
|
| 209 | - $post_id !== (int) $publisher_id |
|
| 210 | - ) { |
|
| 211 | - return $content; |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - $terms = wp_get_post_terms( |
|
| 215 | - $post_id, // The post id. |
|
| 216 | - Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, // The taxonomy slug. |
|
| 217 | - array( |
|
| 218 | - 'fields' => 'slugs', |
|
| 219 | - // We don't need all fields, but only slugs. |
|
| 220 | - ) |
|
| 221 | - ); |
|
| 222 | - |
|
| 223 | - // Check that the entity type is "Organization". |
|
| 224 | - if ( in_array( 'organization', $terms, true ) ) { |
|
| 225 | - // Add the featured image description when the type is "Organization". |
|
| 226 | - |
|
| 227 | - $link = sprintf( '<a target="_blank" href="%s">%s</a>', |
|
| 228 | - esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ), |
|
| 229 | - esc_html__( 'AMP logo guidelines', 'wordlift' ) ); |
|
| 230 | - $content .= sprintf( '<p>' |
|
| 231 | - . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' ) |
|
| 232 | - . '</p>', $link ); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // Finally return the content. |
|
| 236 | - return $content; |
|
| 237 | - } |
|
| 132 | + $entities = get_posts( array( |
|
| 133 | + 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
|
| 134 | + 'post_status' => 'publish', |
|
| 135 | + 'posts_per_page' => - 1, |
|
| 136 | + 'tax_query' => array( |
|
| 137 | + array( |
|
| 138 | + 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
|
| 139 | + 'field' => 'slug', |
|
| 140 | + 'terms' => array( 'organization', 'person' ), |
|
| 141 | + ), |
|
| 142 | + ), |
|
| 143 | + 's' => $filter, |
|
| 144 | + 'orderby' => 'title', |
|
| 145 | + 'order' => 'ASC', |
|
| 146 | + ) ); |
|
| 147 | + |
|
| 148 | + // Remove the search filter added before the query. |
|
| 149 | + remove_filter( 'posts_search', array( |
|
| 150 | + $this, |
|
| 151 | + 'limit_search_to_title', |
|
| 152 | + ), 10, 2 ); |
|
| 153 | + |
|
| 154 | + // Set a reference to ourselves to pass to the closure. |
|
| 155 | + $publisher_service = $this; |
|
| 156 | + |
|
| 157 | + // Map the results in a `Select2` compatible array. |
|
| 158 | + return array_map( function ( $entity ) use ( $publisher_service ) { |
|
| 159 | + $type = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 160 | + $thumb_id = get_post_thumbnail_id( $entity->ID ); |
|
| 161 | + |
|
| 162 | + return array( |
|
| 163 | + 'id' => $entity->ID, |
|
| 164 | + 'text' => $entity->post_title, |
|
| 165 | + 'type' => $type[0]->name, |
|
| 166 | + 'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ), |
|
| 167 | + ); |
|
| 168 | + }, $entities ); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Get the thumbnail's URL. |
|
| 173 | + * |
|
| 174 | + * @since 3.11.0 |
|
| 175 | + * |
|
| 176 | + * @param int $attachment_id The attachment id. |
|
| 177 | + * @param string $size The attachment size (default = 'thumbnail'). |
|
| 178 | + * |
|
| 179 | + * @return string|bool The image URL or false if not found. |
|
| 180 | + */ |
|
| 181 | + public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) { |
|
| 182 | + |
|
| 183 | + $image = wp_get_attachment_image_src( $attachment_id, $size ); |
|
| 184 | + |
|
| 185 | + return isset( $image['0'] ) ? $image['0'] : false; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Add additional instructions to featured image metabox |
|
| 190 | + * when the entity type is the publisher. |
|
| 191 | + * |
|
| 192 | + * @since 3.19.0 |
|
| 193 | + * |
|
| 194 | + * @param string $content Current metabox content. |
|
| 195 | + * |
|
| 196 | + * @return string $content metabox content with additional instructions. |
|
| 197 | + */ |
|
| 198 | + public function add_featured_image_instruction( $content ) { |
|
| 199 | + // Get the current post ID. |
|
| 200 | + $post_id = get_the_ID(); |
|
| 201 | + |
|
| 202 | + // Get the publisher id. |
|
| 203 | + $publisher_id = $this->configuration_service->get_publisher_id(); |
|
| 204 | + |
|
| 205 | + |
|
| 206 | + // Bail if for some reason the post id is not set. |
|
| 207 | + if ( |
|
| 208 | + empty( $post_id ) || |
|
| 209 | + $post_id !== (int) $publisher_id |
|
| 210 | + ) { |
|
| 211 | + return $content; |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + $terms = wp_get_post_terms( |
|
| 215 | + $post_id, // The post id. |
|
| 216 | + Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, // The taxonomy slug. |
|
| 217 | + array( |
|
| 218 | + 'fields' => 'slugs', |
|
| 219 | + // We don't need all fields, but only slugs. |
|
| 220 | + ) |
|
| 221 | + ); |
|
| 222 | + |
|
| 223 | + // Check that the entity type is "Organization". |
|
| 224 | + if ( in_array( 'organization', $terms, true ) ) { |
|
| 225 | + // Add the featured image description when the type is "Organization". |
|
| 226 | + |
|
| 227 | + $link = sprintf( '<a target="_blank" href="%s">%s</a>', |
|
| 228 | + esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ), |
|
| 229 | + esc_html__( 'AMP logo guidelines', 'wordlift' ) ); |
|
| 230 | + $content .= sprintf( '<p>' |
|
| 231 | + . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' ) |
|
| 232 | + . '</p>', $link ); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // Finally return the content. |
|
| 236 | + return $content; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
| 36 | 36 | */ |
| 37 | - public function __construct( $configuration_service ) { |
|
| 37 | + public function __construct($configuration_service) { |
|
| 38 | 38 | $this->configuration_service = $configuration_service; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -51,22 +51,22 @@ discard block |
||
| 51 | 51 | // or Organization. |
| 52 | 52 | |
| 53 | 53 | // Get only the ids as all we need is the count. |
| 54 | - $entities = get_posts( array( |
|
| 54 | + $entities = get_posts(array( |
|
| 55 | 55 | 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
| 56 | 56 | 'post_status' => 'publish', |
| 57 | - 'posts_per_page' => - 1, |
|
| 57 | + 'posts_per_page' => -1, |
|
| 58 | 58 | 'tax_query' => array( |
| 59 | 59 | array( |
| 60 | 60 | 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
| 61 | 61 | 'field' => 'slug', |
| 62 | - 'terms' => array( 'organization', 'person' ), |
|
| 62 | + 'terms' => array('organization', 'person'), |
|
| 63 | 63 | ), |
| 64 | 64 | ), |
| 65 | 65 | 'fields' => 'ids', |
| 66 | - ) ); |
|
| 66 | + )); |
|
| 67 | 67 | |
| 68 | 68 | // Finally return the count. |
| 69 | - return count( $entities ); |
|
| 69 | + return count($entities); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -81,28 +81,28 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return array|string An array of results. |
| 83 | 83 | */ |
| 84 | - public function limit_search_to_title( $search, $wp_query ) { |
|
| 84 | + public function limit_search_to_title($search, $wp_query) { |
|
| 85 | 85 | |
| 86 | 86 | // Bail out if the search or the `search_terms` haven't been set. |
| 87 | - if ( empty( $search ) || empty( $wp_query->query_vars['search_terms'] ) ) { |
|
| 87 | + if (empty($search) || empty($wp_query->query_vars['search_terms'])) { |
|
| 88 | 88 | return $search; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | global $wpdb; |
| 92 | 92 | |
| 93 | 93 | $query_vars = $wp_query->query_vars; |
| 94 | - $percent = ! empty( $query_vars['exact'] ) ? '' : '%'; |
|
| 94 | + $percent = ! empty($query_vars['exact']) ? '' : '%'; |
|
| 95 | 95 | $search = array(); |
| 96 | 96 | |
| 97 | - foreach ( (array) $query_vars['search_terms'] as $term ) { |
|
| 98 | - $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $percent . $wpdb->esc_like( $term ) . $percent ); |
|
| 97 | + foreach ((array) $query_vars['search_terms'] as $term) { |
|
| 98 | + $search[] = $wpdb->prepare("$wpdb->posts.post_title LIKE %s", $percent.$wpdb->esc_like($term).$percent); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( ! is_user_logged_in() ) { |
|
| 101 | + if ( ! is_user_logged_in()) { |
|
| 102 | 102 | $search[] = "$wpdb->posts.post_password = ''"; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $search = ' AND ' . implode( ' AND ', $search ); |
|
| 105 | + $search = ' AND '.implode(' AND ', $search); |
|
| 106 | 106 | |
| 107 | 107 | return $search; |
| 108 | 108 | } |
@@ -117,55 +117,55 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return array An array of results in a select2 friendly format. |
| 119 | 119 | */ |
| 120 | - public function query( $filter = '' ) { |
|
| 120 | + public function query($filter = '') { |
|
| 121 | 121 | |
| 122 | 122 | // Search for the filter in the titles only. |
| 123 | - add_filter( 'posts_search', array( |
|
| 123 | + add_filter('posts_search', array( |
|
| 124 | 124 | $this, |
| 125 | 125 | 'limit_search_to_title', |
| 126 | - ), 10, 2 ); |
|
| 126 | + ), 10, 2); |
|
| 127 | 127 | |
| 128 | 128 | /* |
| 129 | 129 | * Search for entities which are either a Person |
| 130 | 130 | * or Organization. Sort the results by title in ascending order. |
| 131 | 131 | */ |
| 132 | - $entities = get_posts( array( |
|
| 132 | + $entities = get_posts(array( |
|
| 133 | 133 | 'post_type' => Wordlift_Entity_Service::valid_entity_post_types(), |
| 134 | 134 | 'post_status' => 'publish', |
| 135 | - 'posts_per_page' => - 1, |
|
| 135 | + 'posts_per_page' => -1, |
|
| 136 | 136 | 'tax_query' => array( |
| 137 | 137 | array( |
| 138 | 138 | 'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME, |
| 139 | 139 | 'field' => 'slug', |
| 140 | - 'terms' => array( 'organization', 'person' ), |
|
| 140 | + 'terms' => array('organization', 'person'), |
|
| 141 | 141 | ), |
| 142 | 142 | ), |
| 143 | 143 | 's' => $filter, |
| 144 | 144 | 'orderby' => 'title', |
| 145 | 145 | 'order' => 'ASC', |
| 146 | - ) ); |
|
| 146 | + )); |
|
| 147 | 147 | |
| 148 | 148 | // Remove the search filter added before the query. |
| 149 | - remove_filter( 'posts_search', array( |
|
| 149 | + remove_filter('posts_search', array( |
|
| 150 | 150 | $this, |
| 151 | 151 | 'limit_search_to_title', |
| 152 | - ), 10, 2 ); |
|
| 152 | + ), 10, 2); |
|
| 153 | 153 | |
| 154 | 154 | // Set a reference to ourselves to pass to the closure. |
| 155 | 155 | $publisher_service = $this; |
| 156 | 156 | |
| 157 | 157 | // Map the results in a `Select2` compatible array. |
| 158 | - return array_map( function ( $entity ) use ( $publisher_service ) { |
|
| 159 | - $type = wp_get_post_terms( $entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME ); |
|
| 160 | - $thumb_id = get_post_thumbnail_id( $entity->ID ); |
|
| 158 | + return array_map(function($entity) use ($publisher_service) { |
|
| 159 | + $type = wp_get_post_terms($entity->ID, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME); |
|
| 160 | + $thumb_id = get_post_thumbnail_id($entity->ID); |
|
| 161 | 161 | |
| 162 | 162 | return array( |
| 163 | 163 | 'id' => $entity->ID, |
| 164 | 164 | 'text' => $entity->post_title, |
| 165 | 165 | 'type' => $type[0]->name, |
| 166 | - 'thumbnail_url' => $publisher_service->get_attachment_image_url( $thumb_id ), |
|
| 166 | + 'thumbnail_url' => $publisher_service->get_attachment_image_url($thumb_id), |
|
| 167 | 167 | ); |
| 168 | - }, $entities ); |
|
| 168 | + }, $entities); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return string|bool The image URL or false if not found. |
| 180 | 180 | */ |
| 181 | - public function get_attachment_image_url( $attachment_id, $size = 'thumbnail' ) { |
|
| 181 | + public function get_attachment_image_url($attachment_id, $size = 'thumbnail') { |
|
| 182 | 182 | |
| 183 | - $image = wp_get_attachment_image_src( $attachment_id, $size ); |
|
| 183 | + $image = wp_get_attachment_image_src($attachment_id, $size); |
|
| 184 | 184 | |
| 185 | - return isset( $image['0'] ) ? $image['0'] : false; |
|
| 185 | + return isset($image['0']) ? $image['0'] : false; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return string $content metabox content with additional instructions. |
| 197 | 197 | */ |
| 198 | - public function add_featured_image_instruction( $content ) { |
|
| 198 | + public function add_featured_image_instruction($content) { |
|
| 199 | 199 | // Get the current post ID. |
| 200 | 200 | $post_id = get_the_ID(); |
| 201 | 201 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | // Bail if for some reason the post id is not set. |
| 207 | 207 | if ( |
| 208 | - empty( $post_id ) || |
|
| 208 | + empty($post_id) || |
|
| 209 | 209 | $post_id !== (int) $publisher_id |
| 210 | 210 | ) { |
| 211 | 211 | return $content; |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | // Check that the entity type is "Organization". |
| 224 | - if ( in_array( 'organization', $terms, true ) ) { |
|
| 224 | + if (in_array('organization', $terms, true)) { |
|
| 225 | 225 | // Add the featured image description when the type is "Organization". |
| 226 | 226 | |
| 227 | - $link = sprintf( '<a target="_blank" href="%s">%s</a>', |
|
| 228 | - esc_attr__( 'https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift' ), |
|
| 229 | - esc_html__( 'AMP logo guidelines', 'wordlift' ) ); |
|
| 230 | - $content .= sprintf( '<p>' |
|
| 231 | - . esc_html_x( 'According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift' ) |
|
| 232 | - . '</p>', $link ); |
|
| 227 | + $link = sprintf('<a target="_blank" href="%s">%s</a>', |
|
| 228 | + esc_attr__('https://developers.google.com/search/docs/data-types/article#logo-guidelines', 'wordlift'), |
|
| 229 | + esc_html__('AMP logo guidelines', 'wordlift')); |
|
| 230 | + $content .= sprintf('<p>' |
|
| 231 | + . esc_html_x('According to the %s, the logo should fit in a 60x600px rectangle, and either be exactly 60px high (preferred), or exactly 600px wide. For example, 450x45px would not be acceptable, even though it fits in the 600x60px rectangle. To comply with the guidelines, WordLift will automatically resize the Featured Image for structured data formats.', 'After "According to the" goes the link to the "AMP logo guidelines".', 'wordlift') |
|
| 232 | + . '</p>', $link); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // Finally return the content. |