@@ -7,310 +7,310 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_Query_Builder { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * The INSERT statement template. |
|
| 12 | - * |
|
| 13 | - * @since 3.1.7 |
|
| 14 | - */ |
|
| 15 | - const INSERT = 'INSERT DATA { %s };'; |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * The DELETE statement template (it repeats the statements in the WHERE clause. |
|
| 19 | - * |
|
| 20 | - * @since 3.1.7 |
|
| 21 | - */ |
|
| 22 | - const DELETE = 'DELETE { %s } WHERE { %1$s };'; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Tell the statement function to guess the object type (URI, value or parameter). |
|
| 26 | - * |
|
| 27 | - * @since 3.1.7 |
|
| 28 | - */ |
|
| 29 | - const OBJECT_AUTO = - 1; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Tell the statement function that the object is a URI. |
|
| 33 | - * |
|
| 34 | - * @since 3.1.7 |
|
| 35 | - */ |
|
| 36 | - const OBJECT_URI = 0; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Tell the statement function that the object is a value. |
|
| 40 | - * |
|
| 41 | - * @since 3.1.7 |
|
| 42 | - */ |
|
| 43 | - const OBJECT_VALUE = 1; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Tell the statement function that the object is a parameter. |
|
| 47 | - * |
|
| 48 | - * @since 3.1.7 |
|
| 49 | - */ |
|
| 50 | - const OBJECT_PARAMETER = 2; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * The RDFS type. |
|
| 54 | - * |
|
| 55 | - * @since 3.1.7 |
|
| 56 | - */ |
|
| 57 | - const RDFS_TYPE_URI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * The schema.org/Person type. |
|
| 61 | - * |
|
| 62 | - * @since 3.1.7 |
|
| 63 | - */ |
|
| 64 | - const SCHEMA_PERSON_URI = 'http://schema.org/Person'; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * The schema.org given name predicate. |
|
| 68 | - * |
|
| 69 | - * @since 3.1.7 |
|
| 70 | - */ |
|
| 71 | - const SCHEMA_GIVEN_NAME_URI = 'http://schema.org/givenName'; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * The schema.org family name predicate. |
|
| 75 | - * |
|
| 76 | - * @since 3.1.7 |
|
| 77 | - */ |
|
| 78 | - const SCHEMA_FAMILY_NAME_URI = 'http://schema.org/familyName'; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * The schema.org url predicate. |
|
| 82 | - * |
|
| 83 | - * @since 3.1.7 |
|
| 84 | - */ |
|
| 85 | - const SCHEMA_URL_URI = 'http://schema.org/url'; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * @since 3.14.0 |
|
| 89 | - */ |
|
| 90 | - const SCHEMA_IMAGE_URI = 'http://schema.org/image'; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * The location created predicate. |
|
| 94 | - * |
|
| 95 | - * @since 3.14.0 |
|
| 96 | - */ |
|
| 97 | - const SCHEMA_LOCATION_CREATED_URI = 'http://schema.org/locationCreated'; |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * @since 3.14.0 |
|
| 101 | - */ |
|
| 102 | - const SCHEMA_AUTHOR_URI = 'http://schema.org/author'; |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @since 3.14.0 |
|
| 106 | - */ |
|
| 107 | - const SCHEMA_INTERACTION_COUNT_URI = 'http://schema.org/interactionCount'; |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @since 3.14.0 |
|
| 111 | - */ |
|
| 112 | - const DCTERMS_SUBJECT_URI = 'http://purl.org/dc/terms/subject'; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @since 3.14.0 |
|
| 116 | - */ |
|
| 117 | - const DCTERMS_REFERENCES_URI = 'http://purl.org/dc/terms/references'; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * The RDF label. |
|
| 121 | - * |
|
| 122 | - * @since 3.1.7 |
|
| 123 | - */ |
|
| 124 | - const RDFS_LABEL_URI = 'http://www.w3.org/2000/01/rdf-schema#label'; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Hold the template (INSERT or DELETE). |
|
| 128 | - * |
|
| 129 | - * @since 3.1.7 |
|
| 130 | - * @access private |
|
| 131 | - * @var string $template The query template. |
|
| 132 | - */ |
|
| 133 | - private $template; |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * An array of statements (in the form of subject, predicate, object). |
|
| 137 | - * |
|
| 138 | - * @since 3.1.7 |
|
| 139 | - * @access private |
|
| 140 | - * @var array $statements An array of statements. |
|
| 141 | - */ |
|
| 142 | - private $statements = array(); |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * Create a new instance of the Query builder (compatible with PHP 5.3). |
|
| 146 | - * |
|
| 147 | - * @since 3.1.7 |
|
| 148 | - * @return Wordlift_Query_Builder A new instance of the Query builder. |
|
| 149 | - */ |
|
| 150 | - public static function new_instance() { |
|
| 151 | - |
|
| 152 | - return new Wordlift_Query_Builder(); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Set the query to INSERT. |
|
| 157 | - * |
|
| 158 | - * @since 3.1.7 |
|
| 159 | - * @return Wordlift_Query_Builder The Query builder. |
|
| 160 | - */ |
|
| 161 | - public function insert() { |
|
| 162 | - |
|
| 163 | - $this->template = self::INSERT; |
|
| 164 | - |
|
| 165 | - return $this; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Set the query to DELETE. |
|
| 170 | - * |
|
| 171 | - * @since 3.1.7 |
|
| 172 | - * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 173 | - */ |
|
| 174 | - public function delete() { |
|
| 175 | - |
|
| 176 | - $this->template = self::DELETE; |
|
| 177 | - |
|
| 178 | - return $this; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Set the query to SELECT. |
|
| 183 | - * |
|
| 184 | - * @since 3.12.2 |
|
| 185 | - * |
|
| 186 | - * @param string $props The list of properties to read. |
|
| 187 | - * |
|
| 188 | - * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 189 | - */ |
|
| 190 | - public function select( $props = '*' ) { |
|
| 191 | - |
|
| 192 | - $this->template = "SELECT $props WHERE { %s }"; |
|
| 193 | - |
|
| 194 | - return $this; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Add a statement. |
|
| 199 | - * |
|
| 200 | - * @since 3.1.7 |
|
| 201 | - * |
|
| 202 | - * @param string $subject The subject of the statement (must be a URI). |
|
| 203 | - * @param string $predicate The predicate (must be a URI). |
|
| 204 | - * @param string $object The object, can be a URI or a value. |
|
| 205 | - * @param int $object_type The object type, either a {@link OBJECT_URI} or a value {@link OBJECT_VALUE}. If set to {@link OBJECT_AUTO}, the Query builder will try to guess. |
|
| 206 | - * @param string|null $data_type The data type (or null). |
|
| 207 | - * @param string|null $language The language code (or null). |
|
| 208 | - * |
|
| 209 | - * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 210 | - */ |
|
| 211 | - public function statement( $subject, $predicate, $object, $object_type = self::OBJECT_AUTO, $data_type = null, $language = null ) { |
|
| 212 | - |
|
| 213 | - // If no value has been provided, we don't set any statement. |
|
| 214 | - if ( empty( $object ) ) { |
|
| 215 | - return $this; |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - // Guess the subject type. |
|
| 219 | - $subject_value_type = $this->guess_subject_type( $subject ); |
|
| 220 | - |
|
| 221 | - // Get the object type if set, otherwise try to guess it. |
|
| 222 | - $object_value_type = ( self::OBJECT_AUTO === $object_type ? $this->guess_object_type( $predicate, $object ) : $object_type ); |
|
| 223 | - |
|
| 224 | - // Prepare the statement template. |
|
| 225 | - $template = |
|
| 226 | - // Subject as a parameter, no `<`, `>`. |
|
| 227 | - ( self::OBJECT_PARAMETER === $subject_value_type ? '%1$s' : '<%1$s>' ) . |
|
| 228 | - // Predicate. |
|
| 229 | - ' <%2$s> ' . |
|
| 230 | - // Object. |
|
| 231 | - ( self::OBJECT_URI === $object_value_type ? '<%3$s>' : |
|
| 232 | - ( self::OBJECT_PARAMETER === $object_value_type ? '%3$s' : |
|
| 233 | - // self::OBJECT_VALUE === $object_value_type |
|
| 234 | - '"%3$s"' . ( isset( $data_type ) ? '^^%4$s' : '' ) . ( isset( $language ) ? '@%5$s' : '' ) ) ); |
|
| 235 | - |
|
| 236 | - // Escape the subject, predicate and object. |
|
| 237 | - $escaped_subject = Wordlift_Sparql_Service::escape_uri( $subject ); |
|
| 238 | - $escaped_predicate = Wordlift_Sparql_Service::escape_uri( $predicate ); |
|
| 239 | - $escaped_object = ( self::OBJECT_URI === $object_value_type ? Wordlift_Sparql_Service::escape_uri( $object ) : Wordlift_Sparql_Service::escape( $object ) ); |
|
| 240 | - |
|
| 241 | - // Prepare the statement and add it to the list of statements. |
|
| 242 | - $this->statements[] = sprintf( $template, $escaped_subject, $escaped_predicate, $escaped_object, $data_type, $language ); |
|
| 243 | - |
|
| 244 | - return $this; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * Build the query. |
|
| 249 | - * |
|
| 250 | - * @since 3.1.7 |
|
| 251 | - * @return string The query string. |
|
| 252 | - */ |
|
| 253 | - public function build() { |
|
| 254 | - |
|
| 255 | - // If there are no statements return an empty string. |
|
| 256 | - if ( 0 === count( $this->statements ) ) { |
|
| 257 | - return ''; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - return sprintf( $this->template, implode( ' . ', $this->statements ) ) . "\n"; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Guess the statement object type. |
|
| 265 | - * |
|
| 266 | - * @since 3.1.7 |
|
| 267 | - * |
|
| 268 | - * @param string $predicate The predicate. |
|
| 269 | - * @param string $object The object. |
|
| 270 | - * |
|
| 271 | - * @return int {@link Wordlift_Query_Builder::OBJECT_URI} if the Query builder thinks the object must be an URI, {@link Wordlift_Query_Builder::OBJECT_VALUE} otherwise. |
|
| 272 | - */ |
|
| 273 | - private function guess_object_type( $predicate, $object ) { |
|
| 274 | - |
|
| 275 | - // If the object starts with a question mark, it's a parameter. |
|
| 276 | - if ( 0 === strpos( $object, '?' ) ) { |
|
| 277 | - return self::OBJECT_PARAMETER; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - // Guess based on the predicate. |
|
| 281 | - switch ( $predicate ) { |
|
| 282 | - |
|
| 283 | - case self::DCTERMS_REFERENCES_URI: |
|
| 284 | - case self::DCTERMS_SUBJECT_URI: |
|
| 285 | - case self::RDFS_TYPE_URI: |
|
| 286 | - case self::SCHEMA_AUTHOR_URI: |
|
| 287 | - case self::SCHEMA_LOCATION_CREATED_URI: |
|
| 288 | - case self::SCHEMA_URL_URI: |
|
| 289 | - case self::SCHEMA_IMAGE_URI: |
|
| 290 | - return self::OBJECT_URI; |
|
| 291 | - |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - return self::OBJECT_VALUE; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * Guess the subject type. |
|
| 299 | - * |
|
| 300 | - * @since 3.12.3 |
|
| 301 | - * |
|
| 302 | - * @param string $subject The subject string. |
|
| 303 | - * |
|
| 304 | - * @return int {@link Wordlift_Query_Builder::OBJECT_PARAMETER} if the Query builder thinks the subject is a parameter (starts with ?), otherwise {@link Wordlift_Query_Builder::OBJECT_URI}. |
|
| 305 | - */ |
|
| 306 | - private function guess_subject_type( $subject ) { |
|
| 307 | - |
|
| 308 | - // If the object starts with a question mark, it's a parameter. |
|
| 309 | - if ( 0 === strpos( $subject, '?' ) ) { |
|
| 310 | - return self::OBJECT_PARAMETER; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - return self::OBJECT_URI; |
|
| 314 | - } |
|
| 10 | + /** |
|
| 11 | + * The INSERT statement template. |
|
| 12 | + * |
|
| 13 | + * @since 3.1.7 |
|
| 14 | + */ |
|
| 15 | + const INSERT = 'INSERT DATA { %s };'; |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * The DELETE statement template (it repeats the statements in the WHERE clause. |
|
| 19 | + * |
|
| 20 | + * @since 3.1.7 |
|
| 21 | + */ |
|
| 22 | + const DELETE = 'DELETE { %s } WHERE { %1$s };'; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Tell the statement function to guess the object type (URI, value or parameter). |
|
| 26 | + * |
|
| 27 | + * @since 3.1.7 |
|
| 28 | + */ |
|
| 29 | + const OBJECT_AUTO = - 1; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Tell the statement function that the object is a URI. |
|
| 33 | + * |
|
| 34 | + * @since 3.1.7 |
|
| 35 | + */ |
|
| 36 | + const OBJECT_URI = 0; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Tell the statement function that the object is a value. |
|
| 40 | + * |
|
| 41 | + * @since 3.1.7 |
|
| 42 | + */ |
|
| 43 | + const OBJECT_VALUE = 1; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Tell the statement function that the object is a parameter. |
|
| 47 | + * |
|
| 48 | + * @since 3.1.7 |
|
| 49 | + */ |
|
| 50 | + const OBJECT_PARAMETER = 2; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * The RDFS type. |
|
| 54 | + * |
|
| 55 | + * @since 3.1.7 |
|
| 56 | + */ |
|
| 57 | + const RDFS_TYPE_URI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * The schema.org/Person type. |
|
| 61 | + * |
|
| 62 | + * @since 3.1.7 |
|
| 63 | + */ |
|
| 64 | + const SCHEMA_PERSON_URI = 'http://schema.org/Person'; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * The schema.org given name predicate. |
|
| 68 | + * |
|
| 69 | + * @since 3.1.7 |
|
| 70 | + */ |
|
| 71 | + const SCHEMA_GIVEN_NAME_URI = 'http://schema.org/givenName'; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * The schema.org family name predicate. |
|
| 75 | + * |
|
| 76 | + * @since 3.1.7 |
|
| 77 | + */ |
|
| 78 | + const SCHEMA_FAMILY_NAME_URI = 'http://schema.org/familyName'; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * The schema.org url predicate. |
|
| 82 | + * |
|
| 83 | + * @since 3.1.7 |
|
| 84 | + */ |
|
| 85 | + const SCHEMA_URL_URI = 'http://schema.org/url'; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * @since 3.14.0 |
|
| 89 | + */ |
|
| 90 | + const SCHEMA_IMAGE_URI = 'http://schema.org/image'; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * The location created predicate. |
|
| 94 | + * |
|
| 95 | + * @since 3.14.0 |
|
| 96 | + */ |
|
| 97 | + const SCHEMA_LOCATION_CREATED_URI = 'http://schema.org/locationCreated'; |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @since 3.14.0 |
|
| 101 | + */ |
|
| 102 | + const SCHEMA_AUTHOR_URI = 'http://schema.org/author'; |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @since 3.14.0 |
|
| 106 | + */ |
|
| 107 | + const SCHEMA_INTERACTION_COUNT_URI = 'http://schema.org/interactionCount'; |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @since 3.14.0 |
|
| 111 | + */ |
|
| 112 | + const DCTERMS_SUBJECT_URI = 'http://purl.org/dc/terms/subject'; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @since 3.14.0 |
|
| 116 | + */ |
|
| 117 | + const DCTERMS_REFERENCES_URI = 'http://purl.org/dc/terms/references'; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * The RDF label. |
|
| 121 | + * |
|
| 122 | + * @since 3.1.7 |
|
| 123 | + */ |
|
| 124 | + const RDFS_LABEL_URI = 'http://www.w3.org/2000/01/rdf-schema#label'; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Hold the template (INSERT or DELETE). |
|
| 128 | + * |
|
| 129 | + * @since 3.1.7 |
|
| 130 | + * @access private |
|
| 131 | + * @var string $template The query template. |
|
| 132 | + */ |
|
| 133 | + private $template; |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * An array of statements (in the form of subject, predicate, object). |
|
| 137 | + * |
|
| 138 | + * @since 3.1.7 |
|
| 139 | + * @access private |
|
| 140 | + * @var array $statements An array of statements. |
|
| 141 | + */ |
|
| 142 | + private $statements = array(); |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * Create a new instance of the Query builder (compatible with PHP 5.3). |
|
| 146 | + * |
|
| 147 | + * @since 3.1.7 |
|
| 148 | + * @return Wordlift_Query_Builder A new instance of the Query builder. |
|
| 149 | + */ |
|
| 150 | + public static function new_instance() { |
|
| 151 | + |
|
| 152 | + return new Wordlift_Query_Builder(); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Set the query to INSERT. |
|
| 157 | + * |
|
| 158 | + * @since 3.1.7 |
|
| 159 | + * @return Wordlift_Query_Builder The Query builder. |
|
| 160 | + */ |
|
| 161 | + public function insert() { |
|
| 162 | + |
|
| 163 | + $this->template = self::INSERT; |
|
| 164 | + |
|
| 165 | + return $this; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Set the query to DELETE. |
|
| 170 | + * |
|
| 171 | + * @since 3.1.7 |
|
| 172 | + * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 173 | + */ |
|
| 174 | + public function delete() { |
|
| 175 | + |
|
| 176 | + $this->template = self::DELETE; |
|
| 177 | + |
|
| 178 | + return $this; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Set the query to SELECT. |
|
| 183 | + * |
|
| 184 | + * @since 3.12.2 |
|
| 185 | + * |
|
| 186 | + * @param string $props The list of properties to read. |
|
| 187 | + * |
|
| 188 | + * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 189 | + */ |
|
| 190 | + public function select( $props = '*' ) { |
|
| 191 | + |
|
| 192 | + $this->template = "SELECT $props WHERE { %s }"; |
|
| 193 | + |
|
| 194 | + return $this; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Add a statement. |
|
| 199 | + * |
|
| 200 | + * @since 3.1.7 |
|
| 201 | + * |
|
| 202 | + * @param string $subject The subject of the statement (must be a URI). |
|
| 203 | + * @param string $predicate The predicate (must be a URI). |
|
| 204 | + * @param string $object The object, can be a URI or a value. |
|
| 205 | + * @param int $object_type The object type, either a {@link OBJECT_URI} or a value {@link OBJECT_VALUE}. If set to {@link OBJECT_AUTO}, the Query builder will try to guess. |
|
| 206 | + * @param string|null $data_type The data type (or null). |
|
| 207 | + * @param string|null $language The language code (or null). |
|
| 208 | + * |
|
| 209 | + * @return $this \Wordlift_Query_Builder The Query builder. |
|
| 210 | + */ |
|
| 211 | + public function statement( $subject, $predicate, $object, $object_type = self::OBJECT_AUTO, $data_type = null, $language = null ) { |
|
| 212 | + |
|
| 213 | + // If no value has been provided, we don't set any statement. |
|
| 214 | + if ( empty( $object ) ) { |
|
| 215 | + return $this; |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + // Guess the subject type. |
|
| 219 | + $subject_value_type = $this->guess_subject_type( $subject ); |
|
| 220 | + |
|
| 221 | + // Get the object type if set, otherwise try to guess it. |
|
| 222 | + $object_value_type = ( self::OBJECT_AUTO === $object_type ? $this->guess_object_type( $predicate, $object ) : $object_type ); |
|
| 223 | + |
|
| 224 | + // Prepare the statement template. |
|
| 225 | + $template = |
|
| 226 | + // Subject as a parameter, no `<`, `>`. |
|
| 227 | + ( self::OBJECT_PARAMETER === $subject_value_type ? '%1$s' : '<%1$s>' ) . |
|
| 228 | + // Predicate. |
|
| 229 | + ' <%2$s> ' . |
|
| 230 | + // Object. |
|
| 231 | + ( self::OBJECT_URI === $object_value_type ? '<%3$s>' : |
|
| 232 | + ( self::OBJECT_PARAMETER === $object_value_type ? '%3$s' : |
|
| 233 | + // self::OBJECT_VALUE === $object_value_type |
|
| 234 | + '"%3$s"' . ( isset( $data_type ) ? '^^%4$s' : '' ) . ( isset( $language ) ? '@%5$s' : '' ) ) ); |
|
| 235 | + |
|
| 236 | + // Escape the subject, predicate and object. |
|
| 237 | + $escaped_subject = Wordlift_Sparql_Service::escape_uri( $subject ); |
|
| 238 | + $escaped_predicate = Wordlift_Sparql_Service::escape_uri( $predicate ); |
|
| 239 | + $escaped_object = ( self::OBJECT_URI === $object_value_type ? Wordlift_Sparql_Service::escape_uri( $object ) : Wordlift_Sparql_Service::escape( $object ) ); |
|
| 240 | + |
|
| 241 | + // Prepare the statement and add it to the list of statements. |
|
| 242 | + $this->statements[] = sprintf( $template, $escaped_subject, $escaped_predicate, $escaped_object, $data_type, $language ); |
|
| 243 | + |
|
| 244 | + return $this; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * Build the query. |
|
| 249 | + * |
|
| 250 | + * @since 3.1.7 |
|
| 251 | + * @return string The query string. |
|
| 252 | + */ |
|
| 253 | + public function build() { |
|
| 254 | + |
|
| 255 | + // If there are no statements return an empty string. |
|
| 256 | + if ( 0 === count( $this->statements ) ) { |
|
| 257 | + return ''; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + return sprintf( $this->template, implode( ' . ', $this->statements ) ) . "\n"; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Guess the statement object type. |
|
| 265 | + * |
|
| 266 | + * @since 3.1.7 |
|
| 267 | + * |
|
| 268 | + * @param string $predicate The predicate. |
|
| 269 | + * @param string $object The object. |
|
| 270 | + * |
|
| 271 | + * @return int {@link Wordlift_Query_Builder::OBJECT_URI} if the Query builder thinks the object must be an URI, {@link Wordlift_Query_Builder::OBJECT_VALUE} otherwise. |
|
| 272 | + */ |
|
| 273 | + private function guess_object_type( $predicate, $object ) { |
|
| 274 | + |
|
| 275 | + // If the object starts with a question mark, it's a parameter. |
|
| 276 | + if ( 0 === strpos( $object, '?' ) ) { |
|
| 277 | + return self::OBJECT_PARAMETER; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + // Guess based on the predicate. |
|
| 281 | + switch ( $predicate ) { |
|
| 282 | + |
|
| 283 | + case self::DCTERMS_REFERENCES_URI: |
|
| 284 | + case self::DCTERMS_SUBJECT_URI: |
|
| 285 | + case self::RDFS_TYPE_URI: |
|
| 286 | + case self::SCHEMA_AUTHOR_URI: |
|
| 287 | + case self::SCHEMA_LOCATION_CREATED_URI: |
|
| 288 | + case self::SCHEMA_URL_URI: |
|
| 289 | + case self::SCHEMA_IMAGE_URI: |
|
| 290 | + return self::OBJECT_URI; |
|
| 291 | + |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + return self::OBJECT_VALUE; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * Guess the subject type. |
|
| 299 | + * |
|
| 300 | + * @since 3.12.3 |
|
| 301 | + * |
|
| 302 | + * @param string $subject The subject string. |
|
| 303 | + * |
|
| 304 | + * @return int {@link Wordlift_Query_Builder::OBJECT_PARAMETER} if the Query builder thinks the subject is a parameter (starts with ?), otherwise {@link Wordlift_Query_Builder::OBJECT_URI}. |
|
| 305 | + */ |
|
| 306 | + private function guess_subject_type( $subject ) { |
|
| 307 | + |
|
| 308 | + // If the object starts with a question mark, it's a parameter. |
|
| 309 | + if ( 0 === strpos( $subject, '?' ) ) { |
|
| 310 | + return self::OBJECT_PARAMETER; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + return self::OBJECT_URI; |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | 316 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @return $this \Wordlift_Query_Builder The Query builder. |
| 189 | 189 | */ |
| 190 | - public function select( $props = '*' ) { |
|
| 190 | + public function select($props = '*') { |
|
| 191 | 191 | |
| 192 | 192 | $this->template = "SELECT $props WHERE { %s }"; |
| 193 | 193 | |
@@ -208,38 +208,36 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return $this \Wordlift_Query_Builder The Query builder. |
| 210 | 210 | */ |
| 211 | - public function statement( $subject, $predicate, $object, $object_type = self::OBJECT_AUTO, $data_type = null, $language = null ) { |
|
| 211 | + public function statement($subject, $predicate, $object, $object_type = self::OBJECT_AUTO, $data_type = null, $language = null) { |
|
| 212 | 212 | |
| 213 | 213 | // If no value has been provided, we don't set any statement. |
| 214 | - if ( empty( $object ) ) { |
|
| 214 | + if (empty($object)) { |
|
| 215 | 215 | return $this; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Guess the subject type. |
| 219 | - $subject_value_type = $this->guess_subject_type( $subject ); |
|
| 219 | + $subject_value_type = $this->guess_subject_type($subject); |
|
| 220 | 220 | |
| 221 | 221 | // Get the object type if set, otherwise try to guess it. |
| 222 | - $object_value_type = ( self::OBJECT_AUTO === $object_type ? $this->guess_object_type( $predicate, $object ) : $object_type ); |
|
| 222 | + $object_value_type = (self::OBJECT_AUTO === $object_type ? $this->guess_object_type($predicate, $object) : $object_type); |
|
| 223 | 223 | |
| 224 | 224 | // Prepare the statement template. |
| 225 | 225 | $template = |
| 226 | 226 | // Subject as a parameter, no `<`, `>`. |
| 227 | - ( self::OBJECT_PARAMETER === $subject_value_type ? '%1$s' : '<%1$s>' ) . |
|
| 227 | + (self::OBJECT_PARAMETER === $subject_value_type ? '%1$s' : '<%1$s>'). |
|
| 228 | 228 | // Predicate. |
| 229 | - ' <%2$s> ' . |
|
| 229 | + ' <%2$s> '. |
|
| 230 | 230 | // Object. |
| 231 | - ( self::OBJECT_URI === $object_value_type ? '<%3$s>' : |
|
| 232 | - ( self::OBJECT_PARAMETER === $object_value_type ? '%3$s' : |
|
| 233 | - // self::OBJECT_VALUE === $object_value_type |
|
| 234 | - '"%3$s"' . ( isset( $data_type ) ? '^^%4$s' : '' ) . ( isset( $language ) ? '@%5$s' : '' ) ) ); |
|
| 231 | + (self::OBJECT_URI === $object_value_type ? '<%3$s>' : (self::OBJECT_PARAMETER === $object_value_type ? '%3$s' : // self::OBJECT_VALUE === $object_value_type |
|
| 232 | + '"%3$s"'.(isset($data_type) ? '^^%4$s' : '').(isset($language) ? '@%5$s' : ''))); |
|
| 235 | 233 | |
| 236 | 234 | // Escape the subject, predicate and object. |
| 237 | - $escaped_subject = Wordlift_Sparql_Service::escape_uri( $subject ); |
|
| 238 | - $escaped_predicate = Wordlift_Sparql_Service::escape_uri( $predicate ); |
|
| 239 | - $escaped_object = ( self::OBJECT_URI === $object_value_type ? Wordlift_Sparql_Service::escape_uri( $object ) : Wordlift_Sparql_Service::escape( $object ) ); |
|
| 235 | + $escaped_subject = Wordlift_Sparql_Service::escape_uri($subject); |
|
| 236 | + $escaped_predicate = Wordlift_Sparql_Service::escape_uri($predicate); |
|
| 237 | + $escaped_object = (self::OBJECT_URI === $object_value_type ? Wordlift_Sparql_Service::escape_uri($object) : Wordlift_Sparql_Service::escape($object)); |
|
| 240 | 238 | |
| 241 | 239 | // Prepare the statement and add it to the list of statements. |
| 242 | - $this->statements[] = sprintf( $template, $escaped_subject, $escaped_predicate, $escaped_object, $data_type, $language ); |
|
| 240 | + $this->statements[] = sprintf($template, $escaped_subject, $escaped_predicate, $escaped_object, $data_type, $language); |
|
| 243 | 241 | |
| 244 | 242 | return $this; |
| 245 | 243 | } |
@@ -253,11 +251,11 @@ discard block |
||
| 253 | 251 | public function build() { |
| 254 | 252 | |
| 255 | 253 | // If there are no statements return an empty string. |
| 256 | - if ( 0 === count( $this->statements ) ) { |
|
| 254 | + if (0 === count($this->statements)) { |
|
| 257 | 255 | return ''; |
| 258 | 256 | } |
| 259 | 257 | |
| 260 | - return sprintf( $this->template, implode( ' . ', $this->statements ) ) . "\n"; |
|
| 258 | + return sprintf($this->template, implode(' . ', $this->statements))."\n"; |
|
| 261 | 259 | } |
| 262 | 260 | |
| 263 | 261 | /** |
@@ -270,15 +268,15 @@ discard block |
||
| 270 | 268 | * |
| 271 | 269 | * @return int {@link Wordlift_Query_Builder::OBJECT_URI} if the Query builder thinks the object must be an URI, {@link Wordlift_Query_Builder::OBJECT_VALUE} otherwise. |
| 272 | 270 | */ |
| 273 | - private function guess_object_type( $predicate, $object ) { |
|
| 271 | + private function guess_object_type($predicate, $object) { |
|
| 274 | 272 | |
| 275 | 273 | // If the object starts with a question mark, it's a parameter. |
| 276 | - if ( 0 === strpos( $object, '?' ) ) { |
|
| 274 | + if (0 === strpos($object, '?')) { |
|
| 277 | 275 | return self::OBJECT_PARAMETER; |
| 278 | 276 | } |
| 279 | 277 | |
| 280 | 278 | // Guess based on the predicate. |
| 281 | - switch ( $predicate ) { |
|
| 279 | + switch ($predicate) { |
|
| 282 | 280 | |
| 283 | 281 | case self::DCTERMS_REFERENCES_URI: |
| 284 | 282 | case self::DCTERMS_SUBJECT_URI: |
@@ -303,10 +301,10 @@ discard block |
||
| 303 | 301 | * |
| 304 | 302 | * @return int {@link Wordlift_Query_Builder::OBJECT_PARAMETER} if the Query builder thinks the subject is a parameter (starts with ?), otherwise {@link Wordlift_Query_Builder::OBJECT_URI}. |
| 305 | 303 | */ |
| 306 | - private function guess_subject_type( $subject ) { |
|
| 304 | + private function guess_subject_type($subject) { |
|
| 307 | 305 | |
| 308 | 306 | // If the object starts with a question mark, it's a parameter. |
| 309 | - if ( 0 === strpos( $subject, '?' ) ) { |
|
| 307 | + if (0 === strpos($subject, '?')) { |
|
| 310 | 308 | return self::OBJECT_PARAMETER; |
| 311 | 309 | } |
| 312 | 310 | |
@@ -29,1197 +29,1197 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Wordlift { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | - * the plugin. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access protected |
|
| 38 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | - */ |
|
| 40 | - protected $loader; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * The unique identifier of this plugin. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @access protected |
|
| 47 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | - */ |
|
| 49 | - protected $plugin_name; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * The current version of the plugin. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @access protected |
|
| 56 | - * @var string $version The current version of the plugin. |
|
| 57 | - */ |
|
| 58 | - protected $version; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | - * |
|
| 63 | - * @since 3.12.0 |
|
| 64 | - * @access protected |
|
| 65 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | - */ |
|
| 67 | - protected $tinymce_adapter; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The Thumbnail service. |
|
| 71 | - * |
|
| 72 | - * @since 3.1.5 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | - */ |
|
| 76 | - private $thumbnail_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The UI service. |
|
| 80 | - * |
|
| 81 | - * @since 3.2.0 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | - */ |
|
| 85 | - private $ui_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Schema service. |
|
| 89 | - * |
|
| 90 | - * @since 3.3.0 |
|
| 91 | - * @access private |
|
| 92 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | - */ |
|
| 94 | - private $schema_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Entity service. |
|
| 98 | - * |
|
| 99 | - * @since 3.1.0 |
|
| 100 | - * @access protected |
|
| 101 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | - */ |
|
| 103 | - protected $entity_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The Topic Taxonomy service. |
|
| 107 | - * |
|
| 108 | - * @since 3.5.0 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | - */ |
|
| 112 | - private $topic_taxonomy_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The User service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.7 |
|
| 118 | - * @access protected |
|
| 119 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | - */ |
|
| 121 | - protected $user_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Timeline service. |
|
| 125 | - * |
|
| 126 | - * @since 3.1.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | - */ |
|
| 130 | - private $timeline_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Redirect service. |
|
| 134 | - * |
|
| 135 | - * @since 3.2.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | - */ |
|
| 139 | - private $redirect_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Notice service. |
|
| 143 | - * |
|
| 144 | - * @since 3.3.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | - */ |
|
| 148 | - private $notice_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Entity list customization. |
|
| 152 | - * |
|
| 153 | - * @since 3.3.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | - */ |
|
| 157 | - private $entity_list_service; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The Entity Types Taxonomy Walker. |
|
| 161 | - * |
|
| 162 | - * @since 3.1.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | - */ |
|
| 166 | - private $entity_types_taxonomy_walker; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The ShareThis service. |
|
| 170 | - * |
|
| 171 | - * @since 3.2.0 |
|
| 172 | - * @access private |
|
| 173 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | - */ |
|
| 175 | - private $sharethis_service; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The PrimaShop adapter. |
|
| 179 | - * |
|
| 180 | - * @since 3.2.3 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | - */ |
|
| 184 | - private $primashop_adapter; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The WordLift Dashboard adapter. |
|
| 188 | - * |
|
| 189 | - * @since 3.4.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | - */ |
|
| 193 | - private $dashboard_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The entity type service. |
|
| 197 | - * |
|
| 198 | - * @since 3.6.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | - */ |
|
| 202 | - private $entity_post_type_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | - * |
|
| 207 | - * @since 3.6.0 |
|
| 208 | - * @access private |
|
| 209 | - * @var \Wordlift_Entity_Link_Service |
|
| 210 | - */ |
|
| 211 | - private $entity_link_service; |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | - * |
|
| 216 | - * @var 3.6.0 |
|
| 217 | - * @access private |
|
| 218 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | - */ |
|
| 220 | - private $sparql_service; |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * A {@link Wordlift_Import_Service} instance. |
|
| 224 | - * |
|
| 225 | - * @since 3.6.0 |
|
| 226 | - * @access private |
|
| 227 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | - */ |
|
| 229 | - private $import_service; |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | - * |
|
| 234 | - * @since 3.6.0 |
|
| 235 | - * @access private |
|
| 236 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | - */ |
|
| 238 | - private $rebuild_service; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | - * |
|
| 243 | - * @since 3.7.0 |
|
| 244 | - * @access protected |
|
| 245 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | - */ |
|
| 247 | - protected $jsonld_service; |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * |
|
| 251 | - * @since 3.7.0 |
|
| 252 | - * @access private |
|
| 253 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 254 | - */ |
|
| 255 | - private $property_factory; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * The 'Download Your Data' page. |
|
| 259 | - * |
|
| 260 | - * @since 3.6.0 |
|
| 261 | - * @access private |
|
| 262 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 263 | - */ |
|
| 264 | - private $download_your_data_page; |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * The 'WordLift Settings' page. |
|
| 268 | - * |
|
| 269 | - * @since 3.11.0 |
|
| 270 | - * @access protected |
|
| 271 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 272 | - */ |
|
| 273 | - protected $settings_page; |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * The install wizard page. |
|
| 277 | - * |
|
| 278 | - * @since 3.9.0 |
|
| 279 | - * @access private |
|
| 280 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 281 | - */ |
|
| 282 | - private $admin_setup; |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 286 | - * linking of entities to their pages. |
|
| 287 | - * |
|
| 288 | - * @since 3.8.0 |
|
| 289 | - * @access private |
|
| 290 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 291 | - */ |
|
| 292 | - private $content_filter_service; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 296 | - * |
|
| 297 | - * @since 3.9.0 |
|
| 298 | - * @access private |
|
| 299 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 300 | - */ |
|
| 301 | - private $key_validation_service; |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 305 | - * |
|
| 306 | - * @since 3.10.0 |
|
| 307 | - * @access private |
|
| 308 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 309 | - */ |
|
| 310 | - private $rating_service; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.10.0 |
|
| 316 | - * @access protected |
|
| 317 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 318 | - */ |
|
| 319 | - protected $post_to_jsonld_converter; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 323 | - * |
|
| 324 | - * @since 3.10.0 |
|
| 325 | - * @access protected |
|
| 326 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 327 | - */ |
|
| 328 | - protected $configuration_service; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 332 | - * |
|
| 333 | - * @since 3.10.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 336 | - */ |
|
| 337 | - protected $entity_type_service; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 341 | - * |
|
| 342 | - * @since 3.10.0 |
|
| 343 | - * @access protected |
|
| 344 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 345 | - */ |
|
| 346 | - protected $entity_post_to_jsonld_converter; |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 350 | - * |
|
| 351 | - * @since 3.10.0 |
|
| 352 | - * @access protected |
|
| 353 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 354 | - */ |
|
| 355 | - protected $postid_to_jsonld_converter; |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 359 | - * |
|
| 360 | - * @since 3.9.8 |
|
| 361 | - * @access private |
|
| 362 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 363 | - */ |
|
| 364 | - private $status_page; |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 368 | - * |
|
| 369 | - * @since 3.11.0 |
|
| 370 | - * @access protected |
|
| 371 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 372 | - */ |
|
| 373 | - protected $category_taxonomy_service; |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.11.0 |
|
| 379 | - * @access protected |
|
| 380 | - * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 381 | - */ |
|
| 382 | - protected $event_entity_page_service; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 386 | - * |
|
| 387 | - * @since 3.11.0 |
|
| 388 | - * @access protected |
|
| 389 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 390 | - */ |
|
| 391 | - protected $settings_page_action_link; |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 395 | - * |
|
| 396 | - * @since 3.11.0 |
|
| 397 | - * @access protected |
|
| 398 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 399 | - */ |
|
| 400 | - protected $publisher_ajax_adapter; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 404 | - * |
|
| 405 | - * @since 3.11.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 408 | - */ |
|
| 409 | - protected $input_element; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 413 | - * |
|
| 414 | - * @since 3.11.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 417 | - */ |
|
| 418 | - protected $language_select_element; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 422 | - * |
|
| 423 | - * @since 3.11.0 |
|
| 424 | - * @access protected |
|
| 425 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 426 | - */ |
|
| 427 | - protected $publisher_element; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 431 | - * |
|
| 432 | - * @since 3.11.0 |
|
| 433 | - * @access protected |
|
| 434 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 435 | - */ |
|
| 436 | - protected $select2_element; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The controller for the entity type list admin page |
|
| 440 | - * |
|
| 441 | - * @since 3.11.0 |
|
| 442 | - * @access private |
|
| 443 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 444 | - */ |
|
| 445 | - private $entity_type_admin_page; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * The controller for the entity type settings admin page |
|
| 449 | - * |
|
| 450 | - * @since 3.11.0 |
|
| 451 | - * @access private |
|
| 452 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 453 | - */ |
|
| 454 | - private $entity_type_settings_admin_page; |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 458 | - * |
|
| 459 | - * @since 3.11.0 |
|
| 460 | - * @access protected |
|
| 461 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 462 | - */ |
|
| 463 | - protected $related_entities_cloud_widget; |
|
| 464 | - |
|
| 465 | - /** |
|
| 466 | - * {@link Wordlift}'s singleton instance. |
|
| 467 | - * |
|
| 468 | - * @since 3.11.2 |
|
| 469 | - * |
|
| 470 | - * @since 3.11.2 |
|
| 471 | - * @access private |
|
| 472 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 473 | - */ |
|
| 474 | - private static $instance; |
|
| 475 | - |
|
| 476 | - /** |
|
| 477 | - * Define the core functionality of the plugin. |
|
| 478 | - * |
|
| 479 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 480 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 481 | - * the public-facing side of the site. |
|
| 482 | - * |
|
| 483 | - * @since 1.0.0 |
|
| 484 | - */ |
|
| 485 | - public function __construct() { |
|
| 486 | - |
|
| 487 | - $this->plugin_name = 'wordlift'; |
|
| 488 | - $this->version = '3.12.3'; |
|
| 489 | - $this->load_dependencies(); |
|
| 490 | - $this->set_locale(); |
|
| 491 | - $this->define_admin_hooks(); |
|
| 492 | - $this->define_public_hooks(); |
|
| 493 | - |
|
| 494 | - self::$instance = $this; |
|
| 495 | - |
|
| 496 | - } |
|
| 497 | - |
|
| 498 | - /** |
|
| 499 | - * Get the singleton instance. |
|
| 500 | - * |
|
| 501 | - * @since 3.11.2 |
|
| 502 | - * |
|
| 503 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 504 | - */ |
|
| 505 | - public static function get_instance() { |
|
| 506 | - |
|
| 507 | - return self::$instance; |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - /** |
|
| 511 | - * Load the required dependencies for this plugin. |
|
| 512 | - * |
|
| 513 | - * Include the following files that make up the plugin: |
|
| 514 | - * |
|
| 515 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 516 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 517 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 518 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 519 | - * |
|
| 520 | - * Create an instance of the loader which will be used to register the hooks |
|
| 521 | - * with WordPress. |
|
| 522 | - * |
|
| 523 | - * @since 1.0.0 |
|
| 524 | - * @access private |
|
| 525 | - */ |
|
| 526 | - private function load_dependencies() { |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * The class responsible for orchestrating the actions and filters of the |
|
| 530 | - * core plugin. |
|
| 531 | - */ |
|
| 532 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 533 | - |
|
| 534 | - /** |
|
| 535 | - * The class responsible for defining internationalization functionality |
|
| 536 | - * of the plugin. |
|
| 537 | - */ |
|
| 538 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 539 | - |
|
| 540 | - /** |
|
| 541 | - * WordLift's supported languages. |
|
| 542 | - */ |
|
| 543 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 544 | - |
|
| 545 | - /** |
|
| 546 | - * Provide support functions to sanitize data. |
|
| 547 | - */ |
|
| 548 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 549 | - |
|
| 550 | - /** |
|
| 551 | - * The Redirect service. |
|
| 552 | - */ |
|
| 553 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 554 | - |
|
| 555 | - /** |
|
| 556 | - * The Log service. |
|
| 557 | - */ |
|
| 558 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 559 | - |
|
| 560 | - /** |
|
| 561 | - * The configuration service. |
|
| 562 | - */ |
|
| 563 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 564 | - |
|
| 565 | - /** |
|
| 566 | - * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 567 | - */ |
|
| 568 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 569 | - |
|
| 570 | - /** |
|
| 571 | - * The entity type service (i.e. the schema type). |
|
| 572 | - */ |
|
| 573 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 574 | - |
|
| 575 | - /** |
|
| 576 | - * The entity link service. |
|
| 577 | - */ |
|
| 578 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 579 | - |
|
| 580 | - /** |
|
| 581 | - * The Query builder. |
|
| 582 | - */ |
|
| 583 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 584 | - |
|
| 585 | - /** |
|
| 586 | - * The Schema service. |
|
| 587 | - */ |
|
| 588 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 589 | - |
|
| 590 | - /** |
|
| 591 | - * The schema:url property service. |
|
| 592 | - */ |
|
| 593 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 594 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 595 | - |
|
| 596 | - /** |
|
| 597 | - * The UI service. |
|
| 598 | - */ |
|
| 599 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 600 | - |
|
| 601 | - /** |
|
| 602 | - * The Thumbnail service. |
|
| 603 | - */ |
|
| 604 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 605 | - |
|
| 606 | - /** |
|
| 607 | - * The Entity Types Taxonomy service. |
|
| 608 | - */ |
|
| 609 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The Entity service. |
|
| 613 | - */ |
|
| 614 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 615 | - |
|
| 616 | - // Add the entity rating service. |
|
| 617 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 618 | - |
|
| 619 | - /** |
|
| 620 | - * The User service. |
|
| 621 | - */ |
|
| 622 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 623 | - |
|
| 624 | - /** |
|
| 625 | - * The Timeline service. |
|
| 626 | - */ |
|
| 627 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 628 | - |
|
| 629 | - /** |
|
| 630 | - * The Topic Taxonomy service. |
|
| 631 | - */ |
|
| 632 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 633 | - |
|
| 634 | - /** |
|
| 635 | - * The SPARQL service. |
|
| 636 | - */ |
|
| 637 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 638 | - |
|
| 639 | - /** |
|
| 640 | - * The WordLift import service. |
|
| 641 | - */ |
|
| 642 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 643 | - |
|
| 644 | - /** |
|
| 645 | - * The WordLift URI service. |
|
| 646 | - */ |
|
| 647 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 648 | - |
|
| 649 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 650 | - |
|
| 651 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 652 | - |
|
| 653 | - /** |
|
| 654 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 655 | - */ |
|
| 656 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 657 | - |
|
| 658 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 659 | - |
|
| 660 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * Load the converters. |
|
| 664 | - */ |
|
| 665 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 666 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 667 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 668 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 669 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 670 | - |
|
| 671 | - /** |
|
| 672 | - * Load the content filter. |
|
| 673 | - */ |
|
| 674 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 675 | - |
|
| 676 | - /* |
|
| 32 | + /** |
|
| 33 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | + * the plugin. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access protected |
|
| 38 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | + */ |
|
| 40 | + protected $loader; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * The unique identifier of this plugin. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @access protected |
|
| 47 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | + */ |
|
| 49 | + protected $plugin_name; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * The current version of the plugin. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @access protected |
|
| 56 | + * @var string $version The current version of the plugin. |
|
| 57 | + */ |
|
| 58 | + protected $version; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | + * |
|
| 63 | + * @since 3.12.0 |
|
| 64 | + * @access protected |
|
| 65 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | + */ |
|
| 67 | + protected $tinymce_adapter; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The Thumbnail service. |
|
| 71 | + * |
|
| 72 | + * @since 3.1.5 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | + */ |
|
| 76 | + private $thumbnail_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The UI service. |
|
| 80 | + * |
|
| 81 | + * @since 3.2.0 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | + */ |
|
| 85 | + private $ui_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Schema service. |
|
| 89 | + * |
|
| 90 | + * @since 3.3.0 |
|
| 91 | + * @access private |
|
| 92 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | + */ |
|
| 94 | + private $schema_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Entity service. |
|
| 98 | + * |
|
| 99 | + * @since 3.1.0 |
|
| 100 | + * @access protected |
|
| 101 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | + */ |
|
| 103 | + protected $entity_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The Topic Taxonomy service. |
|
| 107 | + * |
|
| 108 | + * @since 3.5.0 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | + */ |
|
| 112 | + private $topic_taxonomy_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The User service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.7 |
|
| 118 | + * @access protected |
|
| 119 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | + */ |
|
| 121 | + protected $user_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Timeline service. |
|
| 125 | + * |
|
| 126 | + * @since 3.1.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | + */ |
|
| 130 | + private $timeline_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Redirect service. |
|
| 134 | + * |
|
| 135 | + * @since 3.2.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | + */ |
|
| 139 | + private $redirect_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Notice service. |
|
| 143 | + * |
|
| 144 | + * @since 3.3.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | + */ |
|
| 148 | + private $notice_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Entity list customization. |
|
| 152 | + * |
|
| 153 | + * @since 3.3.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | + */ |
|
| 157 | + private $entity_list_service; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The Entity Types Taxonomy Walker. |
|
| 161 | + * |
|
| 162 | + * @since 3.1.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | + */ |
|
| 166 | + private $entity_types_taxonomy_walker; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The ShareThis service. |
|
| 170 | + * |
|
| 171 | + * @since 3.2.0 |
|
| 172 | + * @access private |
|
| 173 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | + */ |
|
| 175 | + private $sharethis_service; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The PrimaShop adapter. |
|
| 179 | + * |
|
| 180 | + * @since 3.2.3 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | + */ |
|
| 184 | + private $primashop_adapter; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The WordLift Dashboard adapter. |
|
| 188 | + * |
|
| 189 | + * @since 3.4.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | + */ |
|
| 193 | + private $dashboard_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The entity type service. |
|
| 197 | + * |
|
| 198 | + * @since 3.6.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | + */ |
|
| 202 | + private $entity_post_type_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | + * |
|
| 207 | + * @since 3.6.0 |
|
| 208 | + * @access private |
|
| 209 | + * @var \Wordlift_Entity_Link_Service |
|
| 210 | + */ |
|
| 211 | + private $entity_link_service; |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | + * |
|
| 216 | + * @var 3.6.0 |
|
| 217 | + * @access private |
|
| 218 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | + */ |
|
| 220 | + private $sparql_service; |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * A {@link Wordlift_Import_Service} instance. |
|
| 224 | + * |
|
| 225 | + * @since 3.6.0 |
|
| 226 | + * @access private |
|
| 227 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | + */ |
|
| 229 | + private $import_service; |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | + * |
|
| 234 | + * @since 3.6.0 |
|
| 235 | + * @access private |
|
| 236 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | + */ |
|
| 238 | + private $rebuild_service; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | + * |
|
| 243 | + * @since 3.7.0 |
|
| 244 | + * @access protected |
|
| 245 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | + */ |
|
| 247 | + protected $jsonld_service; |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * |
|
| 251 | + * @since 3.7.0 |
|
| 252 | + * @access private |
|
| 253 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 254 | + */ |
|
| 255 | + private $property_factory; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * The 'Download Your Data' page. |
|
| 259 | + * |
|
| 260 | + * @since 3.6.0 |
|
| 261 | + * @access private |
|
| 262 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 263 | + */ |
|
| 264 | + private $download_your_data_page; |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * The 'WordLift Settings' page. |
|
| 268 | + * |
|
| 269 | + * @since 3.11.0 |
|
| 270 | + * @access protected |
|
| 271 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 272 | + */ |
|
| 273 | + protected $settings_page; |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * The install wizard page. |
|
| 277 | + * |
|
| 278 | + * @since 3.9.0 |
|
| 279 | + * @access private |
|
| 280 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 281 | + */ |
|
| 282 | + private $admin_setup; |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 286 | + * linking of entities to their pages. |
|
| 287 | + * |
|
| 288 | + * @since 3.8.0 |
|
| 289 | + * @access private |
|
| 290 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 291 | + */ |
|
| 292 | + private $content_filter_service; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 296 | + * |
|
| 297 | + * @since 3.9.0 |
|
| 298 | + * @access private |
|
| 299 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 300 | + */ |
|
| 301 | + private $key_validation_service; |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 305 | + * |
|
| 306 | + * @since 3.10.0 |
|
| 307 | + * @access private |
|
| 308 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 309 | + */ |
|
| 310 | + private $rating_service; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.10.0 |
|
| 316 | + * @access protected |
|
| 317 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 318 | + */ |
|
| 319 | + protected $post_to_jsonld_converter; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 323 | + * |
|
| 324 | + * @since 3.10.0 |
|
| 325 | + * @access protected |
|
| 326 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 327 | + */ |
|
| 328 | + protected $configuration_service; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 332 | + * |
|
| 333 | + * @since 3.10.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 336 | + */ |
|
| 337 | + protected $entity_type_service; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 341 | + * |
|
| 342 | + * @since 3.10.0 |
|
| 343 | + * @access protected |
|
| 344 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 345 | + */ |
|
| 346 | + protected $entity_post_to_jsonld_converter; |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 350 | + * |
|
| 351 | + * @since 3.10.0 |
|
| 352 | + * @access protected |
|
| 353 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 354 | + */ |
|
| 355 | + protected $postid_to_jsonld_converter; |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 359 | + * |
|
| 360 | + * @since 3.9.8 |
|
| 361 | + * @access private |
|
| 362 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 363 | + */ |
|
| 364 | + private $status_page; |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 368 | + * |
|
| 369 | + * @since 3.11.0 |
|
| 370 | + * @access protected |
|
| 371 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 372 | + */ |
|
| 373 | + protected $category_taxonomy_service; |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.11.0 |
|
| 379 | + * @access protected |
|
| 380 | + * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 381 | + */ |
|
| 382 | + protected $event_entity_page_service; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 386 | + * |
|
| 387 | + * @since 3.11.0 |
|
| 388 | + * @access protected |
|
| 389 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 390 | + */ |
|
| 391 | + protected $settings_page_action_link; |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 395 | + * |
|
| 396 | + * @since 3.11.0 |
|
| 397 | + * @access protected |
|
| 398 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 399 | + */ |
|
| 400 | + protected $publisher_ajax_adapter; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 404 | + * |
|
| 405 | + * @since 3.11.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 408 | + */ |
|
| 409 | + protected $input_element; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 413 | + * |
|
| 414 | + * @since 3.11.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 417 | + */ |
|
| 418 | + protected $language_select_element; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 422 | + * |
|
| 423 | + * @since 3.11.0 |
|
| 424 | + * @access protected |
|
| 425 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 426 | + */ |
|
| 427 | + protected $publisher_element; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 431 | + * |
|
| 432 | + * @since 3.11.0 |
|
| 433 | + * @access protected |
|
| 434 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 435 | + */ |
|
| 436 | + protected $select2_element; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The controller for the entity type list admin page |
|
| 440 | + * |
|
| 441 | + * @since 3.11.0 |
|
| 442 | + * @access private |
|
| 443 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 444 | + */ |
|
| 445 | + private $entity_type_admin_page; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * The controller for the entity type settings admin page |
|
| 449 | + * |
|
| 450 | + * @since 3.11.0 |
|
| 451 | + * @access private |
|
| 452 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 453 | + */ |
|
| 454 | + private $entity_type_settings_admin_page; |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 458 | + * |
|
| 459 | + * @since 3.11.0 |
|
| 460 | + * @access protected |
|
| 461 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 462 | + */ |
|
| 463 | + protected $related_entities_cloud_widget; |
|
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * {@link Wordlift}'s singleton instance. |
|
| 467 | + * |
|
| 468 | + * @since 3.11.2 |
|
| 469 | + * |
|
| 470 | + * @since 3.11.2 |
|
| 471 | + * @access private |
|
| 472 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 473 | + */ |
|
| 474 | + private static $instance; |
|
| 475 | + |
|
| 476 | + /** |
|
| 477 | + * Define the core functionality of the plugin. |
|
| 478 | + * |
|
| 479 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 480 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 481 | + * the public-facing side of the site. |
|
| 482 | + * |
|
| 483 | + * @since 1.0.0 |
|
| 484 | + */ |
|
| 485 | + public function __construct() { |
|
| 486 | + |
|
| 487 | + $this->plugin_name = 'wordlift'; |
|
| 488 | + $this->version = '3.12.3'; |
|
| 489 | + $this->load_dependencies(); |
|
| 490 | + $this->set_locale(); |
|
| 491 | + $this->define_admin_hooks(); |
|
| 492 | + $this->define_public_hooks(); |
|
| 493 | + |
|
| 494 | + self::$instance = $this; |
|
| 495 | + |
|
| 496 | + } |
|
| 497 | + |
|
| 498 | + /** |
|
| 499 | + * Get the singleton instance. |
|
| 500 | + * |
|
| 501 | + * @since 3.11.2 |
|
| 502 | + * |
|
| 503 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 504 | + */ |
|
| 505 | + public static function get_instance() { |
|
| 506 | + |
|
| 507 | + return self::$instance; |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * Load the required dependencies for this plugin. |
|
| 512 | + * |
|
| 513 | + * Include the following files that make up the plugin: |
|
| 514 | + * |
|
| 515 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 516 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 517 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 518 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 519 | + * |
|
| 520 | + * Create an instance of the loader which will be used to register the hooks |
|
| 521 | + * with WordPress. |
|
| 522 | + * |
|
| 523 | + * @since 1.0.0 |
|
| 524 | + * @access private |
|
| 525 | + */ |
|
| 526 | + private function load_dependencies() { |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * The class responsible for orchestrating the actions and filters of the |
|
| 530 | + * core plugin. |
|
| 531 | + */ |
|
| 532 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 533 | + |
|
| 534 | + /** |
|
| 535 | + * The class responsible for defining internationalization functionality |
|
| 536 | + * of the plugin. |
|
| 537 | + */ |
|
| 538 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 539 | + |
|
| 540 | + /** |
|
| 541 | + * WordLift's supported languages. |
|
| 542 | + */ |
|
| 543 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 544 | + |
|
| 545 | + /** |
|
| 546 | + * Provide support functions to sanitize data. |
|
| 547 | + */ |
|
| 548 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 549 | + |
|
| 550 | + /** |
|
| 551 | + * The Redirect service. |
|
| 552 | + */ |
|
| 553 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 554 | + |
|
| 555 | + /** |
|
| 556 | + * The Log service. |
|
| 557 | + */ |
|
| 558 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 559 | + |
|
| 560 | + /** |
|
| 561 | + * The configuration service. |
|
| 562 | + */ |
|
| 563 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 564 | + |
|
| 565 | + /** |
|
| 566 | + * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 567 | + */ |
|
| 568 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 569 | + |
|
| 570 | + /** |
|
| 571 | + * The entity type service (i.e. the schema type). |
|
| 572 | + */ |
|
| 573 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 574 | + |
|
| 575 | + /** |
|
| 576 | + * The entity link service. |
|
| 577 | + */ |
|
| 578 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 579 | + |
|
| 580 | + /** |
|
| 581 | + * The Query builder. |
|
| 582 | + */ |
|
| 583 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 584 | + |
|
| 585 | + /** |
|
| 586 | + * The Schema service. |
|
| 587 | + */ |
|
| 588 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 589 | + |
|
| 590 | + /** |
|
| 591 | + * The schema:url property service. |
|
| 592 | + */ |
|
| 593 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 594 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 595 | + |
|
| 596 | + /** |
|
| 597 | + * The UI service. |
|
| 598 | + */ |
|
| 599 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 600 | + |
|
| 601 | + /** |
|
| 602 | + * The Thumbnail service. |
|
| 603 | + */ |
|
| 604 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 605 | + |
|
| 606 | + /** |
|
| 607 | + * The Entity Types Taxonomy service. |
|
| 608 | + */ |
|
| 609 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The Entity service. |
|
| 613 | + */ |
|
| 614 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 615 | + |
|
| 616 | + // Add the entity rating service. |
|
| 617 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * The User service. |
|
| 621 | + */ |
|
| 622 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 623 | + |
|
| 624 | + /** |
|
| 625 | + * The Timeline service. |
|
| 626 | + */ |
|
| 627 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 628 | + |
|
| 629 | + /** |
|
| 630 | + * The Topic Taxonomy service. |
|
| 631 | + */ |
|
| 632 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 633 | + |
|
| 634 | + /** |
|
| 635 | + * The SPARQL service. |
|
| 636 | + */ |
|
| 637 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 638 | + |
|
| 639 | + /** |
|
| 640 | + * The WordLift import service. |
|
| 641 | + */ |
|
| 642 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 643 | + |
|
| 644 | + /** |
|
| 645 | + * The WordLift URI service. |
|
| 646 | + */ |
|
| 647 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 648 | + |
|
| 649 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 650 | + |
|
| 651 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 652 | + |
|
| 653 | + /** |
|
| 654 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 655 | + */ |
|
| 656 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 657 | + |
|
| 658 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 659 | + |
|
| 660 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * Load the converters. |
|
| 664 | + */ |
|
| 665 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 666 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 667 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 668 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 669 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 670 | + |
|
| 671 | + /** |
|
| 672 | + * Load the content filter. |
|
| 673 | + */ |
|
| 674 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 675 | + |
|
| 676 | + /* |
|
| 677 | 677 | * Load the excerpt helper. |
| 678 | 678 | */ |
| 679 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 680 | - |
|
| 681 | - /** |
|
| 682 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 683 | - * |
|
| 684 | - * @since 3.8.0 |
|
| 685 | - */ |
|
| 686 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 687 | - |
|
| 688 | - // The Publisher Service and the AJAX adapter. |
|
| 689 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 690 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 691 | - |
|
| 692 | - /** |
|
| 693 | - * Load the WordLift key validation service. |
|
| 694 | - */ |
|
| 695 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 696 | - |
|
| 697 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 698 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 699 | - |
|
| 700 | - // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 701 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 702 | - |
|
| 703 | - /** Adapters. */ |
|
| 704 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 705 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 706 | - |
|
| 707 | - /** |
|
| 708 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 709 | - */ |
|
| 710 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 711 | - |
|
| 712 | - /** |
|
| 713 | - * The class to customize the entity list admin page. |
|
| 714 | - */ |
|
| 715 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 716 | - |
|
| 717 | - /** |
|
| 718 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 719 | - */ |
|
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 721 | - |
|
| 722 | - /** |
|
| 723 | - * The Notice service. |
|
| 724 | - */ |
|
| 725 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 726 | - |
|
| 727 | - /** |
|
| 728 | - * The PrimaShop adapter. |
|
| 729 | - */ |
|
| 730 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 731 | - |
|
| 732 | - /** |
|
| 733 | - * The WordLift Dashboard service. |
|
| 734 | - */ |
|
| 735 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 736 | - |
|
| 737 | - /** |
|
| 738 | - * The admin 'Install wizard' page. |
|
| 739 | - */ |
|
| 740 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 679 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 680 | + |
|
| 681 | + /** |
|
| 682 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 683 | + * |
|
| 684 | + * @since 3.8.0 |
|
| 685 | + */ |
|
| 686 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 687 | + |
|
| 688 | + // The Publisher Service and the AJAX adapter. |
|
| 689 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 690 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 691 | + |
|
| 692 | + /** |
|
| 693 | + * Load the WordLift key validation service. |
|
| 694 | + */ |
|
| 695 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 696 | + |
|
| 697 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 698 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 699 | + |
|
| 700 | + // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 701 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 702 | + |
|
| 703 | + /** Adapters. */ |
|
| 704 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 705 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 706 | + |
|
| 707 | + /** |
|
| 708 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 709 | + */ |
|
| 710 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 711 | + |
|
| 712 | + /** |
|
| 713 | + * The class to customize the entity list admin page. |
|
| 714 | + */ |
|
| 715 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 716 | + |
|
| 717 | + /** |
|
| 718 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 719 | + */ |
|
| 720 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 721 | + |
|
| 722 | + /** |
|
| 723 | + * The Notice service. |
|
| 724 | + */ |
|
| 725 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 726 | + |
|
| 727 | + /** |
|
| 728 | + * The PrimaShop adapter. |
|
| 729 | + */ |
|
| 730 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 731 | + |
|
| 732 | + /** |
|
| 733 | + * The WordLift Dashboard service. |
|
| 734 | + */ |
|
| 735 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 736 | + |
|
| 737 | + /** |
|
| 738 | + * The admin 'Install wizard' page. |
|
| 739 | + */ |
|
| 740 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 741 | + |
|
| 742 | + /** |
|
| 743 | + * The WordLift entity type list admin page controller. |
|
| 744 | + */ |
|
| 745 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 746 | + |
|
| 747 | + /** |
|
| 748 | + * The WordLift entity type settings admin page controller. |
|
| 749 | + */ |
|
| 750 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 751 | + |
|
| 752 | + /** |
|
| 753 | + * The admin 'Download Your Data' page. |
|
| 754 | + */ |
|
| 755 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 756 | + |
|
| 757 | + /** |
|
| 758 | + * The admin 'Download Your Data' page. |
|
| 759 | + */ |
|
| 760 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 761 | + |
|
| 762 | + /** |
|
| 763 | + * The admin 'WordLift Settings' page. |
|
| 764 | + */ |
|
| 765 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 766 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 767 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 768 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 769 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 770 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 771 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 772 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 773 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 774 | + |
|
| 775 | + /** Admin Pages */ |
|
| 776 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 777 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 778 | + |
|
| 779 | + /** |
|
| 780 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 781 | + * side of the site. |
|
| 782 | + */ |
|
| 783 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 784 | + |
|
| 785 | + /** |
|
| 786 | + * The shortcode abstract class. |
|
| 787 | + */ |
|
| 788 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 789 | + |
|
| 790 | + /** |
|
| 791 | + * The Timeline shortcode. |
|
| 792 | + */ |
|
| 793 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 794 | + |
|
| 795 | + /** |
|
| 796 | + * The Navigator shortcode. |
|
| 797 | + */ |
|
| 798 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 799 | + |
|
| 800 | + /** |
|
| 801 | + * The chord shortcode. |
|
| 802 | + */ |
|
| 803 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 804 | + |
|
| 805 | + /** |
|
| 806 | + * The geomap shortcode. |
|
| 807 | + */ |
|
| 808 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 809 | + |
|
| 810 | + /** |
|
| 811 | + * The entity cloud shortcode. |
|
| 812 | + */ |
|
| 813 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 741 | 814 | |
| 742 | - /** |
|
| 743 | - * The WordLift entity type list admin page controller. |
|
| 744 | - */ |
|
| 745 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 746 | - |
|
| 747 | - /** |
|
| 748 | - * The WordLift entity type settings admin page controller. |
|
| 749 | - */ |
|
| 750 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 751 | - |
|
| 752 | - /** |
|
| 753 | - * The admin 'Download Your Data' page. |
|
| 754 | - */ |
|
| 755 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 756 | - |
|
| 757 | - /** |
|
| 758 | - * The admin 'Download Your Data' page. |
|
| 759 | - */ |
|
| 760 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 761 | - |
|
| 762 | - /** |
|
| 763 | - * The admin 'WordLift Settings' page. |
|
| 764 | - */ |
|
| 765 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 766 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 767 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 768 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 769 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 770 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 771 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 772 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 773 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 774 | - |
|
| 775 | - /** Admin Pages */ |
|
| 776 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 777 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 778 | - |
|
| 779 | - /** |
|
| 780 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 781 | - * side of the site. |
|
| 782 | - */ |
|
| 783 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 784 | - |
|
| 785 | - /** |
|
| 786 | - * The shortcode abstract class. |
|
| 787 | - */ |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 789 | - |
|
| 790 | - /** |
|
| 791 | - * The Timeline shortcode. |
|
| 792 | - */ |
|
| 793 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 794 | - |
|
| 795 | - /** |
|
| 796 | - * The Navigator shortcode. |
|
| 797 | - */ |
|
| 798 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 815 | + /** |
|
| 816 | + * The ShareThis service. |
|
| 817 | + */ |
|
| 818 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 799 | 819 | |
| 800 | - /** |
|
| 801 | - * The chord shortcode. |
|
| 802 | - */ |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 820 | + /** |
|
| 821 | + * The SEO service. |
|
| 822 | + */ |
|
| 823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 804 | 824 | |
| 805 | - /** |
|
| 806 | - * The geomap shortcode. |
|
| 807 | - */ |
|
| 808 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 809 | - |
|
| 810 | - /** |
|
| 811 | - * The entity cloud shortcode. |
|
| 812 | - */ |
|
| 813 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 814 | - |
|
| 815 | - /** |
|
| 816 | - * The ShareThis service. |
|
| 817 | - */ |
|
| 818 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 819 | - |
|
| 820 | - /** |
|
| 821 | - * The SEO service. |
|
| 822 | - */ |
|
| 823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 824 | - |
|
| 825 | - /** |
|
| 826 | - * The AMP service. |
|
| 827 | - */ |
|
| 828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 825 | + /** |
|
| 826 | + * The AMP service. |
|
| 827 | + */ |
|
| 828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 829 | 829 | |
| 830 | - /** Widgets */ |
|
| 831 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 830 | + /** Widgets */ |
|
| 831 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 833 | 833 | |
| 834 | - $this->loader = new Wordlift_Loader(); |
|
| 834 | + $this->loader = new Wordlift_Loader(); |
|
| 835 | 835 | |
| 836 | - // Instantiate a global logger. |
|
| 837 | - global $wl_logger; |
|
| 838 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 836 | + // Instantiate a global logger. |
|
| 837 | + global $wl_logger; |
|
| 838 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 839 | 839 | |
| 840 | - // Create the configuration service. |
|
| 841 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 840 | + // Create the configuration service. |
|
| 841 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 842 | 842 | |
| 843 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 844 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 843 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 844 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 845 | 845 | |
| 846 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 847 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 846 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 847 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 848 | 848 | |
| 849 | - // Create an instance of the UI service. |
|
| 850 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 849 | + // Create an instance of the UI service. |
|
| 850 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 851 | 851 | |
| 852 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 853 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 852 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 853 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 854 | 854 | |
| 855 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 855 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 856 | 856 | |
| 857 | - // Create an instance of the Schema service. |
|
| 858 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 859 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 857 | + // Create an instance of the Schema service. |
|
| 858 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 859 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 860 | 860 | |
| 861 | - // Create an instance of the Notice service. |
|
| 862 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 861 | + // Create an instance of the Notice service. |
|
| 862 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 863 | 863 | |
| 864 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 865 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 864 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 865 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 866 | 866 | |
| 867 | - // Create an instance of the User service. |
|
| 868 | - $this->user_service = new Wordlift_User_Service(); |
|
| 867 | + // Create an instance of the User service. |
|
| 868 | + $this->user_service = new Wordlift_User_Service(); |
|
| 869 | 869 | |
| 870 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 871 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 870 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 871 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 872 | 872 | |
| 873 | - // Create a new instance of the Redirect service. |
|
| 874 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 873 | + // Create a new instance of the Redirect service. |
|
| 874 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 875 | 875 | |
| 876 | - // Initialize the shortcodes. |
|
| 877 | - new Wordlift_Navigator_Shortcode(); |
|
| 878 | - new Wordlift_Chord_Shortcode(); |
|
| 879 | - new Wordlift_Geomap_Shortcode(); |
|
| 880 | - new Wordlift_Timeline_Shortcode(); |
|
| 881 | - new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 876 | + // Initialize the shortcodes. |
|
| 877 | + new Wordlift_Navigator_Shortcode(); |
|
| 878 | + new Wordlift_Chord_Shortcode(); |
|
| 879 | + new Wordlift_Geomap_Shortcode(); |
|
| 880 | + new Wordlift_Timeline_Shortcode(); |
|
| 881 | + new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 882 | 882 | |
| 883 | - // Initialize the SEO service. |
|
| 884 | - new Wordlift_Seo_Service(); |
|
| 883 | + // Initialize the SEO service. |
|
| 884 | + new Wordlift_Seo_Service(); |
|
| 885 | 885 | |
| 886 | - // Initialize the AMP service. |
|
| 887 | - new Wordlift_AMP_Service(); |
|
| 886 | + // Initialize the AMP service. |
|
| 887 | + new Wordlift_AMP_Service(); |
|
| 888 | 888 | |
| 889 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 889 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 890 | 890 | |
| 891 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 891 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 892 | 892 | |
| 893 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 894 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 893 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 894 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 895 | 895 | |
| 896 | - // Create an instance of the PrimaShop adapter. |
|
| 897 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 896 | + // Create an instance of the PrimaShop adapter. |
|
| 897 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 898 | 898 | |
| 899 | - // Create an import service instance to hook later to WP's import function. |
|
| 900 | - $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() ); |
|
| 899 | + // Create an import service instance to hook later to WP's import function. |
|
| 900 | + $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() ); |
|
| 901 | 901 | |
| 902 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 902 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 903 | 903 | |
| 904 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 905 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 904 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 905 | + $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 906 | 906 | |
| 907 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 907 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 908 | 908 | |
| 909 | - // Create the entity rating service. |
|
| 910 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 909 | + // Create the entity rating service. |
|
| 910 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 911 | 911 | |
| 912 | - // Create entity list customization (wp-admin/edit.php) |
|
| 913 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 912 | + // Create entity list customization (wp-admin/edit.php) |
|
| 913 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 914 | 914 | |
| 915 | - // Create a new instance of the Redirect service. |
|
| 916 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 915 | + // Create a new instance of the Redirect service. |
|
| 916 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 917 | 917 | |
| 918 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 919 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 918 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 919 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 920 | 920 | |
| 921 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 921 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 922 | 922 | |
| 923 | - // Instantiate the JSON-LD service. |
|
| 924 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 925 | - $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 ); |
|
| 926 | - $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 ); |
|
| 927 | - $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 ); |
|
| 928 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 923 | + // Instantiate the JSON-LD service. |
|
| 924 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 925 | + $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 ); |
|
| 926 | + $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 ); |
|
| 927 | + $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 ); |
|
| 928 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 929 | 929 | |
| 930 | - // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 931 | - $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 930 | + // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 931 | + $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 932 | 932 | |
| 933 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 934 | - $publisher_service = new Wordlift_Publisher_Service(); |
|
| 935 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 933 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 934 | + $publisher_service = new Wordlift_Publisher_Service(); |
|
| 935 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 936 | 936 | |
| 937 | - /** Adapters. */ |
|
| 938 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 937 | + /** Adapters. */ |
|
| 938 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 939 | 939 | |
| 940 | - /** WordPress Admin UI. */ |
|
| 940 | + /** WordPress Admin UI. */ |
|
| 941 | 941 | |
| 942 | - // UI elements. |
|
| 943 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 944 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 945 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 946 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 947 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 942 | + // UI elements. |
|
| 943 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 944 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 945 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 946 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 947 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 948 | 948 | |
| 949 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 950 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element ); |
|
| 951 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 949 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 950 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element ); |
|
| 951 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 952 | 952 | |
| 953 | - // Pages. |
|
| 954 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 953 | + // Pages. |
|
| 954 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 955 | 955 | |
| 956 | - // create an instance of the entity type list admin page controller. |
|
| 957 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 956 | + // create an instance of the entity type list admin page controller. |
|
| 957 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 958 | 958 | |
| 959 | - // create an instance of the entity type etting admin page controller. |
|
| 960 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 959 | + // create an instance of the entity type etting admin page controller. |
|
| 960 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 961 | 961 | |
| 962 | - /** Widgets */ |
|
| 963 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 962 | + /** Widgets */ |
|
| 963 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 964 | 964 | |
| 965 | - //** WordPress Admin */ |
|
| 966 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 967 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 965 | + //** WordPress Admin */ |
|
| 966 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 967 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 968 | 968 | |
| 969 | - // Create an instance of the install wizard. |
|
| 970 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 969 | + // Create an instance of the install wizard. |
|
| 970 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 971 | 971 | |
| 972 | - // Create an instance of the content filter service. |
|
| 973 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service ); |
|
| 972 | + // Create an instance of the content filter service. |
|
| 973 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service ); |
|
| 974 | 974 | |
| 975 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 975 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 976 | 976 | |
| 977 | - $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 977 | + $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 978 | 978 | |
| 979 | - // Load the debug service if WP is in debug mode. |
|
| 980 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 982 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 983 | - } |
|
| 979 | + // Load the debug service if WP is in debug mode. |
|
| 980 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 982 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 983 | + } |
|
| 984 | 984 | |
| 985 | - } |
|
| 985 | + } |
|
| 986 | 986 | |
| 987 | - /** |
|
| 988 | - * Define the locale for this plugin for internationalization. |
|
| 989 | - * |
|
| 990 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 991 | - * with WordPress. |
|
| 992 | - * |
|
| 993 | - * @since 1.0.0 |
|
| 994 | - * @access private |
|
| 995 | - */ |
|
| 996 | - private function set_locale() { |
|
| 987 | + /** |
|
| 988 | + * Define the locale for this plugin for internationalization. |
|
| 989 | + * |
|
| 990 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 991 | + * with WordPress. |
|
| 992 | + * |
|
| 993 | + * @since 1.0.0 |
|
| 994 | + * @access private |
|
| 995 | + */ |
|
| 996 | + private function set_locale() { |
|
| 997 | 997 | |
| 998 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 999 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 998 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 999 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1000 | 1000 | |
| 1001 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1001 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1002 | 1002 | |
| 1003 | - } |
|
| 1003 | + } |
|
| 1004 | 1004 | |
| 1005 | - /** |
|
| 1006 | - * Register all of the hooks related to the admin area functionality |
|
| 1007 | - * of the plugin. |
|
| 1008 | - * |
|
| 1009 | - * @since 1.0.0 |
|
| 1010 | - * @access private |
|
| 1011 | - */ |
|
| 1012 | - private function define_admin_hooks() { |
|
| 1005 | + /** |
|
| 1006 | + * Register all of the hooks related to the admin area functionality |
|
| 1007 | + * of the plugin. |
|
| 1008 | + * |
|
| 1009 | + * @since 1.0.0 |
|
| 1010 | + * @access private |
|
| 1011 | + */ |
|
| 1012 | + private function define_admin_hooks() { |
|
| 1013 | 1013 | |
| 1014 | - $plugin_admin = new Wordlift_Admin( |
|
| 1015 | - $this->get_plugin_name(), |
|
| 1016 | - $this->get_version(), |
|
| 1017 | - $this->configuration_service, |
|
| 1018 | - $this->notice_service |
|
| 1019 | - ); |
|
| 1014 | + $plugin_admin = new Wordlift_Admin( |
|
| 1015 | + $this->get_plugin_name(), |
|
| 1016 | + $this->get_version(), |
|
| 1017 | + $this->configuration_service, |
|
| 1018 | + $this->notice_service |
|
| 1019 | + ); |
|
| 1020 | 1020 | |
| 1021 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1022 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1021 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1022 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1023 | 1023 | |
| 1024 | - // Hook the init action to the Topic Taxonomy service. |
|
| 1025 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1024 | + // Hook the init action to the Topic Taxonomy service. |
|
| 1025 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1026 | 1026 | |
| 1027 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1028 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1027 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1028 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1029 | 1029 | |
| 1030 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1031 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1030 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1031 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1032 | 1032 | |
| 1033 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1034 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1033 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1034 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1035 | 1035 | |
| 1036 | - // Hook posts inserts (or updates) to the user service. |
|
| 1037 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1036 | + // Hook posts inserts (or updates) to the user service. |
|
| 1037 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1038 | 1038 | |
| 1039 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1040 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1039 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1040 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1041 | 1041 | |
| 1042 | - // Register custom allowed redirect hosts. |
|
| 1043 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1044 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1045 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1046 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1047 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1048 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1049 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1042 | + // Register custom allowed redirect hosts. |
|
| 1043 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1044 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1045 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1046 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1047 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1048 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1049 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1050 | 1050 | |
| 1051 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1052 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1053 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1054 | - $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1051 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1052 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1053 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1054 | + $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1055 | 1055 | |
| 1056 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1057 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1056 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1057 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1058 | 1058 | |
| 1059 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1060 | - // Add custom columns |
|
| 1061 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1062 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1063 | - // Add 4W selection |
|
| 1064 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1065 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1059 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1060 | + // Add custom columns |
|
| 1061 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1062 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1063 | + // Add 4W selection |
|
| 1064 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1065 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1066 | 1066 | |
| 1067 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1067 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1068 | 1068 | |
| 1069 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1070 | - // entities. |
|
| 1071 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1069 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1070 | + // entities. |
|
| 1071 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1072 | 1072 | |
| 1073 | - // Filter imported post meta. |
|
| 1074 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1073 | + // Filter imported post meta. |
|
| 1074 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1075 | 1075 | |
| 1076 | - // Notify the import service when an import starts and ends. |
|
| 1077 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1078 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1079 | - |
|
| 1080 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1081 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1076 | + // Notify the import service when an import starts and ends. |
|
| 1077 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1078 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1079 | + |
|
| 1080 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1081 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1082 | 1082 | |
| 1083 | - // Hook the menu to the Download Your Data page. |
|
| 1084 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1085 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1086 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1087 | - |
|
| 1088 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1089 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1083 | + // Hook the menu to the Download Your Data page. |
|
| 1084 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1085 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1086 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1087 | + |
|
| 1088 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1089 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1090 | 1090 | |
| 1091 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1092 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1091 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1092 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1093 | 1093 | |
| 1094 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1095 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1094 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1095 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1096 | 1096 | |
| 1097 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1098 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1097 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1098 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1099 | 1099 | |
| 1100 | - // Hook the admin_init to the settings page. |
|
| 1101 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1100 | + // Hook the admin_init to the settings page. |
|
| 1101 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1102 | 1102 | |
| 1103 | - // Hook the menu creation on the general wordlift menu creation |
|
| 1104 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1105 | - |
|
| 1106 | - // Hook key update. |
|
| 1107 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1108 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1103 | + // Hook the menu creation on the general wordlift menu creation |
|
| 1104 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1105 | + |
|
| 1106 | + // Hook key update. |
|
| 1107 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1108 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1109 | 1109 | |
| 1110 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1111 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1110 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1111 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1112 | 1112 | |
| 1113 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1114 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1113 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1114 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1115 | 1115 | |
| 1116 | - // Hook row actions for the entity type list admin. |
|
| 1117 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1116 | + // Hook row actions for the entity type list admin. |
|
| 1117 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1118 | 1118 | |
| 1119 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1120 | - // page on wordpress versions before 4.7. |
|
| 1121 | - global $wp_version; |
|
| 1122 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1123 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1124 | - } |
|
| 1119 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1120 | + // page on wordpress versions before 4.7. |
|
| 1121 | + global $wp_version; |
|
| 1122 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1123 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1124 | + } |
|
| 1125 | 1125 | |
| 1126 | - /** Adapters. */ |
|
| 1127 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1126 | + /** Adapters. */ |
|
| 1127 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1128 | 1128 | |
| 1129 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1130 | - if ( is_multisite() ) { |
|
| 1131 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1132 | - } |
|
| 1133 | - } |
|
| 1129 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1130 | + if ( is_multisite() ) { |
|
| 1131 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1132 | + } |
|
| 1133 | + } |
|
| 1134 | 1134 | |
| 1135 | - /** |
|
| 1136 | - * Register all of the hooks related to the public-facing functionality |
|
| 1137 | - * of the plugin. |
|
| 1138 | - * |
|
| 1139 | - * @since 1.0.0 |
|
| 1140 | - * @access private |
|
| 1141 | - */ |
|
| 1142 | - private function define_public_hooks() { |
|
| 1135 | + /** |
|
| 1136 | + * Register all of the hooks related to the public-facing functionality |
|
| 1137 | + * of the plugin. |
|
| 1138 | + * |
|
| 1139 | + * @since 1.0.0 |
|
| 1140 | + * @access private |
|
| 1141 | + */ |
|
| 1142 | + private function define_public_hooks() { |
|
| 1143 | 1143 | |
| 1144 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1144 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1145 | 1145 | |
| 1146 | - // Register the entity post type. |
|
| 1147 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1146 | + // Register the entity post type. |
|
| 1147 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1148 | 1148 | |
| 1149 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1150 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1151 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 1152 | - $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 ); |
|
| 1153 | - $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 ); |
|
| 1149 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1150 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1151 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 1152 | + $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 ); |
|
| 1153 | + $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 ); |
|
| 1154 | 1154 | |
| 1155 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1156 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1155 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1156 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1157 | 1157 | |
| 1158 | - // Hook the content filter service to add entity links. |
|
| 1159 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1158 | + // Hook the content filter service to add entity links. |
|
| 1159 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1160 | 1160 | |
| 1161 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1162 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1161 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1162 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1163 | 1163 | |
| 1164 | - // Hook the ShareThis service. |
|
| 1165 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1166 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1164 | + // Hook the ShareThis service. |
|
| 1165 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1166 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1167 | 1167 | |
| 1168 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1169 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1168 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1169 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1170 | 1170 | |
| 1171 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1172 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1173 | - // to categories. |
|
| 1174 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1171 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1172 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1173 | + // to categories. |
|
| 1174 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1175 | 1175 | |
| 1176 | - /* |
|
| 1176 | + /* |
|
| 1177 | 1177 | * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service` |
| 1178 | 1178 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1179 | 1179 | * order of start time. |
| 1180 | 1180 | */ |
| 1181 | - $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1182 | - |
|
| 1183 | - } |
|
| 1184 | - |
|
| 1185 | - /** |
|
| 1186 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1187 | - * |
|
| 1188 | - * @since 1.0.0 |
|
| 1189 | - */ |
|
| 1190 | - public function run() { |
|
| 1191 | - $this->loader->run(); |
|
| 1192 | - } |
|
| 1193 | - |
|
| 1194 | - /** |
|
| 1195 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1196 | - * WordPress and to define internationalization functionality. |
|
| 1197 | - * |
|
| 1198 | - * @since 1.0.0 |
|
| 1199 | - * @return string The name of the plugin. |
|
| 1200 | - */ |
|
| 1201 | - public function get_plugin_name() { |
|
| 1202 | - return $this->plugin_name; |
|
| 1203 | - } |
|
| 1204 | - |
|
| 1205 | - /** |
|
| 1206 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1207 | - * |
|
| 1208 | - * @since 1.0.0 |
|
| 1209 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1210 | - */ |
|
| 1211 | - public function get_loader() { |
|
| 1212 | - return $this->loader; |
|
| 1213 | - } |
|
| 1214 | - |
|
| 1215 | - /** |
|
| 1216 | - * Retrieve the version number of the plugin. |
|
| 1217 | - * |
|
| 1218 | - * @since 1.0.0 |
|
| 1219 | - * @return string The version number of the plugin. |
|
| 1220 | - */ |
|
| 1221 | - public function get_version() { |
|
| 1222 | - return $this->version; |
|
| 1223 | - } |
|
| 1181 | + $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1182 | + |
|
| 1183 | + } |
|
| 1184 | + |
|
| 1185 | + /** |
|
| 1186 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1187 | + * |
|
| 1188 | + * @since 1.0.0 |
|
| 1189 | + */ |
|
| 1190 | + public function run() { |
|
| 1191 | + $this->loader->run(); |
|
| 1192 | + } |
|
| 1193 | + |
|
| 1194 | + /** |
|
| 1195 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1196 | + * WordPress and to define internationalization functionality. |
|
| 1197 | + * |
|
| 1198 | + * @since 1.0.0 |
|
| 1199 | + * @return string The name of the plugin. |
|
| 1200 | + */ |
|
| 1201 | + public function get_plugin_name() { |
|
| 1202 | + return $this->plugin_name; |
|
| 1203 | + } |
|
| 1204 | + |
|
| 1205 | + /** |
|
| 1206 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1207 | + * |
|
| 1208 | + * @since 1.0.0 |
|
| 1209 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1210 | + */ |
|
| 1211 | + public function get_loader() { |
|
| 1212 | + return $this->loader; |
|
| 1213 | + } |
|
| 1214 | + |
|
| 1215 | + /** |
|
| 1216 | + * Retrieve the version number of the plugin. |
|
| 1217 | + * |
|
| 1218 | + * @since 1.0.0 |
|
| 1219 | + * @return string The version number of the plugin. |
|
| 1220 | + */ |
|
| 1221 | + public function get_version() { |
|
| 1222 | + return $this->version; |
|
| 1223 | + } |
|
| 1224 | 1224 | |
| 1225 | 1225 | } |
@@ -16,23 +16,23 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
| 18 | 18 | |
| 19 | - // If the post is published, add the button to view Redlink's linked data. |
|
| 20 | - if ( 'publish' == get_post_status( $post_id ) ) { |
|
| 21 | - if ( $uri = wl_get_entity_uri( $post_id ) ) { |
|
| 22 | - $uri_esc = esc_attr( wl_get_entity_uri( $post_id ) ); |
|
| 23 | - $lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc; |
|
| 24 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 25 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 26 | - "</a></span>\n"; |
|
| 27 | - } |
|
| 28 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 29 | - urlencode( get_permalink( $post_id ) ) . |
|
| 30 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 31 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 32 | - "</a></span>\n"; |
|
| 33 | - } |
|
| 19 | + // If the post is published, add the button to view Redlink's linked data. |
|
| 20 | + if ( 'publish' == get_post_status( $post_id ) ) { |
|
| 21 | + if ( $uri = wl_get_entity_uri( $post_id ) ) { |
|
| 22 | + $uri_esc = esc_attr( wl_get_entity_uri( $post_id ) ); |
|
| 23 | + $lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc; |
|
| 24 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 25 | + esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 26 | + "</a></span>\n"; |
|
| 27 | + } |
|
| 28 | + $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 29 | + urlencode( get_permalink( $post_id ) ) . |
|
| 30 | + "' class='button button-small wl-button' target='_blank'>" . |
|
| 31 | + esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 32 | + "</a></span>\n"; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - return $html; |
|
| 35 | + return $html; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
@@ -14,25 +14,25 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @return The enhanced html. |
| 16 | 16 | */ |
| 17 | -function wl_admin_permalink_html( $html, $post_id, $new_title, $new_slug ) { |
|
| 17 | +function wl_admin_permalink_html($html, $post_id, $new_title, $new_slug) { |
|
| 18 | 18 | |
| 19 | 19 | // If the post is published, add the button to view Redlink's linked data. |
| 20 | - if ( 'publish' == get_post_status( $post_id ) ) { |
|
| 21 | - if ( $uri = wl_get_entity_uri( $post_id ) ) { |
|
| 22 | - $uri_esc = esc_attr( wl_get_entity_uri( $post_id ) ); |
|
| 23 | - $lod_view_href = 'http://lodview.it/lodview/?IRI=' . $uri_esc; |
|
| 24 | - $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>" . |
|
| 25 | - esc_html__( 'View Linked Data', 'wordlift' ) . |
|
| 20 | + if ('publish' == get_post_status($post_id)) { |
|
| 21 | + if ($uri = wl_get_entity_uri($post_id)) { |
|
| 22 | + $uri_esc = esc_attr(wl_get_entity_uri($post_id)); |
|
| 23 | + $lod_view_href = 'http://lodview.it/lodview/?IRI='.$uri_esc; |
|
| 24 | + $html .= "<span id='view-post-btn'><a href='$lod_view_href' class='button button-small wl-button' target='_blank'>". |
|
| 25 | + esc_html__('View Linked Data', 'wordlift'). |
|
| 26 | 26 | "</a></span>\n"; |
| 27 | 27 | } |
| 28 | - $html .= "<span id='view-post-btn'><a href='" . WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL . |
|
| 29 | - urlencode( get_permalink( $post_id ) ) . |
|
| 30 | - "' class='button button-small wl-button' target='_blank'>" . |
|
| 31 | - esc_html__( 'Test Google Rich Snippets', 'wordlift' ) . |
|
| 28 | + $html .= "<span id='view-post-btn'><a href='".WL_CONFIG_TEST_GOOGLE_RICH_SNIPPETS_URL. |
|
| 29 | + urlencode(get_permalink($post_id)). |
|
| 30 | + "' class='button button-small wl-button' target='_blank'>". |
|
| 31 | + esc_html__('Test Google Rich Snippets', 'wordlift'). |
|
| 32 | 32 | "</a></span>\n"; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | return $html; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -add_filter( 'get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4 ); |
|
| 38 | +add_filter('get_sample_permalink_html', 'wl_admin_permalink_html', PHP_INT_MAX, 4); |
|