@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Create a {@link Wordlift_Api_Service} instance. |
| 37 | 37 | * |
| 38 | - * @param $configuration_service \Wordlift_Configuration_Service The {@link Wordlift_Configuration_Service} instance. |
|
| 38 | + * @param Wordlift_Configuration_Service $configuration_service \Wordlift_Configuration_Service The {@link Wordlift_Configuration_Service} instance. |
|
| 39 | 39 | * |
| 40 | 40 | * @since 3.20.0 |
| 41 | 41 | * |
@@ -120,6 +120,9 @@ discard block |
||
| 120 | 120 | return self::get_message_or_error( $response ); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string $path |
|
| 125 | + */ |
|
| 123 | 126 | public function delete( $path ) { |
| 124 | 127 | |
| 125 | 128 | // Prepare the target URL. |
@@ -14,214 +14,214 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Wordlift_Api_Service { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * The {@link Wordlift_Configuration_Service} instance. |
|
| 19 | - * |
|
| 20 | - * @since 3.20.0 |
|
| 21 | - * @access private |
|
| 22 | - * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 23 | - */ |
|
| 24 | - private $configuration_service; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * The {@link Wordlift_Api_Service} singleton instance. |
|
| 28 | - * |
|
| 29 | - * @since 3.20.0 |
|
| 30 | - * @access private |
|
| 31 | - * @var \Wordlift_Api_Service $instance The singleton instance. |
|
| 32 | - */ |
|
| 33 | - private static $instance; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Create a {@link Wordlift_Api_Service} instance. |
|
| 37 | - * |
|
| 38 | - * @param $configuration_service \Wordlift_Configuration_Service The {@link Wordlift_Configuration_Service} instance. |
|
| 39 | - * |
|
| 40 | - * @since 3.20.0 |
|
| 41 | - * |
|
| 42 | - */ |
|
| 43 | - public function __construct( $configuration_service ) { |
|
| 44 | - |
|
| 45 | - $this->configuration_service = $configuration_service; |
|
| 46 | - |
|
| 47 | - self::$instance = $this; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Get the {@link Wordlift_Api_Service} singleton instance. |
|
| 52 | - * |
|
| 53 | - * @return \Wordlift_Api_Service The {@link Wordlift_Api_Service} singleton instance. |
|
| 54 | - * @since 3.20.0 |
|
| 55 | - * |
|
| 56 | - */ |
|
| 57 | - public static function get_instance() { |
|
| 58 | - |
|
| 59 | - return self::$instance; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Perform a `GET` request towards the requested path. |
|
| 64 | - * |
|
| 65 | - * @param string $path The relative path. |
|
| 66 | - * |
|
| 67 | - * @return array|WP_Error |
|
| 68 | - * @since 3.20.0 |
|
| 69 | - * |
|
| 70 | - */ |
|
| 71 | - public function get( $path ) { |
|
| 72 | - |
|
| 73 | - // Prepare the target URL. |
|
| 74 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 75 | - |
|
| 76 | - // Get the response value. |
|
| 77 | - $response = wp_remote_get( $url, array( |
|
| 78 | - 'user-agent' => self::get_user_agent(), |
|
| 79 | - 'headers' => array( |
|
| 80 | - 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 81 | - ), |
|
| 82 | - /* |
|
| 17 | + /** |
|
| 18 | + * The {@link Wordlift_Configuration_Service} instance. |
|
| 19 | + * |
|
| 20 | + * @since 3.20.0 |
|
| 21 | + * @access private |
|
| 22 | + * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance. |
|
| 23 | + */ |
|
| 24 | + private $configuration_service; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * The {@link Wordlift_Api_Service} singleton instance. |
|
| 28 | + * |
|
| 29 | + * @since 3.20.0 |
|
| 30 | + * @access private |
|
| 31 | + * @var \Wordlift_Api_Service $instance The singleton instance. |
|
| 32 | + */ |
|
| 33 | + private static $instance; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Create a {@link Wordlift_Api_Service} instance. |
|
| 37 | + * |
|
| 38 | + * @param $configuration_service \Wordlift_Configuration_Service The {@link Wordlift_Configuration_Service} instance. |
|
| 39 | + * |
|
| 40 | + * @since 3.20.0 |
|
| 41 | + * |
|
| 42 | + */ |
|
| 43 | + public function __construct( $configuration_service ) { |
|
| 44 | + |
|
| 45 | + $this->configuration_service = $configuration_service; |
|
| 46 | + |
|
| 47 | + self::$instance = $this; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Get the {@link Wordlift_Api_Service} singleton instance. |
|
| 52 | + * |
|
| 53 | + * @return \Wordlift_Api_Service The {@link Wordlift_Api_Service} singleton instance. |
|
| 54 | + * @since 3.20.0 |
|
| 55 | + * |
|
| 56 | + */ |
|
| 57 | + public static function get_instance() { |
|
| 58 | + |
|
| 59 | + return self::$instance; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Perform a `GET` request towards the requested path. |
|
| 64 | + * |
|
| 65 | + * @param string $path The relative path. |
|
| 66 | + * |
|
| 67 | + * @return array|WP_Error |
|
| 68 | + * @since 3.20.0 |
|
| 69 | + * |
|
| 70 | + */ |
|
| 71 | + public function get( $path ) { |
|
| 72 | + |
|
| 73 | + // Prepare the target URL. |
|
| 74 | + $url = $this->configuration_service->get_api_url() . $path; |
|
| 75 | + |
|
| 76 | + // Get the response value. |
|
| 77 | + $response = wp_remote_get( $url, array( |
|
| 78 | + 'user-agent' => self::get_user_agent(), |
|
| 79 | + 'headers' => array( |
|
| 80 | + 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 81 | + ), |
|
| 82 | + /* |
|
| 83 | 83 | * Increase the timeout from the default of 5 to 30 secs. |
| 84 | 84 | * |
| 85 | 85 | * @see https://github.com/insideout10/wordlift-plugin/issues/906 |
| 86 | 86 | * |
| 87 | 87 | * @since 3.20.1 |
| 88 | 88 | */ |
| 89 | - 'timeout' => 30, |
|
| 90 | - ) ); |
|
| 91 | - |
|
| 92 | - return self::get_message_or_error( $response ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Perform a `POST` request towards the requested path. |
|
| 97 | - * |
|
| 98 | - * @param string $path The relative path. |
|
| 99 | - * @param array|object $body The request body (will be serialized to JSON). |
|
| 100 | - * |
|
| 101 | - * @return array|WP_Error |
|
| 102 | - * @since 3.20.0 |
|
| 103 | - * |
|
| 104 | - */ |
|
| 105 | - public function post( $path, $body ) { |
|
| 106 | - |
|
| 107 | - // Prepare the target URL. |
|
| 108 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 109 | - |
|
| 110 | - // Get the response value. |
|
| 111 | - $response = wp_remote_post( $url, array( |
|
| 112 | - 'user-agent' => self::get_user_agent(), |
|
| 113 | - 'headers' => array( |
|
| 114 | - 'Content-Type' => 'application/json; ' . get_bloginfo( 'charset' ), |
|
| 115 | - 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 116 | - ), |
|
| 117 | - 'body' => json_encode( $body ), |
|
| 118 | - ) ); |
|
| 119 | - |
|
| 120 | - return self::get_message_or_error( $response ); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - public function delete( $path ) { |
|
| 124 | - |
|
| 125 | - // Prepare the target URL. |
|
| 126 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 127 | - |
|
| 128 | - // Get the response value. |
|
| 129 | - $response = wp_remote_request( $url, array( |
|
| 130 | - 'method' => 'DELETE', |
|
| 131 | - 'user-agent' => self::get_user_agent(), |
|
| 132 | - 'headers' => array( |
|
| 133 | - 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 134 | - ), |
|
| 135 | - ) ); |
|
| 136 | - |
|
| 137 | - return self::get_message_or_error( $response ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Return the {@link WP_Error} in case of error or the actual reply if successful. |
|
| 142 | - * |
|
| 143 | - * @param array|WP_Error $response The response of an http call. |
|
| 144 | - * |
|
| 145 | - * @return string|object|WP_Error A {@link WP_Error} instance or the actual response content. |
|
| 146 | - * @since 3.20.0 |
|
| 147 | - * |
|
| 148 | - */ |
|
| 149 | - private static function get_message_or_error( $response ) { |
|
| 150 | - |
|
| 151 | - // Result is WP_Error. |
|
| 152 | - if ( is_wp_error( $response ) ) { |
|
| 153 | - return $response; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - // `code` not set or not numeric. |
|
| 157 | - $code = wp_remote_retrieve_response_code( $response ); |
|
| 158 | - $message = @wp_remote_retrieve_response_message( $response ); |
|
| 159 | - |
|
| 160 | - if ( empty( $code ) || ! is_numeric( $code ) ) { |
|
| 161 | - return new WP_Error( 0, $message ); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - // Code not 2xx. |
|
| 165 | - if ( 2 !== intval( $code / 100 ) ) { |
|
| 166 | - return new WP_Error( $code, $message ); |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - // Everything's fine, return the message. |
|
| 170 | - return self::try_json_decode( $response ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Try to decode the json response |
|
| 175 | - * |
|
| 176 | - * @param array $response The response array. |
|
| 177 | - * |
|
| 178 | - * @return array|mixed|object The decoded response or the original response body. |
|
| 179 | - * @since 3.20.0 |
|
| 180 | - * |
|
| 181 | - */ |
|
| 182 | - private static function try_json_decode( $response ) { |
|
| 183 | - |
|
| 184 | - // Get the headers. |
|
| 185 | - $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 186 | - $body = wp_remote_retrieve_body( $response ); |
|
| 187 | - |
|
| 188 | - // If it's not an `application/json` return the plain response body. |
|
| 189 | - if ( 0 !== strpos( strtolower( $content_type ), 'application/json' ) ) { |
|
| 190 | - return $body; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - // Decode and return the structured result. |
|
| 194 | - return json_decode( $body ); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Get the User Agent. |
|
| 199 | - * |
|
| 200 | - * @return string The user-agent string. |
|
| 201 | - * @since 3.20.0 |
|
| 202 | - */ |
|
| 203 | - private static function get_user_agent() { |
|
| 204 | - |
|
| 205 | - // Get WL version. |
|
| 206 | - $wl_version = Wordlift::get_instance()->get_version(); |
|
| 207 | - |
|
| 208 | - // Get the WP version. |
|
| 209 | - $wp_version = get_bloginfo( 'version' ); |
|
| 210 | - |
|
| 211 | - // Get the home url. |
|
| 212 | - $home_url = home_url( '/' ); |
|
| 213 | - |
|
| 214 | - // Get the locale flag. |
|
| 215 | - $locale = apply_filters( 'core_version_check_locale', get_locale() ); |
|
| 216 | - |
|
| 217 | - // Get the multisite flag. |
|
| 218 | - $multisite = is_multisite() ? 'yes' : 'no'; |
|
| 219 | - |
|
| 220 | - // Get the PHP version. |
|
| 221 | - $php_version = phpversion(); |
|
| 222 | - |
|
| 223 | - /** @var string $wp_version The variable is defined in `version.php`. */ |
|
| 224 | - return "WordLift/$wl_version WordPress/$wp_version (multisite:$multisite, url:$home_url, locale:$locale) PHP/$php_version"; |
|
| 225 | - } |
|
| 89 | + 'timeout' => 30, |
|
| 90 | + ) ); |
|
| 91 | + |
|
| 92 | + return self::get_message_or_error( $response ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Perform a `POST` request towards the requested path. |
|
| 97 | + * |
|
| 98 | + * @param string $path The relative path. |
|
| 99 | + * @param array|object $body The request body (will be serialized to JSON). |
|
| 100 | + * |
|
| 101 | + * @return array|WP_Error |
|
| 102 | + * @since 3.20.0 |
|
| 103 | + * |
|
| 104 | + */ |
|
| 105 | + public function post( $path, $body ) { |
|
| 106 | + |
|
| 107 | + // Prepare the target URL. |
|
| 108 | + $url = $this->configuration_service->get_api_url() . $path; |
|
| 109 | + |
|
| 110 | + // Get the response value. |
|
| 111 | + $response = wp_remote_post( $url, array( |
|
| 112 | + 'user-agent' => self::get_user_agent(), |
|
| 113 | + 'headers' => array( |
|
| 114 | + 'Content-Type' => 'application/json; ' . get_bloginfo( 'charset' ), |
|
| 115 | + 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 116 | + ), |
|
| 117 | + 'body' => json_encode( $body ), |
|
| 118 | + ) ); |
|
| 119 | + |
|
| 120 | + return self::get_message_or_error( $response ); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + public function delete( $path ) { |
|
| 124 | + |
|
| 125 | + // Prepare the target URL. |
|
| 126 | + $url = $this->configuration_service->get_api_url() . $path; |
|
| 127 | + |
|
| 128 | + // Get the response value. |
|
| 129 | + $response = wp_remote_request( $url, array( |
|
| 130 | + 'method' => 'DELETE', |
|
| 131 | + 'user-agent' => self::get_user_agent(), |
|
| 132 | + 'headers' => array( |
|
| 133 | + 'X-Authorization' => $this->configuration_service->get_key(), |
|
| 134 | + ), |
|
| 135 | + ) ); |
|
| 136 | + |
|
| 137 | + return self::get_message_or_error( $response ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Return the {@link WP_Error} in case of error or the actual reply if successful. |
|
| 142 | + * |
|
| 143 | + * @param array|WP_Error $response The response of an http call. |
|
| 144 | + * |
|
| 145 | + * @return string|object|WP_Error A {@link WP_Error} instance or the actual response content. |
|
| 146 | + * @since 3.20.0 |
|
| 147 | + * |
|
| 148 | + */ |
|
| 149 | + private static function get_message_or_error( $response ) { |
|
| 150 | + |
|
| 151 | + // Result is WP_Error. |
|
| 152 | + if ( is_wp_error( $response ) ) { |
|
| 153 | + return $response; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + // `code` not set or not numeric. |
|
| 157 | + $code = wp_remote_retrieve_response_code( $response ); |
|
| 158 | + $message = @wp_remote_retrieve_response_message( $response ); |
|
| 159 | + |
|
| 160 | + if ( empty( $code ) || ! is_numeric( $code ) ) { |
|
| 161 | + return new WP_Error( 0, $message ); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + // Code not 2xx. |
|
| 165 | + if ( 2 !== intval( $code / 100 ) ) { |
|
| 166 | + return new WP_Error( $code, $message ); |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + // Everything's fine, return the message. |
|
| 170 | + return self::try_json_decode( $response ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Try to decode the json response |
|
| 175 | + * |
|
| 176 | + * @param array $response The response array. |
|
| 177 | + * |
|
| 178 | + * @return array|mixed|object The decoded response or the original response body. |
|
| 179 | + * @since 3.20.0 |
|
| 180 | + * |
|
| 181 | + */ |
|
| 182 | + private static function try_json_decode( $response ) { |
|
| 183 | + |
|
| 184 | + // Get the headers. |
|
| 185 | + $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 186 | + $body = wp_remote_retrieve_body( $response ); |
|
| 187 | + |
|
| 188 | + // If it's not an `application/json` return the plain response body. |
|
| 189 | + if ( 0 !== strpos( strtolower( $content_type ), 'application/json' ) ) { |
|
| 190 | + return $body; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + // Decode and return the structured result. |
|
| 194 | + return json_decode( $body ); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Get the User Agent. |
|
| 199 | + * |
|
| 200 | + * @return string The user-agent string. |
|
| 201 | + * @since 3.20.0 |
|
| 202 | + */ |
|
| 203 | + private static function get_user_agent() { |
|
| 204 | + |
|
| 205 | + // Get WL version. |
|
| 206 | + $wl_version = Wordlift::get_instance()->get_version(); |
|
| 207 | + |
|
| 208 | + // Get the WP version. |
|
| 209 | + $wp_version = get_bloginfo( 'version' ); |
|
| 210 | + |
|
| 211 | + // Get the home url. |
|
| 212 | + $home_url = home_url( '/' ); |
|
| 213 | + |
|
| 214 | + // Get the locale flag. |
|
| 215 | + $locale = apply_filters( 'core_version_check_locale', get_locale() ); |
|
| 216 | + |
|
| 217 | + // Get the multisite flag. |
|
| 218 | + $multisite = is_multisite() ? 'yes' : 'no'; |
|
| 219 | + |
|
| 220 | + // Get the PHP version. |
|
| 221 | + $php_version = phpversion(); |
|
| 222 | + |
|
| 223 | + /** @var string $wp_version The variable is defined in `version.php`. */ |
|
| 224 | + return "WordLift/$wl_version WordPress/$wp_version (multisite:$multisite, url:$home_url, locale:$locale) PHP/$php_version"; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @since 3.20.0 |
| 41 | 41 | * |
| 42 | 42 | */ |
| 43 | - public function __construct( $configuration_service ) { |
|
| 43 | + public function __construct($configuration_service) { |
|
| 44 | 44 | |
| 45 | 45 | $this->configuration_service = $configuration_service; |
| 46 | 46 | |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @since 3.20.0 |
| 69 | 69 | * |
| 70 | 70 | */ |
| 71 | - public function get( $path ) { |
|
| 71 | + public function get($path) { |
|
| 72 | 72 | |
| 73 | 73 | // Prepare the target URL. |
| 74 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 74 | + $url = $this->configuration_service->get_api_url().$path; |
|
| 75 | 75 | |
| 76 | 76 | // Get the response value. |
| 77 | - $response = wp_remote_get( $url, array( |
|
| 77 | + $response = wp_remote_get($url, array( |
|
| 78 | 78 | 'user-agent' => self::get_user_agent(), |
| 79 | 79 | 'headers' => array( |
| 80 | 80 | 'X-Authorization' => $this->configuration_service->get_key(), |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | * @since 3.20.1 |
| 88 | 88 | */ |
| 89 | 89 | 'timeout' => 30, |
| 90 | - ) ); |
|
| 90 | + )); |
|
| 91 | 91 | |
| 92 | - return self::get_message_or_error( $response ); |
|
| 92 | + return self::get_message_or_error($response); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -102,39 +102,39 @@ discard block |
||
| 102 | 102 | * @since 3.20.0 |
| 103 | 103 | * |
| 104 | 104 | */ |
| 105 | - public function post( $path, $body ) { |
|
| 105 | + public function post($path, $body) { |
|
| 106 | 106 | |
| 107 | 107 | // Prepare the target URL. |
| 108 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 108 | + $url = $this->configuration_service->get_api_url().$path; |
|
| 109 | 109 | |
| 110 | 110 | // Get the response value. |
| 111 | - $response = wp_remote_post( $url, array( |
|
| 111 | + $response = wp_remote_post($url, array( |
|
| 112 | 112 | 'user-agent' => self::get_user_agent(), |
| 113 | 113 | 'headers' => array( |
| 114 | - 'Content-Type' => 'application/json; ' . get_bloginfo( 'charset' ), |
|
| 114 | + 'Content-Type' => 'application/json; '.get_bloginfo('charset'), |
|
| 115 | 115 | 'X-Authorization' => $this->configuration_service->get_key(), |
| 116 | 116 | ), |
| 117 | - 'body' => json_encode( $body ), |
|
| 118 | - ) ); |
|
| 117 | + 'body' => json_encode($body), |
|
| 118 | + )); |
|
| 119 | 119 | |
| 120 | - return self::get_message_or_error( $response ); |
|
| 120 | + return self::get_message_or_error($response); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function delete( $path ) { |
|
| 123 | + public function delete($path) { |
|
| 124 | 124 | |
| 125 | 125 | // Prepare the target URL. |
| 126 | - $url = $this->configuration_service->get_api_url() . $path; |
|
| 126 | + $url = $this->configuration_service->get_api_url().$path; |
|
| 127 | 127 | |
| 128 | 128 | // Get the response value. |
| 129 | - $response = wp_remote_request( $url, array( |
|
| 129 | + $response = wp_remote_request($url, array( |
|
| 130 | 130 | 'method' => 'DELETE', |
| 131 | 131 | 'user-agent' => self::get_user_agent(), |
| 132 | 132 | 'headers' => array( |
| 133 | 133 | 'X-Authorization' => $this->configuration_service->get_key(), |
| 134 | 134 | ), |
| 135 | - ) ); |
|
| 135 | + )); |
|
| 136 | 136 | |
| 137 | - return self::get_message_or_error( $response ); |
|
| 137 | + return self::get_message_or_error($response); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -146,28 +146,28 @@ discard block |
||
| 146 | 146 | * @since 3.20.0 |
| 147 | 147 | * |
| 148 | 148 | */ |
| 149 | - private static function get_message_or_error( $response ) { |
|
| 149 | + private static function get_message_or_error($response) { |
|
| 150 | 150 | |
| 151 | 151 | // Result is WP_Error. |
| 152 | - if ( is_wp_error( $response ) ) { |
|
| 152 | + if (is_wp_error($response)) { |
|
| 153 | 153 | return $response; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // `code` not set or not numeric. |
| 157 | - $code = wp_remote_retrieve_response_code( $response ); |
|
| 158 | - $message = @wp_remote_retrieve_response_message( $response ); |
|
| 157 | + $code = wp_remote_retrieve_response_code($response); |
|
| 158 | + $message = @wp_remote_retrieve_response_message($response); |
|
| 159 | 159 | |
| 160 | - if ( empty( $code ) || ! is_numeric( $code ) ) { |
|
| 161 | - return new WP_Error( 0, $message ); |
|
| 160 | + if (empty($code) || ! is_numeric($code)) { |
|
| 161 | + return new WP_Error(0, $message); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Code not 2xx. |
| 165 | - if ( 2 !== intval( $code / 100 ) ) { |
|
| 166 | - return new WP_Error( $code, $message ); |
|
| 165 | + if (2 !== intval($code / 100)) { |
|
| 166 | + return new WP_Error($code, $message); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // Everything's fine, return the message. |
| 170 | - return self::try_json_decode( $response ); |
|
| 170 | + return self::try_json_decode($response); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -179,19 +179,19 @@ discard block |
||
| 179 | 179 | * @since 3.20.0 |
| 180 | 180 | * |
| 181 | 181 | */ |
| 182 | - private static function try_json_decode( $response ) { |
|
| 182 | + private static function try_json_decode($response) { |
|
| 183 | 183 | |
| 184 | 184 | // Get the headers. |
| 185 | - $content_type = wp_remote_retrieve_header( $response, 'content-type' ); |
|
| 186 | - $body = wp_remote_retrieve_body( $response ); |
|
| 185 | + $content_type = wp_remote_retrieve_header($response, 'content-type'); |
|
| 186 | + $body = wp_remote_retrieve_body($response); |
|
| 187 | 187 | |
| 188 | 188 | // If it's not an `application/json` return the plain response body. |
| 189 | - if ( 0 !== strpos( strtolower( $content_type ), 'application/json' ) ) { |
|
| 189 | + if (0 !== strpos(strtolower($content_type), 'application/json')) { |
|
| 190 | 190 | return $body; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Decode and return the structured result. |
| 194 | - return json_decode( $body ); |
|
| 194 | + return json_decode($body); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | $wl_version = Wordlift::get_instance()->get_version(); |
| 207 | 207 | |
| 208 | 208 | // Get the WP version. |
| 209 | - $wp_version = get_bloginfo( 'version' ); |
|
| 209 | + $wp_version = get_bloginfo('version'); |
|
| 210 | 210 | |
| 211 | 211 | // Get the home url. |
| 212 | - $home_url = home_url( '/' ); |
|
| 212 | + $home_url = home_url('/'); |
|
| 213 | 213 | |
| 214 | 214 | // Get the locale flag. |
| 215 | - $locale = apply_filters( 'core_version_check_locale', get_locale() ); |
|
| 215 | + $locale = apply_filters('core_version_check_locale', get_locale()); |
|
| 216 | 216 | |
| 217 | 217 | // Get the multisite flag. |
| 218 | 218 | $multisite = is_multisite() ? 'yes' : 'no'; |
@@ -126,9 +126,8 @@ |
||
| 126 | 126 | * |
| 127 | 127 | * @since 3.2.0 |
| 128 | 128 | * |
| 129 | - * @param int $entity_id A post entity id. |
|
| 130 | 129 | * |
| 131 | - * @return array permalink. |
|
| 130 | + * @return string[] permalink. |
|
| 132 | 131 | */ |
| 133 | 132 | public function allowed_redirect_hosts( $content ) { |
| 134 | 133 | |
@@ -10,129 +10,129 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class Wordlift_Redirect_Service { |
| 12 | 12 | |
| 13 | - const LOD_ENDPOINT = 'http://www.lodview.it'; |
|
| 14 | - const LOD_HOST = 'www.lodview.it'; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * The Log service. |
|
| 18 | - * |
|
| 19 | - * @since 3.2.0 |
|
| 20 | - * @access private |
|
| 21 | - * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 22 | - */ |
|
| 23 | - private $log_service; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * The Entity URI service. |
|
| 27 | - * |
|
| 28 | - * @since 3.2.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var Wordlift_Entity_Uri_Service $entity_uri_service The Entity service. |
|
| 31 | - */ |
|
| 32 | - private $entity_uri_service; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * A singleton instance of the Redirect service (useful for unit tests). |
|
| 36 | - * |
|
| 37 | - * @since 3.2.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var \Wordlift_Redirect_Service $instance The singleton instance. |
|
| 40 | - */ |
|
| 41 | - private static $instance; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Create a Wordlift_Redirect_Service instance. |
|
| 45 | - * |
|
| 46 | - * @param Wordlift_Entity_Uri_Service $entity_uri_service The Entity service. |
|
| 47 | - * |
|
| 48 | - * @since 3.2.0 |
|
| 49 | - * |
|
| 50 | - */ |
|
| 51 | - public function __construct( $entity_uri_service ) { |
|
| 52 | - |
|
| 53 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Redirect_Service' ); |
|
| 54 | - |
|
| 55 | - $this->entity_uri_service = $entity_uri_service; |
|
| 56 | - |
|
| 57 | - self::$instance = $this; |
|
| 58 | - |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get the singleton instance of the Wordlift_Redirect_Service |
|
| 63 | - * |
|
| 64 | - * @return \Wordlift_Redirect_Service The singleton instance of the Wordlift_Redirect_Service. |
|
| 65 | - * @since 3.2.0 |
|
| 66 | - * |
|
| 67 | - */ |
|
| 68 | - public static function get_instance() { |
|
| 69 | - |
|
| 70 | - return self::$instance; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Perform redirect depending on entity uri and target |
|
| 75 | - * |
|
| 76 | - * @since 3.2.0 |
|
| 77 | - */ |
|
| 78 | - public function ajax_redirect() { |
|
| 79 | - |
|
| 80 | - // Check the `uri` parameter. |
|
| 81 | - if ( ! ( $entity_uri = filter_input( INPUT_GET, 'uri', FILTER_VALIDATE_URL ) ) ) { |
|
| 82 | - wp_die( __( 'Invalid URI.', 'wordlift' ), __( 'Invalid URI.', 'wordlift' ), array( |
|
| 83 | - 'response' => 400, |
|
| 84 | - 'back_link' => true, |
|
| 85 | - ) ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - // Check the `to` parameter. |
|
| 89 | - if ( ! ( $target = filter_input( INPUT_GET, 'to' ) ) ) { |
|
| 90 | - wp_die( __( 'Invalid `to` parameter.', 'wordlift' ), __( 'Invalid `to` parameter.', 'wordlift' ), array( |
|
| 91 | - 'response' => 400, |
|
| 92 | - 'back_link' => true, |
|
| 93 | - ) ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - // Check if the entity exists. |
|
| 97 | - if ( ! ( $entity = $this->entity_uri_service->get_entity( $entity_uri ) ) ) { |
|
| 98 | - wp_die( __( 'Entity not found.', 'wordlift' ), __( 'Entity not found.', 'wordlift' ), array( |
|
| 99 | - 'response' => 404, |
|
| 100 | - 'back_link' => true, |
|
| 101 | - ) ); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - switch ( $target ) { |
|
| 105 | - case 'edit': |
|
| 106 | - $redirect_url = get_edit_post_link( $entity, 'none' ); |
|
| 107 | - break; |
|
| 108 | - case 'lod': |
|
| 109 | - $redirect_url = self::LOD_ENDPOINT . '/lodview/?IRI=' . urlencode( $entity_uri ); |
|
| 110 | - break; |
|
| 111 | - case 'permalink': |
|
| 112 | - $redirect_url = get_permalink( $entity ); |
|
| 113 | - break; |
|
| 114 | - default: |
|
| 115 | - wp_die( 'Unsupported redirect target.' ); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - // Perform the redirect |
|
| 119 | - wp_safe_redirect( $redirect_url ); |
|
| 120 | - exit; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Register custom allowed hosts. |
|
| 125 | - * @see https://developer.wordpress.org/reference/functions/wp_safe_redirect/ |
|
| 126 | - * |
|
| 127 | - * @since 3.2.0 |
|
| 128 | - * |
|
| 129 | - * @param int $entity_id A post entity id. |
|
| 130 | - * |
|
| 131 | - * @return array permalink. |
|
| 132 | - */ |
|
| 133 | - public function allowed_redirect_hosts( $content ) { |
|
| 134 | - |
|
| 135 | - return array_merge( $content, array( self::LOD_HOST ) ); |
|
| 136 | - } |
|
| 13 | + const LOD_ENDPOINT = 'http://www.lodview.it'; |
|
| 14 | + const LOD_HOST = 'www.lodview.it'; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * The Log service. |
|
| 18 | + * |
|
| 19 | + * @since 3.2.0 |
|
| 20 | + * @access private |
|
| 21 | + * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 22 | + */ |
|
| 23 | + private $log_service; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * The Entity URI service. |
|
| 27 | + * |
|
| 28 | + * @since 3.2.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var Wordlift_Entity_Uri_Service $entity_uri_service The Entity service. |
|
| 31 | + */ |
|
| 32 | + private $entity_uri_service; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * A singleton instance of the Redirect service (useful for unit tests). |
|
| 36 | + * |
|
| 37 | + * @since 3.2.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var \Wordlift_Redirect_Service $instance The singleton instance. |
|
| 40 | + */ |
|
| 41 | + private static $instance; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Create a Wordlift_Redirect_Service instance. |
|
| 45 | + * |
|
| 46 | + * @param Wordlift_Entity_Uri_Service $entity_uri_service The Entity service. |
|
| 47 | + * |
|
| 48 | + * @since 3.2.0 |
|
| 49 | + * |
|
| 50 | + */ |
|
| 51 | + public function __construct( $entity_uri_service ) { |
|
| 52 | + |
|
| 53 | + $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Redirect_Service' ); |
|
| 54 | + |
|
| 55 | + $this->entity_uri_service = $entity_uri_service; |
|
| 56 | + |
|
| 57 | + self::$instance = $this; |
|
| 58 | + |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get the singleton instance of the Wordlift_Redirect_Service |
|
| 63 | + * |
|
| 64 | + * @return \Wordlift_Redirect_Service The singleton instance of the Wordlift_Redirect_Service. |
|
| 65 | + * @since 3.2.0 |
|
| 66 | + * |
|
| 67 | + */ |
|
| 68 | + public static function get_instance() { |
|
| 69 | + |
|
| 70 | + return self::$instance; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Perform redirect depending on entity uri and target |
|
| 75 | + * |
|
| 76 | + * @since 3.2.0 |
|
| 77 | + */ |
|
| 78 | + public function ajax_redirect() { |
|
| 79 | + |
|
| 80 | + // Check the `uri` parameter. |
|
| 81 | + if ( ! ( $entity_uri = filter_input( INPUT_GET, 'uri', FILTER_VALIDATE_URL ) ) ) { |
|
| 82 | + wp_die( __( 'Invalid URI.', 'wordlift' ), __( 'Invalid URI.', 'wordlift' ), array( |
|
| 83 | + 'response' => 400, |
|
| 84 | + 'back_link' => true, |
|
| 85 | + ) ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + // Check the `to` parameter. |
|
| 89 | + if ( ! ( $target = filter_input( INPUT_GET, 'to' ) ) ) { |
|
| 90 | + wp_die( __( 'Invalid `to` parameter.', 'wordlift' ), __( 'Invalid `to` parameter.', 'wordlift' ), array( |
|
| 91 | + 'response' => 400, |
|
| 92 | + 'back_link' => true, |
|
| 93 | + ) ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + // Check if the entity exists. |
|
| 97 | + if ( ! ( $entity = $this->entity_uri_service->get_entity( $entity_uri ) ) ) { |
|
| 98 | + wp_die( __( 'Entity not found.', 'wordlift' ), __( 'Entity not found.', 'wordlift' ), array( |
|
| 99 | + 'response' => 404, |
|
| 100 | + 'back_link' => true, |
|
| 101 | + ) ); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + switch ( $target ) { |
|
| 105 | + case 'edit': |
|
| 106 | + $redirect_url = get_edit_post_link( $entity, 'none' ); |
|
| 107 | + break; |
|
| 108 | + case 'lod': |
|
| 109 | + $redirect_url = self::LOD_ENDPOINT . '/lodview/?IRI=' . urlencode( $entity_uri ); |
|
| 110 | + break; |
|
| 111 | + case 'permalink': |
|
| 112 | + $redirect_url = get_permalink( $entity ); |
|
| 113 | + break; |
|
| 114 | + default: |
|
| 115 | + wp_die( 'Unsupported redirect target.' ); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + // Perform the redirect |
|
| 119 | + wp_safe_redirect( $redirect_url ); |
|
| 120 | + exit; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Register custom allowed hosts. |
|
| 125 | + * @see https://developer.wordpress.org/reference/functions/wp_safe_redirect/ |
|
| 126 | + * |
|
| 127 | + * @since 3.2.0 |
|
| 128 | + * |
|
| 129 | + * @param int $entity_id A post entity id. |
|
| 130 | + * |
|
| 131 | + * @return array permalink. |
|
| 132 | + */ |
|
| 133 | + public function allowed_redirect_hosts( $content ) { |
|
| 134 | + |
|
| 135 | + return array_merge( $content, array( self::LOD_HOST ) ); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @since 3.2.0 |
| 49 | 49 | * |
| 50 | 50 | */ |
| 51 | - public function __construct( $entity_uri_service ) { |
|
| 51 | + public function __construct($entity_uri_service) { |
|
| 52 | 52 | |
| 53 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Redirect_Service' ); |
|
| 53 | + $this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Redirect_Service'); |
|
| 54 | 54 | |
| 55 | 55 | $this->entity_uri_service = $entity_uri_service; |
| 56 | 56 | |
@@ -78,45 +78,45 @@ discard block |
||
| 78 | 78 | public function ajax_redirect() { |
| 79 | 79 | |
| 80 | 80 | // Check the `uri` parameter. |
| 81 | - if ( ! ( $entity_uri = filter_input( INPUT_GET, 'uri', FILTER_VALIDATE_URL ) ) ) { |
|
| 82 | - wp_die( __( 'Invalid URI.', 'wordlift' ), __( 'Invalid URI.', 'wordlift' ), array( |
|
| 81 | + if ( ! ($entity_uri = filter_input(INPUT_GET, 'uri', FILTER_VALIDATE_URL))) { |
|
| 82 | + wp_die(__('Invalid URI.', 'wordlift'), __('Invalid URI.', 'wordlift'), array( |
|
| 83 | 83 | 'response' => 400, |
| 84 | 84 | 'back_link' => true, |
| 85 | - ) ); |
|
| 85 | + )); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Check the `to` parameter. |
| 89 | - if ( ! ( $target = filter_input( INPUT_GET, 'to' ) ) ) { |
|
| 90 | - wp_die( __( 'Invalid `to` parameter.', 'wordlift' ), __( 'Invalid `to` parameter.', 'wordlift' ), array( |
|
| 89 | + if ( ! ($target = filter_input(INPUT_GET, 'to'))) { |
|
| 90 | + wp_die(__('Invalid `to` parameter.', 'wordlift'), __('Invalid `to` parameter.', 'wordlift'), array( |
|
| 91 | 91 | 'response' => 400, |
| 92 | 92 | 'back_link' => true, |
| 93 | - ) ); |
|
| 93 | + )); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Check if the entity exists. |
| 97 | - if ( ! ( $entity = $this->entity_uri_service->get_entity( $entity_uri ) ) ) { |
|
| 98 | - wp_die( __( 'Entity not found.', 'wordlift' ), __( 'Entity not found.', 'wordlift' ), array( |
|
| 97 | + if ( ! ($entity = $this->entity_uri_service->get_entity($entity_uri))) { |
|
| 98 | + wp_die(__('Entity not found.', 'wordlift'), __('Entity not found.', 'wordlift'), array( |
|
| 99 | 99 | 'response' => 404, |
| 100 | 100 | 'back_link' => true, |
| 101 | - ) ); |
|
| 101 | + )); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - switch ( $target ) { |
|
| 104 | + switch ($target) { |
|
| 105 | 105 | case 'edit': |
| 106 | - $redirect_url = get_edit_post_link( $entity, 'none' ); |
|
| 106 | + $redirect_url = get_edit_post_link($entity, 'none'); |
|
| 107 | 107 | break; |
| 108 | 108 | case 'lod': |
| 109 | - $redirect_url = self::LOD_ENDPOINT . '/lodview/?IRI=' . urlencode( $entity_uri ); |
|
| 109 | + $redirect_url = self::LOD_ENDPOINT.'/lodview/?IRI='.urlencode($entity_uri); |
|
| 110 | 110 | break; |
| 111 | 111 | case 'permalink': |
| 112 | - $redirect_url = get_permalink( $entity ); |
|
| 112 | + $redirect_url = get_permalink($entity); |
|
| 113 | 113 | break; |
| 114 | 114 | default: |
| 115 | - wp_die( 'Unsupported redirect target.' ); |
|
| 115 | + wp_die('Unsupported redirect target.'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Perform the redirect |
| 119 | - wp_safe_redirect( $redirect_url ); |
|
| 119 | + wp_safe_redirect($redirect_url); |
|
| 120 | 120 | exit; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return array permalink. |
| 132 | 132 | */ |
| 133 | - public function allowed_redirect_hosts( $content ) { |
|
| 133 | + public function allowed_redirect_hosts($content) { |
|
| 134 | 134 | |
| 135 | - return array_merge( $content, array( self::LOD_HOST ) ); |
|
| 135 | + return array_merge($content, array(self::LOD_HOST)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | } |
@@ -16,45 +16,45 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function wl_linked_data_save_post( $post_id ) { |
| 18 | 18 | |
| 19 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' ); |
|
| 19 | + $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' ); |
|
| 20 | 20 | |
| 21 | - $log->trace( "Saving post $post_id to Linked Data..." ); |
|
| 21 | + $log->trace( "Saving post $post_id to Linked Data..." ); |
|
| 22 | 22 | |
| 23 | - // If it's not numeric exit from here. |
|
| 24 | - if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) { |
|
| 25 | - $log->debug( "Skipping $post_id, because id is not numeric or is a post revision." ); |
|
| 23 | + // If it's not numeric exit from here. |
|
| 24 | + if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) { |
|
| 25 | + $log->debug( "Skipping $post_id, because id is not numeric or is a post revision." ); |
|
| 26 | 26 | |
| 27 | - return; |
|
| 28 | - } |
|
| 27 | + return; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - // Get the post type and check whether it supports the editor. |
|
| 31 | - // |
|
| 32 | - // @see https://github.com/insideout10/wordlift-plugin/issues/659. |
|
| 33 | - $post_type = get_post_type( $post_id ); |
|
| 34 | - /** |
|
| 35 | - * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting. |
|
| 36 | - * |
|
| 37 | - * @since 3.19.4 |
|
| 38 | - * |
|
| 39 | - * @see https://github.com/insideout10/wordlift-plugin/issues/847. |
|
| 40 | - */ |
|
| 41 | - $is_editor_supported = wl_post_type_supports_editor( $post_type ); |
|
| 30 | + // Get the post type and check whether it supports the editor. |
|
| 31 | + // |
|
| 32 | + // @see https://github.com/insideout10/wordlift-plugin/issues/659. |
|
| 33 | + $post_type = get_post_type( $post_id ); |
|
| 34 | + /** |
|
| 35 | + * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting. |
|
| 36 | + * |
|
| 37 | + * @since 3.19.4 |
|
| 38 | + * |
|
| 39 | + * @see https://github.com/insideout10/wordlift-plugin/issues/847. |
|
| 40 | + */ |
|
| 41 | + $is_editor_supported = wl_post_type_supports_editor( $post_type ); |
|
| 42 | 42 | |
| 43 | - // Bail out if it's not an entity. |
|
| 44 | - if ( ! $is_editor_supported ) { |
|
| 45 | - $log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." ); |
|
| 43 | + // Bail out if it's not an entity. |
|
| 44 | + if ( ! $is_editor_supported ) { |
|
| 45 | + $log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." ); |
|
| 46 | 46 | |
| 47 | - return; |
|
| 48 | - } |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - // Unhook this function so it doesn't loop infinitely. |
|
| 51 | - remove_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 50 | + // Unhook this function so it doesn't loop infinitely. |
|
| 51 | + remove_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 52 | 52 | |
| 53 | - // raise the *wl_linked_data_save_post* event. |
|
| 54 | - do_action( 'wl_linked_data_save_post', $post_id ); |
|
| 53 | + // raise the *wl_linked_data_save_post* event. |
|
| 54 | + do_action( 'wl_linked_data_save_post', $post_id ); |
|
| 55 | 55 | |
| 56 | - // Re-hook this function. |
|
| 57 | - add_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 56 | + // Re-hook this function. |
|
| 57 | + add_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | add_action( 'save_post', 'wl_linked_data_save_post' ); |
@@ -63,108 +63,108 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | function wl_linked_data_rest_insert_post( $post, $request, $creating ){ |
| 65 | 65 | |
| 66 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 66 | + $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 67 | 67 | |
| 68 | - $post_id = $post->ID; |
|
| 69 | - $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 68 | + $post_id = $post->ID; |
|
| 69 | + $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 70 | 70 | |
| 71 | - // Ignore auto-saves |
|
| 72 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 73 | - $log->trace( 'Doing autosave, skipping...' ); |
|
| 74 | - return; |
|
| 75 | - } |
|
| 71 | + // Ignore auto-saves |
|
| 72 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 73 | + $log->trace( 'Doing autosave, skipping...' ); |
|
| 74 | + return; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - // Get the entity service instance. |
|
| 78 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 77 | + // Get the entity service instance. |
|
| 78 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 79 | 79 | |
| 80 | - // Store mapping between tmp new entities uris and real new entities uri |
|
| 81 | - $entities_uri_mapping = array(); |
|
| 80 | + // Store mapping between tmp new entities uris and real new entities uri |
|
| 81 | + $entities_uri_mapping = array(); |
|
| 82 | 82 | |
| 83 | - // Save the entities coming with POST data. |
|
| 84 | - $metas = $request->get_json_params(); |
|
| 85 | - $metas = $metas['meta']; |
|
| 83 | + // Save the entities coming with POST data. |
|
| 84 | + $metas = $request->get_json_params(); |
|
| 85 | + $metas = $metas['meta']; |
|
| 86 | 86 | |
| 87 | - // Ignore if no change in meta |
|
| 88 | - if ( !empty($metas) ) { |
|
| 89 | - $entities_via_meta = json_decode($metas['wl_entities_gutenberg'], true); |
|
| 87 | + // Ignore if no change in meta |
|
| 88 | + if ( !empty($metas) ) { |
|
| 89 | + $entities_via_meta = json_decode($metas['wl_entities_gutenberg'], true); |
|
| 90 | 90 | |
| 91 | - foreach ( $entities_via_meta as $entity_uri => $entity ) { |
|
| 91 | + foreach ( $entities_via_meta as $entity_uri => $entity ) { |
|
| 92 | 92 | |
| 93 | - // Only if the current entity is created from scratch let's avoid to |
|
| 94 | - // create more than one entity with same label & entity type. |
|
| 95 | - $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 96 | - $entity['main_type'] : null; |
|
| 93 | + // Only if the current entity is created from scratch let's avoid to |
|
| 94 | + // create more than one entity with same label & entity type. |
|
| 95 | + $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 96 | + $entity['main_type'] : null; |
|
| 97 | 97 | |
| 98 | - // Look if current entity uri matches an internal existing entity, meaning: |
|
| 99 | - // 1. when $entity_uri is an internal uri |
|
| 100 | - // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
|
| 101 | - $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 98 | + // Look if current entity uri matches an internal existing entity, meaning: |
|
| 99 | + // 1. when $entity_uri is an internal uri |
|
| 100 | + // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
|
| 101 | + $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 102 | 102 | |
| 103 | - // Detect the uri depending if is an existing or a new entity |
|
| 104 | - $uri = ( null === $ie ) ? |
|
| 105 | - Wordlift_Uri_Service::get_instance()->build_uri( |
|
| 106 | - $entity['label'], |
|
| 107 | - Wordlift_Entity_Service::TYPE_NAME, |
|
| 108 | - $entity_type |
|
| 109 | - ) : wl_get_entity_uri( $ie->ID ); |
|
| 103 | + // Detect the uri depending if is an existing or a new entity |
|
| 104 | + $uri = ( null === $ie ) ? |
|
| 105 | + Wordlift_Uri_Service::get_instance()->build_uri( |
|
| 106 | + $entity['label'], |
|
| 107 | + Wordlift_Entity_Service::TYPE_NAME, |
|
| 108 | + $entity_type |
|
| 109 | + ) : wl_get_entity_uri( $ie->ID ); |
|
| 110 | 110 | |
| 111 | - wl_write_log( "Map $entity_uri on $uri" ); |
|
| 112 | - $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 111 | + wl_write_log( "Map $entity_uri on $uri" ); |
|
| 112 | + $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 113 | 113 | |
| 114 | - // Local entities have a tmp uri with 'local-entity-' prefix |
|
| 115 | - // These uris need to be rewritten here and replaced in the content |
|
| 116 | - if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 117 | - // Override the entity obj |
|
| 118 | - $entity['uri'] = $uri; |
|
| 119 | - } |
|
| 114 | + // Local entities have a tmp uri with 'local-entity-' prefix |
|
| 115 | + // These uris need to be rewritten here and replaced in the content |
|
| 116 | + if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 117 | + // Override the entity obj |
|
| 118 | + $entity['uri'] = $uri; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - // Update entity data with related post |
|
| 122 | - $entity['related_post_id'] = $post_id; |
|
| 121 | + // Update entity data with related post |
|
| 122 | + $entity['related_post_id'] = $post_id; |
|
| 123 | 123 | |
| 124 | - // Save the entity if is a new entity |
|
| 125 | - if ( null === $ie ) { |
|
| 126 | - wl_save_entity( $entity ); |
|
| 127 | - } |
|
| 124 | + // Save the entity if is a new entity |
|
| 125 | + if ( null === $ie ) { |
|
| 126 | + wl_save_entity( $entity ); |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - } |
|
| 130 | - } |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - // Replace tmp uris in content post if needed |
|
| 133 | - $updated_post_content = $post->post_content; |
|
| 132 | + // Replace tmp uris in content post if needed |
|
| 133 | + $updated_post_content = $post->post_content; |
|
| 134 | 134 | |
| 135 | - // Update the post content if we found mappings of new entities. |
|
| 136 | - if ( ! empty( $entities_uri_mapping ) ) { |
|
| 137 | - // Save each entity and store the post id. |
|
| 138 | - foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 139 | - $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 140 | - } |
|
| 135 | + // Update the post content if we found mappings of new entities. |
|
| 136 | + if ( ! empty( $entities_uri_mapping ) ) { |
|
| 137 | + // Save each entity and store the post id. |
|
| 138 | + foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 139 | + $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - // Update the post content. |
|
| 143 | - wp_update_post( array( |
|
| 144 | - 'ID' => $post->ID, |
|
| 145 | - 'post_content' => $updated_post_content, |
|
| 146 | - ) ); |
|
| 147 | - } |
|
| 142 | + // Update the post content. |
|
| 143 | + wp_update_post( array( |
|
| 144 | + 'ID' => $post->ID, |
|
| 145 | + 'post_content' => $updated_post_content, |
|
| 146 | + ) ); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - // Extract related/referenced entities from text. |
|
| 150 | - $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 149 | + // Extract related/referenced entities from text. |
|
| 150 | + $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 151 | 151 | |
| 152 | - // Reset previously saved instances. |
|
| 153 | - wl_core_delete_relation_instances( $post_id ); |
|
| 152 | + // Reset previously saved instances. |
|
| 153 | + wl_core_delete_relation_instances( $post_id ); |
|
| 154 | 154 | |
| 155 | - // Save relation instances |
|
| 156 | - foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 155 | + // Save relation instances |
|
| 156 | + foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 157 | 157 | |
| 158 | - wl_core_add_relation_instance( |
|
| 159 | - $post_id, |
|
| 160 | - $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 161 | - $referenced_entity_id |
|
| 162 | - ); |
|
| 158 | + wl_core_add_relation_instance( |
|
| 159 | + $post_id, |
|
| 160 | + $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 161 | + $referenced_entity_id |
|
| 162 | + ); |
|
| 163 | 163 | |
| 164 | - } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - // Push the post to Redlink. |
|
| 167 | - Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 166 | + // Push the post to Redlink. |
|
| 167 | + Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -176,156 +176,156 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | function wl_linked_data_save_post_and_related_entities( $post_id ) { |
| 178 | 178 | |
| 179 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 179 | + $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 180 | 180 | |
| 181 | - $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 181 | + $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 182 | 182 | |
| 183 | - // Ignore auto-saves |
|
| 184 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 185 | - $log->trace( 'Doing autosave, skipping...' ); |
|
| 183 | + // Ignore auto-saves |
|
| 184 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 185 | + $log->trace( 'Doing autosave, skipping...' ); |
|
| 186 | 186 | |
| 187 | - return; |
|
| 188 | - } |
|
| 187 | + return; |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - // get the current post. |
|
| 191 | - $post = get_post( $post_id ); |
|
| 190 | + // get the current post. |
|
| 191 | + $post = get_post( $post_id ); |
|
| 192 | 192 | |
| 193 | - remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 193 | + remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 194 | 194 | |
| 195 | - // wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" ); |
|
| 195 | + // wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" ); |
|
| 196 | 196 | |
| 197 | - // Get the entity service instance. |
|
| 198 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 197 | + // Get the entity service instance. |
|
| 198 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 199 | 199 | |
| 200 | - // Store mapping between tmp new entities uris and real new entities uri |
|
| 201 | - $entities_uri_mapping = array(); |
|
| 200 | + // Store mapping between tmp new entities uris and real new entities uri |
|
| 201 | + $entities_uri_mapping = array(); |
|
| 202 | 202 | |
| 203 | - // Save the entities coming with POST data. |
|
| 204 | - if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) { |
|
| 203 | + // Save the entities coming with POST data. |
|
| 204 | + if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) { |
|
| 205 | 205 | |
| 206 | - wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " ); |
|
| 207 | - wl_write_log( json_encode( $_POST['wl_entities'] ) ); |
|
| 208 | - wl_write_log( "]" ); |
|
| 209 | - wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " ); |
|
| 210 | - wl_write_log( json_encode( $_POST['wl_boxes'], true ) ); |
|
| 211 | - wl_write_log( "]" ); |
|
| 206 | + wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " ); |
|
| 207 | + wl_write_log( json_encode( $_POST['wl_entities'] ) ); |
|
| 208 | + wl_write_log( "]" ); |
|
| 209 | + wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " ); |
|
| 210 | + wl_write_log( json_encode( $_POST['wl_boxes'], true ) ); |
|
| 211 | + wl_write_log( "]" ); |
|
| 212 | 212 | |
| 213 | - $entities_via_post = $_POST['wl_entities']; |
|
| 214 | - $boxes_via_post = $_POST['wl_boxes']; |
|
| 213 | + $entities_via_post = $_POST['wl_entities']; |
|
| 214 | + $boxes_via_post = $_POST['wl_boxes']; |
|
| 215 | 215 | |
| 216 | - foreach ( $entities_via_post as $entity_uri => $entity ) { |
|
| 216 | + foreach ( $entities_via_post as $entity_uri => $entity ) { |
|
| 217 | 217 | |
| 218 | - // Only if the current entity is created from scratch let's avoid to |
|
| 219 | - // create more than one entity with same label & entity type. |
|
| 220 | - $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 221 | - $entity['main_type'] : null; |
|
| 218 | + // Only if the current entity is created from scratch let's avoid to |
|
| 219 | + // create more than one entity with same label & entity type. |
|
| 220 | + $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 221 | + $entity['main_type'] : null; |
|
| 222 | 222 | |
| 223 | - // Look if current entity uri matches an internal existing entity, meaning: |
|
| 224 | - // 1. when $entity_uri is an internal uri |
|
| 225 | - // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
|
| 226 | - $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 223 | + // Look if current entity uri matches an internal existing entity, meaning: |
|
| 224 | + // 1. when $entity_uri is an internal uri |
|
| 225 | + // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
|
| 226 | + $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 227 | 227 | |
| 228 | - // Detect the uri depending if is an existing or a new entity |
|
| 229 | - $uri = ( null === $ie ) ? |
|
| 230 | - Wordlift_Uri_Service::get_instance()->build_uri( |
|
| 231 | - $entity['label'], |
|
| 232 | - Wordlift_Entity_Service::TYPE_NAME, |
|
| 233 | - $entity_type |
|
| 234 | - ) : wl_get_entity_uri( $ie->ID ); |
|
| 228 | + // Detect the uri depending if is an existing or a new entity |
|
| 229 | + $uri = ( null === $ie ) ? |
|
| 230 | + Wordlift_Uri_Service::get_instance()->build_uri( |
|
| 231 | + $entity['label'], |
|
| 232 | + Wordlift_Entity_Service::TYPE_NAME, |
|
| 233 | + $entity_type |
|
| 234 | + ) : wl_get_entity_uri( $ie->ID ); |
|
| 235 | 235 | |
| 236 | - wl_write_log( "Map $entity_uri on $uri" ); |
|
| 237 | - $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 236 | + wl_write_log( "Map $entity_uri on $uri" ); |
|
| 237 | + $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 238 | 238 | |
| 239 | - // Local entities have a tmp uri with 'local-entity-' prefix |
|
| 240 | - // These uris need to be rewritten here and replaced in the content |
|
| 241 | - if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 242 | - // Override the entity obj |
|
| 243 | - $entity['uri'] = $uri; |
|
| 244 | - } |
|
| 239 | + // Local entities have a tmp uri with 'local-entity-' prefix |
|
| 240 | + // These uris need to be rewritten here and replaced in the content |
|
| 241 | + if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 242 | + // Override the entity obj |
|
| 243 | + $entity['uri'] = $uri; |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - // Update entity data with related post |
|
| 247 | - $entity['related_post_id'] = $post_id; |
|
| 246 | + // Update entity data with related post |
|
| 247 | + $entity['related_post_id'] = $post_id; |
|
| 248 | 248 | |
| 249 | - // Save the entity if is a new entity |
|
| 250 | - if ( null === $ie ) { |
|
| 251 | - wl_save_entity( $entity ); |
|
| 252 | - } |
|
| 249 | + // Save the entity if is a new entity |
|
| 250 | + if ( null === $ie ) { |
|
| 251 | + wl_save_entity( $entity ); |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - } |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - // Replace tmp uris in content post if needed |
|
| 259 | - $updated_post_content = $post->post_content; |
|
| 258 | + // Replace tmp uris in content post if needed |
|
| 259 | + $updated_post_content = $post->post_content; |
|
| 260 | 260 | |
| 261 | - // Update the post content if we found mappings of new entities. |
|
| 262 | - if ( ! empty( $entities_uri_mapping ) ) { |
|
| 263 | - // Save each entity and store the post id. |
|
| 264 | - foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 265 | - $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 266 | - } |
|
| 261 | + // Update the post content if we found mappings of new entities. |
|
| 262 | + if ( ! empty( $entities_uri_mapping ) ) { |
|
| 263 | + // Save each entity and store the post id. |
|
| 264 | + foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 265 | + $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - // Update the post content. |
|
| 269 | - wp_update_post( array( |
|
| 270 | - 'ID' => $post->ID, |
|
| 271 | - 'post_content' => $updated_post_content, |
|
| 272 | - ) ); |
|
| 273 | - } |
|
| 268 | + // Update the post content. |
|
| 269 | + wp_update_post( array( |
|
| 270 | + 'ID' => $post->ID, |
|
| 271 | + 'post_content' => $updated_post_content, |
|
| 272 | + ) ); |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - // Extract related/referenced entities from text. |
|
| 276 | - $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 275 | + // Extract related/referenced entities from text. |
|
| 276 | + $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 277 | 277 | |
| 278 | - // Reset previously saved instances. |
|
| 279 | - wl_core_delete_relation_instances( $post_id ); |
|
| 278 | + // Reset previously saved instances. |
|
| 279 | + wl_core_delete_relation_instances( $post_id ); |
|
| 280 | 280 | |
| 281 | - // Save relation instances |
|
| 282 | - foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 281 | + // Save relation instances |
|
| 282 | + foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 283 | 283 | |
| 284 | - wl_core_add_relation_instance( |
|
| 285 | - $post_id, |
|
| 286 | - $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 287 | - $referenced_entity_id |
|
| 288 | - ); |
|
| 284 | + wl_core_add_relation_instance( |
|
| 285 | + $post_id, |
|
| 286 | + $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 287 | + $referenced_entity_id |
|
| 288 | + ); |
|
| 289 | 289 | |
| 290 | - } |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - if ( isset( $_POST['wl_entities'] ) ) { |
|
| 293 | - // Save post metadata if available |
|
| 294 | - $metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ? |
|
| 295 | - $_POST['wl_metadata'] : array(); |
|
| 296 | - |
|
| 297 | - $fields = array( |
|
| 298 | - Wordlift_Schema_Service::FIELD_LOCATION_CREATED, |
|
| 299 | - Wordlift_Schema_Service::FIELD_TOPIC, |
|
| 300 | - ); |
|
| 301 | - |
|
| 302 | - // Unlink topic taxonomy terms |
|
| 303 | - Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID ); |
|
| 304 | - |
|
| 305 | - foreach ( $fields as $field ) { |
|
| 306 | - |
|
| 307 | - // Delete current values |
|
| 308 | - delete_post_meta( $post->ID, $field ); |
|
| 309 | - // Retrieve the entity uri |
|
| 310 | - $uri = ( isset( $metadata_via_post[ $field ] ) ) ? |
|
| 311 | - stripslashes( $metadata_via_post[ $field ] ) : ''; |
|
| 312 | - |
|
| 313 | - $entity = $entity_service->get_entity_post_by_uri( $uri ); |
|
| 314 | - |
|
| 315 | - if ( $entity ) { |
|
| 316 | - add_post_meta( $post->ID, $field, $entity->ID, true ); |
|
| 317 | - // Set also the topic taxonomy |
|
| 318 | - if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) { |
|
| 319 | - Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity ); |
|
| 320 | - } |
|
| 321 | - } |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - // Push the post to Redlink. |
|
| 326 | - Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 327 | - |
|
| 328 | - add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 292 | + if ( isset( $_POST['wl_entities'] ) ) { |
|
| 293 | + // Save post metadata if available |
|
| 294 | + $metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ? |
|
| 295 | + $_POST['wl_metadata'] : array(); |
|
| 296 | + |
|
| 297 | + $fields = array( |
|
| 298 | + Wordlift_Schema_Service::FIELD_LOCATION_CREATED, |
|
| 299 | + Wordlift_Schema_Service::FIELD_TOPIC, |
|
| 300 | + ); |
|
| 301 | + |
|
| 302 | + // Unlink topic taxonomy terms |
|
| 303 | + Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID ); |
|
| 304 | + |
|
| 305 | + foreach ( $fields as $field ) { |
|
| 306 | + |
|
| 307 | + // Delete current values |
|
| 308 | + delete_post_meta( $post->ID, $field ); |
|
| 309 | + // Retrieve the entity uri |
|
| 310 | + $uri = ( isset( $metadata_via_post[ $field ] ) ) ? |
|
| 311 | + stripslashes( $metadata_via_post[ $field ] ) : ''; |
|
| 312 | + |
|
| 313 | + $entity = $entity_service->get_entity_post_by_uri( $uri ); |
|
| 314 | + |
|
| 315 | + if ( $entity ) { |
|
| 316 | + add_post_meta( $post->ID, $field, $entity->ID, true ); |
|
| 317 | + // Set also the topic taxonomy |
|
| 318 | + if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) { |
|
| 319 | + Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity ); |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + // Push the post to Redlink. |
|
| 326 | + Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 327 | + |
|
| 328 | + add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
@@ -348,208 +348,208 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | function wl_save_entity( $entity_data ) { |
| 350 | 350 | |
| 351 | - // Required for REST API calls |
|
| 352 | - if ( ! function_exists( 'wp_crop_image' ) ) { |
|
| 353 | - require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
|
| 354 | - } |
|
| 351 | + // Required for REST API calls |
|
| 352 | + if ( ! function_exists( 'wp_crop_image' ) ) { |
|
| 353 | + require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - $log = Wordlift_Log_Service::get_logger( 'wl_save_entity' ); |
|
| 356 | + $log = Wordlift_Log_Service::get_logger( 'wl_save_entity' ); |
|
| 357 | 357 | |
| 358 | - $uri = $entity_data['uri']; |
|
| 359 | - /* |
|
| 358 | + $uri = $entity_data['uri']; |
|
| 359 | + /* |
|
| 360 | 360 | * Data is coming from a $_POST, sanitize it. |
| 361 | 361 | * |
| 362 | 362 | * @since 3.19.4 |
| 363 | 363 | * |
| 364 | 364 | * @see https://github.com/insideout10/wordlift-plugin/issues/841 |
| 365 | 365 | */ |
| 366 | - $label = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) ); |
|
| 367 | - $type_uri = $entity_data['main_type']; |
|
| 368 | - $entity_types = isset( $entity_data['type'] ) ? $entity_data['type'] : array(); |
|
| 369 | - $description = $entity_data['description']; |
|
| 370 | - $images = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array(); |
|
| 371 | - $same_as = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array(); |
|
| 372 | - $related_post_id = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null; |
|
| 373 | - $other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array(); |
|
| 374 | - |
|
| 375 | - // Get the synonyms. |
|
| 376 | - $synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array(); |
|
| 377 | - |
|
| 378 | - // Check whether an entity already exists with the provided URI. |
|
| 379 | - if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) { |
|
| 380 | - $log->debug( "Post already exists for URI $uri." ); |
|
| 381 | - |
|
| 382 | - return $post; |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - // Prepare properties of the new entity. |
|
| 386 | - $params = array( |
|
| 387 | - 'post_status' => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ), |
|
| 388 | - 'post_type' => Wordlift_Entity_Service::TYPE_NAME, |
|
| 389 | - 'post_title' => $label, |
|
| 390 | - 'post_content' => $description, |
|
| 391 | - 'post_excerpt' => '', |
|
| 392 | - // Ensure we're using a valid slug. We're not overwriting an existing |
|
| 393 | - // entity with a post_name already set, since this call is made only for |
|
| 394 | - // new entities. |
|
| 395 | - // |
|
| 396 | - // See https://github.com/insideout10/wordlift-plugin/issues/282 |
|
| 397 | - 'post_name' => sanitize_title( $label ), |
|
| 398 | - ); |
|
| 399 | - |
|
| 400 | - // If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over" |
|
| 401 | - // the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156) |
|
| 402 | - // Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148) |
|
| 403 | - // This does NOT affect saving an entity from the entity admin page since this function is called when an entity |
|
| 404 | - // is created when saving a post. |
|
| 405 | - global $wpseo_metabox, $seo_ultimate; |
|
| 406 | - if ( isset( $wpseo_metabox ) ) { |
|
| 407 | - remove_action( 'wp_insert_post', array( |
|
| 408 | - $wpseo_metabox, |
|
| 409 | - 'save_postdata', |
|
| 410 | - ) ); |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - if ( isset( $seo_ultimate ) ) { |
|
| 414 | - remove_action( 'save_post', array( |
|
| 415 | - $seo_ultimate, |
|
| 416 | - 'save_postmeta_box', |
|
| 417 | - ) ); |
|
| 418 | - } |
|
| 419 | - |
|
| 420 | - // The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to |
|
| 421 | - // save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks |
|
| 422 | - // to the save_post and restore them after we saved the entity. |
|
| 423 | - // see https://github.com/insideout10/wordlift-plugin/issues/203 |
|
| 424 | - // see https://github.com/insideout10/wordlift-plugin/issues/156 |
|
| 425 | - // see https://github.com/insideout10/wordlift-plugin/issues/148 |
|
| 426 | - global $wp_filter; |
|
| 427 | - $save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks; |
|
| 428 | - is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters(); |
|
| 429 | - |
|
| 430 | - |
|
| 431 | - $log->trace( 'Going to insert new post...' ); |
|
| 432 | - |
|
| 433 | - // create or update the post. |
|
| 434 | - $post_id = wp_insert_post( $params, true ); |
|
| 435 | - |
|
| 436 | - // Setting the alternative labels for this entity. |
|
| 437 | - Wordlift_Entity_Service::get_instance() |
|
| 438 | - ->set_alternative_labels( $post_id, $synonyms ); |
|
| 439 | - |
|
| 440 | - // Restore all the existing filters. |
|
| 441 | - is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters; |
|
| 442 | - |
|
| 443 | - // If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156) |
|
| 444 | - if ( isset( $wpseo_metabox ) ) { |
|
| 445 | - add_action( 'wp_insert_post', array( |
|
| 446 | - $wpseo_metabox, |
|
| 447 | - 'save_postdata', |
|
| 448 | - ) ); |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - // If SEO Ultimate is installed, add back the hook we removed a few lines above. |
|
| 452 | - if ( isset( $seo_ultimate ) ) { |
|
| 453 | - add_action( 'save_post', array( |
|
| 454 | - $seo_ultimate, |
|
| 455 | - 'save_postmeta_box', |
|
| 456 | - ), 10, 2 ); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - // TODO: handle errors. |
|
| 460 | - if ( is_wp_error( $post_id ) ) { |
|
| 461 | - $log->error( 'An error occurred: ' . $post_id->get_error_message() ); |
|
| 462 | - |
|
| 463 | - // inform an error occurred. |
|
| 464 | - return null; |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - wl_set_entity_main_type( $post_id, $type_uri ); |
|
| 468 | - |
|
| 469 | - // Save the entity types. |
|
| 470 | - wl_set_entity_rdf_types( $post_id, $entity_types ); |
|
| 471 | - |
|
| 472 | - // Get a dataset URI for the entity. |
|
| 473 | - $wl_uri = wl_build_entity_uri( $post_id ); |
|
| 474 | - |
|
| 475 | - // Save the entity URI. |
|
| 476 | - wl_set_entity_uri( $post_id, $wl_uri ); |
|
| 477 | - |
|
| 478 | - // Add the uri to the sameAs data if it's not a local URI. |
|
| 479 | - if ( $wl_uri !== $uri ) { |
|
| 480 | - array_push( $same_as, $uri ); |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - $new_uri = wl_get_entity_uri( $post_id ); |
|
| 484 | - |
|
| 485 | - // Save the sameAs data for the entity. |
|
| 486 | - wl_schema_set_value( $post_id, 'sameAs', $same_as ); |
|
| 487 | - |
|
| 488 | - // Save the other properties (latitude, langitude, startDate, endDate, etc.) |
|
| 489 | - foreach ( $other_properties as $property_name => $property_value ) { |
|
| 490 | - wl_schema_set_value( $post_id, $property_name, $property_value ); |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - // Call hooks. |
|
| 494 | - do_action( 'wl_save_entity', $post_id ); |
|
| 495 | - |
|
| 496 | - foreach ( $images as $image_remote_url ) { |
|
| 497 | - |
|
| 498 | - // Check if image is already present in local DB |
|
| 499 | - if ( strpos( $image_remote_url, site_url() ) !== false ) { |
|
| 500 | - // Do nothing. |
|
| 501 | - continue; |
|
| 502 | - } |
|
| 503 | - |
|
| 504 | - // Check if there is an existing attachment for this post ID and source URL. |
|
| 505 | - $existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url ); |
|
| 506 | - |
|
| 507 | - // Skip if an existing image is found. |
|
| 508 | - if ( null !== $existing_image ) { |
|
| 509 | - continue; |
|
| 510 | - } |
|
| 511 | - |
|
| 512 | - // Save the image and get the local path. |
|
| 513 | - $image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url ); |
|
| 514 | - |
|
| 515 | - if ( false === $image ) { |
|
| 516 | - continue; |
|
| 517 | - } |
|
| 366 | + $label = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) ); |
|
| 367 | + $type_uri = $entity_data['main_type']; |
|
| 368 | + $entity_types = isset( $entity_data['type'] ) ? $entity_data['type'] : array(); |
|
| 369 | + $description = $entity_data['description']; |
|
| 370 | + $images = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array(); |
|
| 371 | + $same_as = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array(); |
|
| 372 | + $related_post_id = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null; |
|
| 373 | + $other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array(); |
|
| 374 | + |
|
| 375 | + // Get the synonyms. |
|
| 376 | + $synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array(); |
|
| 377 | + |
|
| 378 | + // Check whether an entity already exists with the provided URI. |
|
| 379 | + if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) { |
|
| 380 | + $log->debug( "Post already exists for URI $uri." ); |
|
| 381 | + |
|
| 382 | + return $post; |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + // Prepare properties of the new entity. |
|
| 386 | + $params = array( |
|
| 387 | + 'post_status' => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ), |
|
| 388 | + 'post_type' => Wordlift_Entity_Service::TYPE_NAME, |
|
| 389 | + 'post_title' => $label, |
|
| 390 | + 'post_content' => $description, |
|
| 391 | + 'post_excerpt' => '', |
|
| 392 | + // Ensure we're using a valid slug. We're not overwriting an existing |
|
| 393 | + // entity with a post_name already set, since this call is made only for |
|
| 394 | + // new entities. |
|
| 395 | + // |
|
| 396 | + // See https://github.com/insideout10/wordlift-plugin/issues/282 |
|
| 397 | + 'post_name' => sanitize_title( $label ), |
|
| 398 | + ); |
|
| 399 | + |
|
| 400 | + // If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over" |
|
| 401 | + // the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156) |
|
| 402 | + // Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148) |
|
| 403 | + // This does NOT affect saving an entity from the entity admin page since this function is called when an entity |
|
| 404 | + // is created when saving a post. |
|
| 405 | + global $wpseo_metabox, $seo_ultimate; |
|
| 406 | + if ( isset( $wpseo_metabox ) ) { |
|
| 407 | + remove_action( 'wp_insert_post', array( |
|
| 408 | + $wpseo_metabox, |
|
| 409 | + 'save_postdata', |
|
| 410 | + ) ); |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + if ( isset( $seo_ultimate ) ) { |
|
| 414 | + remove_action( 'save_post', array( |
|
| 415 | + $seo_ultimate, |
|
| 416 | + 'save_postmeta_box', |
|
| 417 | + ) ); |
|
| 418 | + } |
|
| 419 | + |
|
| 420 | + // The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to |
|
| 421 | + // save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks |
|
| 422 | + // to the save_post and restore them after we saved the entity. |
|
| 423 | + // see https://github.com/insideout10/wordlift-plugin/issues/203 |
|
| 424 | + // see https://github.com/insideout10/wordlift-plugin/issues/156 |
|
| 425 | + // see https://github.com/insideout10/wordlift-plugin/issues/148 |
|
| 426 | + global $wp_filter; |
|
| 427 | + $save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks; |
|
| 428 | + is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters(); |
|
| 429 | + |
|
| 430 | + |
|
| 431 | + $log->trace( 'Going to insert new post...' ); |
|
| 432 | + |
|
| 433 | + // create or update the post. |
|
| 434 | + $post_id = wp_insert_post( $params, true ); |
|
| 435 | + |
|
| 436 | + // Setting the alternative labels for this entity. |
|
| 437 | + Wordlift_Entity_Service::get_instance() |
|
| 438 | + ->set_alternative_labels( $post_id, $synonyms ); |
|
| 439 | + |
|
| 440 | + // Restore all the existing filters. |
|
| 441 | + is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters; |
|
| 442 | + |
|
| 443 | + // If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156) |
|
| 444 | + if ( isset( $wpseo_metabox ) ) { |
|
| 445 | + add_action( 'wp_insert_post', array( |
|
| 446 | + $wpseo_metabox, |
|
| 447 | + 'save_postdata', |
|
| 448 | + ) ); |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + // If SEO Ultimate is installed, add back the hook we removed a few lines above. |
|
| 452 | + if ( isset( $seo_ultimate ) ) { |
|
| 453 | + add_action( 'save_post', array( |
|
| 454 | + $seo_ultimate, |
|
| 455 | + 'save_postmeta_box', |
|
| 456 | + ), 10, 2 ); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + // TODO: handle errors. |
|
| 460 | + if ( is_wp_error( $post_id ) ) { |
|
| 461 | + $log->error( 'An error occurred: ' . $post_id->get_error_message() ); |
|
| 462 | + |
|
| 463 | + // inform an error occurred. |
|
| 464 | + return null; |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + wl_set_entity_main_type( $post_id, $type_uri ); |
|
| 468 | + |
|
| 469 | + // Save the entity types. |
|
| 470 | + wl_set_entity_rdf_types( $post_id, $entity_types ); |
|
| 471 | + |
|
| 472 | + // Get a dataset URI for the entity. |
|
| 473 | + $wl_uri = wl_build_entity_uri( $post_id ); |
|
| 474 | + |
|
| 475 | + // Save the entity URI. |
|
| 476 | + wl_set_entity_uri( $post_id, $wl_uri ); |
|
| 477 | + |
|
| 478 | + // Add the uri to the sameAs data if it's not a local URI. |
|
| 479 | + if ( $wl_uri !== $uri ) { |
|
| 480 | + array_push( $same_as, $uri ); |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + $new_uri = wl_get_entity_uri( $post_id ); |
|
| 484 | + |
|
| 485 | + // Save the sameAs data for the entity. |
|
| 486 | + wl_schema_set_value( $post_id, 'sameAs', $same_as ); |
|
| 487 | + |
|
| 488 | + // Save the other properties (latitude, langitude, startDate, endDate, etc.) |
|
| 489 | + foreach ( $other_properties as $property_name => $property_value ) { |
|
| 490 | + wl_schema_set_value( $post_id, $property_name, $property_value ); |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + // Call hooks. |
|
| 494 | + do_action( 'wl_save_entity', $post_id ); |
|
| 495 | + |
|
| 496 | + foreach ( $images as $image_remote_url ) { |
|
| 497 | + |
|
| 498 | + // Check if image is already present in local DB |
|
| 499 | + if ( strpos( $image_remote_url, site_url() ) !== false ) { |
|
| 500 | + // Do nothing. |
|
| 501 | + continue; |
|
| 502 | + } |
|
| 503 | + |
|
| 504 | + // Check if there is an existing attachment for this post ID and source URL. |
|
| 505 | + $existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url ); |
|
| 506 | + |
|
| 507 | + // Skip if an existing image is found. |
|
| 508 | + if ( null !== $existing_image ) { |
|
| 509 | + continue; |
|
| 510 | + } |
|
| 511 | + |
|
| 512 | + // Save the image and get the local path. |
|
| 513 | + $image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url ); |
|
| 514 | + |
|
| 515 | + if ( false === $image ) { |
|
| 516 | + continue; |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | - // Get the local URL. |
|
| 520 | - $filename = $image['path']; |
|
| 521 | - $url = $image['url']; |
|
| 522 | - $content_type = $image['content_type']; |
|
| 519 | + // Get the local URL. |
|
| 520 | + $filename = $image['path']; |
|
| 521 | + $url = $image['url']; |
|
| 522 | + $content_type = $image['content_type']; |
|
| 523 | 523 | |
| 524 | - $attachment = array( |
|
| 525 | - 'guid' => $url, |
|
| 526 | - // post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type |
|
| 527 | - 'post_title' => $label, |
|
| 528 | - // Set the title to the post title. |
|
| 529 | - 'post_content' => '', |
|
| 530 | - 'post_status' => 'inherit', |
|
| 531 | - 'post_mime_type' => $content_type, |
|
| 532 | - ); |
|
| 533 | - |
|
| 534 | - // Create the attachment in WordPress and generate the related metadata. |
|
| 535 | - $attachment_id = wp_insert_attachment( $attachment, $filename, $post_id ); |
|
| 536 | - |
|
| 537 | - // Set the source URL for the image. |
|
| 538 | - wl_set_source_url( $attachment_id, $image_remote_url ); |
|
| 524 | + $attachment = array( |
|
| 525 | + 'guid' => $url, |
|
| 526 | + // post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type |
|
| 527 | + 'post_title' => $label, |
|
| 528 | + // Set the title to the post title. |
|
| 529 | + 'post_content' => '', |
|
| 530 | + 'post_status' => 'inherit', |
|
| 531 | + 'post_mime_type' => $content_type, |
|
| 532 | + ); |
|
| 533 | + |
|
| 534 | + // Create the attachment in WordPress and generate the related metadata. |
|
| 535 | + $attachment_id = wp_insert_attachment( $attachment, $filename, $post_id ); |
|
| 536 | + |
|
| 537 | + // Set the source URL for the image. |
|
| 538 | + wl_set_source_url( $attachment_id, $image_remote_url ); |
|
| 539 | 539 | |
| 540 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename ); |
|
| 541 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 540 | + $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename ); |
|
| 541 | + wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 542 | 542 | |
| 543 | - // Set it as the featured image. |
|
| 544 | - set_post_thumbnail( $post_id, $attachment_id ); |
|
| 545 | - } |
|
| 543 | + // Set it as the featured image. |
|
| 544 | + set_post_thumbnail( $post_id, $attachment_id ); |
|
| 545 | + } |
|
| 546 | 546 | |
| 547 | - // The entity is pushed to Redlink on save by the function hooked to save_post. |
|
| 548 | - // save the entity in the triple store. |
|
| 549 | - Wordlift_Linked_Data_Service::get_instance()->push( $post_id ); |
|
| 547 | + // The entity is pushed to Redlink on save by the function hooked to save_post. |
|
| 548 | + // save the entity in the triple store. |
|
| 549 | + Wordlift_Linked_Data_Service::get_instance()->push( $post_id ); |
|
| 550 | 550 | |
| 551 | - // finally return the entity post. |
|
| 552 | - return get_post( $post_id ); |
|
| 551 | + // finally return the entity post. |
|
| 552 | + return get_post( $post_id ); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | /** |
@@ -563,40 +563,40 @@ discard block |
||
| 563 | 563 | */ |
| 564 | 564 | function wl_linked_data_content_get_embedded_entities( $content ) { |
| 565 | 565 | |
| 566 | - // Remove quote escapes. |
|
| 567 | - $content = str_replace( '\\"', '"', $content ); |
|
| 566 | + // Remove quote escapes. |
|
| 567 | + $content = str_replace( '\\"', '"', $content ); |
|
| 568 | 568 | |
| 569 | - // Match all itemid attributes. |
|
| 570 | - $pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im'; |
|
| 569 | + // Match all itemid attributes. |
|
| 570 | + $pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im'; |
|
| 571 | 571 | |
| 572 | - // wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" ); |
|
| 572 | + // wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" ); |
|
| 573 | 573 | |
| 574 | - // Remove the pattern while it is found (match nested annotations). |
|
| 575 | - $matches = array(); |
|
| 574 | + // Remove the pattern while it is found (match nested annotations). |
|
| 575 | + $matches = array(); |
|
| 576 | 576 | |
| 577 | - // In case of errors, return an empty array. |
|
| 578 | - if ( false === preg_match_all( $pattern, $content, $matches ) ) { |
|
| 579 | - wl_write_log( "Found no entities embedded in content" ); |
|
| 577 | + // In case of errors, return an empty array. |
|
| 578 | + if ( false === preg_match_all( $pattern, $content, $matches ) ) { |
|
| 579 | + wl_write_log( "Found no entities embedded in content" ); |
|
| 580 | 580 | |
| 581 | - return array(); |
|
| 582 | - } |
|
| 581 | + return array(); |
|
| 582 | + } |
|
| 583 | 583 | |
| 584 | 584 | // wl_write_log("wl_update_related_entities [ content :: $content ][ data :: " . var_export($data, true). " ][ matches :: " . var_export($matches, true) . " ]"); |
| 585 | 585 | |
| 586 | - // Collect the entities. |
|
| 587 | - $entities = array(); |
|
| 588 | - foreach ( $matches[1] as $uri ) { |
|
| 589 | - $uri_d = html_entity_decode( $uri ); |
|
| 586 | + // Collect the entities. |
|
| 587 | + $entities = array(); |
|
| 588 | + foreach ( $matches[1] as $uri ) { |
|
| 589 | + $uri_d = html_entity_decode( $uri ); |
|
| 590 | 590 | |
| 591 | - $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d ); |
|
| 591 | + $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d ); |
|
| 592 | 592 | |
| 593 | - if ( null !== $entity ) { |
|
| 594 | - array_push( $entities, $entity->ID ); |
|
| 595 | - } |
|
| 596 | - } |
|
| 593 | + if ( null !== $entity ) { |
|
| 594 | + array_push( $entities, $entity->ID ); |
|
| 595 | + } |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | - // $count = sizeof( $entities ); |
|
| 599 | - // wl_write_log( "Found $count entities embedded in content" ); |
|
| 598 | + // $count = sizeof( $entities ); |
|
| 599 | + // wl_write_log( "Found $count entities embedded in content" ); |
|
| 600 | 600 | |
| 601 | - return $entities; |
|
| 601 | + return $entities; |
|
| 602 | 602 | } |
@@ -14,15 +14,15 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @param int $post_id The post id. |
| 16 | 16 | */ |
| 17 | -function wl_linked_data_save_post( $post_id ) { |
|
| 17 | +function wl_linked_data_save_post($post_id) { |
|
| 18 | 18 | |
| 19 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' ); |
|
| 19 | + $log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post'); |
|
| 20 | 20 | |
| 21 | - $log->trace( "Saving post $post_id to Linked Data..." ); |
|
| 21 | + $log->trace("Saving post $post_id to Linked Data..."); |
|
| 22 | 22 | |
| 23 | 23 | // If it's not numeric exit from here. |
| 24 | - if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) { |
|
| 25 | - $log->debug( "Skipping $post_id, because id is not numeric or is a post revision." ); |
|
| 24 | + if ( ! is_numeric($post_id) || is_numeric(wp_is_post_revision($post_id))) { |
|
| 25 | + $log->debug("Skipping $post_id, because id is not numeric or is a post revision."); |
|
| 26 | 26 | |
| 27 | 27 | return; |
| 28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | // Get the post type and check whether it supports the editor. |
| 31 | 31 | // |
| 32 | 32 | // @see https://github.com/insideout10/wordlift-plugin/issues/659. |
| 33 | - $post_type = get_post_type( $post_id ); |
|
| 33 | + $post_type = get_post_type($post_id); |
|
| 34 | 34 | /** |
| 35 | 35 | * Use `wl_post_type_supports_editor` which calls a filter to allow 3rd parties to change the setting. |
| 36 | 36 | * |
@@ -38,39 +38,39 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @see https://github.com/insideout10/wordlift-plugin/issues/847. |
| 40 | 40 | */ |
| 41 | - $is_editor_supported = wl_post_type_supports_editor( $post_type ); |
|
| 41 | + $is_editor_supported = wl_post_type_supports_editor($post_type); |
|
| 42 | 42 | |
| 43 | 43 | // Bail out if it's not an entity. |
| 44 | - if ( ! $is_editor_supported ) { |
|
| 45 | - $log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." ); |
|
| 44 | + if ( ! $is_editor_supported) { |
|
| 45 | + $log->debug("Skipping $post_id, because $post_type doesn't support the editor (content)."); |
|
| 46 | 46 | |
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Unhook this function so it doesn't loop infinitely. |
| 51 | - remove_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 51 | + remove_action('save_post', 'wl_linked_data_save_post'); |
|
| 52 | 52 | |
| 53 | 53 | // raise the *wl_linked_data_save_post* event. |
| 54 | - do_action( 'wl_linked_data_save_post', $post_id ); |
|
| 54 | + do_action('wl_linked_data_save_post', $post_id); |
|
| 55 | 55 | |
| 56 | 56 | // Re-hook this function. |
| 57 | - add_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 57 | + add_action('save_post', 'wl_linked_data_save_post'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -add_action( 'save_post', 'wl_linked_data_save_post' ); |
|
| 60 | +add_action('save_post', 'wl_linked_data_save_post'); |
|
| 61 | 61 | |
| 62 | -add_action( 'rest_insert_post', 'wl_linked_data_rest_insert_post', 10, 3 ); |
|
| 62 | +add_action('rest_insert_post', 'wl_linked_data_rest_insert_post', 10, 3); |
|
| 63 | 63 | |
| 64 | -function wl_linked_data_rest_insert_post( $post, $request, $creating ){ |
|
| 64 | +function wl_linked_data_rest_insert_post($post, $request, $creating) { |
|
| 65 | 65 | |
| 66 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 66 | + $log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post_and_related_entities'); |
|
| 67 | 67 | |
| 68 | 68 | $post_id = $post->ID; |
| 69 | - $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 69 | + $log->trace("Saving $post_id to Linked Data along with related entities..."); |
|
| 70 | 70 | |
| 71 | 71 | // Ignore auto-saves |
| 72 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 73 | - $log->trace( 'Doing autosave, skipping...' ); |
|
| 72 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 73 | + $log->trace('Doing autosave, skipping...'); |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -85,35 +85,35 @@ discard block |
||
| 85 | 85 | $metas = $metas['meta']; |
| 86 | 86 | |
| 87 | 87 | // Ignore if no change in meta |
| 88 | - if ( !empty($metas) ) { |
|
| 88 | + if ( ! empty($metas)) { |
|
| 89 | 89 | $entities_via_meta = json_decode($metas['wl_entities_gutenberg'], true); |
| 90 | 90 | |
| 91 | - foreach ( $entities_via_meta as $entity_uri => $entity ) { |
|
| 91 | + foreach ($entities_via_meta as $entity_uri => $entity) { |
|
| 92 | 92 | |
| 93 | 93 | // Only if the current entity is created from scratch let's avoid to |
| 94 | 94 | // create more than one entity with same label & entity type. |
| 95 | - $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 95 | + $entity_type = (preg_match('/^local-entity-.+/', $entity_uri) > 0) ? |
|
| 96 | 96 | $entity['main_type'] : null; |
| 97 | 97 | |
| 98 | 98 | // Look if current entity uri matches an internal existing entity, meaning: |
| 99 | 99 | // 1. when $entity_uri is an internal uri |
| 100 | 100 | // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
| 101 | - $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 101 | + $ie = $entity_service->get_entity_post_by_uri($entity_uri); |
|
| 102 | 102 | |
| 103 | 103 | // Detect the uri depending if is an existing or a new entity |
| 104 | - $uri = ( null === $ie ) ? |
|
| 104 | + $uri = (null === $ie) ? |
|
| 105 | 105 | Wordlift_Uri_Service::get_instance()->build_uri( |
| 106 | 106 | $entity['label'], |
| 107 | 107 | Wordlift_Entity_Service::TYPE_NAME, |
| 108 | 108 | $entity_type |
| 109 | - ) : wl_get_entity_uri( $ie->ID ); |
|
| 109 | + ) : wl_get_entity_uri($ie->ID); |
|
| 110 | 110 | |
| 111 | - wl_write_log( "Map $entity_uri on $uri" ); |
|
| 112 | - $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 111 | + wl_write_log("Map $entity_uri on $uri"); |
|
| 112 | + $entities_uri_mapping[$entity_uri] = $uri; |
|
| 113 | 113 | |
| 114 | 114 | // Local entities have a tmp uri with 'local-entity-' prefix |
| 115 | 115 | // These uris need to be rewritten here and replaced in the content |
| 116 | - if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 116 | + if (preg_match('/^local-entity-.+/', $entity_uri) > 0) { |
|
| 117 | 117 | // Override the entity obj |
| 118 | 118 | $entity['uri'] = $uri; |
| 119 | 119 | } |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | $entity['related_post_id'] = $post_id; |
| 123 | 123 | |
| 124 | 124 | // Save the entity if is a new entity |
| 125 | - if ( null === $ie ) { |
|
| 126 | - wl_save_entity( $entity ); |
|
| 125 | + if (null === $ie) { |
|
| 126 | + wl_save_entity($entity); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | } |
@@ -133,38 +133,38 @@ discard block |
||
| 133 | 133 | $updated_post_content = $post->post_content; |
| 134 | 134 | |
| 135 | 135 | // Update the post content if we found mappings of new entities. |
| 136 | - if ( ! empty( $entities_uri_mapping ) ) { |
|
| 136 | + if ( ! empty($entities_uri_mapping)) { |
|
| 137 | 137 | // Save each entity and store the post id. |
| 138 | - foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 139 | - $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 138 | + foreach ($entities_uri_mapping as $tmp_uri => $uri) { |
|
| 139 | + $updated_post_content = str_replace($tmp_uri, $uri, $updated_post_content); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Update the post content. |
| 143 | - wp_update_post( array( |
|
| 143 | + wp_update_post(array( |
|
| 144 | 144 | 'ID' => $post->ID, |
| 145 | 145 | 'post_content' => $updated_post_content, |
| 146 | - ) ); |
|
| 146 | + )); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Extract related/referenced entities from text. |
| 150 | - $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 150 | + $disambiguated_entities = wl_linked_data_content_get_embedded_entities($updated_post_content); |
|
| 151 | 151 | |
| 152 | 152 | // Reset previously saved instances. |
| 153 | - wl_core_delete_relation_instances( $post_id ); |
|
| 153 | + wl_core_delete_relation_instances($post_id); |
|
| 154 | 154 | |
| 155 | 155 | // Save relation instances |
| 156 | - foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 156 | + foreach (array_unique($disambiguated_entities) as $referenced_entity_id) { |
|
| 157 | 157 | |
| 158 | 158 | wl_core_add_relation_instance( |
| 159 | 159 | $post_id, |
| 160 | - $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 160 | + $entity_service->get_classification_scope_for($referenced_entity_id), |
|
| 161 | 161 | $referenced_entity_id |
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Push the post to Redlink. |
| 167 | - Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 167 | + Wordlift_Linked_Data_Service::get_instance()->push($post->ID); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -174,23 +174,23 @@ discard block |
||
| 174 | 174 | * |
| 175 | 175 | * @param int $post_id The post id being saved. |
| 176 | 176 | */ |
| 177 | -function wl_linked_data_save_post_and_related_entities( $post_id ) { |
|
| 177 | +function wl_linked_data_save_post_and_related_entities($post_id) { |
|
| 178 | 178 | |
| 179 | - $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' ); |
|
| 179 | + $log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post_and_related_entities'); |
|
| 180 | 180 | |
| 181 | - $log->trace( "Saving $post_id to Linked Data along with related entities..." ); |
|
| 181 | + $log->trace("Saving $post_id to Linked Data along with related entities..."); |
|
| 182 | 182 | |
| 183 | 183 | // Ignore auto-saves |
| 184 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 185 | - $log->trace( 'Doing autosave, skipping...' ); |
|
| 184 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
| 185 | + $log->trace('Doing autosave, skipping...'); |
|
| 186 | 186 | |
| 187 | 187 | return; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // get the current post. |
| 191 | - $post = get_post( $post_id ); |
|
| 191 | + $post = get_post($post_id); |
|
| 192 | 192 | |
| 193 | - remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 193 | + remove_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities'); |
|
| 194 | 194 | |
| 195 | 195 | // wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" ); |
| 196 | 196 | |
@@ -201,44 +201,44 @@ discard block |
||
| 201 | 201 | $entities_uri_mapping = array(); |
| 202 | 202 | |
| 203 | 203 | // Save the entities coming with POST data. |
| 204 | - if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) { |
|
| 204 | + if (isset($_POST['wl_entities']) && isset($_POST['wl_boxes'])) { |
|
| 205 | 205 | |
| 206 | - wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " ); |
|
| 207 | - wl_write_log( json_encode( $_POST['wl_entities'] ) ); |
|
| 208 | - wl_write_log( "]" ); |
|
| 209 | - wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " ); |
|
| 210 | - wl_write_log( json_encode( $_POST['wl_boxes'], true ) ); |
|
| 211 | - wl_write_log( "]" ); |
|
| 206 | + wl_write_log("[ post id :: $post_id ][ POST(wl_entities) :: "); |
|
| 207 | + wl_write_log(json_encode($_POST['wl_entities'])); |
|
| 208 | + wl_write_log("]"); |
|
| 209 | + wl_write_log("[ post id :: $post_id ][ POST(wl_boxes) :: "); |
|
| 210 | + wl_write_log(json_encode($_POST['wl_boxes'], true)); |
|
| 211 | + wl_write_log("]"); |
|
| 212 | 212 | |
| 213 | 213 | $entities_via_post = $_POST['wl_entities']; |
| 214 | 214 | $boxes_via_post = $_POST['wl_boxes']; |
| 215 | 215 | |
| 216 | - foreach ( $entities_via_post as $entity_uri => $entity ) { |
|
| 216 | + foreach ($entities_via_post as $entity_uri => $entity) { |
|
| 217 | 217 | |
| 218 | 218 | // Only if the current entity is created from scratch let's avoid to |
| 219 | 219 | // create more than one entity with same label & entity type. |
| 220 | - $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ? |
|
| 220 | + $entity_type = (preg_match('/^local-entity-.+/', $entity_uri) > 0) ? |
|
| 221 | 221 | $entity['main_type'] : null; |
| 222 | 222 | |
| 223 | 223 | // Look if current entity uri matches an internal existing entity, meaning: |
| 224 | 224 | // 1. when $entity_uri is an internal uri |
| 225 | 225 | // 2. when $entity_uri is an external uri used as sameAs of an internal entity |
| 226 | - $ie = $entity_service->get_entity_post_by_uri( $entity_uri ); |
|
| 226 | + $ie = $entity_service->get_entity_post_by_uri($entity_uri); |
|
| 227 | 227 | |
| 228 | 228 | // Detect the uri depending if is an existing or a new entity |
| 229 | - $uri = ( null === $ie ) ? |
|
| 229 | + $uri = (null === $ie) ? |
|
| 230 | 230 | Wordlift_Uri_Service::get_instance()->build_uri( |
| 231 | 231 | $entity['label'], |
| 232 | 232 | Wordlift_Entity_Service::TYPE_NAME, |
| 233 | 233 | $entity_type |
| 234 | - ) : wl_get_entity_uri( $ie->ID ); |
|
| 234 | + ) : wl_get_entity_uri($ie->ID); |
|
| 235 | 235 | |
| 236 | - wl_write_log( "Map $entity_uri on $uri" ); |
|
| 237 | - $entities_uri_mapping[ $entity_uri ] = $uri; |
|
| 236 | + wl_write_log("Map $entity_uri on $uri"); |
|
| 237 | + $entities_uri_mapping[$entity_uri] = $uri; |
|
| 238 | 238 | |
| 239 | 239 | // Local entities have a tmp uri with 'local-entity-' prefix |
| 240 | 240 | // These uris need to be rewritten here and replaced in the content |
| 241 | - if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) { |
|
| 241 | + if (preg_match('/^local-entity-.+/', $entity_uri) > 0) { |
|
| 242 | 242 | // Override the entity obj |
| 243 | 243 | $entity['uri'] = $uri; |
| 244 | 244 | } |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | $entity['related_post_id'] = $post_id; |
| 248 | 248 | |
| 249 | 249 | // Save the entity if is a new entity |
| 250 | - if ( null === $ie ) { |
|
| 251 | - wl_save_entity( $entity ); |
|
| 250 | + if (null === $ie) { |
|
| 251 | + wl_save_entity($entity); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
@@ -259,39 +259,39 @@ discard block |
||
| 259 | 259 | $updated_post_content = $post->post_content; |
| 260 | 260 | |
| 261 | 261 | // Update the post content if we found mappings of new entities. |
| 262 | - if ( ! empty( $entities_uri_mapping ) ) { |
|
| 262 | + if ( ! empty($entities_uri_mapping)) { |
|
| 263 | 263 | // Save each entity and store the post id. |
| 264 | - foreach ( $entities_uri_mapping as $tmp_uri => $uri ) { |
|
| 265 | - $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content ); |
|
| 264 | + foreach ($entities_uri_mapping as $tmp_uri => $uri) { |
|
| 265 | + $updated_post_content = str_replace($tmp_uri, $uri, $updated_post_content); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Update the post content. |
| 269 | - wp_update_post( array( |
|
| 269 | + wp_update_post(array( |
|
| 270 | 270 | 'ID' => $post->ID, |
| 271 | 271 | 'post_content' => $updated_post_content, |
| 272 | - ) ); |
|
| 272 | + )); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // Extract related/referenced entities from text. |
| 276 | - $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content ); |
|
| 276 | + $disambiguated_entities = wl_linked_data_content_get_embedded_entities($updated_post_content); |
|
| 277 | 277 | |
| 278 | 278 | // Reset previously saved instances. |
| 279 | - wl_core_delete_relation_instances( $post_id ); |
|
| 279 | + wl_core_delete_relation_instances($post_id); |
|
| 280 | 280 | |
| 281 | 281 | // Save relation instances |
| 282 | - foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) { |
|
| 282 | + foreach (array_unique($disambiguated_entities) as $referenced_entity_id) { |
|
| 283 | 283 | |
| 284 | 284 | wl_core_add_relation_instance( |
| 285 | 285 | $post_id, |
| 286 | - $entity_service->get_classification_scope_for( $referenced_entity_id ), |
|
| 286 | + $entity_service->get_classification_scope_for($referenced_entity_id), |
|
| 287 | 287 | $referenced_entity_id |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - if ( isset( $_POST['wl_entities'] ) ) { |
|
| 292 | + if (isset($_POST['wl_entities'])) { |
|
| 293 | 293 | // Save post metadata if available |
| 294 | - $metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ? |
|
| 294 | + $metadata_via_post = (isset($_POST['wl_metadata'])) ? |
|
| 295 | 295 | $_POST['wl_metadata'] : array(); |
| 296 | 296 | |
| 297 | 297 | $fields = array( |
@@ -300,35 +300,35 @@ discard block |
||
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | 302 | // Unlink topic taxonomy terms |
| 303 | - Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID ); |
|
| 303 | + Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for($post->ID); |
|
| 304 | 304 | |
| 305 | - foreach ( $fields as $field ) { |
|
| 305 | + foreach ($fields as $field) { |
|
| 306 | 306 | |
| 307 | 307 | // Delete current values |
| 308 | - delete_post_meta( $post->ID, $field ); |
|
| 308 | + delete_post_meta($post->ID, $field); |
|
| 309 | 309 | // Retrieve the entity uri |
| 310 | - $uri = ( isset( $metadata_via_post[ $field ] ) ) ? |
|
| 311 | - stripslashes( $metadata_via_post[ $field ] ) : ''; |
|
| 310 | + $uri = (isset($metadata_via_post[$field])) ? |
|
| 311 | + stripslashes($metadata_via_post[$field]) : ''; |
|
| 312 | 312 | |
| 313 | - $entity = $entity_service->get_entity_post_by_uri( $uri ); |
|
| 313 | + $entity = $entity_service->get_entity_post_by_uri($uri); |
|
| 314 | 314 | |
| 315 | - if ( $entity ) { |
|
| 316 | - add_post_meta( $post->ID, $field, $entity->ID, true ); |
|
| 315 | + if ($entity) { |
|
| 316 | + add_post_meta($post->ID, $field, $entity->ID, true); |
|
| 317 | 317 | // Set also the topic taxonomy |
| 318 | - if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) { |
|
| 319 | - Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity ); |
|
| 318 | + if ($field === Wordlift_Schema_Service::FIELD_TOPIC) { |
|
| 319 | + Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for($post->ID, $entity); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Push the post to Redlink. |
| 326 | - Wordlift_Linked_Data_Service::get_instance()->push( $post->ID ); |
|
| 326 | + Wordlift_Linked_Data_Service::get_instance()->push($post->ID); |
|
| 327 | 327 | |
| 328 | - add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 328 | + add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities'); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | -add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' ); |
|
| 331 | +add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities'); |
|
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * Save the specified data as an entity in WordPress. This method only create new entities. When an existing entity is |
@@ -346,14 +346,14 @@ discard block |
||
| 346 | 346 | * |
| 347 | 347 | * @return null|WP_Post A post instance or null in case of failure. |
| 348 | 348 | */ |
| 349 | -function wl_save_entity( $entity_data ) { |
|
| 349 | +function wl_save_entity($entity_data) { |
|
| 350 | 350 | |
| 351 | 351 | // Required for REST API calls |
| 352 | - if ( ! function_exists( 'wp_crop_image' ) ) { |
|
| 353 | - require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
|
| 352 | + if ( ! function_exists('wp_crop_image')) { |
|
| 353 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - $log = Wordlift_Log_Service::get_logger( 'wl_save_entity' ); |
|
| 356 | + $log = Wordlift_Log_Service::get_logger('wl_save_entity'); |
|
| 357 | 357 | |
| 358 | 358 | $uri = $entity_data['uri']; |
| 359 | 359 | /* |
@@ -363,28 +363,28 @@ discard block |
||
| 363 | 363 | * |
| 364 | 364 | * @see https://github.com/insideout10/wordlift-plugin/issues/841 |
| 365 | 365 | */ |
| 366 | - $label = preg_replace( '/\xEF\xBB\xBF/', '', sanitize_text_field( $entity_data['label'] ) ); |
|
| 366 | + $label = preg_replace('/\xEF\xBB\xBF/', '', sanitize_text_field($entity_data['label'])); |
|
| 367 | 367 | $type_uri = $entity_data['main_type']; |
| 368 | - $entity_types = isset( $entity_data['type'] ) ? $entity_data['type'] : array(); |
|
| 368 | + $entity_types = isset($entity_data['type']) ? $entity_data['type'] : array(); |
|
| 369 | 369 | $description = $entity_data['description']; |
| 370 | - $images = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array(); |
|
| 371 | - $same_as = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array(); |
|
| 372 | - $related_post_id = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null; |
|
| 373 | - $other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array(); |
|
| 370 | + $images = isset($entity_data['image']) ? (array) $entity_data['image'] : array(); |
|
| 371 | + $same_as = isset($entity_data['sameas']) ? (array) $entity_data['sameas'] : array(); |
|
| 372 | + $related_post_id = isset($entity_data['related_post_id']) ? $entity_data['related_post_id'] : null; |
|
| 373 | + $other_properties = isset($entity_data['properties']) ? $entity_data['properties'] : array(); |
|
| 374 | 374 | |
| 375 | 375 | // Get the synonyms. |
| 376 | - $synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array(); |
|
| 376 | + $synonyms = isset($entity_data['synonym']) ? $entity_data['synonym'] : array(); |
|
| 377 | 377 | |
| 378 | 378 | // Check whether an entity already exists with the provided URI. |
| 379 | - if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) { |
|
| 380 | - $log->debug( "Post already exists for URI $uri." ); |
|
| 379 | + if (null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri)) { |
|
| 380 | + $log->debug("Post already exists for URI $uri."); |
|
| 381 | 381 | |
| 382 | 382 | return $post; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // Prepare properties of the new entity. |
| 386 | 386 | $params = array( |
| 387 | - 'post_status' => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ), |
|
| 387 | + 'post_status' => (is_numeric($related_post_id) ? get_post_status($related_post_id) : 'draft'), |
|
| 388 | 388 | 'post_type' => Wordlift_Entity_Service::TYPE_NAME, |
| 389 | 389 | 'post_title' => $label, |
| 390 | 390 | 'post_content' => $description, |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | // new entities. |
| 395 | 395 | // |
| 396 | 396 | // See https://github.com/insideout10/wordlift-plugin/issues/282 |
| 397 | - 'post_name' => sanitize_title( $label ), |
|
| 397 | + 'post_name' => sanitize_title($label), |
|
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | // If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over" |
@@ -403,18 +403,18 @@ discard block |
||
| 403 | 403 | // This does NOT affect saving an entity from the entity admin page since this function is called when an entity |
| 404 | 404 | // is created when saving a post. |
| 405 | 405 | global $wpseo_metabox, $seo_ultimate; |
| 406 | - if ( isset( $wpseo_metabox ) ) { |
|
| 407 | - remove_action( 'wp_insert_post', array( |
|
| 406 | + if (isset($wpseo_metabox)) { |
|
| 407 | + remove_action('wp_insert_post', array( |
|
| 408 | 408 | $wpseo_metabox, |
| 409 | 409 | 'save_postdata', |
| 410 | - ) ); |
|
| 410 | + )); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if ( isset( $seo_ultimate ) ) { |
|
| 414 | - remove_action( 'save_post', array( |
|
| 413 | + if (isset($seo_ultimate)) { |
|
| 414 | + remove_action('save_post', array( |
|
| 415 | 415 | $seo_ultimate, |
| 416 | 416 | 'save_postmeta_box', |
| 417 | - ) ); |
|
| 417 | + )); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to |
@@ -424,95 +424,95 @@ discard block |
||
| 424 | 424 | // see https://github.com/insideout10/wordlift-plugin/issues/156 |
| 425 | 425 | // see https://github.com/insideout10/wordlift-plugin/issues/148 |
| 426 | 426 | global $wp_filter; |
| 427 | - $save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks; |
|
| 428 | - is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters(); |
|
| 427 | + $save_post_filters = is_array($wp_filter['save_post']) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks; |
|
| 428 | + is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters(); |
|
| 429 | 429 | |
| 430 | 430 | |
| 431 | - $log->trace( 'Going to insert new post...' ); |
|
| 431 | + $log->trace('Going to insert new post...'); |
|
| 432 | 432 | |
| 433 | 433 | // create or update the post. |
| 434 | - $post_id = wp_insert_post( $params, true ); |
|
| 434 | + $post_id = wp_insert_post($params, true); |
|
| 435 | 435 | |
| 436 | 436 | // Setting the alternative labels for this entity. |
| 437 | 437 | Wordlift_Entity_Service::get_instance() |
| 438 | - ->set_alternative_labels( $post_id, $synonyms ); |
|
| 438 | + ->set_alternative_labels($post_id, $synonyms); |
|
| 439 | 439 | |
| 440 | 440 | // Restore all the existing filters. |
| 441 | - is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters; |
|
| 441 | + is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters; |
|
| 442 | 442 | |
| 443 | 443 | // If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156) |
| 444 | - if ( isset( $wpseo_metabox ) ) { |
|
| 445 | - add_action( 'wp_insert_post', array( |
|
| 444 | + if (isset($wpseo_metabox)) { |
|
| 445 | + add_action('wp_insert_post', array( |
|
| 446 | 446 | $wpseo_metabox, |
| 447 | 447 | 'save_postdata', |
| 448 | - ) ); |
|
| 448 | + )); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // If SEO Ultimate is installed, add back the hook we removed a few lines above. |
| 452 | - if ( isset( $seo_ultimate ) ) { |
|
| 453 | - add_action( 'save_post', array( |
|
| 452 | + if (isset($seo_ultimate)) { |
|
| 453 | + add_action('save_post', array( |
|
| 454 | 454 | $seo_ultimate, |
| 455 | 455 | 'save_postmeta_box', |
| 456 | - ), 10, 2 ); |
|
| 456 | + ), 10, 2); |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | // TODO: handle errors. |
| 460 | - if ( is_wp_error( $post_id ) ) { |
|
| 461 | - $log->error( 'An error occurred: ' . $post_id->get_error_message() ); |
|
| 460 | + if (is_wp_error($post_id)) { |
|
| 461 | + $log->error('An error occurred: '.$post_id->get_error_message()); |
|
| 462 | 462 | |
| 463 | 463 | // inform an error occurred. |
| 464 | 464 | return null; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - wl_set_entity_main_type( $post_id, $type_uri ); |
|
| 467 | + wl_set_entity_main_type($post_id, $type_uri); |
|
| 468 | 468 | |
| 469 | 469 | // Save the entity types. |
| 470 | - wl_set_entity_rdf_types( $post_id, $entity_types ); |
|
| 470 | + wl_set_entity_rdf_types($post_id, $entity_types); |
|
| 471 | 471 | |
| 472 | 472 | // Get a dataset URI for the entity. |
| 473 | - $wl_uri = wl_build_entity_uri( $post_id ); |
|
| 473 | + $wl_uri = wl_build_entity_uri($post_id); |
|
| 474 | 474 | |
| 475 | 475 | // Save the entity URI. |
| 476 | - wl_set_entity_uri( $post_id, $wl_uri ); |
|
| 476 | + wl_set_entity_uri($post_id, $wl_uri); |
|
| 477 | 477 | |
| 478 | 478 | // Add the uri to the sameAs data if it's not a local URI. |
| 479 | - if ( $wl_uri !== $uri ) { |
|
| 480 | - array_push( $same_as, $uri ); |
|
| 479 | + if ($wl_uri !== $uri) { |
|
| 480 | + array_push($same_as, $uri); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - $new_uri = wl_get_entity_uri( $post_id ); |
|
| 483 | + $new_uri = wl_get_entity_uri($post_id); |
|
| 484 | 484 | |
| 485 | 485 | // Save the sameAs data for the entity. |
| 486 | - wl_schema_set_value( $post_id, 'sameAs', $same_as ); |
|
| 486 | + wl_schema_set_value($post_id, 'sameAs', $same_as); |
|
| 487 | 487 | |
| 488 | 488 | // Save the other properties (latitude, langitude, startDate, endDate, etc.) |
| 489 | - foreach ( $other_properties as $property_name => $property_value ) { |
|
| 490 | - wl_schema_set_value( $post_id, $property_name, $property_value ); |
|
| 489 | + foreach ($other_properties as $property_name => $property_value) { |
|
| 490 | + wl_schema_set_value($post_id, $property_name, $property_value); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // Call hooks. |
| 494 | - do_action( 'wl_save_entity', $post_id ); |
|
| 494 | + do_action('wl_save_entity', $post_id); |
|
| 495 | 495 | |
| 496 | - foreach ( $images as $image_remote_url ) { |
|
| 496 | + foreach ($images as $image_remote_url) { |
|
| 497 | 497 | |
| 498 | 498 | // Check if image is already present in local DB |
| 499 | - if ( strpos( $image_remote_url, site_url() ) !== false ) { |
|
| 499 | + if (strpos($image_remote_url, site_url()) !== false) { |
|
| 500 | 500 | // Do nothing. |
| 501 | 501 | continue; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // Check if there is an existing attachment for this post ID and source URL. |
| 505 | - $existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url ); |
|
| 505 | + $existing_image = wl_get_attachment_for_source_url($post_id, $image_remote_url); |
|
| 506 | 506 | |
| 507 | 507 | // Skip if an existing image is found. |
| 508 | - if ( null !== $existing_image ) { |
|
| 508 | + if (null !== $existing_image) { |
|
| 509 | 509 | continue; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | // Save the image and get the local path. |
| 513 | - $image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url ); |
|
| 513 | + $image = Wordlift_Remote_Image_Service::save_from_url($image_remote_url); |
|
| 514 | 514 | |
| 515 | - if ( false === $image ) { |
|
| 515 | + if (false === $image) { |
|
| 516 | 516 | continue; |
| 517 | 517 | } |
| 518 | 518 | |
@@ -532,24 +532,24 @@ discard block |
||
| 532 | 532 | ); |
| 533 | 533 | |
| 534 | 534 | // Create the attachment in WordPress and generate the related metadata. |
| 535 | - $attachment_id = wp_insert_attachment( $attachment, $filename, $post_id ); |
|
| 535 | + $attachment_id = wp_insert_attachment($attachment, $filename, $post_id); |
|
| 536 | 536 | |
| 537 | 537 | // Set the source URL for the image. |
| 538 | - wl_set_source_url( $attachment_id, $image_remote_url ); |
|
| 538 | + wl_set_source_url($attachment_id, $image_remote_url); |
|
| 539 | 539 | |
| 540 | - $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename ); |
|
| 541 | - wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
|
| 540 | + $attachment_data = wp_generate_attachment_metadata($attachment_id, $filename); |
|
| 541 | + wp_update_attachment_metadata($attachment_id, $attachment_data); |
|
| 542 | 542 | |
| 543 | 543 | // Set it as the featured image. |
| 544 | - set_post_thumbnail( $post_id, $attachment_id ); |
|
| 544 | + set_post_thumbnail($post_id, $attachment_id); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | // The entity is pushed to Redlink on save by the function hooked to save_post. |
| 548 | 548 | // save the entity in the triple store. |
| 549 | - Wordlift_Linked_Data_Service::get_instance()->push( $post_id ); |
|
| 549 | + Wordlift_Linked_Data_Service::get_instance()->push($post_id); |
|
| 550 | 550 | |
| 551 | 551 | // finally return the entity post. |
| 552 | - return get_post( $post_id ); |
|
| 552 | + return get_post($post_id); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | /** |
@@ -561,10 +561,10 @@ discard block |
||
| 561 | 561 | * |
| 562 | 562 | * @return array An array of entity posts. |
| 563 | 563 | */ |
| 564 | -function wl_linked_data_content_get_embedded_entities( $content ) { |
|
| 564 | +function wl_linked_data_content_get_embedded_entities($content) { |
|
| 565 | 565 | |
| 566 | 566 | // Remove quote escapes. |
| 567 | - $content = str_replace( '\\"', '"', $content ); |
|
| 567 | + $content = str_replace('\\"', '"', $content); |
|
| 568 | 568 | |
| 569 | 569 | // Match all itemid attributes. |
| 570 | 570 | $pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im'; |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | $matches = array(); |
| 576 | 576 | |
| 577 | 577 | // In case of errors, return an empty array. |
| 578 | - if ( false === preg_match_all( $pattern, $content, $matches ) ) { |
|
| 579 | - wl_write_log( "Found no entities embedded in content" ); |
|
| 578 | + if (false === preg_match_all($pattern, $content, $matches)) { |
|
| 579 | + wl_write_log("Found no entities embedded in content"); |
|
| 580 | 580 | |
| 581 | 581 | return array(); |
| 582 | 582 | } |
@@ -585,13 +585,13 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | // Collect the entities. |
| 587 | 587 | $entities = array(); |
| 588 | - foreach ( $matches[1] as $uri ) { |
|
| 589 | - $uri_d = html_entity_decode( $uri ); |
|
| 588 | + foreach ($matches[1] as $uri) { |
|
| 589 | + $uri_d = html_entity_decode($uri); |
|
| 590 | 590 | |
| 591 | - $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d ); |
|
| 591 | + $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri_d); |
|
| 592 | 592 | |
| 593 | - if ( null !== $entity ) { |
|
| 594 | - array_push( $entities, $entity->ID ); |
|
| 593 | + if (null !== $entity) { |
|
| 594 | + array_push($entities, $entity->ID); |
|
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | |
@@ -28,1475 +28,1475 @@ discard block |
||
| 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 $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 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_Admin_Settings_Page_Action_Link} class. |
|
| 433 | - * |
|
| 434 | - * @since 3.11.0 |
|
| 435 | - * @access protected |
|
| 436 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | - */ |
|
| 438 | - protected $analytics_settings_page_action_link; |
|
| 439 | - |
|
| 440 | - /** |
|
| 441 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | - * |
|
| 443 | - * @since 3.11.0 |
|
| 444 | - * @access protected |
|
| 445 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | - */ |
|
| 447 | - protected $analytics_connect; |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | - * |
|
| 452 | - * @since 3.11.0 |
|
| 453 | - * @access protected |
|
| 454 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | - */ |
|
| 456 | - protected $publisher_ajax_adapter; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | - * |
|
| 461 | - * @since 3.11.0 |
|
| 462 | - * @access protected |
|
| 463 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | - */ |
|
| 465 | - protected $input_element; |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | - * |
|
| 470 | - * @since 3.13.0 |
|
| 471 | - * @access protected |
|
| 472 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | - */ |
|
| 474 | - protected $radio_input_element; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | - * |
|
| 479 | - * @since 3.11.0 |
|
| 480 | - * @access protected |
|
| 481 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | - */ |
|
| 483 | - protected $language_select_element; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | - * |
|
| 488 | - * @since 3.18.0 |
|
| 489 | - * @access protected |
|
| 490 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | - */ |
|
| 492 | - protected $country_select_element; |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | - * |
|
| 497 | - * @since 3.11.0 |
|
| 498 | - * @access protected |
|
| 499 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | - */ |
|
| 501 | - protected $publisher_element; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | - * |
|
| 506 | - * @since 3.11.0 |
|
| 507 | - * @access protected |
|
| 508 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | - */ |
|
| 510 | - protected $select2_element; |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * The controller for the entity type list admin page |
|
| 514 | - * |
|
| 515 | - * @since 3.11.0 |
|
| 516 | - * @access private |
|
| 517 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | - */ |
|
| 519 | - private $entity_type_admin_page; |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * The controller for the entity type settings admin page |
|
| 523 | - * |
|
| 524 | - * @since 3.11.0 |
|
| 525 | - * @access private |
|
| 526 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | - */ |
|
| 528 | - private $entity_type_settings_admin_page; |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | - * |
|
| 533 | - * @since 3.11.0 |
|
| 534 | - * @access protected |
|
| 535 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | - */ |
|
| 537 | - protected $related_entities_cloud_widget; |
|
| 538 | - |
|
| 539 | - /** |
|
| 540 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | - * |
|
| 542 | - * @since 3.14.0 |
|
| 543 | - * @access protected |
|
| 544 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | - */ |
|
| 546 | - protected $author_element; |
|
| 547 | - |
|
| 548 | - /** |
|
| 549 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | - * |
|
| 551 | - * @since 3.14.0 |
|
| 552 | - * @access protected |
|
| 553 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | - */ |
|
| 555 | - protected $batch_analysis_service; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | - * |
|
| 560 | - * @since 3.12.0 |
|
| 561 | - * @access protected |
|
| 562 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | - */ |
|
| 564 | - protected $sample_data_service; |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | - * |
|
| 569 | - * @since 3.12.0 |
|
| 570 | - * @access protected |
|
| 571 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | - */ |
|
| 573 | - protected $sample_data_ajax_adapter; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | - * |
|
| 578 | - * @since 3.14.2 |
|
| 579 | - * @access protected |
|
| 580 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | - */ |
|
| 582 | - private $batch_analysis_adapter; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | - * |
|
| 587 | - * @since 3.14.3 |
|
| 588 | - * @access private |
|
| 589 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | - */ |
|
| 591 | - private $relation_rebuild_service; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | - * |
|
| 596 | - * @since 3.14.3 |
|
| 597 | - * @access private |
|
| 598 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | - */ |
|
| 600 | - private $relation_rebuild_adapter; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | - * |
|
| 605 | - * @since 3.18.0 |
|
| 606 | - * @access private |
|
| 607 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | - */ |
|
| 609 | - private $reference_rebuild_service; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | - * |
|
| 614 | - * @since 3.16.0 |
|
| 615 | - * @access protected |
|
| 616 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | - */ |
|
| 618 | - protected $google_analytics_export_service; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * {@link Wordlift}'s singleton instance. |
|
| 622 | - * |
|
| 623 | - * @since 3.15.0 |
|
| 624 | - * @access protected |
|
| 625 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | - */ |
|
| 627 | - protected $entity_type_adapter; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | - * |
|
| 632 | - * @since 3.15.0 |
|
| 633 | - * @access protected |
|
| 634 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | - */ |
|
| 636 | - protected $linked_data_service; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | - * |
|
| 641 | - * @since 3.15.0 |
|
| 642 | - * @access protected |
|
| 643 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | - */ |
|
| 645 | - protected $storage_factory; |
|
| 646 | - |
|
| 647 | - /** |
|
| 648 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | - * |
|
| 650 | - * @since 3.15.0 |
|
| 651 | - * @access protected |
|
| 652 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | - */ |
|
| 654 | - protected $rendition_factory; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | - * |
|
| 659 | - * @since 3.15.0 |
|
| 660 | - * @access private |
|
| 661 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | - */ |
|
| 663 | - private $autocomplete_service; |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | - * |
|
| 668 | - * @since 3.15.0 |
|
| 669 | - * @access private |
|
| 670 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | - */ |
|
| 672 | - private $autocomplete_adapter; |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | - * |
|
| 677 | - * @since 3.15.0 |
|
| 678 | - * @access protected |
|
| 679 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | - */ |
|
| 681 | - protected $relation_service; |
|
| 682 | - |
|
| 683 | - /** |
|
| 684 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | - * |
|
| 686 | - * @since 3.16.0 |
|
| 687 | - * @access protected |
|
| 688 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | - * |
|
| 690 | - */ |
|
| 691 | - protected $cached_postid_to_jsonld_converter; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | - * |
|
| 696 | - * @since 3.16.0 |
|
| 697 | - * @access protected |
|
| 698 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | - */ |
|
| 700 | - protected $file_cache_service; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | - * |
|
| 705 | - * @since 3.16.3 |
|
| 706 | - * @access protected |
|
| 707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | - */ |
|
| 709 | - protected $entity_uri_service; |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | - * |
|
| 714 | - * @since 3.19.0 |
|
| 715 | - * @access protected |
|
| 716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | - */ |
|
| 718 | - protected $publisher_service; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * {@link Wordlift}'s singleton instance. |
|
| 722 | - * |
|
| 723 | - * @since 3.11.2 |
|
| 724 | - * @access private |
|
| 725 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | - */ |
|
| 727 | - private static $instance; |
|
| 728 | - |
|
| 729 | - //</editor-fold> |
|
| 730 | - |
|
| 731 | - /** |
|
| 732 | - * Define the core functionality of the plugin. |
|
| 733 | - * |
|
| 734 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | - * the public-facing side of the site. |
|
| 737 | - * |
|
| 738 | - * @since 1.0.0 |
|
| 739 | - */ |
|
| 740 | - public function __construct() { |
|
| 741 | - |
|
| 742 | - self::$instance = $this; |
|
| 743 | - |
|
| 744 | - $this->plugin_name = 'wordlift'; |
|
| 745 | - $this->version = '3.20.0'; |
|
| 746 | - $this->load_dependencies(); |
|
| 747 | - $this->set_locale(); |
|
| 748 | - $this->define_admin_hooks(); |
|
| 749 | - $this->define_public_hooks(); |
|
| 750 | - |
|
| 751 | - // If we're in `WP_CLI` load the related files. |
|
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | - $this->load_cli_dependencies(); |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Get the singleton instance. |
|
| 760 | - * |
|
| 761 | - * @since 3.11.2 |
|
| 762 | - * |
|
| 763 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 764 | - */ |
|
| 765 | - public static function get_instance() { |
|
| 766 | - |
|
| 767 | - return self::$instance; |
|
| 768 | - } |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * Load the required dependencies for this plugin. |
|
| 772 | - * |
|
| 773 | - * Include the following files that make up the plugin: |
|
| 774 | - * |
|
| 775 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | - * |
|
| 780 | - * Create an instance of the loader which will be used to register the hooks |
|
| 781 | - * with WordPress. |
|
| 782 | - * |
|
| 783 | - * @since 1.0.0 |
|
| 784 | - * @access private |
|
| 785 | - */ |
|
| 786 | - private function load_dependencies() { |
|
| 787 | - |
|
| 788 | - /** |
|
| 789 | - * The class responsible for orchestrating the actions and filters of the |
|
| 790 | - * core plugin. |
|
| 791 | - */ |
|
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | - |
|
| 794 | - // The class responsible for plugin uninstall. |
|
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | - |
|
| 797 | - /** |
|
| 798 | - * The class responsible for defining internationalization functionality |
|
| 799 | - * of the plugin. |
|
| 800 | - */ |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | - |
|
| 803 | - /** |
|
| 804 | - * WordLift's supported languages. |
|
| 805 | - */ |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | - |
|
| 808 | - /** |
|
| 809 | - * WordLift's supported countries. |
|
| 810 | - */ |
|
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * Provide support functions to sanitize data. |
|
| 815 | - */ |
|
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | - |
|
| 818 | - /** Services. */ |
|
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * The Query builder. |
|
| 832 | - */ |
|
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | - |
|
| 835 | - /** |
|
| 836 | - * The Schema service. |
|
| 837 | - */ |
|
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | - |
|
| 840 | - /** |
|
| 841 | - * The schema:url property service. |
|
| 842 | - */ |
|
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | - |
|
| 846 | - /** |
|
| 847 | - * The UI service. |
|
| 848 | - */ |
|
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | - |
|
| 851 | - /** |
|
| 852 | - * The Thumbnail service. |
|
| 853 | - */ |
|
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | - |
|
| 856 | - /** |
|
| 857 | - * The Entity Types Taxonomy service. |
|
| 858 | - */ |
|
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | - |
|
| 861 | - /** |
|
| 862 | - * The Entity service. |
|
| 863 | - */ |
|
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | - |
|
| 867 | - // Add the entity rating service. |
|
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | - |
|
| 870 | - /** |
|
| 871 | - * The User service. |
|
| 872 | - */ |
|
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * The Timeline service. |
|
| 877 | - */ |
|
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | - |
|
| 880 | - /** |
|
| 881 | - * The Topic Taxonomy service. |
|
| 882 | - */ |
|
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | - |
|
| 885 | - /** |
|
| 886 | - * The SPARQL service. |
|
| 887 | - */ |
|
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * The WordLift import service. |
|
| 892 | - */ |
|
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | - |
|
| 895 | - /** |
|
| 896 | - * The WordLift URI service. |
|
| 897 | - */ |
|
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | - |
|
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | - |
|
| 914 | - /** |
|
| 915 | - * Load the converters. |
|
| 916 | - */ |
|
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | - |
|
| 924 | - /** |
|
| 925 | - * Load cache-related files. |
|
| 926 | - */ |
|
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | - |
|
| 929 | - /** |
|
| 930 | - * Load the content filter. |
|
| 931 | - */ |
|
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | - |
|
| 934 | - /* |
|
| 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 $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 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_Admin_Settings_Page_Action_Link} class. |
|
| 433 | + * |
|
| 434 | + * @since 3.11.0 |
|
| 435 | + * @access protected |
|
| 436 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 437 | + */ |
|
| 438 | + protected $analytics_settings_page_action_link; |
|
| 439 | + |
|
| 440 | + /** |
|
| 441 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 442 | + * |
|
| 443 | + * @since 3.11.0 |
|
| 444 | + * @access protected |
|
| 445 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 446 | + */ |
|
| 447 | + protected $analytics_connect; |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 451 | + * |
|
| 452 | + * @since 3.11.0 |
|
| 453 | + * @access protected |
|
| 454 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 455 | + */ |
|
| 456 | + protected $publisher_ajax_adapter; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 460 | + * |
|
| 461 | + * @since 3.11.0 |
|
| 462 | + * @access protected |
|
| 463 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 464 | + */ |
|
| 465 | + protected $input_element; |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 469 | + * |
|
| 470 | + * @since 3.13.0 |
|
| 471 | + * @access protected |
|
| 472 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 473 | + */ |
|
| 474 | + protected $radio_input_element; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 478 | + * |
|
| 479 | + * @since 3.11.0 |
|
| 480 | + * @access protected |
|
| 481 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 482 | + */ |
|
| 483 | + protected $language_select_element; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 487 | + * |
|
| 488 | + * @since 3.18.0 |
|
| 489 | + * @access protected |
|
| 490 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 491 | + */ |
|
| 492 | + protected $country_select_element; |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 496 | + * |
|
| 497 | + * @since 3.11.0 |
|
| 498 | + * @access protected |
|
| 499 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 500 | + */ |
|
| 501 | + protected $publisher_element; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 505 | + * |
|
| 506 | + * @since 3.11.0 |
|
| 507 | + * @access protected |
|
| 508 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 509 | + */ |
|
| 510 | + protected $select2_element; |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * The controller for the entity type list admin page |
|
| 514 | + * |
|
| 515 | + * @since 3.11.0 |
|
| 516 | + * @access private |
|
| 517 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 518 | + */ |
|
| 519 | + private $entity_type_admin_page; |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * The controller for the entity type settings admin page |
|
| 523 | + * |
|
| 524 | + * @since 3.11.0 |
|
| 525 | + * @access private |
|
| 526 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 527 | + */ |
|
| 528 | + private $entity_type_settings_admin_page; |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 532 | + * |
|
| 533 | + * @since 3.11.0 |
|
| 534 | + * @access protected |
|
| 535 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 536 | + */ |
|
| 537 | + protected $related_entities_cloud_widget; |
|
| 538 | + |
|
| 539 | + /** |
|
| 540 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 541 | + * |
|
| 542 | + * @since 3.14.0 |
|
| 543 | + * @access protected |
|
| 544 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 545 | + */ |
|
| 546 | + protected $author_element; |
|
| 547 | + |
|
| 548 | + /** |
|
| 549 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 550 | + * |
|
| 551 | + * @since 3.14.0 |
|
| 552 | + * @access protected |
|
| 553 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
| 554 | + */ |
|
| 555 | + protected $batch_analysis_service; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 559 | + * |
|
| 560 | + * @since 3.12.0 |
|
| 561 | + * @access protected |
|
| 562 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 563 | + */ |
|
| 564 | + protected $sample_data_service; |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 568 | + * |
|
| 569 | + * @since 3.12.0 |
|
| 570 | + * @access protected |
|
| 571 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 572 | + */ |
|
| 573 | + protected $sample_data_ajax_adapter; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 577 | + * |
|
| 578 | + * @since 3.14.2 |
|
| 579 | + * @access protected |
|
| 580 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
| 581 | + */ |
|
| 582 | + private $batch_analysis_adapter; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 586 | + * |
|
| 587 | + * @since 3.14.3 |
|
| 588 | + * @access private |
|
| 589 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
| 590 | + */ |
|
| 591 | + private $relation_rebuild_service; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 595 | + * |
|
| 596 | + * @since 3.14.3 |
|
| 597 | + * @access private |
|
| 598 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
| 599 | + */ |
|
| 600 | + private $relation_rebuild_adapter; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 604 | + * |
|
| 605 | + * @since 3.18.0 |
|
| 606 | + * @access private |
|
| 607 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
| 608 | + */ |
|
| 609 | + private $reference_rebuild_service; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 613 | + * |
|
| 614 | + * @since 3.16.0 |
|
| 615 | + * @access protected |
|
| 616 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 617 | + */ |
|
| 618 | + protected $google_analytics_export_service; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * {@link Wordlift}'s singleton instance. |
|
| 622 | + * |
|
| 623 | + * @since 3.15.0 |
|
| 624 | + * @access protected |
|
| 625 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 626 | + */ |
|
| 627 | + protected $entity_type_adapter; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
| 631 | + * |
|
| 632 | + * @since 3.15.0 |
|
| 633 | + * @access protected |
|
| 634 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
| 635 | + */ |
|
| 636 | + protected $linked_data_service; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 640 | + * |
|
| 641 | + * @since 3.15.0 |
|
| 642 | + * @access protected |
|
| 643 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 644 | + */ |
|
| 645 | + protected $storage_factory; |
|
| 646 | + |
|
| 647 | + /** |
|
| 648 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 649 | + * |
|
| 650 | + * @since 3.15.0 |
|
| 651 | + * @access protected |
|
| 652 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
| 653 | + */ |
|
| 654 | + protected $rendition_factory; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
| 658 | + * |
|
| 659 | + * @since 3.15.0 |
|
| 660 | + * @access private |
|
| 661 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
| 662 | + */ |
|
| 663 | + private $autocomplete_service; |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 667 | + * |
|
| 668 | + * @since 3.15.0 |
|
| 669 | + * @access private |
|
| 670 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 671 | + */ |
|
| 672 | + private $autocomplete_adapter; |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * The {@link Wordlift_Relation_Service} instance. |
|
| 676 | + * |
|
| 677 | + * @since 3.15.0 |
|
| 678 | + * @access protected |
|
| 679 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
| 680 | + */ |
|
| 681 | + protected $relation_service; |
|
| 682 | + |
|
| 683 | + /** |
|
| 684 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 685 | + * |
|
| 686 | + * @since 3.16.0 |
|
| 687 | + * @access protected |
|
| 688 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 689 | + * |
|
| 690 | + */ |
|
| 691 | + protected $cached_postid_to_jsonld_converter; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
| 695 | + * |
|
| 696 | + * @since 3.16.0 |
|
| 697 | + * @access protected |
|
| 698 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
| 699 | + */ |
|
| 700 | + protected $file_cache_service; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 704 | + * |
|
| 705 | + * @since 3.16.3 |
|
| 706 | + * @access protected |
|
| 707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 708 | + */ |
|
| 709 | + protected $entity_uri_service; |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 713 | + * |
|
| 714 | + * @since 3.19.0 |
|
| 715 | + * @access protected |
|
| 716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 717 | + */ |
|
| 718 | + protected $publisher_service; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * {@link Wordlift}'s singleton instance. |
|
| 722 | + * |
|
| 723 | + * @since 3.11.2 |
|
| 724 | + * @access private |
|
| 725 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 726 | + */ |
|
| 727 | + private static $instance; |
|
| 728 | + |
|
| 729 | + //</editor-fold> |
|
| 730 | + |
|
| 731 | + /** |
|
| 732 | + * Define the core functionality of the plugin. |
|
| 733 | + * |
|
| 734 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 735 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 736 | + * the public-facing side of the site. |
|
| 737 | + * |
|
| 738 | + * @since 1.0.0 |
|
| 739 | + */ |
|
| 740 | + public function __construct() { |
|
| 741 | + |
|
| 742 | + self::$instance = $this; |
|
| 743 | + |
|
| 744 | + $this->plugin_name = 'wordlift'; |
|
| 745 | + $this->version = '3.20.0'; |
|
| 746 | + $this->load_dependencies(); |
|
| 747 | + $this->set_locale(); |
|
| 748 | + $this->define_admin_hooks(); |
|
| 749 | + $this->define_public_hooks(); |
|
| 750 | + |
|
| 751 | + // If we're in `WP_CLI` load the related files. |
|
| 752 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 753 | + $this->load_cli_dependencies(); |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Get the singleton instance. |
|
| 760 | + * |
|
| 761 | + * @since 3.11.2 |
|
| 762 | + * |
|
| 763 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 764 | + */ |
|
| 765 | + public static function get_instance() { |
|
| 766 | + |
|
| 767 | + return self::$instance; |
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * Load the required dependencies for this plugin. |
|
| 772 | + * |
|
| 773 | + * Include the following files that make up the plugin: |
|
| 774 | + * |
|
| 775 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 776 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 777 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 778 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 779 | + * |
|
| 780 | + * Create an instance of the loader which will be used to register the hooks |
|
| 781 | + * with WordPress. |
|
| 782 | + * |
|
| 783 | + * @since 1.0.0 |
|
| 784 | + * @access private |
|
| 785 | + */ |
|
| 786 | + private function load_dependencies() { |
|
| 787 | + |
|
| 788 | + /** |
|
| 789 | + * The class responsible for orchestrating the actions and filters of the |
|
| 790 | + * core plugin. |
|
| 791 | + */ |
|
| 792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 793 | + |
|
| 794 | + // The class responsible for plugin uninstall. |
|
| 795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | + |
|
| 797 | + /** |
|
| 798 | + * The class responsible for defining internationalization functionality |
|
| 799 | + * of the plugin. |
|
| 800 | + */ |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 802 | + |
|
| 803 | + /** |
|
| 804 | + * WordLift's supported languages. |
|
| 805 | + */ |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 807 | + |
|
| 808 | + /** |
|
| 809 | + * WordLift's supported countries. |
|
| 810 | + */ |
|
| 811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * Provide support functions to sanitize data. |
|
| 815 | + */ |
|
| 816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 817 | + |
|
| 818 | + /** Services. */ |
|
| 819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * The Query builder. |
|
| 832 | + */ |
|
| 833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 834 | + |
|
| 835 | + /** |
|
| 836 | + * The Schema service. |
|
| 837 | + */ |
|
| 838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 839 | + |
|
| 840 | + /** |
|
| 841 | + * The schema:url property service. |
|
| 842 | + */ |
|
| 843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | + |
|
| 846 | + /** |
|
| 847 | + * The UI service. |
|
| 848 | + */ |
|
| 849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 850 | + |
|
| 851 | + /** |
|
| 852 | + * The Thumbnail service. |
|
| 853 | + */ |
|
| 854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | + |
|
| 856 | + /** |
|
| 857 | + * The Entity Types Taxonomy service. |
|
| 858 | + */ |
|
| 859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | + |
|
| 861 | + /** |
|
| 862 | + * The Entity service. |
|
| 863 | + */ |
|
| 864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 866 | + |
|
| 867 | + // Add the entity rating service. |
|
| 868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 869 | + |
|
| 870 | + /** |
|
| 871 | + * The User service. |
|
| 872 | + */ |
|
| 873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * The Timeline service. |
|
| 877 | + */ |
|
| 878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 879 | + |
|
| 880 | + /** |
|
| 881 | + * The Topic Taxonomy service. |
|
| 882 | + */ |
|
| 883 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | + |
|
| 885 | + /** |
|
| 886 | + * The SPARQL service. |
|
| 887 | + */ |
|
| 888 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * The WordLift import service. |
|
| 892 | + */ |
|
| 893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 894 | + |
|
| 895 | + /** |
|
| 896 | + * The WordLift URI service. |
|
| 897 | + */ |
|
| 898 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | + |
|
| 911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 913 | + |
|
| 914 | + /** |
|
| 915 | + * Load the converters. |
|
| 916 | + */ |
|
| 917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | + |
|
| 924 | + /** |
|
| 925 | + * Load cache-related files. |
|
| 926 | + */ |
|
| 927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 928 | + |
|
| 929 | + /** |
|
| 930 | + * Load the content filter. |
|
| 931 | + */ |
|
| 932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | + |
|
| 934 | + /* |
|
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | - |
|
| 939 | - /** |
|
| 940 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | - * |
|
| 942 | - * @since 3.8.0 |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | - |
|
| 946 | - // The Publisher Service and the AJAX adapter. |
|
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | - |
|
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * Load the WordLift key validation service. |
|
| 954 | - */ |
|
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | - |
|
| 957 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | - |
|
| 960 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | - |
|
| 965 | - /** Linked Data. */ |
|
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | - |
|
| 978 | - /** Linked Data Rendition. */ |
|
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | - |
|
| 984 | - /** Services. */ |
|
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | - |
|
| 989 | - /** Adapters. */ |
|
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | - |
|
| 997 | - /** Async Tasks. */ |
|
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | - |
|
| 1004 | - /** Autocomplete. */ |
|
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | - |
|
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | - |
|
| 1010 | - /** Analytics */ |
|
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | - |
|
| 1013 | - /** |
|
| 1014 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | - */ |
|
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | - |
|
| 1018 | - /** |
|
| 1019 | - * The class to customize the entity list admin page. |
|
| 1020 | - */ |
|
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | - |
|
| 1023 | - /** |
|
| 1024 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | - */ |
|
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | - |
|
| 1028 | - /** |
|
| 1029 | - * The Notice service. |
|
| 1030 | - */ |
|
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | - |
|
| 1033 | - /** |
|
| 1034 | - * The PrimaShop adapter. |
|
| 1035 | - */ |
|
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | - |
|
| 1038 | - /** |
|
| 1039 | - * The WordLift Dashboard service. |
|
| 1040 | - */ |
|
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | - |
|
| 1043 | - /** |
|
| 1044 | - * The admin 'Install wizard' page. |
|
| 1045 | - */ |
|
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | - |
|
| 1048 | - /** |
|
| 1049 | - * The WordLift entity type list admin page controller. |
|
| 1050 | - */ |
|
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | - |
|
| 1053 | - /** |
|
| 1054 | - * The WordLift entity type settings admin page controller. |
|
| 1055 | - */ |
|
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * The admin 'Download Your Data' page. |
|
| 1060 | - */ |
|
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | - |
|
| 1063 | - /** |
|
| 1064 | - * The admin 'WordLift Settings' page. |
|
| 1065 | - */ |
|
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | - |
|
| 1083 | - /** Admin Pages */ |
|
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1089 | - |
|
| 1090 | - /** |
|
| 1091 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 1092 | - * side of the site. |
|
| 1093 | - */ |
|
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1095 | - |
|
| 1096 | - /** |
|
| 1097 | - * The shortcode abstract class. |
|
| 1098 | - */ |
|
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1100 | - |
|
| 1101 | - /** |
|
| 1102 | - * The Timeline shortcode. |
|
| 1103 | - */ |
|
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1105 | - |
|
| 1106 | - /** |
|
| 1107 | - * The Navigator shortcode. |
|
| 1108 | - */ |
|
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1110 | - |
|
| 1111 | - /** |
|
| 1112 | - * The chord shortcode. |
|
| 1113 | - */ |
|
| 1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1115 | - |
|
| 1116 | - /** |
|
| 1117 | - * The geomap shortcode. |
|
| 1118 | - */ |
|
| 1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1120 | - |
|
| 1121 | - /** |
|
| 1122 | - * The entity cloud shortcode. |
|
| 1123 | - */ |
|
| 1124 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1125 | - |
|
| 1126 | - /** |
|
| 1127 | - * The entity glossary shortcode. |
|
| 1128 | - */ |
|
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1131 | - |
|
| 1132 | - /** |
|
| 1133 | - * Faceted Search shortcode. |
|
| 1134 | - */ |
|
| 1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1136 | - |
|
| 1137 | - /** |
|
| 1138 | - * The ShareThis service. |
|
| 1139 | - */ |
|
| 1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1141 | - |
|
| 1142 | - /** |
|
| 1143 | - * The SEO service. |
|
| 1144 | - */ |
|
| 1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1146 | - |
|
| 1147 | - /** |
|
| 1148 | - * The AMP service. |
|
| 1149 | - */ |
|
| 1150 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1151 | - |
|
| 1152 | - /** Widgets */ |
|
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1155 | - |
|
| 1156 | - /* |
|
| 937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | + |
|
| 939 | + /** |
|
| 940 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 941 | + * |
|
| 942 | + * @since 3.8.0 |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | + |
|
| 946 | + // The Publisher Service and the AJAX adapter. |
|
| 947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | + |
|
| 950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * Load the WordLift key validation service. |
|
| 954 | + */ |
|
| 955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | + |
|
| 957 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | + |
|
| 960 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | + |
|
| 965 | + /** Linked Data. */ |
|
| 966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | + |
|
| 978 | + /** Linked Data Rendition. */ |
|
| 979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | + |
|
| 984 | + /** Services. */ |
|
| 985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 988 | + |
|
| 989 | + /** Adapters. */ |
|
| 990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | + |
|
| 997 | + /** Async Tasks. */ |
|
| 998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | + |
|
| 1004 | + /** Autocomplete. */ |
|
| 1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | + |
|
| 1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | + |
|
| 1010 | + /** Analytics */ |
|
| 1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | + |
|
| 1013 | + /** |
|
| 1014 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 1015 | + */ |
|
| 1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1017 | + |
|
| 1018 | + /** |
|
| 1019 | + * The class to customize the entity list admin page. |
|
| 1020 | + */ |
|
| 1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | + |
|
| 1023 | + /** |
|
| 1024 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 1025 | + */ |
|
| 1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | + |
|
| 1028 | + /** |
|
| 1029 | + * The Notice service. |
|
| 1030 | + */ |
|
| 1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * The PrimaShop adapter. |
|
| 1035 | + */ |
|
| 1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | + |
|
| 1038 | + /** |
|
| 1039 | + * The WordLift Dashboard service. |
|
| 1040 | + */ |
|
| 1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | + |
|
| 1043 | + /** |
|
| 1044 | + * The admin 'Install wizard' page. |
|
| 1045 | + */ |
|
| 1046 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | + |
|
| 1048 | + /** |
|
| 1049 | + * The WordLift entity type list admin page controller. |
|
| 1050 | + */ |
|
| 1051 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | + |
|
| 1053 | + /** |
|
| 1054 | + * The WordLift entity type settings admin page controller. |
|
| 1055 | + */ |
|
| 1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * The admin 'Download Your Data' page. |
|
| 1060 | + */ |
|
| 1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | + |
|
| 1063 | + /** |
|
| 1064 | + * The admin 'WordLift Settings' page. |
|
| 1065 | + */ |
|
| 1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | + |
|
| 1083 | + /** Admin Pages */ |
|
| 1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1088 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1089 | + |
|
| 1090 | + /** |
|
| 1091 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 1092 | + * side of the site. |
|
| 1093 | + */ |
|
| 1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1095 | + |
|
| 1096 | + /** |
|
| 1097 | + * The shortcode abstract class. |
|
| 1098 | + */ |
|
| 1099 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1100 | + |
|
| 1101 | + /** |
|
| 1102 | + * The Timeline shortcode. |
|
| 1103 | + */ |
|
| 1104 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1105 | + |
|
| 1106 | + /** |
|
| 1107 | + * The Navigator shortcode. |
|
| 1108 | + */ |
|
| 1109 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1110 | + |
|
| 1111 | + /** |
|
| 1112 | + * The chord shortcode. |
|
| 1113 | + */ |
|
| 1114 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1115 | + |
|
| 1116 | + /** |
|
| 1117 | + * The geomap shortcode. |
|
| 1118 | + */ |
|
| 1119 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1120 | + |
|
| 1121 | + /** |
|
| 1122 | + * The entity cloud shortcode. |
|
| 1123 | + */ |
|
| 1124 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1125 | + |
|
| 1126 | + /** |
|
| 1127 | + * The entity glossary shortcode. |
|
| 1128 | + */ |
|
| 1129 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1130 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1131 | + |
|
| 1132 | + /** |
|
| 1133 | + * Faceted Search shortcode. |
|
| 1134 | + */ |
|
| 1135 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1136 | + |
|
| 1137 | + /** |
|
| 1138 | + * The ShareThis service. |
|
| 1139 | + */ |
|
| 1140 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1141 | + |
|
| 1142 | + /** |
|
| 1143 | + * The SEO service. |
|
| 1144 | + */ |
|
| 1145 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1146 | + |
|
| 1147 | + /** |
|
| 1148 | + * The AMP service. |
|
| 1149 | + */ |
|
| 1150 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1151 | + |
|
| 1152 | + /** Widgets */ |
|
| 1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1155 | + |
|
| 1156 | + /* |
|
| 1157 | 1157 | * Schema.org Services. |
| 1158 | 1158 | * |
| 1159 | 1159 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1160 | 1160 | */ |
| 1161 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1165 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1166 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1167 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1168 | - } else { |
|
| 1169 | - $schemaorg_property_service = null; |
|
| 1170 | - } |
|
| 1161 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1165 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1166 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
| 1167 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1168 | + } else { |
|
| 1169 | + $schemaorg_property_service = null; |
|
| 1170 | + } |
|
| 1171 | 1171 | |
| 1172 | - $this->loader = new Wordlift_Loader(); |
|
| 1172 | + $this->loader = new Wordlift_Loader(); |
|
| 1173 | 1173 | |
| 1174 | - // Instantiate a global logger. |
|
| 1175 | - global $wl_logger; |
|
| 1176 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1174 | + // Instantiate a global logger. |
|
| 1175 | + global $wl_logger; |
|
| 1176 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1177 | 1177 | |
| 1178 | - // Load the `wl-api` end-point. |
|
| 1179 | - new Wordlift_Http_Api(); |
|
| 1178 | + // Load the `wl-api` end-point. |
|
| 1179 | + new Wordlift_Http_Api(); |
|
| 1180 | 1180 | |
| 1181 | - // Load the Install Service. |
|
| 1182 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1181 | + // Load the Install Service. |
|
| 1182 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1183 | 1183 | |
| 1184 | - /** Services. */ |
|
| 1185 | - // Create the configuration service. |
|
| 1186 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1187 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1184 | + /** Services. */ |
|
| 1185 | + // Create the configuration service. |
|
| 1186 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 1187 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1188 | 1188 | |
| 1189 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1190 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1189 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1190 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1191 | 1191 | |
| 1192 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1193 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1192 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1193 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1194 | 1194 | |
| 1195 | - // Create an instance of the UI service. |
|
| 1196 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 1195 | + // Create an instance of the UI service. |
|
| 1196 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 1197 | 1197 | |
| 1198 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1199 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1198 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 1199 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 1200 | 1200 | |
| 1201 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1202 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1203 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1204 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1201 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 1202 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1203 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1204 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
| 1205 | 1205 | |
| 1206 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1207 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1208 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1209 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1210 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1206 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1207 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1208 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1209 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1210 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1211 | 1211 | |
| 1212 | - // Instantiate the JSON-LD service. |
|
| 1213 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1212 | + // Instantiate the JSON-LD service. |
|
| 1213 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1214 | 1214 | |
| 1215 | - /** Linked Data. */ |
|
| 1216 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1217 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1215 | + /** Linked Data. */ |
|
| 1216 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1217 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1218 | 1218 | |
| 1219 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1219 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1220 | 1220 | |
| 1221 | - // Create a new instance of the Redirect service. |
|
| 1222 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1223 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1224 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1221 | + // Create a new instance of the Redirect service. |
|
| 1222 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1223 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1224 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1225 | 1225 | |
| 1226 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1227 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1226 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1227 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1228 | 1228 | |
| 1229 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1229 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1230 | 1230 | |
| 1231 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1231 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1232 | 1232 | |
| 1233 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1234 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1233 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1234 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1235 | 1235 | |
| 1236 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1237 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1236 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1237 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1238 | 1238 | |
| 1239 | - // Create an instance of the PrimaShop adapter. |
|
| 1240 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1239 | + // Create an instance of the PrimaShop adapter. |
|
| 1240 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1241 | 1241 | |
| 1242 | - // Create an import service instance to hook later to WP's import function. |
|
| 1243 | - $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() ); |
|
| 1242 | + // Create an import service instance to hook later to WP's import function. |
|
| 1243 | + $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() ); |
|
| 1244 | 1244 | |
| 1245 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1245 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1246 | 1246 | |
| 1247 | - // Create the entity rating service. |
|
| 1248 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1247 | + // Create the entity rating service. |
|
| 1248 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1249 | 1249 | |
| 1250 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1251 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1250 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1251 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1252 | 1252 | |
| 1253 | - // Create a new instance of the Redirect service. |
|
| 1254 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1253 | + // Create a new instance of the Redirect service. |
|
| 1254 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1255 | 1255 | |
| 1256 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1257 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1258 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1259 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1256 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1257 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1258 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1259 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1260 | 1260 | |
| 1261 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1261 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 1262 | 1262 | |
| 1263 | - // Instantiate the JSON-LD service. |
|
| 1264 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1265 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1266 | - $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 ); |
|
| 1267 | - $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 ); |
|
| 1268 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1269 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1270 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1263 | + // Instantiate the JSON-LD service. |
|
| 1264 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1265 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1266 | + $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 ); |
|
| 1267 | + $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 ); |
|
| 1268 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1269 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1270 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1271 | 1271 | |
| 1272 | 1272 | |
| 1273 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1274 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1275 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1276 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1277 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1278 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1273 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1274 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1275 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1276 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1277 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1278 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1279 | 1279 | |
| 1280 | - // Initialize the shortcodes. |
|
| 1281 | - new Wordlift_Navigator_Shortcode(); |
|
| 1282 | - new Wordlift_Chord_Shortcode(); |
|
| 1283 | - new Wordlift_Geomap_Shortcode(); |
|
| 1284 | - new Wordlift_Timeline_Shortcode(); |
|
| 1285 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1286 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1287 | - new Wordlift_Faceted_Search_Shortcode(); |
|
| 1280 | + // Initialize the shortcodes. |
|
| 1281 | + new Wordlift_Navigator_Shortcode(); |
|
| 1282 | + new Wordlift_Chord_Shortcode(); |
|
| 1283 | + new Wordlift_Geomap_Shortcode(); |
|
| 1284 | + new Wordlift_Timeline_Shortcode(); |
|
| 1285 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1286 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1287 | + new Wordlift_Faceted_Search_Shortcode(); |
|
| 1288 | 1288 | |
| 1289 | - // Initialize the SEO service. |
|
| 1290 | - new Wordlift_Seo_Service(); |
|
| 1289 | + // Initialize the SEO service. |
|
| 1290 | + new Wordlift_Seo_Service(); |
|
| 1291 | 1291 | |
| 1292 | - // Initialize the AMP service. |
|
| 1293 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1292 | + // Initialize the AMP service. |
|
| 1293 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1294 | 1294 | |
| 1295 | - /** Services. */ |
|
| 1296 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1297 | - new Wordlift_Image_Service(); |
|
| 1295 | + /** Services. */ |
|
| 1296 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1297 | + new Wordlift_Image_Service(); |
|
| 1298 | 1298 | |
| 1299 | - /** Adapters. */ |
|
| 1300 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1301 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1302 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1303 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1304 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1299 | + /** Adapters. */ |
|
| 1300 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1301 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1302 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1303 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1304 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1305 | 1305 | |
| 1306 | - /* |
|
| 1306 | + /* |
|
| 1307 | 1307 | * Exclude our public js from WP-Rocket. |
| 1308 | 1308 | * |
| 1309 | 1309 | * @since 3.19.4 |
| 1310 | 1310 | * |
| 1311 | 1311 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1312 | 1312 | */ |
| 1313 | - new Wordlift_WpRocket_Adapter(); |
|
| 1313 | + new Wordlift_WpRocket_Adapter(); |
|
| 1314 | 1314 | |
| 1315 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1316 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1317 | - $this->sparql_service, |
|
| 1318 | - $uri_service |
|
| 1319 | - ); |
|
| 1315 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 1316 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
| 1317 | + $this->sparql_service, |
|
| 1318 | + $uri_service |
|
| 1319 | + ); |
|
| 1320 | 1320 | |
| 1321 | - /** Async Tasks. */ |
|
| 1322 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 1323 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1324 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1325 | - new Wordlift_Push_References_Async_Task(); |
|
| 1321 | + /** Async Tasks. */ |
|
| 1322 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 1323 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
| 1324 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
| 1325 | + new Wordlift_Push_References_Async_Task(); |
|
| 1326 | 1326 | |
| 1327 | - /** WL Autocomplete. */ |
|
| 1328 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1329 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1327 | + /** WL Autocomplete. */ |
|
| 1328 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1329 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1330 | 1330 | |
| 1331 | - /** WordPress Admin UI. */ |
|
| 1331 | + /** WordPress Admin UI. */ |
|
| 1332 | 1332 | |
| 1333 | - // UI elements. |
|
| 1334 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1335 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1336 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1337 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1338 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1339 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1340 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1341 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1333 | + // UI elements. |
|
| 1334 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1335 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1336 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1337 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1338 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1339 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1340 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1341 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1342 | 1342 | |
| 1343 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1344 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1345 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1343 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1344 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1345 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1346 | 1346 | |
| 1347 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1348 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1349 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1347 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1348 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1349 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1350 | 1350 | |
| 1351 | - // Pages. |
|
| 1352 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1353 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1351 | + // Pages. |
|
| 1352 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1353 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1354 | 1354 | |
| 1355 | - // create an instance of the entity type list admin page controller. |
|
| 1356 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1355 | + // create an instance of the entity type list admin page controller. |
|
| 1356 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1357 | 1357 | |
| 1358 | - // create an instance of the entity type setting admin page controller. |
|
| 1359 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1358 | + // create an instance of the entity type setting admin page controller. |
|
| 1359 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1360 | 1360 | |
| 1361 | - /** Widgets */ |
|
| 1362 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1361 | + /** Widgets */ |
|
| 1362 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1363 | 1363 | |
| 1364 | - /* WordPress Admin. */ |
|
| 1365 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1366 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1364 | + /* WordPress Admin. */ |
|
| 1365 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1366 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1367 | 1367 | |
| 1368 | - // Create an instance of the install wizard. |
|
| 1369 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1368 | + // Create an instance of the install wizard. |
|
| 1369 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1370 | 1370 | |
| 1371 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1371 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1372 | 1372 | |
| 1373 | - // User Profile. |
|
| 1374 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1373 | + // User Profile. |
|
| 1374 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1375 | 1375 | |
| 1376 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1376 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1377 | 1377 | |
| 1378 | - // Load the debug service if WP is in debug mode. |
|
| 1379 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1380 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1381 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1382 | - } |
|
| 1378 | + // Load the debug service if WP is in debug mode. |
|
| 1379 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1380 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1381 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1382 | + } |
|
| 1383 | 1383 | |
| 1384 | - // Remote Image Service. |
|
| 1385 | - new Wordlift_Remote_Image_Service(); |
|
| 1384 | + // Remote Image Service. |
|
| 1385 | + new Wordlift_Remote_Image_Service(); |
|
| 1386 | 1386 | |
| 1387 | - /* |
|
| 1387 | + /* |
|
| 1388 | 1388 | * Provides mappings between post types and entity types. |
| 1389 | 1389 | * |
| 1390 | 1390 | * @since 3.20.0 |
| 1391 | 1391 | * |
| 1392 | 1392 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1393 | 1393 | */ |
| 1394 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1395 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1396 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1394 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1395 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1396 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1397 | 1397 | |
| 1398 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1399 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1398 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1399 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1400 | 1400 | |
| 1401 | - /* |
|
| 1401 | + /* |
|
| 1402 | 1402 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1403 | 1403 | * |
| 1404 | 1404 | * Eventually Batch Actions will become Batch Operations. |
| 1405 | 1405 | * |
| 1406 | 1406 | * @since 3.20.0 |
| 1407 | 1407 | */ |
| 1408 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1408 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1409 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1410 | 1410 | |
| 1411 | - /* |
|
| 1411 | + /* |
|
| 1412 | 1412 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
| 1413 | 1413 | * |
| 1414 | 1414 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1415 | 1415 | * |
| 1416 | 1416 | * @since 3.20.0 |
| 1417 | 1417 | */ |
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1419 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1418 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1419 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1420 | 1420 | |
| 1421 | - /* |
|
| 1421 | + /* |
|
| 1422 | 1422 | * Load dependencies for the front-end. |
| 1423 | 1423 | * |
| 1424 | 1424 | * @since 3.20.0 |
| 1425 | 1425 | */ |
| 1426 | - if ( ! is_admin() ) { |
|
| 1427 | - /* |
|
| 1426 | + if ( ! is_admin() ) { |
|
| 1427 | + /* |
|
| 1428 | 1428 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1429 | 1429 | * |
| 1430 | 1430 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1431 | 1431 | * |
| 1432 | 1432 | * @since 3.20.0 |
| 1433 | 1433 | */ |
| 1434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1435 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1436 | - } |
|
| 1437 | - |
|
| 1438 | - } |
|
| 1439 | - |
|
| 1440 | - /** |
|
| 1441 | - * Define the locale for this plugin for internationalization. |
|
| 1442 | - * |
|
| 1443 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1444 | - * with WordPress. |
|
| 1445 | - * |
|
| 1446 | - * @since 1.0.0 |
|
| 1447 | - * @access private |
|
| 1448 | - */ |
|
| 1449 | - private function set_locale() { |
|
| 1450 | - |
|
| 1451 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1452 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1453 | - |
|
| 1454 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1455 | - |
|
| 1456 | - } |
|
| 1457 | - |
|
| 1458 | - /** |
|
| 1459 | - * Register all of the hooks related to the admin area functionality |
|
| 1460 | - * of the plugin. |
|
| 1461 | - * |
|
| 1462 | - * @since 1.0.0 |
|
| 1463 | - * @access private |
|
| 1464 | - */ |
|
| 1465 | - private function define_admin_hooks() { |
|
| 1466 | - |
|
| 1467 | - $plugin_admin = new Wordlift_Admin( |
|
| 1468 | - $this->get_plugin_name(), |
|
| 1469 | - $this->get_version(), |
|
| 1470 | - $this->configuration_service, |
|
| 1471 | - $this->notice_service, |
|
| 1472 | - $this->user_service |
|
| 1473 | - ); |
|
| 1474 | - |
|
| 1475 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1476 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1477 | - |
|
| 1478 | - // Hook the init action to taxonomy services. |
|
| 1479 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1480 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1481 | - |
|
| 1482 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1483 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1484 | - |
|
| 1485 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1486 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1487 | - |
|
| 1488 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1489 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1490 | - |
|
| 1491 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1492 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1493 | - |
|
| 1494 | - // Register custom allowed redirect hosts. |
|
| 1495 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1496 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1497 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1498 | - |
|
| 1499 | - /* |
|
| 1434 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1435 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1436 | + } |
|
| 1437 | + |
|
| 1438 | + } |
|
| 1439 | + |
|
| 1440 | + /** |
|
| 1441 | + * Define the locale for this plugin for internationalization. |
|
| 1442 | + * |
|
| 1443 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1444 | + * with WordPress. |
|
| 1445 | + * |
|
| 1446 | + * @since 1.0.0 |
|
| 1447 | + * @access private |
|
| 1448 | + */ |
|
| 1449 | + private function set_locale() { |
|
| 1450 | + |
|
| 1451 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1452 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1453 | + |
|
| 1454 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1455 | + |
|
| 1456 | + } |
|
| 1457 | + |
|
| 1458 | + /** |
|
| 1459 | + * Register all of the hooks related to the admin area functionality |
|
| 1460 | + * of the plugin. |
|
| 1461 | + * |
|
| 1462 | + * @since 1.0.0 |
|
| 1463 | + * @access private |
|
| 1464 | + */ |
|
| 1465 | + private function define_admin_hooks() { |
|
| 1466 | + |
|
| 1467 | + $plugin_admin = new Wordlift_Admin( |
|
| 1468 | + $this->get_plugin_name(), |
|
| 1469 | + $this->get_version(), |
|
| 1470 | + $this->configuration_service, |
|
| 1471 | + $this->notice_service, |
|
| 1472 | + $this->user_service |
|
| 1473 | + ); |
|
| 1474 | + |
|
| 1475 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1476 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1477 | + |
|
| 1478 | + // Hook the init action to taxonomy services. |
|
| 1479 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1480 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1481 | + |
|
| 1482 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1483 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1484 | + |
|
| 1485 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1486 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1487 | + |
|
| 1488 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1489 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1490 | + |
|
| 1491 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1492 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1493 | + |
|
| 1494 | + // Register custom allowed redirect hosts. |
|
| 1495 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1496 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1497 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1498 | + |
|
| 1499 | + /* |
|
| 1500 | 1500 | * The old dashboard is replaced with dashboard v2. |
| 1501 | 1501 | * |
| 1502 | 1502 | * The old dashboard service is still loaded because its functions are used. |
@@ -1505,292 +1505,292 @@ discard block |
||
| 1505 | 1505 | * |
| 1506 | 1506 | * @since 3.20.0 |
| 1507 | 1507 | */ |
| 1508 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1509 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1510 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1511 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1512 | - |
|
| 1513 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1514 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1515 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1516 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1517 | - |
|
| 1518 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1519 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1520 | - |
|
| 1521 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1522 | - // Add custom columns. |
|
| 1523 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1524 | - // no explicit entity as it prevents handling of other post types. |
|
| 1525 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1526 | - // Add 4W selection. |
|
| 1527 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1528 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1529 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1530 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1531 | - |
|
| 1532 | - /* |
|
| 1508 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1509 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1510 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1511 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1512 | + |
|
| 1513 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1514 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1515 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1516 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1517 | + |
|
| 1518 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1519 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1520 | + |
|
| 1521 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1522 | + // Add custom columns. |
|
| 1523 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1524 | + // no explicit entity as it prevents handling of other post types. |
|
| 1525 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1526 | + // Add 4W selection. |
|
| 1527 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1528 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1529 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1530 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1531 | + |
|
| 1532 | + /* |
|
| 1533 | 1533 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1534 | 1534 | * |
| 1535 | 1535 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1536 | 1536 | */ |
| 1537 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1538 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1539 | - } |
|
| 1537 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1538 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1539 | + } |
|
| 1540 | 1540 | |
| 1541 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1542 | - // entities. |
|
| 1543 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1541 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1542 | + // entities. |
|
| 1543 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1544 | 1544 | |
| 1545 | - // Filter imported post meta. |
|
| 1546 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1545 | + // Filter imported post meta. |
|
| 1546 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1547 | 1547 | |
| 1548 | - // Notify the import service when an import starts and ends. |
|
| 1549 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1550 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1548 | + // Notify the import service when an import starts and ends. |
|
| 1549 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1550 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1551 | 1551 | |
| 1552 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1553 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1554 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1552 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1553 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1554 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1555 | 1555 | |
| 1556 | - // Hook the menu to the Download Your Data page. |
|
| 1557 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1558 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1559 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1556 | + // Hook the menu to the Download Your Data page. |
|
| 1557 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1558 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1559 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1560 | 1560 | |
| 1561 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1561 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1562 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1563 | 1563 | |
| 1564 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1565 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1566 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1567 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1564 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1565 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1566 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1567 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1568 | 1568 | |
| 1569 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1570 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1569 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1570 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1571 | 1571 | |
| 1572 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1573 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1572 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1573 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1574 | 1574 | |
| 1575 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1576 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1575 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1576 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1577 | 1577 | |
| 1578 | - // Hook the admin_init to the settings page. |
|
| 1579 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1580 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1578 | + // Hook the admin_init to the settings page. |
|
| 1579 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1580 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1581 | 1581 | |
| 1582 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1582 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1583 | 1583 | |
| 1584 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1585 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1586 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1587 | - // Add the functionality only if a flag is set in wp-config.php . |
|
| 1588 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1589 | - } |
|
| 1584 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1585 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1586 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1587 | + // Add the functionality only if a flag is set in wp-config.php . |
|
| 1588 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1589 | + } |
|
| 1590 | 1590 | |
| 1591 | - /* |
|
| 1591 | + /* |
|
| 1592 | 1592 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
| 1593 | 1593 | * |
| 1594 | 1594 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
| 1595 | 1595 | * |
| 1596 | 1596 | * @since 3.20.0 |
| 1597 | 1597 | */ |
| 1598 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1599 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1600 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1601 | - } |
|
| 1602 | - |
|
| 1603 | - // Hook key update. |
|
| 1604 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1605 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1606 | - |
|
| 1607 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1608 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1609 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1610 | - |
|
| 1611 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1612 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1613 | - |
|
| 1614 | - // Hook row actions for the entity type list admin. |
|
| 1615 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1616 | - |
|
| 1617 | - /** Ajax actions. */ |
|
| 1618 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1619 | - |
|
| 1620 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1621 | - // page on WordPress versions before 4.7. |
|
| 1622 | - global $wp_version; |
|
| 1623 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1624 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1625 | - } |
|
| 1626 | - |
|
| 1627 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1628 | - |
|
| 1629 | - /** Adapters. */ |
|
| 1630 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1631 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1632 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1633 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1634 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1635 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1636 | - |
|
| 1637 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1638 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1639 | - |
|
| 1640 | - |
|
| 1641 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1642 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1643 | - |
|
| 1644 | - // Handle the autocomplete request. |
|
| 1645 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1646 | - $this->autocomplete_adapter, |
|
| 1647 | - 'wl_autocomplete', |
|
| 1648 | - ) ); |
|
| 1649 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1650 | - $this->autocomplete_adapter, |
|
| 1651 | - 'wl_autocomplete', |
|
| 1652 | - ) ); |
|
| 1653 | - |
|
| 1654 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1655 | - if ( is_multisite() ) { |
|
| 1656 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1657 | - } |
|
| 1658 | - |
|
| 1659 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1660 | - |
|
| 1661 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1662 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1663 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1664 | - } |
|
| 1665 | - |
|
| 1666 | - /** |
|
| 1667 | - * Register all of the hooks related to the public-facing functionality |
|
| 1668 | - * of the plugin. |
|
| 1669 | - * |
|
| 1670 | - * @since 1.0.0 |
|
| 1671 | - * @access private |
|
| 1672 | - */ |
|
| 1673 | - private function define_public_hooks() { |
|
| 1674 | - |
|
| 1675 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1676 | - |
|
| 1677 | - // Register the entity post type. |
|
| 1678 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1679 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1680 | - |
|
| 1681 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1682 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1683 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1684 | - $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 ); |
|
| 1685 | - $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 ); |
|
| 1686 | - |
|
| 1687 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1688 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1689 | - |
|
| 1690 | - // Hook the content filter service to add entity links. |
|
| 1691 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1692 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1693 | - } |
|
| 1694 | - |
|
| 1695 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1696 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1697 | - |
|
| 1698 | - // Hook the ShareThis service. |
|
| 1699 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1700 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1701 | - |
|
| 1702 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1703 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | - |
|
| 1705 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1706 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1707 | - // to categories. |
|
| 1708 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1709 | - |
|
| 1710 | - /* |
|
| 1598 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1599 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
| 1600 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1601 | + } |
|
| 1602 | + |
|
| 1603 | + // Hook key update. |
|
| 1604 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1605 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1606 | + |
|
| 1607 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1608 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1609 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1610 | + |
|
| 1611 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1612 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1613 | + |
|
| 1614 | + // Hook row actions for the entity type list admin. |
|
| 1615 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1616 | + |
|
| 1617 | + /** Ajax actions. */ |
|
| 1618 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1619 | + |
|
| 1620 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1621 | + // page on WordPress versions before 4.7. |
|
| 1622 | + global $wp_version; |
|
| 1623 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1624 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1625 | + } |
|
| 1626 | + |
|
| 1627 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1628 | + |
|
| 1629 | + /** Adapters. */ |
|
| 1630 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1631 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1632 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1633 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1634 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1635 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1636 | + |
|
| 1637 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1638 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1639 | + |
|
| 1640 | + |
|
| 1641 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1642 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1643 | + |
|
| 1644 | + // Handle the autocomplete request. |
|
| 1645 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1646 | + $this->autocomplete_adapter, |
|
| 1647 | + 'wl_autocomplete', |
|
| 1648 | + ) ); |
|
| 1649 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1650 | + $this->autocomplete_adapter, |
|
| 1651 | + 'wl_autocomplete', |
|
| 1652 | + ) ); |
|
| 1653 | + |
|
| 1654 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1655 | + if ( is_multisite() ) { |
|
| 1656 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1657 | + } |
|
| 1658 | + |
|
| 1659 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1660 | + |
|
| 1661 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1662 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1663 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1664 | + } |
|
| 1665 | + |
|
| 1666 | + /** |
|
| 1667 | + * Register all of the hooks related to the public-facing functionality |
|
| 1668 | + * of the plugin. |
|
| 1669 | + * |
|
| 1670 | + * @since 1.0.0 |
|
| 1671 | + * @access private |
|
| 1672 | + */ |
|
| 1673 | + private function define_public_hooks() { |
|
| 1674 | + |
|
| 1675 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1676 | + |
|
| 1677 | + // Register the entity post type. |
|
| 1678 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1679 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1680 | + |
|
| 1681 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1682 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1683 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1684 | + $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 ); |
|
| 1685 | + $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 ); |
|
| 1686 | + |
|
| 1687 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1688 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1689 | + |
|
| 1690 | + // Hook the content filter service to add entity links. |
|
| 1691 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1692 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1693 | + } |
|
| 1694 | + |
|
| 1695 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1696 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1697 | + |
|
| 1698 | + // Hook the ShareThis service. |
|
| 1699 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1700 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1701 | + |
|
| 1702 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1703 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1704 | + |
|
| 1705 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1706 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1707 | + // to categories. |
|
| 1708 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1709 | + |
|
| 1710 | + /* |
|
| 1711 | 1711 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1712 | 1712 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1713 | 1713 | * order of start time. |
| 1714 | 1714 | */ |
| 1715 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1716 | - |
|
| 1717 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1718 | - |
|
| 1719 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1720 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1721 | - |
|
| 1722 | - // Analytics Script Frontend. |
|
| 1723 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1724 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1725 | - } |
|
| 1726 | - |
|
| 1727 | - } |
|
| 1728 | - |
|
| 1729 | - /** |
|
| 1730 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1731 | - * |
|
| 1732 | - * @since 1.0.0 |
|
| 1733 | - */ |
|
| 1734 | - public function run() { |
|
| 1735 | - $this->loader->run(); |
|
| 1736 | - } |
|
| 1737 | - |
|
| 1738 | - /** |
|
| 1739 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1740 | - * WordPress and to define internationalization functionality. |
|
| 1741 | - * |
|
| 1742 | - * @since 1.0.0 |
|
| 1743 | - * @return string The name of the plugin. |
|
| 1744 | - */ |
|
| 1745 | - public function get_plugin_name() { |
|
| 1746 | - return $this->plugin_name; |
|
| 1747 | - } |
|
| 1748 | - |
|
| 1749 | - /** |
|
| 1750 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1751 | - * |
|
| 1752 | - * @since 1.0.0 |
|
| 1753 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1754 | - */ |
|
| 1755 | - public function get_loader() { |
|
| 1756 | - return $this->loader; |
|
| 1757 | - } |
|
| 1758 | - |
|
| 1759 | - /** |
|
| 1760 | - * Retrieve the version number of the plugin. |
|
| 1761 | - * |
|
| 1762 | - * @since 1.0.0 |
|
| 1763 | - * @return string The version number of the plugin. |
|
| 1764 | - */ |
|
| 1765 | - public function get_version() { |
|
| 1766 | - return $this->version; |
|
| 1767 | - } |
|
| 1768 | - |
|
| 1769 | - /** |
|
| 1770 | - * Load dependencies for WP-CLI. |
|
| 1771 | - * |
|
| 1772 | - * @since 3.18.0 |
|
| 1773 | - * @throws Exception |
|
| 1774 | - */ |
|
| 1775 | - private function load_cli_dependencies() { |
|
| 1776 | - |
|
| 1777 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1778 | - |
|
| 1779 | - $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 ); |
|
| 1780 | - |
|
| 1781 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1782 | - |
|
| 1783 | - } |
|
| 1784 | - |
|
| 1785 | - /** |
|
| 1786 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1787 | - * |
|
| 1788 | - * @since 3.20.0 |
|
| 1789 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1790 | - */ |
|
| 1791 | - public function get_dashboard_service() { |
|
| 1792 | - |
|
| 1793 | - return $this->dashboard_service; |
|
| 1794 | - } |
|
| 1715 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1716 | + |
|
| 1717 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1718 | + |
|
| 1719 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1720 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1721 | + |
|
| 1722 | + // Analytics Script Frontend. |
|
| 1723 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1724 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1725 | + } |
|
| 1726 | + |
|
| 1727 | + } |
|
| 1728 | + |
|
| 1729 | + /** |
|
| 1730 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1731 | + * |
|
| 1732 | + * @since 1.0.0 |
|
| 1733 | + */ |
|
| 1734 | + public function run() { |
|
| 1735 | + $this->loader->run(); |
|
| 1736 | + } |
|
| 1737 | + |
|
| 1738 | + /** |
|
| 1739 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1740 | + * WordPress and to define internationalization functionality. |
|
| 1741 | + * |
|
| 1742 | + * @since 1.0.0 |
|
| 1743 | + * @return string The name of the plugin. |
|
| 1744 | + */ |
|
| 1745 | + public function get_plugin_name() { |
|
| 1746 | + return $this->plugin_name; |
|
| 1747 | + } |
|
| 1748 | + |
|
| 1749 | + /** |
|
| 1750 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1751 | + * |
|
| 1752 | + * @since 1.0.0 |
|
| 1753 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1754 | + */ |
|
| 1755 | + public function get_loader() { |
|
| 1756 | + return $this->loader; |
|
| 1757 | + } |
|
| 1758 | + |
|
| 1759 | + /** |
|
| 1760 | + * Retrieve the version number of the plugin. |
|
| 1761 | + * |
|
| 1762 | + * @since 1.0.0 |
|
| 1763 | + * @return string The version number of the plugin. |
|
| 1764 | + */ |
|
| 1765 | + public function get_version() { |
|
| 1766 | + return $this->version; |
|
| 1767 | + } |
|
| 1768 | + |
|
| 1769 | + /** |
|
| 1770 | + * Load dependencies for WP-CLI. |
|
| 1771 | + * |
|
| 1772 | + * @since 3.18.0 |
|
| 1773 | + * @throws Exception |
|
| 1774 | + */ |
|
| 1775 | + private function load_cli_dependencies() { |
|
| 1776 | + |
|
| 1777 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1778 | + |
|
| 1779 | + $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 ); |
|
| 1780 | + |
|
| 1781 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1782 | + |
|
| 1783 | + } |
|
| 1784 | + |
|
| 1785 | + /** |
|
| 1786 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
| 1787 | + * |
|
| 1788 | + * @since 3.20.0 |
|
| 1789 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
| 1790 | + */ |
|
| 1791 | + public function get_dashboard_service() { |
|
| 1792 | + |
|
| 1793 | + return $this->dashboard_service; |
|
| 1794 | + } |
|
| 1795 | 1795 | |
| 1796 | 1796 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $this->define_public_hooks(); |
| 750 | 750 | |
| 751 | 751 | // If we're in `WP_CLI` load the related files. |
| 752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 752 | + if (class_exists('WP_CLI')) { |
|
| 753 | 753 | $this->load_cli_dependencies(); |
| 754 | 754 | } |
| 755 | 755 | |
@@ -789,379 +789,379 @@ discard block |
||
| 789 | 789 | * The class responsible for orchestrating the actions and filters of the |
| 790 | 790 | * core plugin. |
| 791 | 791 | */ |
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 792 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 793 | 793 | |
| 794 | 794 | // The class responsible for plugin uninstall. |
| 795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 796 | 796 | |
| 797 | 797 | /** |
| 798 | 798 | * The class responsible for defining internationalization functionality |
| 799 | 799 | * of the plugin. |
| 800 | 800 | */ |
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | 804 | * WordLift's supported languages. |
| 805 | 805 | */ |
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 807 | 807 | |
| 808 | 808 | /** |
| 809 | 809 | * WordLift's supported countries. |
| 810 | 810 | */ |
| 811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
| 811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
| 812 | 812 | |
| 813 | 813 | /** |
| 814 | 814 | * Provide support functions to sanitize data. |
| 815 | 815 | */ |
| 816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 817 | 817 | |
| 818 | 818 | /** Services. */ |
| 819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
| 821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
| 819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 820 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
| 821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 823 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 824 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 826 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
| 827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
| 828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
| 829 | 829 | |
| 830 | 830 | /** |
| 831 | 831 | * The Query builder. |
| 832 | 832 | */ |
| 833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 834 | 834 | |
| 835 | 835 | /** |
| 836 | 836 | * The Schema service. |
| 837 | 837 | */ |
| 838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * The schema:url property service. |
| 842 | 842 | */ |
| 843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** |
| 847 | 847 | * The UI service. |
| 848 | 848 | */ |
| 849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 850 | 850 | |
| 851 | 851 | /** |
| 852 | 852 | * The Thumbnail service. |
| 853 | 853 | */ |
| 854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | 857 | * The Entity Types Taxonomy service. |
| 858 | 858 | */ |
| 859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * The Entity service. |
| 863 | 863 | */ |
| 864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 864 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | // Add the entity rating service. |
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 868 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 869 | 869 | |
| 870 | 870 | /** |
| 871 | 871 | * The User service. |
| 872 | 872 | */ |
| 873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 873 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 874 | 874 | |
| 875 | 875 | /** |
| 876 | 876 | * The Timeline service. |
| 877 | 877 | */ |
| 878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 878 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 879 | 879 | |
| 880 | 880 | /** |
| 881 | 881 | * The Topic Taxonomy service. |
| 882 | 882 | */ |
| 883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 883 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 884 | 884 | |
| 885 | 885 | /** |
| 886 | 886 | * The SPARQL service. |
| 887 | 887 | */ |
| 888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 888 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 889 | 889 | |
| 890 | 890 | /** |
| 891 | 891 | * The WordLift import service. |
| 892 | 892 | */ |
| 893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 894 | 894 | |
| 895 | 895 | /** |
| 896 | 896 | * The WordLift URI service. |
| 897 | 897 | */ |
| 898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 898 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
| 906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
| 907 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
| 908 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
| 909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
| 910 | 910 | |
| 911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 913 | 913 | |
| 914 | 914 | /** |
| 915 | 915 | * Load the converters. |
| 916 | 916 | */ |
| 917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 922 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 923 | 923 | |
| 924 | 924 | /** |
| 925 | 925 | * Load cache-related files. |
| 926 | 926 | */ |
| 927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
| 927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
| 928 | 928 | |
| 929 | 929 | /** |
| 930 | 930 | * Load the content filter. |
| 931 | 931 | */ |
| 932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 933 | 933 | |
| 934 | 934 | /* |
| 935 | 935 | * Load the excerpt helper. |
| 936 | 936 | */ |
| 937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 937 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 938 | 938 | |
| 939 | 939 | /** |
| 940 | 940 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 941 | 941 | * |
| 942 | 942 | * @since 3.8.0 |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 945 | 945 | |
| 946 | 946 | // The Publisher Service and the AJAX adapter. |
| 947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 949 | 949 | |
| 950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 950 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 951 | 951 | |
| 952 | 952 | /** |
| 953 | 953 | * Load the WordLift key validation service. |
| 954 | 954 | */ |
| 955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 956 | 956 | |
| 957 | 957 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 959 | 959 | |
| 960 | 960 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
| 962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
| 963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
| 964 | 964 | |
| 965 | 965 | /** Linked Data. */ |
| 966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 977 | 977 | |
| 978 | 978 | /** Linked Data Rendition. */ |
| 979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
| 980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
| 981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
| 982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
| 983 | 983 | |
| 984 | 984 | /** Services. */ |
| 985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
| 987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
| 985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 986 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
| 987 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
| 988 | 988 | |
| 989 | 989 | /** Adapters. */ |
| 990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
| 995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** Async Tasks. */ |
| 998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
| 999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
| 1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
| 1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
| 1003 | 1003 | |
| 1004 | 1004 | /** Autocomplete. */ |
| 1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php'; |
|
| 1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 1007 | 1007 | |
| 1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 1008 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
| 1009 | 1009 | |
| 1010 | 1010 | /** Analytics */ |
| 1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1011 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 1012 | 1012 | |
| 1013 | 1013 | /** |
| 1014 | 1014 | * The class responsible for defining all actions that occur in the admin area. |
| 1015 | 1015 | */ |
| 1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 1016 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | 1019 | * The class to customize the entity list admin page. |
| 1020 | 1020 | */ |
| 1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 1021 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 1022 | 1022 | |
| 1023 | 1023 | /** |
| 1024 | 1024 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 1025 | 1025 | */ |
| 1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1026 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 1027 | 1027 | |
| 1028 | 1028 | /** |
| 1029 | 1029 | * The Notice service. |
| 1030 | 1030 | */ |
| 1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 1031 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 1032 | 1032 | |
| 1033 | 1033 | /** |
| 1034 | 1034 | * The PrimaShop adapter. |
| 1035 | 1035 | */ |
| 1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | 1039 | * The WordLift Dashboard service. |
| 1040 | 1040 | */ |
| 1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | /** |
| 1044 | 1044 | * The admin 'Install wizard' page. |
| 1045 | 1045 | */ |
| 1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 1046 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | 1049 | * The WordLift entity type list admin page controller. |
| 1050 | 1050 | */ |
| 1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1051 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 1052 | 1052 | |
| 1053 | 1053 | /** |
| 1054 | 1054 | * The WordLift entity type settings admin page controller. |
| 1055 | 1055 | */ |
| 1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 1056 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * The admin 'Download Your Data' page. |
| 1060 | 1060 | */ |
| 1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 1062 | 1062 | |
| 1063 | 1063 | /** |
| 1064 | 1064 | * The admin 'WordLift Settings' page. |
| 1065 | 1065 | */ |
| 1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 1067 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 1068 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
| 1069 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 1073 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 1074 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
| 1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 1082 | 1082 | |
| 1083 | 1083 | /** Admin Pages */ |
| 1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
| 1088 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 1089 | 1089 | |
| 1090 | 1090 | /** |
| 1091 | 1091 | * The class responsible for defining all actions that occur in the public-facing |
| 1092 | 1092 | * side of the site. |
| 1093 | 1093 | */ |
| 1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 1094 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 1095 | 1095 | |
| 1096 | 1096 | /** |
| 1097 | 1097 | * The shortcode abstract class. |
| 1098 | 1098 | */ |
| 1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 1099 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 1100 | 1100 | |
| 1101 | 1101 | /** |
| 1102 | 1102 | * The Timeline shortcode. |
| 1103 | 1103 | */ |
| 1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 1104 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 1105 | 1105 | |
| 1106 | 1106 | /** |
| 1107 | 1107 | * The Navigator shortcode. |
| 1108 | 1108 | */ |
| 1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 1109 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 1110 | 1110 | |
| 1111 | 1111 | /** |
| 1112 | 1112 | * The chord shortcode. |
| 1113 | 1113 | */ |
| 1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 1114 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 1115 | 1115 | |
| 1116 | 1116 | /** |
| 1117 | 1117 | * The geomap shortcode. |
| 1118 | 1118 | */ |
| 1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 1119 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 1120 | 1120 | |
| 1121 | 1121 | /** |
| 1122 | 1122 | * The entity cloud shortcode. |
| 1123 | 1123 | */ |
| 1124 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1124 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 1125 | 1125 | |
| 1126 | 1126 | /** |
| 1127 | 1127 | * The entity glossary shortcode. |
| 1128 | 1128 | */ |
| 1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1129 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
| 1130 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 1131 | 1131 | |
| 1132 | 1132 | /** |
| 1133 | 1133 | * Faceted Search shortcode. |
| 1134 | 1134 | */ |
| 1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1135 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 1136 | 1136 | |
| 1137 | 1137 | /** |
| 1138 | 1138 | * The ShareThis service. |
| 1139 | 1139 | */ |
| 1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 1140 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 1141 | 1141 | |
| 1142 | 1142 | /** |
| 1143 | 1143 | * The SEO service. |
| 1144 | 1144 | */ |
| 1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 1145 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 1146 | 1146 | |
| 1147 | 1147 | /** |
| 1148 | 1148 | * The AMP service. |
| 1149 | 1149 | */ |
| 1150 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 1150 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 1151 | 1151 | |
| 1152 | 1152 | /** Widgets */ |
| 1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1153 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 1154 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1155 | 1155 | |
| 1156 | 1156 | /* |
| 1157 | 1157 | * Schema.org Services. |
| 1158 | 1158 | * |
| 1159 | 1159 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1160 | 1160 | */ |
| 1161 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
| 1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1161 | + if (WL_ALL_ENTITY_TYPES) { |
|
| 1162 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1163 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1164 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1165 | 1165 | new Wordlift_Schemaorg_Sync_Service(); |
| 1166 | 1166 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
| 1167 | 1167 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | |
| 1174 | 1174 | // Instantiate a global logger. |
| 1175 | 1175 | global $wl_logger; |
| 1176 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1176 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1177 | 1177 | |
| 1178 | 1178 | // Load the `wl-api` end-point. |
| 1179 | 1179 | new Wordlift_Http_Api(); |
@@ -1184,13 +1184,13 @@ discard block |
||
| 1184 | 1184 | /** Services. */ |
| 1185 | 1185 | // Create the configuration service. |
| 1186 | 1186 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 1187 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
| 1187 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
| 1188 | 1188 | |
| 1189 | 1189 | // Create an entity type service instance. It'll be later bound to the init action. |
| 1190 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 1190 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 1191 | 1191 | |
| 1192 | 1192 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1193 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 1193 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 1194 | 1194 | |
| 1195 | 1195 | // Create an instance of the UI service. |
| 1196 | 1196 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1199,34 +1199,34 @@ discard block |
||
| 1199 | 1199 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
| 1200 | 1200 | |
| 1201 | 1201 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 1202 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 1202 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 1203 | 1203 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1204 | 1204 | $this->relation_service = new Wordlift_Relation_Service(); |
| 1205 | 1205 | |
| 1206 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
| 1207 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
| 1208 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
| 1209 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
| 1210 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
| 1206 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
| 1207 | + $this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/'); |
|
| 1208 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
| 1209 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
| 1210 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
| 1211 | 1211 | |
| 1212 | 1212 | // Instantiate the JSON-LD service. |
| 1213 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1213 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1214 | 1214 | |
| 1215 | 1215 | /** Linked Data. */ |
| 1216 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
| 1217 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
| 1216 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
| 1217 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
| 1218 | 1218 | |
| 1219 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
| 1219 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
| 1220 | 1220 | |
| 1221 | 1221 | // Create a new instance of the Redirect service. |
| 1222 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_uri_service ); |
|
| 1223 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 1224 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
| 1222 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_uri_service); |
|
| 1223 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 1224 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
| 1225 | 1225 | |
| 1226 | 1226 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1227 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
| 1227 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
| 1228 | 1228 | |
| 1229 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
| 1229 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service); |
|
| 1230 | 1230 | |
| 1231 | 1231 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 1232 | 1232 | |
@@ -1240,68 +1240,68 @@ discard block |
||
| 1240 | 1240 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1241 | 1241 | |
| 1242 | 1242 | // Create an import service instance to hook later to WP's import function. |
| 1243 | - $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() ); |
|
| 1243 | + $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()); |
|
| 1244 | 1244 | |
| 1245 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1245 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1246 | 1246 | |
| 1247 | 1247 | // Create the entity rating service. |
| 1248 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 1248 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 1249 | 1249 | |
| 1250 | 1250 | // Create entity list customization (wp-admin/edit.php). |
| 1251 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 1251 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 1252 | 1252 | |
| 1253 | 1253 | // Create a new instance of the Redirect service. |
| 1254 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
| 1254 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
| 1255 | 1255 | |
| 1256 | 1256 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1257 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
| 1258 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1259 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1257 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
| 1258 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1259 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1260 | 1260 | |
| 1261 | 1261 | $attachment_service = new Wordlift_Attachment_Service(); |
| 1262 | 1262 | |
| 1263 | 1263 | // Instantiate the JSON-LD service. |
| 1264 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 1265 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
| 1266 | - $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 ); |
|
| 1267 | - $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 ); |
|
| 1268 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 1269 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
| 1270 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 1271 | - |
|
| 1272 | - |
|
| 1273 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
| 1274 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
| 1275 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
| 1276 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
| 1277 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
| 1278 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
| 1264 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 1265 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service); |
|
| 1266 | + $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); |
|
| 1267 | + $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); |
|
| 1268 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 1269 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service); |
|
| 1270 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 1271 | + |
|
| 1272 | + |
|
| 1273 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
| 1274 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
| 1275 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
| 1276 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
| 1277 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
| 1278 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
| 1279 | 1279 | |
| 1280 | 1280 | // Initialize the shortcodes. |
| 1281 | 1281 | new Wordlift_Navigator_Shortcode(); |
| 1282 | 1282 | new Wordlift_Chord_Shortcode(); |
| 1283 | 1283 | new Wordlift_Geomap_Shortcode(); |
| 1284 | 1284 | new Wordlift_Timeline_Shortcode(); |
| 1285 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
| 1286 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
| 1285 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
| 1286 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
| 1287 | 1287 | new Wordlift_Faceted_Search_Shortcode(); |
| 1288 | 1288 | |
| 1289 | 1289 | // Initialize the SEO service. |
| 1290 | 1290 | new Wordlift_Seo_Service(); |
| 1291 | 1291 | |
| 1292 | 1292 | // Initialize the AMP service. |
| 1293 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
| 1293 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
| 1294 | 1294 | |
| 1295 | 1295 | /** Services. */ |
| 1296 | 1296 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1297 | 1297 | new Wordlift_Image_Service(); |
| 1298 | 1298 | |
| 1299 | 1299 | /** Adapters. */ |
| 1300 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
| 1301 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
| 1302 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 1303 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
| 1304 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
| 1300 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
| 1301 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
| 1302 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 1303 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service); |
|
| 1304 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
| 1305 | 1305 | |
| 1306 | 1306 | /* |
| 1307 | 1307 | * Exclude our public js from WP-Rocket. |
@@ -1325,8 +1325,8 @@ discard block |
||
| 1325 | 1325 | new Wordlift_Push_References_Async_Task(); |
| 1326 | 1326 | |
| 1327 | 1327 | /** WL Autocomplete. */ |
| 1328 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
| 1329 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
| 1328 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service); |
|
| 1329 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service); |
|
| 1330 | 1330 | |
| 1331 | 1331 | /** WordPress Admin UI. */ |
| 1332 | 1332 | |
@@ -1337,19 +1337,19 @@ discard block |
||
| 1337 | 1337 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1338 | 1338 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1339 | 1339 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1340 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
| 1341 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
| 1340 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
| 1341 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
| 1342 | 1342 | |
| 1343 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 1344 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
| 1345 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 1343 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 1344 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service); |
|
| 1345 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 1346 | 1346 | |
| 1347 | - $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
| 1348 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page ); |
|
| 1347 | + $this->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
| 1348 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page); |
|
| 1349 | 1349 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1350 | 1350 | |
| 1351 | 1351 | // Pages. |
| 1352 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 1352 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 1353 | 1353 | new Wordlift_Entity_Type_Admin_Service(); |
| 1354 | 1354 | |
| 1355 | 1355 | // create an instance of the entity type list admin page controller. |
@@ -1362,23 +1362,23 @@ discard block |
||
| 1362 | 1362 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1363 | 1363 | |
| 1364 | 1364 | /* WordPress Admin. */ |
| 1365 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1366 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1365 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1366 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1367 | 1367 | |
| 1368 | 1368 | // Create an instance of the install wizard. |
| 1369 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
| 1369 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element); |
|
| 1370 | 1370 | |
| 1371 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1371 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1372 | 1372 | |
| 1373 | 1373 | // User Profile. |
| 1374 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1374 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1375 | 1375 | |
| 1376 | 1376 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1377 | 1377 | |
| 1378 | 1378 | // Load the debug service if WP is in debug mode. |
| 1379 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1380 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1381 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1379 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1380 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1381 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | // Remote Image Service. |
@@ -1391,12 +1391,12 @@ discard block |
||
| 1391 | 1391 | * |
| 1392 | 1392 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1393 | 1393 | */ |
| 1394 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1395 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1396 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1394 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
| 1395 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1396 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1397 | 1397 | |
| 1398 | 1398 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1399 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1399 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1400 | 1400 | |
| 1401 | 1401 | /* |
| 1402 | 1402 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1405,8 +1405,8 @@ discard block |
||
| 1405 | 1405 | * |
| 1406 | 1406 | * @since 3.20.0 |
| 1407 | 1407 | */ |
| 1408 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1408 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1409 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1410 | 1410 | |
| 1411 | 1411 | /* |
| 1412 | 1412 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1415,15 +1415,15 @@ discard block |
||
| 1415 | 1415 | * |
| 1416 | 1416 | * @since 3.20.0 |
| 1417 | 1417 | */ |
| 1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1419 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
| 1418 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
| 1419 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
| 1420 | 1420 | |
| 1421 | 1421 | /* |
| 1422 | 1422 | * Load dependencies for the front-end. |
| 1423 | 1423 | * |
| 1424 | 1424 | * @since 3.20.0 |
| 1425 | 1425 | */ |
| 1426 | - if ( ! is_admin() ) { |
|
| 1426 | + if ( ! is_admin()) { |
|
| 1427 | 1427 | /* |
| 1428 | 1428 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1429 | 1429 | * |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | * |
| 1432 | 1432 | * @since 3.20.0 |
| 1433 | 1433 | */ |
| 1434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1435 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
| 1434 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1435 | + new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | } |
@@ -1449,9 +1449,9 @@ discard block |
||
| 1449 | 1449 | private function set_locale() { |
| 1450 | 1450 | |
| 1451 | 1451 | $plugin_i18n = new Wordlift_i18n(); |
| 1452 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1452 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1453 | 1453 | |
| 1454 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1454 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1455 | 1455 | |
| 1456 | 1456 | } |
| 1457 | 1457 | |
@@ -1472,29 +1472,29 @@ discard block |
||
| 1472 | 1472 | $this->user_service |
| 1473 | 1473 | ); |
| 1474 | 1474 | |
| 1475 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1476 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1475 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1476 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1477 | 1477 | |
| 1478 | 1478 | // Hook the init action to taxonomy services. |
| 1479 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1480 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1479 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1480 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
| 1481 | 1481 | |
| 1482 | 1482 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1483 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1483 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1484 | 1484 | |
| 1485 | 1485 | // Hook the added_post_meta action to the Thumbnail service. |
| 1486 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1486 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1487 | 1487 | |
| 1488 | 1488 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1489 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1489 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1490 | 1490 | |
| 1491 | 1491 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1492 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1492 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1493 | 1493 | |
| 1494 | 1494 | // Register custom allowed redirect hosts. |
| 1495 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1495 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1496 | 1496 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1497 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1497 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1498 | 1498 | |
| 1499 | 1499 | /* |
| 1500 | 1500 | * The old dashboard is replaced with dashboard v2. |
@@ -1512,80 +1512,80 @@ discard block |
||
| 1512 | 1512 | |
| 1513 | 1513 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1514 | 1514 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1515 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1516 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1515 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1516 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
| 1517 | 1517 | |
| 1518 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1519 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1518 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1519 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1520 | 1520 | |
| 1521 | 1521 | // Entity listing customization (wp-admin/edit.php) |
| 1522 | 1522 | // Add custom columns. |
| 1523 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1523 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1524 | 1524 | // no explicit entity as it prevents handling of other post types. |
| 1525 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1525 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1526 | 1526 | // Add 4W selection. |
| 1527 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1528 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1529 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
| 1530 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
| 1527 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1528 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1529 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
| 1530 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
| 1531 | 1531 | |
| 1532 | 1532 | /* |
| 1533 | 1533 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1534 | 1534 | * |
| 1535 | 1535 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1536 | 1536 | */ |
| 1537 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
| 1538 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1537 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
| 1538 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1542 | 1542 | // entities. |
| 1543 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1543 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1544 | 1544 | |
| 1545 | 1545 | // Filter imported post meta. |
| 1546 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1546 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1547 | 1547 | |
| 1548 | 1548 | // Notify the import service when an import starts and ends. |
| 1549 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1550 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1549 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1550 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1551 | 1551 | |
| 1552 | 1552 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1553 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1554 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
| 1553 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1554 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
| 1555 | 1555 | |
| 1556 | 1556 | // Hook the menu to the Download Your Data page. |
| 1557 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1558 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1559 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1557 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1558 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1559 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1560 | 1560 | |
| 1561 | 1561 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1562 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1562 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1563 | 1563 | |
| 1564 | 1564 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1565 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1566 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1567 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1565 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1566 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1567 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1568 | 1568 | |
| 1569 | 1569 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1570 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1570 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1571 | 1571 | |
| 1572 | 1572 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1573 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
| 1573 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
| 1574 | 1574 | |
| 1575 | 1575 | // Hook the `admin_init` function to the Admin Setup. |
| 1576 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1576 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1577 | 1577 | |
| 1578 | 1578 | // Hook the admin_init to the settings page. |
| 1579 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1580 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
| 1579 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1580 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
| 1581 | 1581 | |
| 1582 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
| 1582 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
| 1583 | 1583 | |
| 1584 | 1584 | // Hook the menu creation on the general wordlift menu creation. |
| 1585 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1586 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
| 1585 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1586 | + if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) { |
|
| 1587 | 1587 | // Add the functionality only if a flag is set in wp-config.php . |
| 1588 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
| 1588 | + $this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2); |
|
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | /* |
@@ -1595,72 +1595,72 @@ discard block |
||
| 1595 | 1595 | * |
| 1596 | 1596 | * @since 3.20.0 |
| 1597 | 1597 | */ |
| 1598 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
| 1598 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
| 1599 | 1599 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
| 1600 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
| 1600 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | // Hook key update. |
| 1604 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1605 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1604 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1605 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1606 | 1606 | |
| 1607 | 1607 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1608 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1609 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1608 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1609 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1); |
|
| 1610 | 1610 | |
| 1611 | 1611 | // Hook the AJAX `wl_publisher` action name. |
| 1612 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1612 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1613 | 1613 | |
| 1614 | 1614 | // Hook row actions for the entity type list admin. |
| 1615 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1615 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1616 | 1616 | |
| 1617 | 1617 | /** Ajax actions. */ |
| 1618 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
| 1618 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
| 1619 | 1619 | |
| 1620 | 1620 | // Hook capabilities manipulation to allow access to entity type admin |
| 1621 | 1621 | // page on WordPress versions before 4.7. |
| 1622 | 1622 | global $wp_version; |
| 1623 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1624 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1623 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1624 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1627 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1628 | 1628 | |
| 1629 | 1629 | /** Adapters. */ |
| 1630 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1631 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
| 1632 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
| 1633 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
| 1634 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
| 1635 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
| 1630 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1631 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit'); |
|
| 1632 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts'); |
|
| 1633 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel'); |
|
| 1634 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning'); |
|
| 1635 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
| 1636 | 1636 | |
| 1637 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
| 1638 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
| 1637 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
| 1638 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
| 1639 | 1639 | |
| 1640 | 1640 | |
| 1641 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
| 1642 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
| 1641 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
| 1642 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
| 1643 | 1643 | |
| 1644 | 1644 | // Handle the autocomplete request. |
| 1645 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
| 1645 | + add_action('wp_ajax_wl_autocomplete', array( |
|
| 1646 | 1646 | $this->autocomplete_adapter, |
| 1647 | 1647 | 'wl_autocomplete', |
| 1648 | - ) ); |
|
| 1649 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1648 | + )); |
|
| 1649 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
| 1650 | 1650 | $this->autocomplete_adapter, |
| 1651 | 1651 | 'wl_autocomplete', |
| 1652 | - ) ); |
|
| 1652 | + )); |
|
| 1653 | 1653 | |
| 1654 | 1654 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1655 | - if ( is_multisite() ) { |
|
| 1656 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1655 | + if (is_multisite()) { |
|
| 1656 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
| 1659 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
| 1660 | 1660 | |
| 1661 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1662 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1663 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
| 1661 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1662 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1663 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | /** |
@@ -1672,56 +1672,56 @@ discard block |
||
| 1672 | 1672 | */ |
| 1673 | 1673 | private function define_public_hooks() { |
| 1674 | 1674 | |
| 1675 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1675 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1676 | 1676 | |
| 1677 | 1677 | // Register the entity post type. |
| 1678 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1679 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
| 1678 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1679 | + $this->loader->add_action('init', $this->install_service, 'install'); |
|
| 1680 | 1680 | |
| 1681 | 1681 | // Bind the link generation and handling hooks to the entity link service. |
| 1682 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1683 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1684 | - $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 ); |
|
| 1685 | - $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 ); |
|
| 1682 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1683 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1684 | + $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); |
|
| 1685 | + $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); |
|
| 1686 | 1686 | |
| 1687 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1688 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1687 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1688 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1689 | 1689 | |
| 1690 | 1690 | // Hook the content filter service to add entity links. |
| 1691 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1692 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1691 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1692 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1696 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1696 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1697 | 1697 | |
| 1698 | 1698 | // Hook the ShareThis service. |
| 1699 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1700 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1699 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1700 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1701 | 1701 | |
| 1702 | 1702 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1703 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1703 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1704 | 1704 | |
| 1705 | 1705 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1706 | 1706 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1707 | 1707 | // to categories. |
| 1708 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1708 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1709 | 1709 | |
| 1710 | 1710 | /* |
| 1711 | 1711 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1712 | 1712 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1713 | 1713 | * order of start time. |
| 1714 | 1714 | */ |
| 1715 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1715 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1716 | 1716 | |
| 1717 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1717 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1718 | 1718 | |
| 1719 | 1719 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1720 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
| 1720 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
| 1721 | 1721 | |
| 1722 | 1722 | // Analytics Script Frontend. |
| 1723 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
| 1724 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1723 | + if ($this->configuration_service->is_analytics_enable()) { |
|
| 1724 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | 1727 | } |
@@ -1774,11 +1774,11 @@ discard block |
||
| 1774 | 1774 | */ |
| 1775 | 1775 | private function load_cli_dependencies() { |
| 1776 | 1776 | |
| 1777 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1777 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
| 1778 | 1778 | |
| 1779 | - $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 ); |
|
| 1779 | + $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); |
|
| 1780 | 1780 | |
| 1781 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
| 1781 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
| 1782 | 1782 | |
| 1783 | 1783 | } |
| 1784 | 1784 | |
@@ -16,56 +16,56 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Admin_Search_Rankings_Page extends Wordlift_Admin_Page { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * We decide whether to load this page from {@link Wordlift} if the user subscription is editorial or business. |
|
| 21 | - * |
|
| 22 | - * @since 3.20.0 |
|
| 23 | - */ |
|
| 24 | - public function __construct() { |
|
| 25 | - // Do nothing. We need this because the parent class calls the `admin_menu` hook. |
|
| 26 | - } |
|
| 19 | + /** |
|
| 20 | + * We decide whether to load this page from {@link Wordlift} if the user subscription is editorial or business. |
|
| 21 | + * |
|
| 22 | + * @since 3.20.0 |
|
| 23 | + */ |
|
| 24 | + public function __construct() { |
|
| 25 | + // Do nothing. We need this because the parent class calls the `admin_menu` hook. |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @inheritdoc |
|
| 30 | - */ |
|
| 31 | - function get_page_title() { |
|
| 28 | + /** |
|
| 29 | + * @inheritdoc |
|
| 30 | + */ |
|
| 31 | + function get_page_title() { |
|
| 32 | 32 | |
| 33 | - return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 34 | - } |
|
| 33 | + return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @inheritdoc |
|
| 38 | - */ |
|
| 39 | - function get_menu_title() { |
|
| 36 | + /** |
|
| 37 | + * @inheritdoc |
|
| 38 | + */ |
|
| 39 | + function get_menu_title() { |
|
| 40 | 40 | |
| 41 | - return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 42 | - } |
|
| 41 | + return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @inheritdoc |
|
| 46 | - */ |
|
| 47 | - function get_menu_slug() { |
|
| 44 | + /** |
|
| 45 | + * @inheritdoc |
|
| 46 | + */ |
|
| 47 | + function get_menu_slug() { |
|
| 48 | 48 | |
| 49 | - return 'wl_search_rankings'; |
|
| 50 | - } |
|
| 49 | + return 'wl_search_rankings'; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @inheritdoc |
|
| 54 | - */ |
|
| 55 | - function get_partial_name() { |
|
| 52 | + /** |
|
| 53 | + * @inheritdoc |
|
| 54 | + */ |
|
| 55 | + function get_partial_name() { |
|
| 56 | 56 | |
| 57 | - return 'wordlift-admin-search-rankings.php'; |
|
| 58 | - } |
|
| 57 | + return 'wordlift-admin-search-rankings.php'; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @inheritdoc |
|
| 62 | - */ |
|
| 63 | - public function enqueue_scripts() { |
|
| 64 | - parent::enqueue_scripts(); |
|
| 60 | + /** |
|
| 61 | + * @inheritdoc |
|
| 62 | + */ |
|
| 63 | + public function enqueue_scripts() { |
|
| 64 | + parent::enqueue_scripts(); |
|
| 65 | 65 | |
| 66 | - wp_enqueue_script( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.js', array( 'wp-util' ), Wordlift::get_instance()->get_version() ); |
|
| 67 | - wp_enqueue_style( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.css', array(), Wordlift::get_instance()->get_version() ); |
|
| 66 | + wp_enqueue_script( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.js', array( 'wp-util' ), Wordlift::get_instance()->get_version() ); |
|
| 67 | + wp_enqueue_style( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.css', array(), Wordlift::get_instance()->get_version() ); |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function get_page_title() { |
| 32 | 32 | |
| 33 | - return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 33 | + return _x('Search Rankings', 'Search Rankings', 'wordlift'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function get_menu_title() { |
| 40 | 40 | |
| 41 | - return _x( 'Search Rankings', 'Search Rankings', 'wordlift' ); |
|
| 41 | + return _x('Search Rankings', 'Search Rankings', 'wordlift'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | public function enqueue_scripts() { |
| 64 | 64 | parent::enqueue_scripts(); |
| 65 | 65 | |
| 66 | - wp_enqueue_script( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.js', array( 'wp-util' ), Wordlift::get_instance()->get_version() ); |
|
| 67 | - wp_enqueue_style( 'wl-admin-search-rankings', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/search-rankings.css', array(), Wordlift::get_instance()->get_version() ); |
|
| 66 | + wp_enqueue_script('wl-admin-search-rankings', plugin_dir_url(dirname(__FILE__)).'admin/js/1/search-rankings.js', array('wp-util'), Wordlift::get_instance()->get_version()); |
|
| 67 | + wp_enqueue_style('wl-admin-search-rankings', plugin_dir_url(dirname(__FILE__)).'admin/js/1/search-rankings.css', array(), Wordlift::get_instance()->get_version()); |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
@@ -18,29 +18,29 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
| 20 | 20 | |
| 21 | - // Get the entity service instance. |
|
| 22 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 21 | + // Get the entity service instance. |
|
| 22 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
| 23 | 23 | |
| 24 | - // Show the View Linked Data button only for entities. |
|
| 25 | - // |
|
| 26 | - // See https://github.com/insideout10/wordlift-plugin/issues/668. |
|
| 27 | - if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | - && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 24 | + // Show the View Linked Data button only for entities. |
|
| 25 | + // |
|
| 26 | + // See https://github.com/insideout10/wordlift-plugin/issues/668. |
|
| 27 | + if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | + && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 29 | 29 | |
| 30 | - $lod_view_href = esc_attr( $uri ); |
|
| 31 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 32 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 33 | - "</a></span>\n"; |
|
| 30 | + $lod_view_href = esc_attr( $uri ); |
|
| 31 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 32 | + esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 33 | + "</a></span>\n"; |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 38 | - urlencode( get_permalink( $post_id ) ) . |
|
| 39 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 40 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 41 | - "</a></span>\n"; |
|
| 37 | + $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 38 | + urlencode( get_permalink( $post_id ) ) . |
|
| 39 | + "' class='button button-small wl-button' target='_blank'>" . |
|
| 40 | + esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 41 | + "</a></span>\n"; |
|
| 42 | 42 | |
| 43 | - return $html; |
|
| 43 | + return $html; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return string The enhanced html. |
| 18 | 18 | */ |
| 19 | -function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
|
| 19 | +function wl_admin_permalink_html($html, $post_id, $new_title, $new_slug) { |
|
| 20 | 20 | |
| 21 | 21 | // Get the entity service instance. |
| 22 | 22 | $entity_service = Wordlift_Entity_Service::get_instance(); |
@@ -24,23 +24,23 @@ discard block |
||
| 24 | 24 | // Show the View Linked Data button only for entities. |
| 25 | 25 | // |
| 26 | 26 | // See https://github.com/insideout10/wordlift-plugin/issues/668. |
| 27 | - if ( 'publish' === get_post_status( $post_id ) |
|
| 28 | - && $uri = $entity_service->get_uri( $post_id ) ) { |
|
| 27 | + if ('publish' === get_post_status($post_id) |
|
| 28 | + && $uri = $entity_service->get_uri($post_id)) { |
|
| 29 | 29 | |
| 30 | - $lod_view_href = esc_attr( $uri ); |
|
| 31 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 32 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 30 | + $lod_view_href = esc_attr($uri); |
|
| 31 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>". |
|
| 32 | + esc_html__('View Linked Data', 'wordlift'). |
|
| 33 | 33 | "</a></span>\n"; |
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 38 | - urlencode( get_permalink( $post_id ) ) . |
|
| 39 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 40 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 37 | + $html .= "<span id='view-post-btn'><a href='".WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL. |
|
| 38 | + urlencode(get_permalink($post_id)). |
|
| 39 | + "' class='button button-small wl-button' target='_blank'>". |
|
| 40 | + esc_html__('Test Google Rich Snippets', 'wordlift'). |
|
| 41 | 41 | "</a></span>\n"; |
| 42 | 42 | |
| 43 | 43 | return $html; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
|
| 46 | +add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4); |
|
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <div class="wrap"> |
| 2 | - <h1><?php echo esc_html_x( 'Search Rankings', 'Page title', 'Wordlift' ); ?></h1> |
|
| 2 | + <h1><?php echo esc_html_x('Search Rankings', 'Page title', 'Wordlift'); ?></h1> |
|
| 3 | 3 | |
| 4 | 4 | <div id="treemap"></div> |
| 5 | 5 | |
| 6 | - <div class="pull-right">powered by <a target="_blank" href="https://www.woorank.com/"><img style="height: 18px; vertical-align: top;" src="<?php echo plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'images/logo-woorank.svg'; ?>"></a></div> |
|
| 6 | + <div class="pull-right">powered by <a target="_blank" href="https://www.woorank.com/"><img style="height: 18px; vertical-align: top;" src="<?php echo plugin_dir_url(dirname(dirname(__FILE__))).'images/logo-woorank.svg'; ?>"></a></div> |
|
| 7 | 7 | </div> |
| 8 | 8 | \ No newline at end of file |