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