@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // If this file is called directly, abort. |
| 28 | 28 | if ( ! defined( 'WPINC' ) ) { |
| 29 | - die; |
|
| 29 | + die; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Include WordLift constants. |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function wl_write_log( $log ) { |
| 50 | 50 | |
| 51 | - Wordlift_Log_Service::get_instance()->info( $log ); |
|
| 51 | + Wordlift_Log_Service::get_instance()->info( $log ); |
|
| 52 | 52 | |
| 53 | 53 | // $handler = apply_filters( 'wl_write_log_handler', null ); |
| 54 | 54 | // |
@@ -76,20 +76,20 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function wl_write_log_handler( $log, $caller = null ) { |
| 78 | 78 | |
| 79 | - global $wl_logger; |
|
| 79 | + global $wl_logger; |
|
| 80 | 80 | |
| 81 | - if ( true === WP_DEBUG ) { |
|
| 81 | + if ( true === WP_DEBUG ) { |
|
| 82 | 82 | |
| 83 | - $message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) . |
|
| 84 | - ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) ); |
|
| 83 | + $message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) . |
|
| 84 | + ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) ); |
|
| 85 | 85 | |
| 86 | - if ( isset( $wl_logger ) ) { |
|
| 87 | - $wl_logger->info( $message ); |
|
| 88 | - } else { |
|
| 89 | - error_log( $message ); |
|
| 90 | - } |
|
| 86 | + if ( isset( $wl_logger ) ) { |
|
| 87 | + $wl_logger->info( $message ); |
|
| 88 | + } else { |
|
| 89 | + error_log( $message ); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function wl_write_log_hide_key( $text ) { |
| 108 | 108 | |
| 109 | - return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 109 | + return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function wl_queue_sparql_update_query( $query ) { |
| 120 | 120 | |
| 121 | - $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 122 | - file_put_contents( $filename, $query . "\n", FILE_APPEND ); |
|
| 121 | + $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 122 | + file_put_contents( $filename, $query . "\n", FILE_APPEND ); |
|
| 123 | 123 | |
| 124 | - wl_write_log( "wl_queue_sparql_update_query [ filename :: $filename ]" ); |
|
| 124 | + wl_write_log( "wl_queue_sparql_update_query [ filename :: $filename ]" ); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -131,28 +131,28 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function wl_execute_saved_sparql_update_query( $request_id ) { |
| 133 | 133 | |
| 134 | - $filename = WL_TEMP_DIR . $request_id . '.sparql'; |
|
| 134 | + $filename = WL_TEMP_DIR . $request_id . '.sparql'; |
|
| 135 | 135 | |
| 136 | - // If the file doesn't exist, exit. |
|
| 137 | - if ( ! file_exists( $filename ) ) { |
|
| 138 | - wl_write_log( "wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]" ); |
|
| 136 | + // If the file doesn't exist, exit. |
|
| 137 | + if ( ! file_exists( $filename ) ) { |
|
| 138 | + wl_write_log( "wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]" ); |
|
| 139 | 139 | |
| 140 | - return; |
|
| 141 | - } |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - wl_write_log( "wl_execute_saved_sparql_update_query [ filename :: $filename ]" ); |
|
| 143 | + wl_write_log( "wl_execute_saved_sparql_update_query [ filename :: $filename ]" ); |
|
| 144 | 144 | |
| 145 | - // Get the query saved in the file. |
|
| 146 | - $query = file_get_contents( $filename ); |
|
| 145 | + // Get the query saved in the file. |
|
| 146 | + $query = file_get_contents( $filename ); |
|
| 147 | 147 | |
| 148 | - // Execute the SPARQL query. |
|
| 149 | - rl_execute_sparql_update_query( $query, false ); |
|
| 148 | + // Execute the SPARQL query. |
|
| 149 | + rl_execute_sparql_update_query( $query, false ); |
|
| 150 | 150 | |
| 151 | - // Reindex the triple store. |
|
| 152 | - wordlift_reindex_triple_store(); |
|
| 151 | + // Reindex the triple store. |
|
| 152 | + wordlift_reindex_triple_store(); |
|
| 153 | 153 | |
| 154 | - // Delete the temporary file. |
|
| 155 | - unlink( $filename ); |
|
| 154 | + // Delete the temporary file. |
|
| 155 | + unlink( $filename ); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | add_action( 'wl_execute_saved_sparql_update_query', 'wl_execute_saved_sparql_update_query', 10, 1 ); |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function wordlift_buttonhooks() { |
| 164 | 164 | |
| 165 | - // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
|
| 166 | - if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 167 | - add_filter( 'mce_external_plugins', 'wordlift_register_tinymce_javascript' ); |
|
| 168 | - } |
|
| 165 | + // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
|
| 166 | + if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 167 | + add_filter( 'mce_external_plugins', 'wordlift_register_tinymce_javascript' ); |
|
| 168 | + } |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | function wordlift_register_tinymce_javascript( $plugin_array ) { |
| 179 | 179 | |
| 180 | - // add the wordlift plugin. |
|
| 181 | - // We can't use the minified version here. |
|
| 180 | + // add the wordlift plugin. |
|
| 181 | + // We can't use the minified version here. |
|
| 182 | 182 | |
| 183 | - // Get WordLift's version as a cache killer. |
|
| 184 | - $version = Wordlift::get_instance()->get_version(); |
|
| 183 | + // Get WordLift's version as a cache killer. |
|
| 184 | + $version = Wordlift::get_instance()->get_version(); |
|
| 185 | 185 | |
| 186 | - // Add our own JavaScript file to TinyMCE's extensions. |
|
| 187 | - $plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 186 | + // Add our own JavaScript file to TinyMCE's extensions. |
|
| 187 | + $plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 188 | 188 | |
| 189 | - return $plugin_array; |
|
| 189 | + return $plugin_array; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -194,21 +194,21 @@ discard block |
||
| 194 | 194 | * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/ |
| 195 | 195 | */ |
| 196 | 196 | function wordlift_allowed_post_tags() { |
| 197 | - global $allowedposttags; |
|
| 198 | - |
|
| 199 | - $tags = array( 'span' ); |
|
| 200 | - $new_attributes = array( |
|
| 201 | - 'itemscope' => array(), |
|
| 202 | - 'itemtype' => array(), |
|
| 203 | - 'itemprop' => array(), |
|
| 204 | - 'itemid' => array(), |
|
| 205 | - ); |
|
| 206 | - |
|
| 207 | - foreach ( $tags as $tag ) { |
|
| 208 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 209 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 210 | - } |
|
| 211 | - } |
|
| 197 | + global $allowedposttags; |
|
| 198 | + |
|
| 199 | + $tags = array( 'span' ); |
|
| 200 | + $new_attributes = array( |
|
| 201 | + 'itemscope' => array(), |
|
| 202 | + 'itemtype' => array(), |
|
| 203 | + 'itemprop' => array(), |
|
| 204 | + 'itemid' => array(), |
|
| 205 | + ); |
|
| 206 | + |
|
| 207 | + foreach ( $tags as $tag ) { |
|
| 208 | + if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 209 | + $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // init process for button control |
@@ -222,28 +222,28 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | function wordlift_admin_enqueue_scripts() { |
| 224 | 224 | |
| 225 | - // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
| 226 | - wp_enqueue_script( 'wpdialogs' ); |
|
| 227 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 225 | + // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
|
| 226 | + wp_enqueue_script( 'wpdialogs' ); |
|
| 227 | + wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 228 | 228 | |
| 229 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 229 | + wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 230 | 230 | |
| 231 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 232 | - wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' ); |
|
| 233 | - wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' ); |
|
| 234 | - wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' ); |
|
| 235 | - wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' ); |
|
| 231 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 232 | + wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' ); |
|
| 233 | + wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' ); |
|
| 234 | + wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' ); |
|
| 235 | + wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' ); |
|
| 236 | 236 | |
| 237 | - // Disable auto-save for custom entity posts only |
|
| 238 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 239 | - wp_dequeue_script( 'autosave' ); |
|
| 240 | - } |
|
| 237 | + // Disable auto-save for custom entity posts only |
|
| 238 | + if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 239 | + wp_dequeue_script( 'autosave' ); |
|
| 240 | + } |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' ); |
| 244 | 244 | |
| 245 | 245 | function wl_enqueue_scripts() { |
| 246 | - wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' ); |
|
| 246 | + wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' ); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' ); |
@@ -258,18 +258,18 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | function wordlift_allowed_html( $allowedtags, $context ) { |
| 260 | 260 | |
| 261 | - if ( 'post' !== $context ) { |
|
| 262 | - return $allowedtags; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - return array_merge_recursive( $allowedtags, array( |
|
| 266 | - 'span' => array( |
|
| 267 | - 'itemscope' => true, |
|
| 268 | - 'itemtype' => true, |
|
| 269 | - 'itemid' => true, |
|
| 270 | - 'itemprop' => true, |
|
| 271 | - ), |
|
| 272 | - ) ); |
|
| 261 | + if ( 'post' !== $context ) { |
|
| 262 | + return $allowedtags; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + return array_merge_recursive( $allowedtags, array( |
|
| 266 | + 'span' => array( |
|
| 267 | + 'itemscope' => true, |
|
| 268 | + 'itemtype' => true, |
|
| 269 | + 'itemid' => true, |
|
| 270 | + 'itemprop' => true, |
|
| 271 | + ), |
|
| 272 | + ) ); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | function wl_get_coordinates( $post_id ) { |
| 285 | 285 | |
| 286 | - $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 287 | - $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 286 | + $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 287 | + $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 288 | 288 | |
| 289 | - // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
|
| 290 | - // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 291 | - return array( |
|
| 292 | - 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 293 | - 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 294 | - ); |
|
| 289 | + // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
|
| 290 | + // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
|
| 291 | + return array( |
|
| 292 | + 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 293 | + 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 294 | + ); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -303,13 +303,13 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | function wl_get_post_modified_time( $post ) { |
| 305 | 305 | |
| 306 | - $date_modified = get_post_modified_time( 'c', true, $post ); |
|
| 306 | + $date_modified = get_post_modified_time( 'c', true, $post ); |
|
| 307 | 307 | |
| 308 | - if ( '-' === substr( $date_modified, 0, 1 ) ) { |
|
| 309 | - return get_the_time( 'c', $post ); |
|
| 310 | - } |
|
| 308 | + if ( '-' === substr( $date_modified, 0, 1 ) ) { |
|
| 309 | + return get_the_time( 'c', $post ); |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - return $date_modified; |
|
| 312 | + return $date_modified; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -322,42 +322,42 @@ discard block |
||
| 322 | 322 | function wl_get_image_urls( $post_id ) { |
| 323 | 323 | |
| 324 | 324 | |
| 325 | - // If there is a featured image it has the priority |
|
| 326 | - $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
| 327 | - if ( is_numeric( $featured_image_id ) ) { |
|
| 328 | - $image_url = wp_get_attachment_url( $featured_image_id ); |
|
| 325 | + // If there is a featured image it has the priority |
|
| 326 | + $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
| 327 | + if ( is_numeric( $featured_image_id ) ) { |
|
| 328 | + $image_url = wp_get_attachment_url( $featured_image_id ); |
|
| 329 | 329 | |
| 330 | - return array( $image_url ); |
|
| 331 | - } |
|
| 330 | + return array( $image_url ); |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - // wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" ); |
|
| 333 | + // wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" ); |
|
| 334 | 334 | |
| 335 | - $images = get_children( array( |
|
| 336 | - 'post_parent' => $post_id, |
|
| 337 | - 'post_type' => 'attachment', |
|
| 338 | - 'post_mime_type' => 'image', |
|
| 339 | - ) ); |
|
| 335 | + $images = get_children( array( |
|
| 336 | + 'post_parent' => $post_id, |
|
| 337 | + 'post_type' => 'attachment', |
|
| 338 | + 'post_mime_type' => 'image', |
|
| 339 | + ) ); |
|
| 340 | 340 | |
| 341 | - // Return an empty array if no image is found. |
|
| 342 | - if ( empty( $images ) ) { |
|
| 343 | - return array(); |
|
| 344 | - } |
|
| 341 | + // Return an empty array if no image is found. |
|
| 342 | + if ( empty( $images ) ) { |
|
| 343 | + return array(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - // Prepare the return array. |
|
| 347 | - $image_urls = array(); |
|
| 346 | + // Prepare the return array. |
|
| 347 | + $image_urls = array(); |
|
| 348 | 348 | |
| 349 | - // Collect the URLs. |
|
| 350 | - foreach ( $images as $attachment_id => $attachment ) { |
|
| 351 | - $image_url = wp_get_attachment_url( $attachment_id ); |
|
| 352 | - // Ensure the URL isn't collected already. |
|
| 353 | - if ( ! in_array( $image_url, $image_urls ) ) { |
|
| 354 | - array_push( $image_urls, $image_url ); |
|
| 355 | - } |
|
| 356 | - } |
|
| 349 | + // Collect the URLs. |
|
| 350 | + foreach ( $images as $attachment_id => $attachment ) { |
|
| 351 | + $image_url = wp_get_attachment_url( $attachment_id ); |
|
| 352 | + // Ensure the URL isn't collected already. |
|
| 353 | + if ( ! in_array( $image_url, $image_urls ) ) { |
|
| 354 | + array_push( $image_urls, $image_url ); |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | - // wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" ); |
|
| 358 | + // wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" ); |
|
| 359 | 359 | |
| 360 | - return $image_urls; |
|
| 360 | + return $image_urls; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -370,19 +370,19 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | function wl_get_sparql_images( $uri, $post_id ) { |
| 372 | 372 | |
| 373 | - $sparql = ''; |
|
| 373 | + $sparql = ''; |
|
| 374 | 374 | |
| 375 | - // Get the escaped URI. |
|
| 376 | - $uri_e = esc_html( $uri ); |
|
| 375 | + // Get the escaped URI. |
|
| 376 | + $uri_e = esc_html( $uri ); |
|
| 377 | 377 | |
| 378 | - // Add SPARQL stmts to write the schema:image. |
|
| 379 | - $image_urls = wl_get_image_urls( $post_id ); |
|
| 380 | - foreach ( $image_urls as $image_url ) { |
|
| 381 | - $image_url_esc = wl_sparql_escape_uri( $image_url ); |
|
| 382 | - $sparql .= " <$uri_e> schema:image <$image_url_esc> . \n"; |
|
| 383 | - } |
|
| 378 | + // Add SPARQL stmts to write the schema:image. |
|
| 379 | + $image_urls = wl_get_image_urls( $post_id ); |
|
| 380 | + foreach ( $image_urls as $image_url ) { |
|
| 381 | + $image_url_esc = wl_sparql_escape_uri( $image_url ); |
|
| 382 | + $sparql .= " <$uri_e> schema:image <$image_url_esc> . \n"; |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | - return $sparql; |
|
| 385 | + return $sparql; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -395,24 +395,24 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
| 397 | 397 | |
| 398 | - // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
| 398 | + // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
|
| 399 | 399 | |
| 400 | - $posts = get_posts( array( |
|
| 401 | - 'post_type' => 'attachment', |
|
| 402 | - 'posts_per_page' => 1, |
|
| 403 | - 'post_status' => 'any', |
|
| 404 | - 'post_parent' => $parent_post_id, |
|
| 405 | - 'meta_key' => 'wl_source_url', |
|
| 406 | - 'meta_value' => $source_url, |
|
| 407 | - ) ); |
|
| 400 | + $posts = get_posts( array( |
|
| 401 | + 'post_type' => 'attachment', |
|
| 402 | + 'posts_per_page' => 1, |
|
| 403 | + 'post_status' => 'any', |
|
| 404 | + 'post_parent' => $parent_post_id, |
|
| 405 | + 'meta_key' => 'wl_source_url', |
|
| 406 | + 'meta_value' => $source_url, |
|
| 407 | + ) ); |
|
| 408 | 408 | |
| 409 | - // Return the found post. |
|
| 410 | - if ( 1 === count( $posts ) ) { |
|
| 411 | - return $posts[0]; |
|
| 412 | - } |
|
| 409 | + // Return the found post. |
|
| 410 | + if ( 1 === count( $posts ) ) { |
|
| 411 | + return $posts[0]; |
|
| 412 | + } |
|
| 413 | 413 | |
| 414 | - // Return null. |
|
| 415 | - return null; |
|
| 414 | + // Return null. |
|
| 415 | + return null; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | function wl_set_source_url( $post_id, $source_url ) { |
| 425 | 425 | |
| 426 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 427 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 426 | + delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 427 | + add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | |
@@ -442,61 +442,61 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | function wl_flush_rewrite_rules_hard( $hard ) { |
| 444 | 444 | |
| 445 | - // If WL is not yet configured, we cannot perform any update, so we exit. |
|
| 446 | - if ( '' === wl_configuration_get_key() ) { |
|
| 447 | - return; |
|
| 448 | - } |
|
| 445 | + // If WL is not yet configured, we cannot perform any update, so we exit. |
|
| 446 | + if ( '' === wl_configuration_get_key() ) { |
|
| 447 | + return; |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - // Set the initial offset and limit each call to 100 posts to avoid memory errors. |
|
| 451 | - $offset = 0; |
|
| 452 | - $limit = 100; |
|
| 450 | + // Set the initial offset and limit each call to 100 posts to avoid memory errors. |
|
| 451 | + $offset = 0; |
|
| 452 | + $limit = 100; |
|
| 453 | 453 | |
| 454 | - // Get more posts if the number of returned posts matches the limit. |
|
| 455 | - while ( $limit === ( $posts = get_posts( array( |
|
| 456 | - 'offset' => $offset, |
|
| 457 | - 'numberposts' => $limit, |
|
| 458 | - 'orderby' => 'ID', |
|
| 459 | - 'post_type' => 'any', |
|
| 460 | - 'post_status' => 'publish', |
|
| 461 | - ) ) ) ) { |
|
| 454 | + // Get more posts if the number of returned posts matches the limit. |
|
| 455 | + while ( $limit === ( $posts = get_posts( array( |
|
| 456 | + 'offset' => $offset, |
|
| 457 | + 'numberposts' => $limit, |
|
| 458 | + 'orderby' => 'ID', |
|
| 459 | + 'post_type' => 'any', |
|
| 460 | + 'post_status' => 'publish', |
|
| 461 | + ) ) ) ) { |
|
| 462 | 462 | |
| 463 | - // Holds the delete part of the query. |
|
| 464 | - $delete_query = rl_sparql_prefixes(); |
|
| 463 | + // Holds the delete part of the query. |
|
| 464 | + $delete_query = rl_sparql_prefixes(); |
|
| 465 | 465 | |
| 466 | - // Holds the insert part of the query. |
|
| 467 | - $insert_query = ''; |
|
| 466 | + // Holds the insert part of the query. |
|
| 467 | + $insert_query = ''; |
|
| 468 | 468 | |
| 469 | - // Cycle in each post to build the query. |
|
| 470 | - foreach ( $posts as $post ) { |
|
| 469 | + // Cycle in each post to build the query. |
|
| 470 | + foreach ( $posts as $post ) { |
|
| 471 | 471 | |
| 472 | - // Ignore revisions. |
|
| 473 | - if ( wp_is_post_revision( $post->ID ) ) { |
|
| 474 | - continue; |
|
| 475 | - } |
|
| 472 | + // Ignore revisions. |
|
| 473 | + if ( wp_is_post_revision( $post->ID ) ) { |
|
| 474 | + continue; |
|
| 475 | + } |
|
| 476 | 476 | |
| 477 | - // Get the entity URI. |
|
| 478 | - $s = Wordlift_Sparql_Service::escape_uri( Wordlift_Entity_Service::get_instance() |
|
| 479 | - ->get_uri( $post->ID ) ); |
|
| 477 | + // Get the entity URI. |
|
| 478 | + $s = Wordlift_Sparql_Service::escape_uri( Wordlift_Entity_Service::get_instance() |
|
| 479 | + ->get_uri( $post->ID ) ); |
|
| 480 | 480 | |
| 481 | - // Get the post URL. |
|
| 482 | - // $url = wl_sparql_escape_uri( get_permalink( $post->ID ) ); |
|
| 481 | + // Get the post URL. |
|
| 482 | + // $url = wl_sparql_escape_uri( get_permalink( $post->ID ) ); |
|
| 483 | 483 | |
| 484 | - // Prepare the DELETE and INSERT commands. |
|
| 485 | - $delete_query .= "DELETE { <$s> schema:url ?u . } WHERE { <$s> schema:url ?u . };\n"; |
|
| 484 | + // Prepare the DELETE and INSERT commands. |
|
| 485 | + $delete_query .= "DELETE { <$s> schema:url ?u . } WHERE { <$s> schema:url ?u . };\n"; |
|
| 486 | 486 | |
| 487 | - $insert_query .= Wordlift_Schema_Url_Property_Service::get_instance() |
|
| 488 | - ->get_insert_query( $s, $post->ID ); |
|
| 487 | + $insert_query .= Wordlift_Schema_Url_Property_Service::get_instance() |
|
| 488 | + ->get_insert_query( $s, $post->ID ); |
|
| 489 | 489 | |
| 490 | - } |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | |
| 493 | - // Execute the query. |
|
| 494 | - rl_execute_sparql_update_query( $delete_query . $insert_query ); |
|
| 493 | + // Execute the query. |
|
| 494 | + rl_execute_sparql_update_query( $delete_query . $insert_query ); |
|
| 495 | 495 | |
| 496 | - // Advance to the next posts. |
|
| 497 | - $offset += $limit; |
|
| 496 | + // Advance to the next posts. |
|
| 497 | + $offset += $limit; |
|
| 498 | 498 | |
| 499 | - } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | 501 | // // Get all published posts. |
| 502 | 502 | // $posts = get_posts( array( |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | function wl_sanitize_uri_path( $path, $char = '_' ) { |
| 524 | 524 | |
| 525 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 525 | + return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -534,11 +534,11 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | function wl_force_to_array( $value ) { |
| 536 | 536 | |
| 537 | - if ( ! is_array( $value ) ) { |
|
| 538 | - return array( $value ); |
|
| 539 | - } |
|
| 537 | + if ( ! is_array( $value ) ) { |
|
| 538 | + return array( $value ); |
|
| 539 | + } |
|
| 540 | 540 | |
| 541 | - return $value; |
|
| 541 | + return $value; |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | /** |
@@ -546,26 +546,26 @@ discard block |
||
| 546 | 546 | */ |
| 547 | 547 | function wl_shutdown() { |
| 548 | 548 | |
| 549 | - // Get the filename to the temporary SPARQL file. |
|
| 550 | - $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 549 | + // Get the filename to the temporary SPARQL file. |
|
| 550 | + $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 551 | 551 | |
| 552 | - // If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it. |
|
| 553 | - if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) { |
|
| 552 | + // If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it. |
|
| 553 | + if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) { |
|
| 554 | 554 | |
| 555 | - // The request ID. |
|
| 556 | - $args = array( WL_REQUEST_ID ); |
|
| 555 | + // The request ID. |
|
| 556 | + $args = array( WL_REQUEST_ID ); |
|
| 557 | 557 | |
| 558 | - // Schedule the execution of the SPARQL query with the request ID. |
|
| 559 | - wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args ); |
|
| 558 | + // Schedule the execution of the SPARQL query with the request ID. |
|
| 559 | + wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args ); |
|
| 560 | 560 | |
| 561 | - // Check that the request is scheduled. |
|
| 562 | - $timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args ); |
|
| 561 | + // Check that the request is scheduled. |
|
| 562 | + $timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args ); |
|
| 563 | 563 | |
| 564 | - // Spawn the cron. |
|
| 565 | - spawn_cron(); |
|
| 564 | + // Spawn the cron. |
|
| 565 | + spawn_cron(); |
|
| 566 | 566 | |
| 567 | - wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" ); |
|
| 568 | - } |
|
| 567 | + wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" ); |
|
| 568 | + } |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | add_action( 'shutdown', 'wl_shutdown' ); |
@@ -579,46 +579,46 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | function wl_replace_item_id_with_uri( $content ) { |
| 581 | 581 | |
| 582 | - // wl_write_log( "wl_replace_item_id_with_uri" ); |
|
| 582 | + // wl_write_log( "wl_replace_item_id_with_uri" ); |
|
| 583 | 583 | |
| 584 | - // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
| 585 | - $content = stripslashes( $content ); |
|
| 584 | + // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
|
| 585 | + $content = stripslashes( $content ); |
|
| 586 | 586 | |
| 587 | - // If any match are found. |
|
| 588 | - $matches = array(); |
|
| 589 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 587 | + // If any match are found. |
|
| 588 | + $matches = array(); |
|
| 589 | + if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 590 | 590 | |
| 591 | - foreach ( $matches as $match ) { |
|
| 591 | + foreach ( $matches as $match ) { |
|
| 592 | 592 | |
| 593 | - // Get the item ID. |
|
| 594 | - $item_id = $match[1]; |
|
| 593 | + // Get the item ID. |
|
| 594 | + $item_id = $match[1]; |
|
| 595 | 595 | |
| 596 | - // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
| 597 | - $post = Wordlift_Entity_Service::get_instance() |
|
| 598 | - ->get_entity_post_by_uri( $item_id ); |
|
| 596 | + // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
|
| 597 | + $post = Wordlift_Entity_Service::get_instance() |
|
| 598 | + ->get_entity_post_by_uri( $item_id ); |
|
| 599 | 599 | |
| 600 | - // If no entity is found, continue to the next one. |
|
| 601 | - if ( null === $post ) { |
|
| 602 | - continue; |
|
| 603 | - } |
|
| 600 | + // If no entity is found, continue to the next one. |
|
| 601 | + if ( null === $post ) { |
|
| 602 | + continue; |
|
| 603 | + } |
|
| 604 | 604 | |
| 605 | - // Get the URI for that post. |
|
| 606 | - $uri = wl_get_entity_uri( $post->ID ); |
|
| 605 | + // Get the URI for that post. |
|
| 606 | + $uri = wl_get_entity_uri( $post->ID ); |
|
| 607 | 607 | |
| 608 | - // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
| 608 | + // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
|
| 609 | 609 | |
| 610 | - // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
| 611 | - if ( $item_id !== $uri ) { |
|
| 612 | - $uri_e = esc_html( $uri ); |
|
| 613 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 614 | - } |
|
| 615 | - } |
|
| 616 | - } |
|
| 610 | + // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
|
| 611 | + if ( $item_id !== $uri ) { |
|
| 612 | + $uri_e = esc_html( $uri ); |
|
| 613 | + $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 614 | + } |
|
| 615 | + } |
|
| 616 | + } |
|
| 617 | 617 | |
| 618 | - // Reapply slashes. |
|
| 619 | - $content = addslashes( $content ); |
|
| 618 | + // Reapply slashes. |
|
| 619 | + $content = addslashes( $content ); |
|
| 620 | 620 | |
| 621 | - return $content; |
|
| 621 | + return $content; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | * This action is documented in includes/class-wordlift-activator.php |
| 692 | 692 | */ |
| 693 | 693 | function activate_wordlift() { |
| 694 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 695 | - Wordlift_Activator::activate(); |
|
| 694 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 695 | + Wordlift_Activator::activate(); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -700,8 +700,8 @@ discard block |
||
| 700 | 700 | * This action is documented in includes/class-wordlift-deactivator.php |
| 701 | 701 | */ |
| 702 | 702 | function deactivate_wordlift() { |
| 703 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 704 | - Wordlift_Deactivator::deactivate(); |
|
| 703 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 704 | + Wordlift_Deactivator::deactivate(); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | register_activation_hook( __FILE__, 'activate_wordlift' ); |
@@ -724,8 +724,8 @@ discard block |
||
| 724 | 724 | */ |
| 725 | 725 | function run_wordlift() { |
| 726 | 726 | |
| 727 | - $plugin = new Wordlift(); |
|
| 728 | - $plugin->run(); |
|
| 727 | + $plugin = new Wordlift(); |
|
| 728 | + $plugin->run(); |
|
| 729 | 729 | |
| 730 | 730 | } |
| 731 | 731 | |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | // If this file is called directly, abort. |
| 28 | -if ( ! defined( 'WPINC' ) ) { |
|
| 28 | +if ( ! defined('WPINC')) { |
|
| 29 | 29 | die; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Include WordLift constants. |
| 33 | -require_once( 'wordlift_constants.php' ); |
|
| 33 | +require_once('wordlift_constants.php'); |
|
| 34 | 34 | |
| 35 | 35 | // Load modules |
| 36 | -require_once( 'modules/core/wordlift_core.php' ); |
|
| 36 | +require_once('modules/core/wordlift_core.php'); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Log to the debug.log file. |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param string|mixed $log The log data. |
| 48 | 48 | */ |
| 49 | -function wl_write_log( $log ) { |
|
| 49 | +function wl_write_log($log) { |
|
| 50 | 50 | |
| 51 | - Wordlift_Log_Service::get_instance()->info( $log ); |
|
| 51 | + Wordlift_Log_Service::get_instance()->info($log); |
|
| 52 | 52 | |
| 53 | 53 | // $handler = apply_filters( 'wl_write_log_handler', null ); |
| 54 | 54 | // |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | * @param string|array $log The log data. |
| 75 | 75 | * @param string $caller The calling function. |
| 76 | 76 | */ |
| 77 | -function wl_write_log_handler( $log, $caller = null ) { |
|
| 77 | +function wl_write_log_handler($log, $caller = null) { |
|
| 78 | 78 | |
| 79 | 79 | global $wl_logger; |
| 80 | 80 | |
| 81 | - if ( true === WP_DEBUG ) { |
|
| 81 | + if (true === WP_DEBUG) { |
|
| 82 | 82 | |
| 83 | - $message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) . |
|
| 84 | - ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) ); |
|
| 83 | + $message = (isset($caller) ? sprintf('[%-40.40s] ', $caller) : ''). |
|
| 84 | + (is_array($log) || is_object($log) ? print_r($log, true) : wl_write_log_hide_key($log)); |
|
| 85 | 85 | |
| 86 | - if ( isset( $wl_logger ) ) { |
|
| 87 | - $wl_logger->info( $message ); |
|
| 86 | + if (isset($wl_logger)) { |
|
| 87 | + $wl_logger->info($message); |
|
| 88 | 88 | } else { |
| 89 | - error_log( $message ); |
|
| 89 | + error_log($message); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | } |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return string A text with the key hidden. |
| 106 | 106 | */ |
| 107 | -function wl_write_log_hide_key( $text ) { |
|
| 107 | +function wl_write_log_hide_key($text) { |
|
| 108 | 108 | |
| 109 | - return str_ireplace( wl_configuration_get_key(), '<hidden>', $text ); |
|
| 109 | + return str_ireplace(wl_configuration_get_key(), '<hidden>', $text); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @param string $query A SPARQL query. |
| 118 | 118 | */ |
| 119 | -function wl_queue_sparql_update_query( $query ) { |
|
| 119 | +function wl_queue_sparql_update_query($query) { |
|
| 120 | 120 | |
| 121 | - $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 122 | - file_put_contents( $filename, $query . "\n", FILE_APPEND ); |
|
| 121 | + $filename = WL_TEMP_DIR.WL_REQUEST_ID.'.sparql'; |
|
| 122 | + file_put_contents($filename, $query."\n", FILE_APPEND); |
|
| 123 | 123 | |
| 124 | - wl_write_log( "wl_queue_sparql_update_query [ filename :: $filename ]" ); |
|
| 124 | + wl_write_log("wl_queue_sparql_update_query [ filename :: $filename ]"); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -129,33 +129,33 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @param int $request_id The request ID. |
| 131 | 131 | */ |
| 132 | -function wl_execute_saved_sparql_update_query( $request_id ) { |
|
| 132 | +function wl_execute_saved_sparql_update_query($request_id) { |
|
| 133 | 133 | |
| 134 | - $filename = WL_TEMP_DIR . $request_id . '.sparql'; |
|
| 134 | + $filename = WL_TEMP_DIR.$request_id.'.sparql'; |
|
| 135 | 135 | |
| 136 | 136 | // If the file doesn't exist, exit. |
| 137 | - if ( ! file_exists( $filename ) ) { |
|
| 138 | - wl_write_log( "wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]" ); |
|
| 137 | + if ( ! file_exists($filename)) { |
|
| 138 | + wl_write_log("wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]"); |
|
| 139 | 139 | |
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - wl_write_log( "wl_execute_saved_sparql_update_query [ filename :: $filename ]" ); |
|
| 143 | + wl_write_log("wl_execute_saved_sparql_update_query [ filename :: $filename ]"); |
|
| 144 | 144 | |
| 145 | 145 | // Get the query saved in the file. |
| 146 | - $query = file_get_contents( $filename ); |
|
| 146 | + $query = file_get_contents($filename); |
|
| 147 | 147 | |
| 148 | 148 | // Execute the SPARQL query. |
| 149 | - rl_execute_sparql_update_query( $query, false ); |
|
| 149 | + rl_execute_sparql_update_query($query, false); |
|
| 150 | 150 | |
| 151 | 151 | // Reindex the triple store. |
| 152 | 152 | wordlift_reindex_triple_store(); |
| 153 | 153 | |
| 154 | 154 | // Delete the temporary file. |
| 155 | - unlink( $filename ); |
|
| 155 | + unlink($filename); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -add_action( 'wl_execute_saved_sparql_update_query', 'wl_execute_saved_sparql_update_query', 10, 1 ); |
|
| 158 | +add_action('wl_execute_saved_sparql_update_query', 'wl_execute_saved_sparql_update_query', 10, 1); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Add buttons hook for the TinyMCE editor. This method is called by the WP init hook. |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | function wordlift_buttonhooks() { |
| 164 | 164 | |
| 165 | 165 | // Only add hooks when the current user has permissions AND is in Rich Text editor mode |
| 166 | - if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) { |
|
| 167 | - add_filter( 'mce_external_plugins', 'wordlift_register_tinymce_javascript' ); |
|
| 166 | + if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing')) { |
|
| 167 | + add_filter('mce_external_plugins', 'wordlift_register_tinymce_javascript'); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return array The modified plugins array. |
| 177 | 177 | */ |
| 178 | -function wordlift_register_tinymce_javascript( $plugin_array ) { |
|
| 178 | +function wordlift_register_tinymce_javascript($plugin_array) { |
|
| 179 | 179 | |
| 180 | 180 | // add the wordlift plugin. |
| 181 | 181 | // We can't use the minified version here. |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $version = Wordlift::get_instance()->get_version(); |
| 185 | 185 | |
| 186 | 186 | // Add our own JavaScript file to TinyMCE's extensions. |
| 187 | - $plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js?ver=' . $version; |
|
| 187 | + $plugin_array['wordlift'] = plugin_dir_url(__FILE__).'js/wordlift-reloaded.js?ver='.$version; |
|
| 188 | 188 | |
| 189 | 189 | return $plugin_array; |
| 190 | 190 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | function wordlift_allowed_post_tags() { |
| 197 | 197 | global $allowedposttags; |
| 198 | 198 | |
| 199 | - $tags = array( 'span' ); |
|
| 199 | + $tags = array('span'); |
|
| 200 | 200 | $new_attributes = array( |
| 201 | 201 | 'itemscope' => array(), |
| 202 | 202 | 'itemtype' => array(), |
@@ -204,17 +204,17 @@ discard block |
||
| 204 | 204 | 'itemid' => array(), |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - foreach ( $tags as $tag ) { |
|
| 208 | - if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) { |
|
| 209 | - $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); |
|
| 207 | + foreach ($tags as $tag) { |
|
| 208 | + if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) { |
|
| 209 | + $allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // init process for button control |
| 215 | -add_action( 'init', 'wordlift_buttonhooks' ); |
|
| 215 | +add_action('init', 'wordlift_buttonhooks'); |
|
| 216 | 216 | // add allowed post tags. |
| 217 | -add_action( 'init', 'wordlift_allowed_post_tags' ); |
|
| 217 | +add_action('init', 'wordlift_allowed_post_tags'); |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,30 +223,30 @@ discard block |
||
| 223 | 223 | function wordlift_admin_enqueue_scripts() { |
| 224 | 224 | |
| 225 | 225 | // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/) |
| 226 | - wp_enqueue_script( 'wpdialogs' ); |
|
| 227 | - wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
|
| 226 | + wp_enqueue_script('wpdialogs'); |
|
| 227 | + wp_enqueue_style('wp-jquery-ui-dialog'); |
|
| 228 | 228 | |
| 229 | - wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' ); |
|
| 229 | + wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css'); |
|
| 230 | 230 | |
| 231 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
| 232 | - wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' ); |
|
| 233 | - wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' ); |
|
| 234 | - wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' ); |
|
| 235 | - wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' ); |
|
| 231 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
| 232 | + wp_enqueue_script('angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js'); |
|
| 233 | + wp_enqueue_script('angularjs-geolocation', plugin_dir_url(__FILE__).'/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js'); |
|
| 234 | + wp_enqueue_script('angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js'); |
|
| 235 | + wp_enqueue_script('angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js'); |
|
| 236 | 236 | |
| 237 | 237 | // Disable auto-save for custom entity posts only |
| 238 | - if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) { |
|
| 239 | - wp_dequeue_script( 'autosave' ); |
|
| 238 | + if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) { |
|
| 239 | + wp_dequeue_script('autosave'); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | -add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' ); |
|
| 243 | +add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts'); |
|
| 244 | 244 | |
| 245 | 245 | function wl_enqueue_scripts() { |
| 246 | - wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' ); |
|
| 246 | + wp_enqueue_style('wordlift-ui', plugin_dir_url(__FILE__).'css/wordlift-ui.min.css'); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | -add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' ); |
|
| 249 | +add_action('wp_enqueue_scripts', 'wl_enqueue_scripts'); |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Hooked to *wp_kses_allowed_html* filter, adds microdata attributes. |
@@ -256,23 +256,23 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return array An array which contains allowed microdata attributes. |
| 258 | 258 | */ |
| 259 | -function wordlift_allowed_html( $allowedtags, $context ) { |
|
| 259 | +function wordlift_allowed_html($allowedtags, $context) { |
|
| 260 | 260 | |
| 261 | - if ( 'post' !== $context ) { |
|
| 261 | + if ('post' !== $context) { |
|
| 262 | 262 | return $allowedtags; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - return array_merge_recursive( $allowedtags, array( |
|
| 265 | + return array_merge_recursive($allowedtags, array( |
|
| 266 | 266 | 'span' => array( |
| 267 | 267 | 'itemscope' => true, |
| 268 | 268 | 'itemtype' => true, |
| 269 | 269 | 'itemid' => true, |
| 270 | 270 | 'itemprop' => true, |
| 271 | 271 | ), |
| 272 | - ) ); |
|
| 272 | + )); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | -add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 ); |
|
| 275 | +add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2); |
|
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * Get the coordinates for the specified post ID. |
@@ -281,16 +281,16 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return array|null An array of coordinates or null. |
| 283 | 283 | */ |
| 284 | -function wl_get_coordinates( $post_id ) { |
|
| 284 | +function wl_get_coordinates($post_id) { |
|
| 285 | 285 | |
| 286 | - $latitude = wl_schema_get_value( $post_id, 'latitude' ); |
|
| 287 | - $longitude = wl_schema_get_value( $post_id, 'longitude' ); |
|
| 286 | + $latitude = wl_schema_get_value($post_id, 'latitude'); |
|
| 287 | + $longitude = wl_schema_get_value($post_id, 'longitude'); |
|
| 288 | 288 | |
| 289 | 289 | // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe: |
| 290 | 290 | // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana." |
| 291 | 291 | return array( |
| 292 | - 'latitude' => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '', |
|
| 293 | - 'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '', |
|
| 292 | + 'latitude' => isset($latitude[0]) && is_numeric($latitude[0]) ? $latitude[0] : '', |
|
| 293 | + 'longitude' => isset($longitude[0]) && is_numeric($longitude[0]) ? $longitude[0] : '', |
|
| 294 | 294 | ); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | * |
| 302 | 302 | * @return string A datetime. |
| 303 | 303 | */ |
| 304 | -function wl_get_post_modified_time( $post ) { |
|
| 304 | +function wl_get_post_modified_time($post) { |
|
| 305 | 305 | |
| 306 | - $date_modified = get_post_modified_time( 'c', true, $post ); |
|
| 306 | + $date_modified = get_post_modified_time('c', true, $post); |
|
| 307 | 307 | |
| 308 | - if ( '-' === substr( $date_modified, 0, 1 ) ) { |
|
| 309 | - return get_the_time( 'c', $post ); |
|
| 308 | + if ('-' === substr($date_modified, 0, 1)) { |
|
| 309 | + return get_the_time('c', $post); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | return $date_modified; |
@@ -319,27 +319,27 @@ discard block |
||
| 319 | 319 | * |
| 320 | 320 | * @return array An array of image URLs. |
| 321 | 321 | */ |
| 322 | -function wl_get_image_urls( $post_id ) { |
|
| 322 | +function wl_get_image_urls($post_id) { |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | // If there is a featured image it has the priority |
| 326 | - $featured_image_id = get_post_thumbnail_id( $post_id ); |
|
| 327 | - if ( is_numeric( $featured_image_id ) ) { |
|
| 328 | - $image_url = wp_get_attachment_url( $featured_image_id ); |
|
| 326 | + $featured_image_id = get_post_thumbnail_id($post_id); |
|
| 327 | + if (is_numeric($featured_image_id)) { |
|
| 328 | + $image_url = wp_get_attachment_url($featured_image_id); |
|
| 329 | 329 | |
| 330 | - return array( $image_url ); |
|
| 330 | + return array($image_url); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" ); |
| 334 | 334 | |
| 335 | - $images = get_children( array( |
|
| 335 | + $images = get_children(array( |
|
| 336 | 336 | 'post_parent' => $post_id, |
| 337 | 337 | 'post_type' => 'attachment', |
| 338 | 338 | 'post_mime_type' => 'image', |
| 339 | - ) ); |
|
| 339 | + )); |
|
| 340 | 340 | |
| 341 | 341 | // Return an empty array if no image is found. |
| 342 | - if ( empty( $images ) ) { |
|
| 342 | + if (empty($images)) { |
|
| 343 | 343 | return array(); |
| 344 | 344 | } |
| 345 | 345 | |
@@ -347,11 +347,11 @@ discard block |
||
| 347 | 347 | $image_urls = array(); |
| 348 | 348 | |
| 349 | 349 | // Collect the URLs. |
| 350 | - foreach ( $images as $attachment_id => $attachment ) { |
|
| 351 | - $image_url = wp_get_attachment_url( $attachment_id ); |
|
| 350 | + foreach ($images as $attachment_id => $attachment) { |
|
| 351 | + $image_url = wp_get_attachment_url($attachment_id); |
|
| 352 | 352 | // Ensure the URL isn't collected already. |
| 353 | - if ( ! in_array( $image_url, $image_urls ) ) { |
|
| 354 | - array_push( $image_urls, $image_url ); |
|
| 353 | + if ( ! in_array($image_url, $image_urls)) { |
|
| 354 | + array_push($image_urls, $image_url); |
|
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | |
@@ -368,17 +368,17 @@ discard block |
||
| 368 | 368 | * |
| 369 | 369 | * @return string The SPARQL fragment. |
| 370 | 370 | */ |
| 371 | -function wl_get_sparql_images( $uri, $post_id ) { |
|
| 371 | +function wl_get_sparql_images($uri, $post_id) { |
|
| 372 | 372 | |
| 373 | 373 | $sparql = ''; |
| 374 | 374 | |
| 375 | 375 | // Get the escaped URI. |
| 376 | - $uri_e = esc_html( $uri ); |
|
| 376 | + $uri_e = esc_html($uri); |
|
| 377 | 377 | |
| 378 | 378 | // Add SPARQL stmts to write the schema:image. |
| 379 | - $image_urls = wl_get_image_urls( $post_id ); |
|
| 380 | - foreach ( $image_urls as $image_url ) { |
|
| 381 | - $image_url_esc = wl_sparql_escape_uri( $image_url ); |
|
| 379 | + $image_urls = wl_get_image_urls($post_id); |
|
| 380 | + foreach ($image_urls as $image_url) { |
|
| 381 | + $image_url_esc = wl_sparql_escape_uri($image_url); |
|
| 382 | 382 | $sparql .= " <$uri_e> schema:image <$image_url_esc> . \n"; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -393,21 +393,21 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return WP_Post|null A post instance or null if not found. |
| 395 | 395 | */ |
| 396 | -function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) { |
|
| 396 | +function wl_get_attachment_for_source_url($parent_post_id, $source_url) { |
|
| 397 | 397 | |
| 398 | 398 | // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" ); |
| 399 | 399 | |
| 400 | - $posts = get_posts( array( |
|
| 400 | + $posts = get_posts(array( |
|
| 401 | 401 | 'post_type' => 'attachment', |
| 402 | 402 | 'posts_per_page' => 1, |
| 403 | 403 | 'post_status' => 'any', |
| 404 | 404 | 'post_parent' => $parent_post_id, |
| 405 | 405 | 'meta_key' => 'wl_source_url', |
| 406 | 406 | 'meta_value' => $source_url, |
| 407 | - ) ); |
|
| 407 | + )); |
|
| 408 | 408 | |
| 409 | 409 | // Return the found post. |
| 410 | - if ( 1 === count( $posts ) ) { |
|
| 410 | + if (1 === count($posts)) { |
|
| 411 | 411 | return $posts[0]; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | * @param int $post_id The post ID. |
| 422 | 422 | * @param string $source_url The source URL. |
| 423 | 423 | */ |
| 424 | -function wl_set_source_url( $post_id, $source_url ) { |
|
| 424 | +function wl_set_source_url($post_id, $source_url) { |
|
| 425 | 425 | |
| 426 | - delete_post_meta( $post_id, 'wl_source_url' ); |
|
| 427 | - add_post_meta( $post_id, 'wl_source_url', $source_url ); |
|
| 426 | + delete_post_meta($post_id, 'wl_source_url'); |
|
| 427 | + add_post_meta($post_id, 'wl_source_url', $source_url); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | |
@@ -440,10 +440,10 @@ discard block |
||
| 440 | 440 | * |
| 441 | 441 | * @param bool $hard True if the rewrite involves configuration updates in Apache/IIS. |
| 442 | 442 | */ |
| 443 | -function wl_flush_rewrite_rules_hard( $hard ) { |
|
| 443 | +function wl_flush_rewrite_rules_hard($hard) { |
|
| 444 | 444 | |
| 445 | 445 | // If WL is not yet configured, we cannot perform any update, so we exit. |
| 446 | - if ( '' === wl_configuration_get_key() ) { |
|
| 446 | + if ('' === wl_configuration_get_key()) { |
|
| 447 | 447 | return; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | $limit = 100; |
| 453 | 453 | |
| 454 | 454 | // Get more posts if the number of returned posts matches the limit. |
| 455 | - while ( $limit === ( $posts = get_posts( array( |
|
| 455 | + while ($limit === ($posts = get_posts(array( |
|
| 456 | 456 | 'offset' => $offset, |
| 457 | 457 | 'numberposts' => $limit, |
| 458 | 458 | 'orderby' => 'ID', |
| 459 | 459 | 'post_type' => 'any', |
| 460 | 460 | 'post_status' => 'publish', |
| 461 | - ) ) ) ) { |
|
| 461 | + )))) { |
|
| 462 | 462 | |
| 463 | 463 | // Holds the delete part of the query. |
| 464 | 464 | $delete_query = rl_sparql_prefixes(); |
@@ -467,16 +467,16 @@ discard block |
||
| 467 | 467 | $insert_query = ''; |
| 468 | 468 | |
| 469 | 469 | // Cycle in each post to build the query. |
| 470 | - foreach ( $posts as $post ) { |
|
| 470 | + foreach ($posts as $post) { |
|
| 471 | 471 | |
| 472 | 472 | // Ignore revisions. |
| 473 | - if ( wp_is_post_revision( $post->ID ) ) { |
|
| 473 | + if (wp_is_post_revision($post->ID)) { |
|
| 474 | 474 | continue; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | // Get the entity URI. |
| 478 | - $s = Wordlift_Sparql_Service::escape_uri( Wordlift_Entity_Service::get_instance() |
|
| 479 | - ->get_uri( $post->ID ) ); |
|
| 478 | + $s = Wordlift_Sparql_Service::escape_uri(Wordlift_Entity_Service::get_instance() |
|
| 479 | + ->get_uri($post->ID)); |
|
| 480 | 480 | |
| 481 | 481 | // Get the post URL. |
| 482 | 482 | // $url = wl_sparql_escape_uri( get_permalink( $post->ID ) ); |
@@ -485,13 +485,13 @@ discard block |
||
| 485 | 485 | $delete_query .= "DELETE { <$s> schema:url ?u . } WHERE { <$s> schema:url ?u . };\n"; |
| 486 | 486 | |
| 487 | 487 | $insert_query .= Wordlift_Schema_Url_Property_Service::get_instance() |
| 488 | - ->get_insert_query( $s, $post->ID ); |
|
| 488 | + ->get_insert_query($s, $post->ID); |
|
| 489 | 489 | |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | |
| 493 | 493 | // Execute the query. |
| 494 | - rl_execute_sparql_update_query( $delete_query . $insert_query ); |
|
| 494 | + rl_execute_sparql_update_query($delete_query.$insert_query); |
|
| 495 | 495 | |
| 496 | 496 | // Advance to the next posts. |
| 497 | 497 | $offset += $limit; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | -add_filter( 'flush_rewrite_rules_hard', 'wl_flush_rewrite_rules_hard', 10, 1 ); |
|
| 510 | +add_filter('flush_rewrite_rules_hard', 'wl_flush_rewrite_rules_hard', 10, 1); |
|
| 511 | 511 | |
| 512 | 512 | /** |
| 513 | 513 | * Sanitizes an URI path by replacing the non allowed characters with an underscore. |
@@ -520,9 +520,9 @@ discard block |
||
| 520 | 520 | * |
| 521 | 521 | * @return string The sanitized path. |
| 522 | 522 | */ |
| 523 | -function wl_sanitize_uri_path( $path, $char = '_' ) { |
|
| 523 | +function wl_sanitize_uri_path($path, $char = '_') { |
|
| 524 | 524 | |
| 525 | - return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char ); |
|
| 525 | + return Wordlift_Uri_Service::get_instance()->sanitize_path($path, $char); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -532,10 +532,10 @@ discard block |
||
| 532 | 532 | * |
| 533 | 533 | * @return array Array containing $value (if $value was not an array) |
| 534 | 534 | */ |
| 535 | -function wl_force_to_array( $value ) { |
|
| 535 | +function wl_force_to_array($value) { |
|
| 536 | 536 | |
| 537 | - if ( ! is_array( $value ) ) { |
|
| 538 | - return array( $value ); |
|
| 537 | + if ( ! is_array($value)) { |
|
| 538 | + return array($value); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | return $value; |
@@ -547,28 +547,28 @@ discard block |
||
| 547 | 547 | function wl_shutdown() { |
| 548 | 548 | |
| 549 | 549 | // Get the filename to the temporary SPARQL file. |
| 550 | - $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql'; |
|
| 550 | + $filename = WL_TEMP_DIR.WL_REQUEST_ID.'.sparql'; |
|
| 551 | 551 | |
| 552 | 552 | // If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it. |
| 553 | - if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) { |
|
| 553 | + if (WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists($filename)) { |
|
| 554 | 554 | |
| 555 | 555 | // The request ID. |
| 556 | - $args = array( WL_REQUEST_ID ); |
|
| 556 | + $args = array(WL_REQUEST_ID); |
|
| 557 | 557 | |
| 558 | 558 | // Schedule the execution of the SPARQL query with the request ID. |
| 559 | - wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args ); |
|
| 559 | + wp_schedule_single_event(time(), 'wl_execute_saved_sparql_update_query', $args); |
|
| 560 | 560 | |
| 561 | 561 | // Check that the request is scheduled. |
| 562 | - $timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args ); |
|
| 562 | + $timestamp = wp_next_scheduled('wl_execute_saved_sparql_update_query', $args); |
|
| 563 | 563 | |
| 564 | 564 | // Spawn the cron. |
| 565 | 565 | spawn_cron(); |
| 566 | 566 | |
| 567 | - wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" ); |
|
| 567 | + wl_write_log("wl_shutdown [ request id :: ".WL_REQUEST_ID." ][ timestamp :: $timestamp ]"); |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | -add_action( 'shutdown', 'wl_shutdown' ); |
|
| 571 | +add_action('shutdown', 'wl_shutdown'); |
|
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | 574 | * Replaces the *itemid* attributes URIs with the WordLift URIs. |
@@ -577,113 +577,113 @@ discard block |
||
| 577 | 577 | * |
| 578 | 578 | * @return string The updated post content. |
| 579 | 579 | */ |
| 580 | -function wl_replace_item_id_with_uri( $content ) { |
|
| 580 | +function wl_replace_item_id_with_uri($content) { |
|
| 581 | 581 | |
| 582 | 582 | // wl_write_log( "wl_replace_item_id_with_uri" ); |
| 583 | 583 | |
| 584 | 584 | // Strip slashes, see https://core.trac.wordpress.org/ticket/21767 |
| 585 | - $content = stripslashes( $content ); |
|
| 585 | + $content = stripslashes($content); |
|
| 586 | 586 | |
| 587 | 587 | // If any match are found. |
| 588 | 588 | $matches = array(); |
| 589 | - if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) { |
|
| 589 | + if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) { |
|
| 590 | 590 | |
| 591 | - foreach ( $matches as $match ) { |
|
| 591 | + foreach ($matches as $match) { |
|
| 592 | 592 | |
| 593 | 593 | // Get the item ID. |
| 594 | 594 | $item_id = $match[1]; |
| 595 | 595 | |
| 596 | 596 | // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' . |
| 597 | 597 | $post = Wordlift_Entity_Service::get_instance() |
| 598 | - ->get_entity_post_by_uri( $item_id ); |
|
| 598 | + ->get_entity_post_by_uri($item_id); |
|
| 599 | 599 | |
| 600 | 600 | // If no entity is found, continue to the next one. |
| 601 | - if ( null === $post ) { |
|
| 601 | + if (null === $post) { |
|
| 602 | 602 | continue; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // Get the URI for that post. |
| 606 | - $uri = wl_get_entity_uri( $post->ID ); |
|
| 606 | + $uri = wl_get_entity_uri($post->ID); |
|
| 607 | 607 | |
| 608 | 608 | // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" ); |
| 609 | 609 | |
| 610 | 610 | // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress. |
| 611 | - if ( $item_id !== $uri ) { |
|
| 612 | - $uri_e = esc_html( $uri ); |
|
| 613 | - $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content ); |
|
| 611 | + if ($item_id !== $uri) { |
|
| 612 | + $uri_e = esc_html($uri); |
|
| 613 | + $content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content); |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Reapply slashes. |
| 619 | - $content = addslashes( $content ); |
|
| 619 | + $content = addslashes($content); |
|
| 620 | 620 | |
| 621 | 621 | return $content; |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | -add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 ); |
|
| 624 | +add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1); |
|
| 625 | 625 | |
| 626 | -require_once( 'wordlift_entity_functions.php' ); |
|
| 626 | +require_once('wordlift_entity_functions.php'); |
|
| 627 | 627 | |
| 628 | 628 | // add editor related methods. |
| 629 | -require_once( 'wordlift_editor.php' ); |
|
| 629 | +require_once('wordlift_editor.php'); |
|
| 630 | 630 | |
| 631 | 631 | // add the WordLift entity custom type. |
| 632 | -require_once( 'wordlift_entity_type.php' ); |
|
| 633 | -require_once( 'wordlift_entity_type_taxonomy.php' ); |
|
| 632 | +require_once('wordlift_entity_type.php'); |
|
| 633 | +require_once('wordlift_entity_type_taxonomy.php'); |
|
| 634 | 634 | |
| 635 | 635 | // add callbacks on post save to notify data changes from wp to redlink triple store |
| 636 | -require_once( 'wordlift_to_redlink_data_push_callbacks.php' ); |
|
| 636 | +require_once('wordlift_to_redlink_data_push_callbacks.php'); |
|
| 637 | 637 | |
| 638 | -require_once( 'modules/configuration/wordlift_configuration_settings.php' ); |
|
| 638 | +require_once('modules/configuration/wordlift_configuration_settings.php'); |
|
| 639 | 639 | |
| 640 | 640 | // Load modules |
| 641 | -require_once( 'modules/analyzer/wordlift_analyzer.php' ); |
|
| 642 | -require_once( 'modules/linked_data/wordlift_linked_data.php' ); |
|
| 643 | -require_once( 'modules/prefixes/wordlift_prefixes.php' ); |
|
| 644 | -require_once( 'modules/redirector/wordlift_redirector.php' ); |
|
| 641 | +require_once('modules/analyzer/wordlift_analyzer.php'); |
|
| 642 | +require_once('modules/linked_data/wordlift_linked_data.php'); |
|
| 643 | +require_once('modules/prefixes/wordlift_prefixes.php'); |
|
| 644 | +require_once('modules/redirector/wordlift_redirector.php'); |
|
| 645 | 645 | |
| 646 | 646 | // Shortcodes |
| 647 | 647 | |
| 648 | -require_once( 'modules/geo_widget/wordlift_geo_widget.php' ); |
|
| 649 | -require_once( 'shortcodes/wordlift_shortcode_chord.php' ); |
|
| 650 | -require_once( 'shortcodes/wordlift_shortcode_geomap.php' ); |
|
| 651 | -require_once( 'shortcodes/wordlift_shortcode_field.php' ); |
|
| 652 | -require_once( 'shortcodes/wordlift_shortcode_faceted_search.php' ); |
|
| 653 | -require_once( 'shortcodes/wordlift_shortcode_navigator.php' ); |
|
| 648 | +require_once('modules/geo_widget/wordlift_geo_widget.php'); |
|
| 649 | +require_once('shortcodes/wordlift_shortcode_chord.php'); |
|
| 650 | +require_once('shortcodes/wordlift_shortcode_geomap.php'); |
|
| 651 | +require_once('shortcodes/wordlift_shortcode_field.php'); |
|
| 652 | +require_once('shortcodes/wordlift_shortcode_faceted_search.php'); |
|
| 653 | +require_once('shortcodes/wordlift_shortcode_navigator.php'); |
|
| 654 | 654 | |
| 655 | -require_once( 'widgets/wordlift_widget_geo.php' ); |
|
| 656 | -require_once( 'widgets/wordlift_widget_chord.php' ); |
|
| 657 | -require_once( 'widgets/wordlift_widget_timeline.php' ); |
|
| 655 | +require_once('widgets/wordlift_widget_geo.php'); |
|
| 656 | +require_once('widgets/wordlift_widget_chord.php'); |
|
| 657 | +require_once('widgets/wordlift_widget_timeline.php'); |
|
| 658 | 658 | |
| 659 | -require_once( 'wordlift_sparql.php' ); |
|
| 660 | -require_once( 'wordlift_redlink.php' ); |
|
| 659 | +require_once('wordlift_sparql.php'); |
|
| 660 | +require_once('wordlift_redlink.php'); |
|
| 661 | 661 | |
| 662 | 662 | // Add admin functions. |
| 663 | 663 | // TODO: find a way to make 'admin' UI tests work. |
| 664 | 664 | //if ( is_admin() ) { |
| 665 | 665 | |
| 666 | -require_once( 'admin/wordlift_admin.php' ); |
|
| 667 | -require_once( 'admin/wordlift_admin_edit_post.php' ); |
|
| 668 | -require_once( 'admin/wordlift_admin_save_post.php' ); |
|
| 666 | +require_once('admin/wordlift_admin.php'); |
|
| 667 | +require_once('admin/wordlift_admin_edit_post.php'); |
|
| 668 | +require_once('admin/wordlift_admin_save_post.php'); |
|
| 669 | 669 | |
| 670 | 670 | // add the entities meta box. |
| 671 | -require_once( 'admin/wordlift_admin_meta_box_entities.php' ); |
|
| 671 | +require_once('admin/wordlift_admin_meta_box_entities.php'); |
|
| 672 | 672 | |
| 673 | 673 | // add the entity creation AJAX. |
| 674 | -require_once( 'admin/wordlift_admin_ajax_related_posts.php' ); |
|
| 674 | +require_once('admin/wordlift_admin_ajax_related_posts.php'); |
|
| 675 | 675 | |
| 676 | 676 | // Load the wl_chord TinyMCE button and configuration dialog. |
| 677 | -require_once( 'admin/wordlift_admin_shortcodes.php' ); |
|
| 677 | +require_once('admin/wordlift_admin_shortcodes.php'); |
|
| 678 | 678 | |
| 679 | 679 | // Provide syncing features. |
| 680 | -require_once( 'admin/wordlift_admin_sync.php' ); |
|
| 680 | +require_once('admin/wordlift_admin_sync.php'); |
|
| 681 | 681 | //} |
| 682 | 682 | |
| 683 | 683 | // load languages. |
| 684 | 684 | // TODO: the following call gives for granted that the plugin is in the wordlift directory, |
| 685 | 685 | // we're currently doing this because wordlift is symbolic linked. |
| 686 | -load_plugin_textdomain( 'wordlift', false, '/wordlift/languages' ); |
|
| 686 | +load_plugin_textdomain('wordlift', false, '/wordlift/languages'); |
|
| 687 | 687 | |
| 688 | 688 | |
| 689 | 689 | /** |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | * This action is documented in includes/class-wordlift-activator.php |
| 692 | 692 | */ |
| 693 | 693 | function activate_wordlift() { |
| 694 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
| 694 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php'; |
|
| 695 | 695 | Wordlift_Activator::activate(); |
| 696 | 696 | } |
| 697 | 697 | |
@@ -700,18 +700,18 @@ discard block |
||
| 700 | 700 | * This action is documented in includes/class-wordlift-deactivator.php |
| 701 | 701 | */ |
| 702 | 702 | function deactivate_wordlift() { |
| 703 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
| 703 | + require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php'; |
|
| 704 | 704 | Wordlift_Deactivator::deactivate(); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | -register_activation_hook( __FILE__, 'activate_wordlift' ); |
|
| 708 | -register_deactivation_hook( __FILE__, 'deactivate_wordlift' ); |
|
| 707 | +register_activation_hook(__FILE__, 'activate_wordlift'); |
|
| 708 | +register_deactivation_hook(__FILE__, 'deactivate_wordlift'); |
|
| 709 | 709 | |
| 710 | 710 | /** |
| 711 | 711 | * The core plugin class that is used to define internationalization, |
| 712 | 712 | * admin-specific hooks, and public-facing site hooks. |
| 713 | 713 | */ |
| 714 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php'; |
|
| 714 | +require plugin_dir_path(__FILE__).'includes/class-wordlift.php'; |
|
| 715 | 715 | |
| 716 | 716 | /** |
| 717 | 717 | * Begins execution of the plugin. |
@@ -29,1122 +29,1122 @@ |
||
| 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 Thumbnail service. |
|
| 62 | - * |
|
| 63 | - * @since 3.1.5 |
|
| 64 | - * @access private |
|
| 65 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | - */ |
|
| 67 | - private $thumbnail_service; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The UI service. |
|
| 71 | - * |
|
| 72 | - * @since 3.2.0 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 75 | - */ |
|
| 76 | - private $ui_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The Schema service. |
|
| 80 | - * |
|
| 81 | - * @since 3.3.0 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 84 | - */ |
|
| 85 | - private $schema_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Entity service. |
|
| 89 | - * |
|
| 90 | - * @since 3.1.0 |
|
| 91 | - * @access protected |
|
| 92 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 93 | - */ |
|
| 94 | - protected $entity_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Topic Taxonomy service. |
|
| 98 | - * |
|
| 99 | - * @since 3.5.0 |
|
| 100 | - * @access private |
|
| 101 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 102 | - */ |
|
| 103 | - private $topic_taxonomy_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The User service. |
|
| 107 | - * |
|
| 108 | - * @since 3.1.7 |
|
| 109 | - * @access protected |
|
| 110 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 111 | - */ |
|
| 112 | - protected $user_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The Timeline service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.0 |
|
| 118 | - * @access private |
|
| 119 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 120 | - */ |
|
| 121 | - private $timeline_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Redirect service. |
|
| 125 | - * |
|
| 126 | - * @since 3.2.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 129 | - */ |
|
| 130 | - private $redirect_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Notice service. |
|
| 134 | - * |
|
| 135 | - * @since 3.3.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 138 | - */ |
|
| 139 | - private $notice_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Entity list customization. |
|
| 143 | - * |
|
| 144 | - * @since 3.3.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 147 | - */ |
|
| 148 | - private $entity_list_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Entity Types Taxonomy Walker. |
|
| 152 | - * |
|
| 153 | - * @since 3.1.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 156 | - */ |
|
| 157 | - private $entity_types_taxonomy_walker; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The ShareThis service. |
|
| 161 | - * |
|
| 162 | - * @since 3.2.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 165 | - */ |
|
| 166 | - private $sharethis_service; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The PrimaShop adapter. |
|
| 170 | - * |
|
| 171 | - * @since 3.2.3 |
|
| 172 | - * @access private |
|
| 173 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 174 | - */ |
|
| 175 | - private $primashop_adapter; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The WordLift Dashboard adapter. |
|
| 179 | - * |
|
| 180 | - * @since 3.4.0 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 183 | - */ |
|
| 184 | - private $dashboard_service; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The entity type service. |
|
| 188 | - * |
|
| 189 | - * @since 3.6.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 192 | - */ |
|
| 193 | - private $entity_post_type_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 197 | - * |
|
| 198 | - * @since 3.6.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Entity_Link_Service |
|
| 201 | - */ |
|
| 202 | - private $entity_link_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 206 | - * |
|
| 207 | - * @var 3.6.0 |
|
| 208 | - * @access private |
|
| 209 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 210 | - */ |
|
| 211 | - private $sparql_service; |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * A {@link Wordlift_Import_Service} instance. |
|
| 215 | - * |
|
| 216 | - * @since 3.6.0 |
|
| 217 | - * @access private |
|
| 218 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 219 | - */ |
|
| 220 | - private $import_service; |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 224 | - * |
|
| 225 | - * @since 3.6.0 |
|
| 226 | - * @access private |
|
| 227 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 228 | - */ |
|
| 229 | - private $rebuild_service; |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 233 | - * |
|
| 234 | - * @since 3.7.0 |
|
| 235 | - * @access protected |
|
| 236 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 237 | - */ |
|
| 238 | - protected $jsonld_service; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * |
|
| 242 | - * @since 3.7.0 |
|
| 243 | - * @access private |
|
| 244 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 245 | - */ |
|
| 246 | - private $property_factory; |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * The 'Download Your Data' page. |
|
| 250 | - * |
|
| 251 | - * @since 3.6.0 |
|
| 252 | - * @access private |
|
| 253 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 254 | - */ |
|
| 255 | - private $download_your_data_page; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * The 'WordLift Settings' page. |
|
| 259 | - * |
|
| 260 | - * @since 3.11.0 |
|
| 261 | - * @access protected |
|
| 262 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 263 | - */ |
|
| 264 | - protected $settings_page; |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * The install wizard page. |
|
| 268 | - * |
|
| 269 | - * @since 3.9.0 |
|
| 270 | - * @access private |
|
| 271 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 272 | - */ |
|
| 273 | - private $admin_setup; |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 277 | - * linking of entities to their pages. |
|
| 278 | - * |
|
| 279 | - * @since 3.8.0 |
|
| 280 | - * @access private |
|
| 281 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 282 | - */ |
|
| 283 | - private $content_filter_service; |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 287 | - * |
|
| 288 | - * @since 3.9.0 |
|
| 289 | - * @access private |
|
| 290 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 291 | - */ |
|
| 292 | - private $key_validation_service; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 296 | - * |
|
| 297 | - * @since 3.10.0 |
|
| 298 | - * @access private |
|
| 299 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 300 | - */ |
|
| 301 | - private $rating_service; |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 305 | - * |
|
| 306 | - * @since 3.10.0 |
|
| 307 | - * @access protected |
|
| 308 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 309 | - */ |
|
| 310 | - protected $post_to_jsonld_converter; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.10.0 |
|
| 316 | - * @access protected |
|
| 317 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 318 | - */ |
|
| 319 | - protected $configuration_service; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 323 | - * |
|
| 324 | - * @since 3.10.0 |
|
| 325 | - * @access protected |
|
| 326 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 327 | - */ |
|
| 328 | - protected $entity_type_service; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 332 | - * |
|
| 333 | - * @since 3.10.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 336 | - */ |
|
| 337 | - protected $entity_post_to_jsonld_converter; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 341 | - * |
|
| 342 | - * @since 3.10.0 |
|
| 343 | - * @access protected |
|
| 344 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 345 | - */ |
|
| 346 | - protected $postid_to_jsonld_converter; |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 350 | - * |
|
| 351 | - * @since 3.9.8 |
|
| 352 | - * @access private |
|
| 353 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 354 | - */ |
|
| 355 | - private $status_page; |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 359 | - * |
|
| 360 | - * @since 3.11.0 |
|
| 361 | - * @access protected |
|
| 362 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 363 | - */ |
|
| 364 | - protected $category_taxonomy_service; |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 368 | - * |
|
| 369 | - * @since 3.11.0 |
|
| 370 | - * @access protected |
|
| 371 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 372 | - */ |
|
| 373 | - protected $settings_page_action_link; |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.11.0 |
|
| 379 | - * @access protected |
|
| 380 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 381 | - */ |
|
| 382 | - protected $publisher_ajax_adapter; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 386 | - * |
|
| 387 | - * @since 3.11.0 |
|
| 388 | - * @access protected |
|
| 389 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 390 | - */ |
|
| 391 | - protected $input_element; |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 395 | - * |
|
| 396 | - * @since 3.11.0 |
|
| 397 | - * @access protected |
|
| 398 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 399 | - */ |
|
| 400 | - protected $language_select_element; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 404 | - * |
|
| 405 | - * @since 3.11.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 408 | - */ |
|
| 409 | - protected $publisher_element; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 413 | - * |
|
| 414 | - * @since 3.11.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 417 | - */ |
|
| 418 | - protected $select2_element; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * The controller for the entity type list admin page |
|
| 422 | - * |
|
| 423 | - * @since 3.11.0 |
|
| 424 | - * @access private |
|
| 425 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 426 | - */ |
|
| 427 | - private $entity_type_admin_page; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * The controller for the entity type settings admin page |
|
| 431 | - * |
|
| 432 | - * @since 3.11.0 |
|
| 433 | - * @access private |
|
| 434 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 435 | - */ |
|
| 436 | - private $entity_type_settings_admin_page; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 440 | - * |
|
| 441 | - * @since 3.11.0 |
|
| 442 | - * @access protected |
|
| 443 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 444 | - */ |
|
| 445 | - protected $related_entities_cloud_widget; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * {@link Wordlift}'s singleton instance. |
|
| 449 | - * |
|
| 450 | - * @since 3.11.2 |
|
| 451 | - * |
|
| 452 | - * @since 3.11.2 |
|
| 453 | - * @access private |
|
| 454 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 455 | - */ |
|
| 456 | - private static $instance; |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * Define the core functionality of the plugin. |
|
| 460 | - * |
|
| 461 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 462 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 463 | - * the public-facing side of the site. |
|
| 464 | - * |
|
| 465 | - * @since 1.0.0 |
|
| 466 | - */ |
|
| 467 | - public function __construct() { |
|
| 468 | - |
|
| 469 | - $this->plugin_name = 'wordlift'; |
|
| 470 | - $this->version = '3.11.2'; |
|
| 471 | - $this->load_dependencies(); |
|
| 472 | - $this->set_locale(); |
|
| 473 | - $this->define_admin_hooks(); |
|
| 474 | - $this->define_public_hooks(); |
|
| 475 | - |
|
| 476 | - self::$instance = $this; |
|
| 477 | - |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - /** |
|
| 481 | - * Get the singleton instance. |
|
| 482 | - * |
|
| 483 | - * @since 3.11.2 |
|
| 484 | - * |
|
| 485 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 486 | - */ |
|
| 487 | - public static function get_instance() { |
|
| 488 | - |
|
| 489 | - return self::$instance; |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * Load the required dependencies for this plugin. |
|
| 494 | - * |
|
| 495 | - * Include the following files that make up the plugin: |
|
| 496 | - * |
|
| 497 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 498 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 499 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 500 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 501 | - * |
|
| 502 | - * Create an instance of the loader which will be used to register the hooks |
|
| 503 | - * with WordPress. |
|
| 504 | - * |
|
| 505 | - * @since 1.0.0 |
|
| 506 | - * @access private |
|
| 507 | - */ |
|
| 508 | - private function load_dependencies() { |
|
| 509 | - |
|
| 510 | - /** |
|
| 511 | - * The class responsible for orchestrating the actions and filters of the |
|
| 512 | - * core plugin. |
|
| 513 | - */ |
|
| 514 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 515 | - |
|
| 516 | - /** |
|
| 517 | - * The class responsible for defining internationalization functionality |
|
| 518 | - * of the plugin. |
|
| 519 | - */ |
|
| 520 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 521 | - |
|
| 522 | - /** |
|
| 523 | - * WordLift's supported languages. |
|
| 524 | - */ |
|
| 525 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 526 | - |
|
| 527 | - /** |
|
| 528 | - * Provide support functions to sanitize data. |
|
| 529 | - */ |
|
| 530 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 531 | - |
|
| 532 | - /** |
|
| 533 | - * The Redirect service. |
|
| 534 | - */ |
|
| 535 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * The Log service. |
|
| 539 | - */ |
|
| 540 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 541 | - |
|
| 542 | - /** |
|
| 543 | - * The configuration service. |
|
| 544 | - */ |
|
| 545 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 546 | - |
|
| 547 | - /** |
|
| 548 | - * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 549 | - */ |
|
| 550 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 551 | - |
|
| 552 | - /** |
|
| 553 | - * The entity type service (i.e. the schema type). |
|
| 554 | - */ |
|
| 555 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 556 | - |
|
| 557 | - /** |
|
| 558 | - * The entity link service. |
|
| 559 | - */ |
|
| 560 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 561 | - |
|
| 562 | - /** |
|
| 563 | - * The Query builder. |
|
| 564 | - */ |
|
| 565 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 566 | - |
|
| 567 | - /** |
|
| 568 | - * The Schema service. |
|
| 569 | - */ |
|
| 570 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 571 | - |
|
| 572 | - /** |
|
| 573 | - * The schema:url property service. |
|
| 574 | - */ |
|
| 575 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 576 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 577 | - |
|
| 578 | - /** |
|
| 579 | - * The UI service. |
|
| 580 | - */ |
|
| 581 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 582 | - |
|
| 583 | - /** |
|
| 584 | - * The Thumbnail service. |
|
| 585 | - */ |
|
| 586 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 587 | - |
|
| 588 | - /** |
|
| 589 | - * The Entity Types Taxonomy service. |
|
| 590 | - */ |
|
| 591 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * The Entity service. |
|
| 595 | - */ |
|
| 596 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 597 | - |
|
| 598 | - // Add the entity rating service. |
|
| 599 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 600 | - |
|
| 601 | - /** |
|
| 602 | - * The User service. |
|
| 603 | - */ |
|
| 604 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 605 | - |
|
| 606 | - /** |
|
| 607 | - * The Timeline service. |
|
| 608 | - */ |
|
| 609 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 610 | - |
|
| 611 | - /** |
|
| 612 | - * The Topic Taxonomy service. |
|
| 613 | - */ |
|
| 614 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 615 | - |
|
| 616 | - /** |
|
| 617 | - * The SPARQL service. |
|
| 618 | - */ |
|
| 619 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 620 | - |
|
| 621 | - /** |
|
| 622 | - * The WordLift import service. |
|
| 623 | - */ |
|
| 624 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 625 | - |
|
| 626 | - /** |
|
| 627 | - * The WordLift URI service. |
|
| 628 | - */ |
|
| 629 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 630 | - |
|
| 631 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 632 | - |
|
| 633 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 634 | - |
|
| 635 | - /** |
|
| 636 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 637 | - */ |
|
| 638 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 639 | - |
|
| 640 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 641 | - |
|
| 642 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 643 | - |
|
| 644 | - /** |
|
| 645 | - * Load the converters. |
|
| 646 | - */ |
|
| 647 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 648 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 649 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 650 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 651 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 652 | - |
|
| 653 | - /** |
|
| 654 | - * Load the content filter. |
|
| 655 | - */ |
|
| 656 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 657 | - |
|
| 658 | - /** |
|
| 659 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 660 | - * |
|
| 661 | - * @since 3.8.0 |
|
| 662 | - */ |
|
| 663 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 664 | - |
|
| 665 | - // The Publisher Service and the AJAX adapter. |
|
| 666 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 667 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 668 | - |
|
| 669 | - /** |
|
| 670 | - * Load the WordLift key validation service. |
|
| 671 | - */ |
|
| 672 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 673 | - |
|
| 674 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 675 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 676 | - |
|
| 677 | - /** |
|
| 678 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 679 | - */ |
|
| 680 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 681 | - |
|
| 682 | - /** |
|
| 683 | - * The class to customize the entity list admin page. |
|
| 684 | - */ |
|
| 685 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 686 | - |
|
| 687 | - /** |
|
| 688 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 689 | - */ |
|
| 690 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 691 | - |
|
| 692 | - /** |
|
| 693 | - * The Notice service. |
|
| 694 | - */ |
|
| 695 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 696 | - |
|
| 697 | - /** |
|
| 698 | - * The PrimaShop adapter. |
|
| 699 | - */ |
|
| 700 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 701 | - |
|
| 702 | - /** |
|
| 703 | - * The WordLift Dashboard service. |
|
| 704 | - */ |
|
| 705 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 706 | - |
|
| 707 | - /** |
|
| 708 | - * The admin 'Install wizard' page. |
|
| 709 | - */ |
|
| 710 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 711 | - |
|
| 712 | - /** |
|
| 713 | - * The WordLift entity type list admin page controller. |
|
| 714 | - */ |
|
| 715 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 716 | - |
|
| 717 | - /** |
|
| 718 | - * The WordLift entity type settings admin page controller. |
|
| 719 | - */ |
|
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 721 | - |
|
| 722 | - /** |
|
| 723 | - * The admin 'Download Your Data' page. |
|
| 724 | - */ |
|
| 725 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 726 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 727 | - |
|
| 728 | - /** |
|
| 729 | - * The admin 'Download Your Data' page. |
|
| 730 | - */ |
|
| 731 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 732 | - |
|
| 733 | - /** |
|
| 734 | - * The admin 'WordLift Settings' page. |
|
| 735 | - */ |
|
| 736 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 737 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 738 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 739 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 740 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 741 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 742 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 743 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 744 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 745 | - |
|
| 746 | - /** Admin Pages */ |
|
| 747 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 748 | - |
|
| 749 | - /** |
|
| 750 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 751 | - * side of the site. |
|
| 752 | - */ |
|
| 753 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 754 | - |
|
| 755 | - /** |
|
| 756 | - * The shortcode abstract class. |
|
| 757 | - */ |
|
| 758 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 759 | - |
|
| 760 | - /** |
|
| 761 | - * The Timeline shortcode. |
|
| 762 | - */ |
|
| 763 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 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 Thumbnail service. |
|
| 62 | + * |
|
| 63 | + * @since 3.1.5 |
|
| 64 | + * @access private |
|
| 65 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | + */ |
|
| 67 | + private $thumbnail_service; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The UI service. |
|
| 71 | + * |
|
| 72 | + * @since 3.2.0 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 75 | + */ |
|
| 76 | + private $ui_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The Schema service. |
|
| 80 | + * |
|
| 81 | + * @since 3.3.0 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 84 | + */ |
|
| 85 | + private $schema_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Entity service. |
|
| 89 | + * |
|
| 90 | + * @since 3.1.0 |
|
| 91 | + * @access protected |
|
| 92 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 93 | + */ |
|
| 94 | + protected $entity_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Topic Taxonomy service. |
|
| 98 | + * |
|
| 99 | + * @since 3.5.0 |
|
| 100 | + * @access private |
|
| 101 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 102 | + */ |
|
| 103 | + private $topic_taxonomy_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The User service. |
|
| 107 | + * |
|
| 108 | + * @since 3.1.7 |
|
| 109 | + * @access protected |
|
| 110 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 111 | + */ |
|
| 112 | + protected $user_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The Timeline service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.0 |
|
| 118 | + * @access private |
|
| 119 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 120 | + */ |
|
| 121 | + private $timeline_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Redirect service. |
|
| 125 | + * |
|
| 126 | + * @since 3.2.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 129 | + */ |
|
| 130 | + private $redirect_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Notice service. |
|
| 134 | + * |
|
| 135 | + * @since 3.3.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 138 | + */ |
|
| 139 | + private $notice_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Entity list customization. |
|
| 143 | + * |
|
| 144 | + * @since 3.3.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 147 | + */ |
|
| 148 | + private $entity_list_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Entity Types Taxonomy Walker. |
|
| 152 | + * |
|
| 153 | + * @since 3.1.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 156 | + */ |
|
| 157 | + private $entity_types_taxonomy_walker; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The ShareThis service. |
|
| 161 | + * |
|
| 162 | + * @since 3.2.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 165 | + */ |
|
| 166 | + private $sharethis_service; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The PrimaShop adapter. |
|
| 170 | + * |
|
| 171 | + * @since 3.2.3 |
|
| 172 | + * @access private |
|
| 173 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 174 | + */ |
|
| 175 | + private $primashop_adapter; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The WordLift Dashboard adapter. |
|
| 179 | + * |
|
| 180 | + * @since 3.4.0 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 183 | + */ |
|
| 184 | + private $dashboard_service; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The entity type service. |
|
| 188 | + * |
|
| 189 | + * @since 3.6.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 192 | + */ |
|
| 193 | + private $entity_post_type_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 197 | + * |
|
| 198 | + * @since 3.6.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Entity_Link_Service |
|
| 201 | + */ |
|
| 202 | + private $entity_link_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 206 | + * |
|
| 207 | + * @var 3.6.0 |
|
| 208 | + * @access private |
|
| 209 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 210 | + */ |
|
| 211 | + private $sparql_service; |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * A {@link Wordlift_Import_Service} instance. |
|
| 215 | + * |
|
| 216 | + * @since 3.6.0 |
|
| 217 | + * @access private |
|
| 218 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 219 | + */ |
|
| 220 | + private $import_service; |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 224 | + * |
|
| 225 | + * @since 3.6.0 |
|
| 226 | + * @access private |
|
| 227 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 228 | + */ |
|
| 229 | + private $rebuild_service; |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 233 | + * |
|
| 234 | + * @since 3.7.0 |
|
| 235 | + * @access protected |
|
| 236 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 237 | + */ |
|
| 238 | + protected $jsonld_service; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * |
|
| 242 | + * @since 3.7.0 |
|
| 243 | + * @access private |
|
| 244 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 245 | + */ |
|
| 246 | + private $property_factory; |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * The 'Download Your Data' page. |
|
| 250 | + * |
|
| 251 | + * @since 3.6.0 |
|
| 252 | + * @access private |
|
| 253 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 254 | + */ |
|
| 255 | + private $download_your_data_page; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * The 'WordLift Settings' page. |
|
| 259 | + * |
|
| 260 | + * @since 3.11.0 |
|
| 261 | + * @access protected |
|
| 262 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 263 | + */ |
|
| 264 | + protected $settings_page; |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * The install wizard page. |
|
| 268 | + * |
|
| 269 | + * @since 3.9.0 |
|
| 270 | + * @access private |
|
| 271 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 272 | + */ |
|
| 273 | + private $admin_setup; |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 277 | + * linking of entities to their pages. |
|
| 278 | + * |
|
| 279 | + * @since 3.8.0 |
|
| 280 | + * @access private |
|
| 281 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 282 | + */ |
|
| 283 | + private $content_filter_service; |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 287 | + * |
|
| 288 | + * @since 3.9.0 |
|
| 289 | + * @access private |
|
| 290 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 291 | + */ |
|
| 292 | + private $key_validation_service; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 296 | + * |
|
| 297 | + * @since 3.10.0 |
|
| 298 | + * @access private |
|
| 299 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 300 | + */ |
|
| 301 | + private $rating_service; |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 305 | + * |
|
| 306 | + * @since 3.10.0 |
|
| 307 | + * @access protected |
|
| 308 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 309 | + */ |
|
| 310 | + protected $post_to_jsonld_converter; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.10.0 |
|
| 316 | + * @access protected |
|
| 317 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 318 | + */ |
|
| 319 | + protected $configuration_service; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 323 | + * |
|
| 324 | + * @since 3.10.0 |
|
| 325 | + * @access protected |
|
| 326 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 327 | + */ |
|
| 328 | + protected $entity_type_service; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 332 | + * |
|
| 333 | + * @since 3.10.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 336 | + */ |
|
| 337 | + protected $entity_post_to_jsonld_converter; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 341 | + * |
|
| 342 | + * @since 3.10.0 |
|
| 343 | + * @access protected |
|
| 344 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 345 | + */ |
|
| 346 | + protected $postid_to_jsonld_converter; |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 350 | + * |
|
| 351 | + * @since 3.9.8 |
|
| 352 | + * @access private |
|
| 353 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 354 | + */ |
|
| 355 | + private $status_page; |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 359 | + * |
|
| 360 | + * @since 3.11.0 |
|
| 361 | + * @access protected |
|
| 362 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 363 | + */ |
|
| 364 | + protected $category_taxonomy_service; |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 368 | + * |
|
| 369 | + * @since 3.11.0 |
|
| 370 | + * @access protected |
|
| 371 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 372 | + */ |
|
| 373 | + protected $settings_page_action_link; |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.11.0 |
|
| 379 | + * @access protected |
|
| 380 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 381 | + */ |
|
| 382 | + protected $publisher_ajax_adapter; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 386 | + * |
|
| 387 | + * @since 3.11.0 |
|
| 388 | + * @access protected |
|
| 389 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 390 | + */ |
|
| 391 | + protected $input_element; |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 395 | + * |
|
| 396 | + * @since 3.11.0 |
|
| 397 | + * @access protected |
|
| 398 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 399 | + */ |
|
| 400 | + protected $language_select_element; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 404 | + * |
|
| 405 | + * @since 3.11.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 408 | + */ |
|
| 409 | + protected $publisher_element; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 413 | + * |
|
| 414 | + * @since 3.11.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 417 | + */ |
|
| 418 | + protected $select2_element; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * The controller for the entity type list admin page |
|
| 422 | + * |
|
| 423 | + * @since 3.11.0 |
|
| 424 | + * @access private |
|
| 425 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 426 | + */ |
|
| 427 | + private $entity_type_admin_page; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * The controller for the entity type settings admin page |
|
| 431 | + * |
|
| 432 | + * @since 3.11.0 |
|
| 433 | + * @access private |
|
| 434 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 435 | + */ |
|
| 436 | + private $entity_type_settings_admin_page; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 440 | + * |
|
| 441 | + * @since 3.11.0 |
|
| 442 | + * @access protected |
|
| 443 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 444 | + */ |
|
| 445 | + protected $related_entities_cloud_widget; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * {@link Wordlift}'s singleton instance. |
|
| 449 | + * |
|
| 450 | + * @since 3.11.2 |
|
| 451 | + * |
|
| 452 | + * @since 3.11.2 |
|
| 453 | + * @access private |
|
| 454 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 455 | + */ |
|
| 456 | + private static $instance; |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * Define the core functionality of the plugin. |
|
| 460 | + * |
|
| 461 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 462 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 463 | + * the public-facing side of the site. |
|
| 464 | + * |
|
| 465 | + * @since 1.0.0 |
|
| 466 | + */ |
|
| 467 | + public function __construct() { |
|
| 468 | + |
|
| 469 | + $this->plugin_name = 'wordlift'; |
|
| 470 | + $this->version = '3.11.2'; |
|
| 471 | + $this->load_dependencies(); |
|
| 472 | + $this->set_locale(); |
|
| 473 | + $this->define_admin_hooks(); |
|
| 474 | + $this->define_public_hooks(); |
|
| 475 | + |
|
| 476 | + self::$instance = $this; |
|
| 477 | + |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * Get the singleton instance. |
|
| 482 | + * |
|
| 483 | + * @since 3.11.2 |
|
| 484 | + * |
|
| 485 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 486 | + */ |
|
| 487 | + public static function get_instance() { |
|
| 488 | + |
|
| 489 | + return self::$instance; |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * Load the required dependencies for this plugin. |
|
| 494 | + * |
|
| 495 | + * Include the following files that make up the plugin: |
|
| 496 | + * |
|
| 497 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 498 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 499 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 500 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 501 | + * |
|
| 502 | + * Create an instance of the loader which will be used to register the hooks |
|
| 503 | + * with WordPress. |
|
| 504 | + * |
|
| 505 | + * @since 1.0.0 |
|
| 506 | + * @access private |
|
| 507 | + */ |
|
| 508 | + private function load_dependencies() { |
|
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * The class responsible for orchestrating the actions and filters of the |
|
| 512 | + * core plugin. |
|
| 513 | + */ |
|
| 514 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 515 | + |
|
| 516 | + /** |
|
| 517 | + * The class responsible for defining internationalization functionality |
|
| 518 | + * of the plugin. |
|
| 519 | + */ |
|
| 520 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 521 | + |
|
| 522 | + /** |
|
| 523 | + * WordLift's supported languages. |
|
| 524 | + */ |
|
| 525 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 526 | + |
|
| 527 | + /** |
|
| 528 | + * Provide support functions to sanitize data. |
|
| 529 | + */ |
|
| 530 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 531 | + |
|
| 532 | + /** |
|
| 533 | + * The Redirect service. |
|
| 534 | + */ |
|
| 535 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * The Log service. |
|
| 539 | + */ |
|
| 540 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 541 | + |
|
| 542 | + /** |
|
| 543 | + * The configuration service. |
|
| 544 | + */ |
|
| 545 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 546 | + |
|
| 547 | + /** |
|
| 548 | + * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 549 | + */ |
|
| 550 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 551 | + |
|
| 552 | + /** |
|
| 553 | + * The entity type service (i.e. the schema type). |
|
| 554 | + */ |
|
| 555 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 556 | + |
|
| 557 | + /** |
|
| 558 | + * The entity link service. |
|
| 559 | + */ |
|
| 560 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 561 | + |
|
| 562 | + /** |
|
| 563 | + * The Query builder. |
|
| 564 | + */ |
|
| 565 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 566 | + |
|
| 567 | + /** |
|
| 568 | + * The Schema service. |
|
| 569 | + */ |
|
| 570 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 571 | + |
|
| 572 | + /** |
|
| 573 | + * The schema:url property service. |
|
| 574 | + */ |
|
| 575 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 576 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 577 | + |
|
| 578 | + /** |
|
| 579 | + * The UI service. |
|
| 580 | + */ |
|
| 581 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 582 | + |
|
| 583 | + /** |
|
| 584 | + * The Thumbnail service. |
|
| 585 | + */ |
|
| 586 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 587 | + |
|
| 588 | + /** |
|
| 589 | + * The Entity Types Taxonomy service. |
|
| 590 | + */ |
|
| 591 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * The Entity service. |
|
| 595 | + */ |
|
| 596 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 597 | + |
|
| 598 | + // Add the entity rating service. |
|
| 599 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 600 | + |
|
| 601 | + /** |
|
| 602 | + * The User service. |
|
| 603 | + */ |
|
| 604 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 605 | + |
|
| 606 | + /** |
|
| 607 | + * The Timeline service. |
|
| 608 | + */ |
|
| 609 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 610 | + |
|
| 611 | + /** |
|
| 612 | + * The Topic Taxonomy service. |
|
| 613 | + */ |
|
| 614 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 615 | + |
|
| 616 | + /** |
|
| 617 | + * The SPARQL service. |
|
| 618 | + */ |
|
| 619 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 620 | + |
|
| 621 | + /** |
|
| 622 | + * The WordLift import service. |
|
| 623 | + */ |
|
| 624 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 625 | + |
|
| 626 | + /** |
|
| 627 | + * The WordLift URI service. |
|
| 628 | + */ |
|
| 629 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 630 | + |
|
| 631 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 632 | + |
|
| 633 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 634 | + |
|
| 635 | + /** |
|
| 636 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 637 | + */ |
|
| 638 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 639 | + |
|
| 640 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 641 | + |
|
| 642 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 643 | + |
|
| 644 | + /** |
|
| 645 | + * Load the converters. |
|
| 646 | + */ |
|
| 647 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 648 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 649 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 650 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 651 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 652 | + |
|
| 653 | + /** |
|
| 654 | + * Load the content filter. |
|
| 655 | + */ |
|
| 656 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 657 | + |
|
| 658 | + /** |
|
| 659 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 660 | + * |
|
| 661 | + * @since 3.8.0 |
|
| 662 | + */ |
|
| 663 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 664 | + |
|
| 665 | + // The Publisher Service and the AJAX adapter. |
|
| 666 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 667 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 668 | + |
|
| 669 | + /** |
|
| 670 | + * Load the WordLift key validation service. |
|
| 671 | + */ |
|
| 672 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 673 | + |
|
| 674 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 675 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 676 | + |
|
| 677 | + /** |
|
| 678 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 679 | + */ |
|
| 680 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 681 | + |
|
| 682 | + /** |
|
| 683 | + * The class to customize the entity list admin page. |
|
| 684 | + */ |
|
| 685 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 686 | + |
|
| 687 | + /** |
|
| 688 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 689 | + */ |
|
| 690 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 691 | + |
|
| 692 | + /** |
|
| 693 | + * The Notice service. |
|
| 694 | + */ |
|
| 695 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 696 | + |
|
| 697 | + /** |
|
| 698 | + * The PrimaShop adapter. |
|
| 699 | + */ |
|
| 700 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 701 | + |
|
| 702 | + /** |
|
| 703 | + * The WordLift Dashboard service. |
|
| 704 | + */ |
|
| 705 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 706 | + |
|
| 707 | + /** |
|
| 708 | + * The admin 'Install wizard' page. |
|
| 709 | + */ |
|
| 710 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 711 | + |
|
| 712 | + /** |
|
| 713 | + * The WordLift entity type list admin page controller. |
|
| 714 | + */ |
|
| 715 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 716 | + |
|
| 717 | + /** |
|
| 718 | + * The WordLift entity type settings admin page controller. |
|
| 719 | + */ |
|
| 720 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 721 | + |
|
| 722 | + /** |
|
| 723 | + * The admin 'Download Your Data' page. |
|
| 724 | + */ |
|
| 725 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 726 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 727 | + |
|
| 728 | + /** |
|
| 729 | + * The admin 'Download Your Data' page. |
|
| 730 | + */ |
|
| 731 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 732 | + |
|
| 733 | + /** |
|
| 734 | + * The admin 'WordLift Settings' page. |
|
| 735 | + */ |
|
| 736 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 737 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 738 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 739 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 740 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 741 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 742 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 743 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 744 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 745 | + |
|
| 746 | + /** Admin Pages */ |
|
| 747 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 748 | + |
|
| 749 | + /** |
|
| 750 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 751 | + * side of the site. |
|
| 752 | + */ |
|
| 753 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 754 | + |
|
| 755 | + /** |
|
| 756 | + * The shortcode abstract class. |
|
| 757 | + */ |
|
| 758 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 759 | + |
|
| 760 | + /** |
|
| 761 | + * The Timeline shortcode. |
|
| 762 | + */ |
|
| 763 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 764 | 764 | |
| 765 | - /** |
|
| 766 | - * The Navigator shortcode. |
|
| 767 | - */ |
|
| 768 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * The chord shortcode. |
|
| 772 | - */ |
|
| 773 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 765 | + /** |
|
| 766 | + * The Navigator shortcode. |
|
| 767 | + */ |
|
| 768 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * The chord shortcode. |
|
| 772 | + */ |
|
| 773 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 774 | 774 | |
| 775 | - /** |
|
| 776 | - * The geomap shortcode. |
|
| 777 | - */ |
|
| 778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 775 | + /** |
|
| 776 | + * The geomap shortcode. |
|
| 777 | + */ |
|
| 778 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 779 | 779 | |
| 780 | - /** |
|
| 781 | - * The ShareThis service. |
|
| 782 | - */ |
|
| 783 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 780 | + /** |
|
| 781 | + * The ShareThis service. |
|
| 782 | + */ |
|
| 783 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 784 | 784 | |
| 785 | - /** |
|
| 786 | - * The SEO service. |
|
| 787 | - */ |
|
| 788 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 785 | + /** |
|
| 786 | + * The SEO service. |
|
| 787 | + */ |
|
| 788 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 789 | 789 | |
| 790 | - /** Widgets */ |
|
| 791 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 790 | + /** Widgets */ |
|
| 791 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 793 | 793 | |
| 794 | - $this->loader = new Wordlift_Loader(); |
|
| 794 | + $this->loader = new Wordlift_Loader(); |
|
| 795 | 795 | |
| 796 | - // Instantiate a global logger. |
|
| 797 | - global $wl_logger; |
|
| 798 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 796 | + // Instantiate a global logger. |
|
| 797 | + global $wl_logger; |
|
| 798 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 799 | 799 | |
| 800 | - // Create the configuration service. |
|
| 801 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 800 | + // Create the configuration service. |
|
| 801 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 802 | 802 | |
| 803 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 804 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 803 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 804 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 805 | 805 | |
| 806 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 807 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 806 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 807 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 808 | 808 | |
| 809 | - // Create an instance of the UI service. |
|
| 810 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 809 | + // Create an instance of the UI service. |
|
| 810 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 811 | 811 | |
| 812 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 813 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 812 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 813 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 814 | 814 | |
| 815 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 815 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 816 | 816 | |
| 817 | - // Create an instance of the Schema service. |
|
| 818 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 819 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 817 | + // Create an instance of the Schema service. |
|
| 818 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 819 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 820 | 820 | |
| 821 | - // Create an instance of the Notice service. |
|
| 822 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 821 | + // Create an instance of the Notice service. |
|
| 822 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 823 | 823 | |
| 824 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 825 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 824 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 825 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 826 | 826 | |
| 827 | - // Create an instance of the User service. |
|
| 828 | - $this->user_service = new Wordlift_User_Service(); |
|
| 827 | + // Create an instance of the User service. |
|
| 828 | + $this->user_service = new Wordlift_User_Service(); |
|
| 829 | 829 | |
| 830 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 831 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 830 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 831 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 832 | 832 | |
| 833 | - // Create a new instance of the Redirect service. |
|
| 834 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 833 | + // Create a new instance of the Redirect service. |
|
| 834 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 835 | 835 | |
| 836 | - // Initialize the shortcodes. |
|
| 837 | - new Wordlift_Navigator_Shortcode(); |
|
| 838 | - new Wordlift_Chord_Shortcode(); |
|
| 839 | - new Wordlift_Geomap_Shortcode(); |
|
| 840 | - new Wordlift_Timeline_Shortcode(); |
|
| 836 | + // Initialize the shortcodes. |
|
| 837 | + new Wordlift_Navigator_Shortcode(); |
|
| 838 | + new Wordlift_Chord_Shortcode(); |
|
| 839 | + new Wordlift_Geomap_Shortcode(); |
|
| 840 | + new Wordlift_Timeline_Shortcode(); |
|
| 841 | 841 | |
| 842 | - // Initialize the SEO service. |
|
| 843 | - new Wordlift_Seo_Service(); |
|
| 842 | + // Initialize the SEO service. |
|
| 843 | + new Wordlift_Seo_Service(); |
|
| 844 | 844 | |
| 845 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 845 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 846 | 846 | |
| 847 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 847 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 848 | 848 | |
| 849 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 850 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 849 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 850 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 851 | 851 | |
| 852 | - // Create an instance of the PrimaShop adapter. |
|
| 853 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 852 | + // Create an instance of the PrimaShop adapter. |
|
| 853 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 854 | 854 | |
| 855 | - // Create an import service instance to hook later to WP's import function. |
|
| 856 | - $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() ); |
|
| 855 | + // Create an import service instance to hook later to WP's import function. |
|
| 856 | + $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() ); |
|
| 857 | 857 | |
| 858 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 858 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 859 | 859 | |
| 860 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 861 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 860 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 861 | + $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 862 | 862 | |
| 863 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 863 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 864 | 864 | |
| 865 | - // Create the entity rating service. |
|
| 866 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 865 | + // Create the entity rating service. |
|
| 866 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 867 | 867 | |
| 868 | - // Create entity list customization (wp-admin/edit.php) |
|
| 869 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 868 | + // Create entity list customization (wp-admin/edit.php) |
|
| 869 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 870 | 870 | |
| 871 | - // Create a new instance of the Redirect service. |
|
| 872 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 871 | + // Create a new instance of the Redirect service. |
|
| 872 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 873 | 873 | |
| 874 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 875 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 874 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 875 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 876 | 876 | |
| 877 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 877 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 878 | 878 | |
| 879 | - // Instantiate the JSON-LD service. |
|
| 880 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 881 | - $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 ); |
|
| 882 | - $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 ); |
|
| 883 | - $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 ); |
|
| 884 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 879 | + // Instantiate the JSON-LD service. |
|
| 880 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 881 | + $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 ); |
|
| 882 | + $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 ); |
|
| 883 | + $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 ); |
|
| 884 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 885 | 885 | |
| 886 | - // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 887 | - $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 886 | + // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 887 | + $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 888 | 888 | |
| 889 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 890 | - $publisher_service = new Wordlift_Publisher_Service(); |
|
| 891 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 889 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 890 | + $publisher_service = new Wordlift_Publisher_Service(); |
|
| 891 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 892 | 892 | |
| 893 | - /** WordPress Admin UI. */ |
|
| 893 | + /** WordPress Admin UI. */ |
|
| 894 | 894 | |
| 895 | - // UI elements. |
|
| 896 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 897 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 898 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 899 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 900 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 895 | + // UI elements. |
|
| 896 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 897 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 898 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 899 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 900 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 901 | 901 | |
| 902 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 903 | - $this->status_page = new Wordlift_Admin_Status_Page(); |
|
| 904 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element ); |
|
| 905 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 902 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 903 | + $this->status_page = new Wordlift_Admin_Status_Page(); |
|
| 904 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element ); |
|
| 905 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 906 | 906 | |
| 907 | - // Pages. |
|
| 908 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 907 | + // Pages. |
|
| 908 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 909 | 909 | |
| 910 | - // create an instance of the entity type list admin page controller. |
|
| 911 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 910 | + // create an instance of the entity type list admin page controller. |
|
| 911 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 912 | 912 | |
| 913 | - // create an instance of the entity type etting admin page controller. |
|
| 914 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 913 | + // create an instance of the entity type etting admin page controller. |
|
| 914 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 915 | 915 | |
| 916 | - /** Widgets */ |
|
| 917 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 916 | + /** Widgets */ |
|
| 917 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 918 | 918 | |
| 919 | - //** WordPress Admin */ |
|
| 920 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 921 | - $this->status_page = new Wordlift_Admin_Status_Page(); |
|
| 919 | + //** WordPress Admin */ |
|
| 920 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 921 | + $this->status_page = new Wordlift_Admin_Status_Page(); |
|
| 922 | 922 | |
| 923 | - // Create an instance of the install wizard. |
|
| 924 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 923 | + // Create an instance of the install wizard. |
|
| 924 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 925 | 925 | |
| 926 | - // Create an instance of the content filter service. |
|
| 927 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service ); |
|
| 926 | + // Create an instance of the content filter service. |
|
| 927 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service ); |
|
| 928 | 928 | |
| 929 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 929 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 930 | 930 | |
| 931 | - // Load the debug service if WP is in debug mode. |
|
| 932 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 933 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 934 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 935 | - } |
|
| 931 | + // Load the debug service if WP is in debug mode. |
|
| 932 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 933 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 934 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 935 | + } |
|
| 936 | 936 | |
| 937 | - } |
|
| 937 | + } |
|
| 938 | 938 | |
| 939 | - /** |
|
| 940 | - * Define the locale for this plugin for internationalization. |
|
| 941 | - * |
|
| 942 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 943 | - * with WordPress. |
|
| 944 | - * |
|
| 945 | - * @since 1.0.0 |
|
| 946 | - * @access private |
|
| 947 | - */ |
|
| 948 | - private function set_locale() { |
|
| 939 | + /** |
|
| 940 | + * Define the locale for this plugin for internationalization. |
|
| 941 | + * |
|
| 942 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 943 | + * with WordPress. |
|
| 944 | + * |
|
| 945 | + * @since 1.0.0 |
|
| 946 | + * @access private |
|
| 947 | + */ |
|
| 948 | + private function set_locale() { |
|
| 949 | 949 | |
| 950 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 951 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 950 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 951 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 952 | 952 | |
| 953 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 953 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 954 | 954 | |
| 955 | - } |
|
| 955 | + } |
|
| 956 | 956 | |
| 957 | - /** |
|
| 958 | - * Register all of the hooks related to the admin area functionality |
|
| 959 | - * of the plugin. |
|
| 960 | - * |
|
| 961 | - * @since 1.0.0 |
|
| 962 | - * @access private |
|
| 963 | - */ |
|
| 964 | - private function define_admin_hooks() { |
|
| 957 | + /** |
|
| 958 | + * Register all of the hooks related to the admin area functionality |
|
| 959 | + * of the plugin. |
|
| 960 | + * |
|
| 961 | + * @since 1.0.0 |
|
| 962 | + * @access private |
|
| 963 | + */ |
|
| 964 | + private function define_admin_hooks() { |
|
| 965 | 965 | |
| 966 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 966 | + $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 967 | 967 | |
| 968 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 969 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 968 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 969 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 970 | 970 | |
| 971 | - // Hook the init action to the Topic Taxonomy service. |
|
| 972 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 971 | + // Hook the init action to the Topic Taxonomy service. |
|
| 972 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 973 | 973 | |
| 974 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 975 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 974 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 975 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 976 | 976 | |
| 977 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 978 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 977 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 978 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 979 | 979 | |
| 980 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 981 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 980 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 981 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 982 | 982 | |
| 983 | - // Hook posts inserts (or updates) to the user service. |
|
| 984 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 983 | + // Hook posts inserts (or updates) to the user service. |
|
| 984 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 985 | 985 | |
| 986 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 987 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 986 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 987 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 988 | 988 | |
| 989 | - // Register custom allowed redirect hosts. |
|
| 990 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 991 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 992 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 993 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 994 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 995 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 996 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 989 | + // Register custom allowed redirect hosts. |
|
| 990 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 991 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 992 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 993 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 994 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 995 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 996 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 997 | 997 | |
| 998 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 999 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1000 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1001 | - $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 998 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 999 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1000 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1001 | + $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1002 | 1002 | |
| 1003 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1004 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1003 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1004 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1005 | 1005 | |
| 1006 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1007 | - // Add custom columns |
|
| 1008 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1009 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1010 | - // Add 4W selection |
|
| 1011 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1012 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1006 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1007 | + // Add custom columns |
|
| 1008 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1009 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1010 | + // Add 4W selection |
|
| 1011 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1012 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1013 | 1013 | |
| 1014 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1014 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1015 | 1015 | |
| 1016 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1017 | - // entities. |
|
| 1018 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1016 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1017 | + // entities. |
|
| 1018 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1019 | 1019 | |
| 1020 | - // Filter imported post meta. |
|
| 1021 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1020 | + // Filter imported post meta. |
|
| 1021 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1022 | 1022 | |
| 1023 | - // Notify the import service when an import starts and ends. |
|
| 1024 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1025 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1023 | + // Notify the import service when an import starts and ends. |
|
| 1024 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1025 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1026 | 1026 | |
| 1027 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1028 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1027 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1028 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1029 | 1029 | |
| 1030 | - // Hook the menu to the Download Your Data page. |
|
| 1031 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1032 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1033 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1034 | - |
|
| 1035 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1036 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1037 | - |
|
| 1038 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1039 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1040 | - |
|
| 1041 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1042 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1043 | - |
|
| 1044 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1045 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1046 | - |
|
| 1047 | - // Hook the admin_init to the settings page. |
|
| 1048 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1049 | - |
|
| 1050 | - // Hook the menu creation on the general wordlift menu creation |
|
| 1051 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1052 | - |
|
| 1053 | - // Hook key update. |
|
| 1054 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1055 | - |
|
| 1056 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1057 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1058 | - |
|
| 1059 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1060 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1061 | - |
|
| 1062 | - // Hook row actions for the entity type list admin. |
|
| 1063 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1064 | - |
|
| 1065 | - } |
|
| 1066 | - |
|
| 1067 | - /** |
|
| 1068 | - * Register all of the hooks related to the public-facing functionality |
|
| 1069 | - * of the plugin. |
|
| 1070 | - * |
|
| 1071 | - * @since 1.0.0 |
|
| 1072 | - * @access private |
|
| 1073 | - */ |
|
| 1074 | - private function define_public_hooks() { |
|
| 1075 | - |
|
| 1076 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1077 | - |
|
| 1078 | - // Register the entity post type. |
|
| 1079 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1080 | - |
|
| 1081 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1082 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1083 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 1084 | - $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 ); |
|
| 1085 | - $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 ); |
|
| 1086 | - |
|
| 1087 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1088 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1089 | - |
|
| 1090 | - // Hook the content filter service to add entity links. |
|
| 1091 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1092 | - |
|
| 1093 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1094 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1095 | - |
|
| 1096 | - // Hook the ShareThis service. |
|
| 1097 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1098 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1099 | - |
|
| 1100 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1101 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1102 | - |
|
| 1103 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1104 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1105 | - // to categories. |
|
| 1106 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1107 | - |
|
| 1108 | - } |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1112 | - * |
|
| 1113 | - * @since 1.0.0 |
|
| 1114 | - */ |
|
| 1115 | - public function run() { |
|
| 1116 | - $this->loader->run(); |
|
| 1117 | - } |
|
| 1118 | - |
|
| 1119 | - /** |
|
| 1120 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1121 | - * WordPress and to define internationalization functionality. |
|
| 1122 | - * |
|
| 1123 | - * @since 1.0.0 |
|
| 1124 | - * @return string The name of the plugin. |
|
| 1125 | - */ |
|
| 1126 | - public function get_plugin_name() { |
|
| 1127 | - return $this->plugin_name; |
|
| 1128 | - } |
|
| 1129 | - |
|
| 1130 | - /** |
|
| 1131 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1132 | - * |
|
| 1133 | - * @since 1.0.0 |
|
| 1134 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1135 | - */ |
|
| 1136 | - public function get_loader() { |
|
| 1137 | - return $this->loader; |
|
| 1138 | - } |
|
| 1139 | - |
|
| 1140 | - /** |
|
| 1141 | - * Retrieve the version number of the plugin. |
|
| 1142 | - * |
|
| 1143 | - * @since 1.0.0 |
|
| 1144 | - * @return string The version number of the plugin. |
|
| 1145 | - */ |
|
| 1146 | - public function get_version() { |
|
| 1147 | - return $this->version; |
|
| 1148 | - } |
|
| 1030 | + // Hook the menu to the Download Your Data page. |
|
| 1031 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1032 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1033 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1034 | + |
|
| 1035 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1036 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1037 | + |
|
| 1038 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1039 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1040 | + |
|
| 1041 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1042 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1043 | + |
|
| 1044 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1045 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1046 | + |
|
| 1047 | + // Hook the admin_init to the settings page. |
|
| 1048 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1049 | + |
|
| 1050 | + // Hook the menu creation on the general wordlift menu creation |
|
| 1051 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1052 | + |
|
| 1053 | + // Hook key update. |
|
| 1054 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1055 | + |
|
| 1056 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1057 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1058 | + |
|
| 1059 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1060 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1061 | + |
|
| 1062 | + // Hook row actions for the entity type list admin. |
|
| 1063 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1064 | + |
|
| 1065 | + } |
|
| 1066 | + |
|
| 1067 | + /** |
|
| 1068 | + * Register all of the hooks related to the public-facing functionality |
|
| 1069 | + * of the plugin. |
|
| 1070 | + * |
|
| 1071 | + * @since 1.0.0 |
|
| 1072 | + * @access private |
|
| 1073 | + */ |
|
| 1074 | + private function define_public_hooks() { |
|
| 1075 | + |
|
| 1076 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1077 | + |
|
| 1078 | + // Register the entity post type. |
|
| 1079 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1080 | + |
|
| 1081 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1082 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1083 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 1084 | + $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 ); |
|
| 1085 | + $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 ); |
|
| 1086 | + |
|
| 1087 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1088 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1089 | + |
|
| 1090 | + // Hook the content filter service to add entity links. |
|
| 1091 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1092 | + |
|
| 1093 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1094 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1095 | + |
|
| 1096 | + // Hook the ShareThis service. |
|
| 1097 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1098 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1099 | + |
|
| 1100 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1101 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1102 | + |
|
| 1103 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1104 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1105 | + // to categories. |
|
| 1106 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1107 | + |
|
| 1108 | + } |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1112 | + * |
|
| 1113 | + * @since 1.0.0 |
|
| 1114 | + */ |
|
| 1115 | + public function run() { |
|
| 1116 | + $this->loader->run(); |
|
| 1117 | + } |
|
| 1118 | + |
|
| 1119 | + /** |
|
| 1120 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1121 | + * WordPress and to define internationalization functionality. |
|
| 1122 | + * |
|
| 1123 | + * @since 1.0.0 |
|
| 1124 | + * @return string The name of the plugin. |
|
| 1125 | + */ |
|
| 1126 | + public function get_plugin_name() { |
|
| 1127 | + return $this->plugin_name; |
|
| 1128 | + } |
|
| 1129 | + |
|
| 1130 | + /** |
|
| 1131 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1132 | + * |
|
| 1133 | + * @since 1.0.0 |
|
| 1134 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1135 | + */ |
|
| 1136 | + public function get_loader() { |
|
| 1137 | + return $this->loader; |
|
| 1138 | + } |
|
| 1139 | + |
|
| 1140 | + /** |
|
| 1141 | + * Retrieve the version number of the plugin. |
|
| 1142 | + * |
|
| 1143 | + * @since 1.0.0 |
|
| 1144 | + * @return string The version number of the plugin. |
|
| 1145 | + */ |
|
| 1146 | + public function get_version() { |
|
| 1147 | + return $this->version; |
|
| 1148 | + } |
|
| 1149 | 1149 | |
| 1150 | 1150 | } |