@@ -18,74 +18,74 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Category_Taxonomy_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.11.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Entity_Post_Type_Service $entity_post_type_service The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $entity_post_type_service; |
|
| 21 | + /** |
|
| 22 | + * The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.11.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Entity_Post_Type_Service $entity_post_type_service The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $entity_post_type_service; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Create a {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.11.0 |
|
| 34 | - * |
|
| 35 | - * @param \Wordlift_Entity_Post_Type_Service $entity_post_type_service The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 36 | - */ |
|
| 37 | - function __construct( $entity_post_type_service ) { |
|
| 30 | + /** |
|
| 31 | + * Create a {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.11.0 |
|
| 34 | + * |
|
| 35 | + * @param \Wordlift_Entity_Post_Type_Service $entity_post_type_service The {@link Wordlift_Entity_Post_Type_Service} instance. |
|
| 36 | + */ |
|
| 37 | + function __construct( $entity_post_type_service ) { |
|
| 38 | 38 | |
| 39 | - $this->entity_post_type_service = $entity_post_type_service; |
|
| 39 | + $this->entity_post_type_service = $entity_post_type_service; |
|
| 40 | 40 | |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Set the entity post types as one to be included in archive pages. |
|
| 45 | - * |
|
| 46 | - * In order to have entities show up in standard WP categories (Posts categories) |
|
| 47 | - * we configure the `entity` post type, but we also need to alter the main |
|
| 48 | - * WP query (which by default queries posts only) to include the `entities`. |
|
| 49 | - * |
|
| 50 | - * @since 3.11.0 |
|
| 51 | - * |
|
| 52 | - * @param WP_Query $query WP's {@link WP_Query} instance. |
|
| 53 | - */ |
|
| 54 | - public function pre_get_posts( $query ) { |
|
| 43 | + /** |
|
| 44 | + * Set the entity post types as one to be included in archive pages. |
|
| 45 | + * |
|
| 46 | + * In order to have entities show up in standard WP categories (Posts categories) |
|
| 47 | + * we configure the `entity` post type, but we also need to alter the main |
|
| 48 | + * WP query (which by default queries posts only) to include the `entities`. |
|
| 49 | + * |
|
| 50 | + * @since 3.11.0 |
|
| 51 | + * |
|
| 52 | + * @param WP_Query $query WP's {@link WP_Query} instance. |
|
| 53 | + */ |
|
| 54 | + public function pre_get_posts( $query ) { |
|
| 55 | 55 | |
| 56 | - // Only for the main query, avoid problems with widgets and what not. |
|
| 57 | - if ( ! $query->is_main_query() ) { |
|
| 58 | - return; |
|
| 59 | - } |
|
| 56 | + // Only for the main query, avoid problems with widgets and what not. |
|
| 57 | + if ( ! $query->is_main_query() ) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - // We don't want to alter the query if we're in the admin UI, if this is |
|
| 62 | - // not a category query, or if the `suppress_filters` is set. |
|
| 63 | - // |
|
| 64 | - // Note that it is unlikely for `suppress_filter` to be set on the front |
|
| 65 | - // end, but let's be safe if it is set the calling code assumes no |
|
| 66 | - // modifications of queries. |
|
| 67 | - // |
|
| 68 | - // is_admin is needed, otherwise category based post filters will show |
|
| 69 | - // both types and at the current release (4.7) it causes PHP errors. |
|
| 70 | - if ( is_admin() || ! is_category() || ! empty( $query->query_vars['suppress_filters'] ) ) { |
|
| 71 | - return; |
|
| 72 | - } |
|
| 61 | + // We don't want to alter the query if we're in the admin UI, if this is |
|
| 62 | + // not a category query, or if the `suppress_filters` is set. |
|
| 63 | + // |
|
| 64 | + // Note that it is unlikely for `suppress_filter` to be set on the front |
|
| 65 | + // end, but let's be safe if it is set the calling code assumes no |
|
| 66 | + // modifications of queries. |
|
| 67 | + // |
|
| 68 | + // is_admin is needed, otherwise category based post filters will show |
|
| 69 | + // both types and at the current release (4.7) it causes PHP errors. |
|
| 70 | + if ( is_admin() || ! is_category() || ! empty( $query->query_vars['suppress_filters'] ) ) { |
|
| 71 | + return; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - // Check the current post types, maybe the category archive pages |
|
| 75 | - // are already associated with other post types. |
|
| 76 | - // |
|
| 77 | - // If `post_type` isn't set, WP assumes `post` by default. |
|
| 78 | - $post_types = (array) ( $query->get( 'post_type' ) ?: 'post' ); |
|
| 74 | + // Check the current post types, maybe the category archive pages |
|
| 75 | + // are already associated with other post types. |
|
| 76 | + // |
|
| 77 | + // If `post_type` isn't set, WP assumes `post` by default. |
|
| 78 | + $post_types = (array) ( $query->get( 'post_type' ) ?: 'post' ); |
|
| 79 | 79 | |
| 80 | - // Add the entities post type only if the post post type is used in the query |
|
| 81 | - // since we only want `entities` to appear alongside posts. |
|
| 82 | - if ( in_array( 'post', $post_types ) ) { |
|
| 83 | - $post_types[] = $this->entity_post_type_service->get_post_type(); |
|
| 84 | - } |
|
| 80 | + // Add the entities post type only if the post post type is used in the query |
|
| 81 | + // since we only want `entities` to appear alongside posts. |
|
| 82 | + if ( in_array( 'post', $post_types ) ) { |
|
| 83 | + $post_types[] = $this->entity_post_type_service->get_post_type(); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - // Update the query post types. |
|
| 87 | - $query->set( 'post_type', $post_types ); |
|
| 86 | + // Update the query post types. |
|
| 87 | + $query->set( 'post_type', $post_types ); |
|
| 88 | 88 | |
| 89 | - } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param \Wordlift_Entity_Post_Type_Service $entity_post_type_service The {@link Wordlift_Entity_Post_Type_Service} instance. |
| 36 | 36 | */ |
| 37 | - function __construct( $entity_post_type_service ) { |
|
| 37 | + function __construct($entity_post_type_service) { |
|
| 38 | 38 | |
| 39 | 39 | $this->entity_post_type_service = $entity_post_type_service; |
| 40 | 40 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param WP_Query $query WP's {@link WP_Query} instance. |
| 53 | 53 | */ |
| 54 | - public function pre_get_posts( $query ) { |
|
| 54 | + public function pre_get_posts($query) { |
|
| 55 | 55 | |
| 56 | 56 | // Only for the main query, avoid problems with widgets and what not. |
| 57 | - if ( ! $query->is_main_query() ) { |
|
| 57 | + if ( ! $query->is_main_query()) { |
|
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | // |
| 68 | 68 | // is_admin is needed, otherwise category based post filters will show |
| 69 | 69 | // both types and at the current release (4.7) it causes PHP errors. |
| 70 | - if ( is_admin() || ! is_category() || ! empty( $query->query_vars['suppress_filters'] ) ) { |
|
| 70 | + if (is_admin() || ! is_category() || ! empty($query->query_vars['suppress_filters'])) { |
|
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | // are already associated with other post types. |
| 76 | 76 | // |
| 77 | 77 | // If `post_type` isn't set, WP assumes `post` by default. |
| 78 | - $post_types = (array) ( $query->get( 'post_type' ) ?: 'post' ); |
|
| 78 | + $post_types = (array) ($query->get('post_type') ?: 'post'); |
|
| 79 | 79 | |
| 80 | 80 | // Add the entities post type only if the post post type is used in the query |
| 81 | 81 | // since we only want `entities` to appear alongside posts. |
| 82 | - if ( in_array( 'post', $post_types ) ) { |
|
| 82 | + if (in_array('post', $post_types)) { |
|
| 83 | 83 | $post_types[] = $this->entity_post_type_service->get_post_type(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Update the query post types. |
| 87 | - $query->set( 'post_type', $post_types ); |
|
| 87 | + $query->set('post_type', $post_types); |
|
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | - exit; |
|
| 15 | + exit; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $term = get_term( $term_id, 'wl_entity_type' ); |
| 19 | 19 | |
| 20 | 20 | $term_settings = ! is_null( $settings ) ? $settings : array( |
| 21 | - 'title' => '', |
|
| 22 | - 'description' => '', |
|
| 21 | + 'title' => '', |
|
| 22 | + 'description' => '', |
|
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | ?> |
@@ -37,32 +37,32 @@ discard block |
||
| 37 | 37 | <tr class="form-field form-required term-name-wrap"> |
| 38 | 38 | <th scope="row"> |
| 39 | 39 | <label><?php |
| 40 | - esc_html_e( 'Name', 'wordlift' ); ?></label> |
|
| 40 | + esc_html_e( 'Name', 'wordlift' ); ?></label> |
|
| 41 | 41 | </th> |
| 42 | 42 | <td><?php |
| 43 | - echo esc_html( $term->name ) ?></td> |
|
| 43 | + echo esc_html( $term->name ) ?></td> |
|
| 44 | 44 | </tr> |
| 45 | 45 | <tr class="form-field form-required term-name-wrap"> |
| 46 | 46 | <th scope="row"> |
| 47 | 47 | <label for="title"><?php |
| 48 | - esc_html_e( 'Title', 'wordlift' ); ?></label> |
|
| 48 | + esc_html_e( 'Title', 'wordlift' ); ?></label> |
|
| 49 | 49 | </th> |
| 50 | 50 | <td><input name="title" id="title" type="text" |
| 51 | 51 | value="<?php echo esc_attr( $term_settings['title'] ) ?>" |
| 52 | 52 | size="40" /> |
| 53 | 53 | <p class="description"><?php |
| 54 | - esc_html_e( 'The HTML title to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 54 | + esc_html_e( 'The HTML title to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 55 | 55 | </td> |
| 56 | 56 | </tr> |
| 57 | 57 | <tr class="form-field term-description-wrap"> |
| 58 | 58 | <th scope="row"><label for="description"><?php |
| 59 | - esc_html_e( 'Description', 'wordlift' ); ?></label> |
|
| 59 | + esc_html_e( 'Description', 'wordlift' ); ?></label> |
|
| 60 | 60 | </th> |
| 61 | 61 | <td><textarea name="description" id="description" rows="5" |
| 62 | 62 | cols="50" class="large-text"><?php |
| 63 | - echo esc_html( $term_settings['description'] ) ?></textarea> |
|
| 63 | + echo esc_html( $term_settings['description'] ) ?></textarea> |
|
| 64 | 64 | <p class="description"><?php |
| 65 | - esc_html_e( 'The description to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 65 | + esc_html_e( 'The description to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 66 | 66 | </td> |
| 67 | 67 | </tr> |
| 68 | 68 | </table> |
@@ -11,61 +11,61 @@ |
||
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -$term = get_term( $term_id, 'wl_entity_type' ); |
|
| 18 | +$term = get_term($term_id, 'wl_entity_type'); |
|
| 19 | 19 | |
| 20 | -$term_settings = ! is_null( $settings ) ? $settings : array( |
|
| 20 | +$term_settings = ! is_null($settings) ? $settings : array( |
|
| 21 | 21 | 'title' => '', |
| 22 | 22 | 'description' => '', |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | ?> |
| 26 | 26 | <div class="wrap"> |
| 27 | - <h1><?php esc_html_e( 'Edit Entity Type', 'wordlift' ) ?></h1> |
|
| 27 | + <h1><?php esc_html_e('Edit Entity Type', 'wordlift') ?></h1> |
|
| 28 | 28 | |
| 29 | 29 | <form name="edittag" id="edittag" method="post" |
| 30 | - action="<?php echo admin_url( 'admin.php?page=wl_entity_type_settings' ) ?>" |
|
| 30 | + action="<?php echo admin_url('admin.php?page=wl_entity_type_settings') ?>" |
|
| 31 | 31 | class="validate"> |
| 32 | 32 | <input type="hidden" name="tag_ID" |
| 33 | - value="<?php echo esc_attr( $term_id ) ?>" /> |
|
| 33 | + value="<?php echo esc_attr($term_id) ?>" /> |
|
| 34 | 34 | <input type="hidden" name="action" value="wl_edit_entity_type_term" /> |
| 35 | - <?php wp_nonce_field( 'update-entity_type_term_' . $term_id ); ?> |
|
| 35 | + <?php wp_nonce_field('update-entity_type_term_'.$term_id); ?> |
|
| 36 | 36 | <table class="form-table"> |
| 37 | 37 | <tr class="form-field form-required term-name-wrap"> |
| 38 | 38 | <th scope="row"> |
| 39 | 39 | <label><?php |
| 40 | - esc_html_e( 'Name', 'wordlift' ); ?></label> |
|
| 40 | + esc_html_e('Name', 'wordlift'); ?></label> |
|
| 41 | 41 | </th> |
| 42 | 42 | <td><?php |
| 43 | - echo esc_html( $term->name ) ?></td> |
|
| 43 | + echo esc_html($term->name) ?></td> |
|
| 44 | 44 | </tr> |
| 45 | 45 | <tr class="form-field form-required term-name-wrap"> |
| 46 | 46 | <th scope="row"> |
| 47 | 47 | <label for="title"><?php |
| 48 | - esc_html_e( 'Title', 'wordlift' ); ?></label> |
|
| 48 | + esc_html_e('Title', 'wordlift'); ?></label> |
|
| 49 | 49 | </th> |
| 50 | 50 | <td><input name="title" id="title" type="text" |
| 51 | - value="<?php echo esc_attr( $term_settings['title'] ) ?>" |
|
| 51 | + value="<?php echo esc_attr($term_settings['title']) ?>" |
|
| 52 | 52 | size="40" /> |
| 53 | 53 | <p class="description"><?php |
| 54 | - esc_html_e( 'The HTML title to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 54 | + esc_html_e('The HTML title to be used in the entity type archive page.', 'wordlift'); ?></p> |
|
| 55 | 55 | </td> |
| 56 | 56 | </tr> |
| 57 | 57 | <tr class="form-field term-description-wrap"> |
| 58 | 58 | <th scope="row"><label for="description"><?php |
| 59 | - esc_html_e( 'Description', 'wordlift' ); ?></label> |
|
| 59 | + esc_html_e('Description', 'wordlift'); ?></label> |
|
| 60 | 60 | </th> |
| 61 | 61 | <td><textarea name="description" id="description" rows="5" |
| 62 | 62 | cols="50" class="large-text"><?php |
| 63 | - echo esc_html( $term_settings['description'] ) ?></textarea> |
|
| 63 | + echo esc_html($term_settings['description']) ?></textarea> |
|
| 64 | 64 | <p class="description"><?php |
| 65 | - esc_html_e( 'The description to be used in the entity type archive page.', 'wordlift' ); ?></p> |
|
| 65 | + esc_html_e('The description to be used in the entity type archive page.', 'wordlift'); ?></p> |
|
| 66 | 66 | </td> |
| 67 | 67 | </tr> |
| 68 | 68 | </table> |
| 69 | - <?php submit_button( __( 'Update' ) ); ?> |
|
| 69 | + <?php submit_button(__('Update')); ?> |
|
| 70 | 70 | </form> |
| 71 | 71 | </div> |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Related_Entities_Cloud_Widget extends Wordlift_Widget { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Create an {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 21 | - * |
|
| 22 | - * @since 3.11.0 |
|
| 23 | - */ |
|
| 24 | - public function __construct() { |
|
| 25 | - parent::__construct( |
|
| 26 | - 'wl_related_entities_cloud', |
|
| 27 | - __( 'WordLift Entities Cloud', 'wordlift' ), |
|
| 28 | - array( |
|
| 29 | - 'classname' => 'wl_related_entities_cloud', |
|
| 30 | - 'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ), |
|
| 31 | - ) |
|
| 32 | - ); |
|
| 33 | - |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @inheritdoc |
|
| 38 | - */ |
|
| 39 | - public function form( $instance ) { |
|
| 40 | - $title_id = $this->get_field_id( 'title' ); |
|
| 41 | - $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
| 42 | - ?> |
|
| 19 | + /** |
|
| 20 | + * Create an {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 21 | + * |
|
| 22 | + * @since 3.11.0 |
|
| 23 | + */ |
|
| 24 | + public function __construct() { |
|
| 25 | + parent::__construct( |
|
| 26 | + 'wl_related_entities_cloud', |
|
| 27 | + __( 'WordLift Entities Cloud', 'wordlift' ), |
|
| 28 | + array( |
|
| 29 | + 'classname' => 'wl_related_entities_cloud', |
|
| 30 | + 'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ), |
|
| 31 | + ) |
|
| 32 | + ); |
|
| 33 | + |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @inheritdoc |
|
| 38 | + */ |
|
| 39 | + public function form( $instance ) { |
|
| 40 | + $title_id = $this->get_field_id( 'title' ); |
|
| 41 | + $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
| 42 | + ?> |
|
| 43 | 43 | |
| 44 | 44 | <p><label for="<?php echo esc_attr( $title_id ); ?>"><?php |
| 45 | - esc_html_e( 'Title:' ); ?></label> |
|
| 45 | + esc_html_e( 'Title:' ); ?></label> |
|
| 46 | 46 | <input type="text" class="widefat" |
| 47 | 47 | id="<?php echo esc_attr( $title_id ); ?>" |
| 48 | 48 | name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" |
@@ -51,46 +51,46 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | <?php |
| 53 | 53 | |
| 54 | - return 'wl_related_entities_cloud_form'; |
|
| 55 | - } |
|
| 54 | + return 'wl_related_entities_cloud_form'; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @inheritdoc |
|
| 59 | - */ |
|
| 60 | - public function update( $new_instance, $old_instance ) { |
|
| 57 | + /** |
|
| 58 | + * @inheritdoc |
|
| 59 | + */ |
|
| 60 | + public function update( $new_instance, $old_instance ) { |
|
| 61 | 61 | |
| 62 | - return array( 'title' => sanitize_text_field( $new_instance['title'] ) ); |
|
| 63 | - } |
|
| 62 | + return array( 'title' => sanitize_text_field( $new_instance['title'] ) ); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @inheritdoc |
|
| 67 | - */ |
|
| 68 | - public function widget( $args, $instance ) { |
|
| 65 | + /** |
|
| 66 | + * @inheritdoc |
|
| 67 | + */ |
|
| 68 | + public function widget( $args, $instance ) { |
|
| 69 | 69 | |
| 70 | - /* |
|
| 70 | + /* |
|
| 71 | 71 | * Use the shortcode to calculate the HTML required to show the cloud |
| 72 | 72 | * if there is no such html do not render the widget at all. |
| 73 | 73 | */ |
| 74 | - $cloud_html = do_shortcode( '[wl_cloud]' ); |
|
| 75 | - if ( empty( $cloud_html ) ) { |
|
| 76 | - return false; |
|
| 77 | - } |
|
| 74 | + $cloud_html = do_shortcode( '[wl_cloud]' ); |
|
| 75 | + if ( empty( $cloud_html ) ) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - // The widget title. |
|
| 80 | - $title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title']; |
|
| 79 | + // The widget title. |
|
| 80 | + $title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title']; |
|
| 81 | 81 | |
| 82 | - // Standard filter all widgets should apply |
|
| 83 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 82 | + // Standard filter all widgets should apply |
|
| 83 | + $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 84 | 84 | |
| 85 | - echo $args['before_widget']; |
|
| 85 | + echo $args['before_widget']; |
|
| 86 | 86 | |
| 87 | - if ( $title ) { |
|
| 88 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 89 | - } |
|
| 87 | + if ( $title ) { |
|
| 88 | + echo $args['before_title'] . $title . $args['after_title']; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - echo $cloud_html; |
|
| 92 | - echo $args['after_widget']; |
|
| 91 | + echo $cloud_html; |
|
| 92 | + echo $args['after_widget']; |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | public function __construct() { |
| 25 | 25 | parent::__construct( |
| 26 | 26 | 'wl_related_entities_cloud', |
| 27 | - __( 'WordLift Entities Cloud', 'wordlift' ), |
|
| 27 | + __('WordLift Entities Cloud', 'wordlift'), |
|
| 28 | 28 | array( |
| 29 | 29 | 'classname' => 'wl_related_entities_cloud', |
| 30 | - 'description' => __( 'Display entities related to the current post/entity in a tag cloud.', 'wordlift' ), |
|
| 30 | + 'description' => __('Display entities related to the current post/entity in a tag cloud.', 'wordlift'), |
|
| 31 | 31 | ) |
| 32 | 32 | ); |
| 33 | 33 | |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @inheritdoc |
| 38 | 38 | */ |
| 39 | - public function form( $instance ) { |
|
| 40 | - $title_id = $this->get_field_id( 'title' ); |
|
| 41 | - $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
|
| 39 | + public function form($instance) { |
|
| 40 | + $title_id = $this->get_field_id('title'); |
|
| 41 | + $instance['title'] = ! empty($instance['title']) ? esc_attr($instance['title']) : ''; |
|
| 42 | 42 | ?> |
| 43 | 43 | |
| 44 | - <p><label for="<?php echo esc_attr( $title_id ); ?>"><?php |
|
| 45 | - esc_html_e( 'Title:' ); ?></label> |
|
| 44 | + <p><label for="<?php echo esc_attr($title_id); ?>"><?php |
|
| 45 | + esc_html_e('Title:'); ?></label> |
|
| 46 | 46 | <input type="text" class="widefat" |
| 47 | - id="<?php echo esc_attr( $title_id ); ?>" |
|
| 48 | - name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" |
|
| 49 | - value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
| 47 | + id="<?php echo esc_attr($title_id); ?>" |
|
| 48 | + name="<?php echo esc_attr($this->get_field_name('title')); ?>" |
|
| 49 | + value="<?php echo esc_attr($instance['title']); ?>" /> |
|
| 50 | 50 | </p> |
| 51 | 51 | |
| 52 | 52 | <?php |
@@ -57,35 +57,35 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @inheritdoc |
| 59 | 59 | */ |
| 60 | - public function update( $new_instance, $old_instance ) { |
|
| 60 | + public function update($new_instance, $old_instance) { |
|
| 61 | 61 | |
| 62 | - return array( 'title' => sanitize_text_field( $new_instance['title'] ) ); |
|
| 62 | + return array('title' => sanitize_text_field($new_instance['title'])); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @inheritdoc |
| 67 | 67 | */ |
| 68 | - public function widget( $args, $instance ) { |
|
| 68 | + public function widget($args, $instance) { |
|
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | 71 | * Use the shortcode to calculate the HTML required to show the cloud |
| 72 | 72 | * if there is no such html do not render the widget at all. |
| 73 | 73 | */ |
| 74 | - $cloud_html = do_shortcode( '[wl_cloud]' ); |
|
| 75 | - if ( empty( $cloud_html ) ) { |
|
| 74 | + $cloud_html = do_shortcode('[wl_cloud]'); |
|
| 75 | + if (empty($cloud_html)) { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // The widget title. |
| 80 | - $title = empty( $instance['title'] ) ? __( 'Related Entities', 'wordlift' ) : $instance['title']; |
|
| 80 | + $title = empty($instance['title']) ? __('Related Entities', 'wordlift') : $instance['title']; |
|
| 81 | 81 | |
| 82 | 82 | // Standard filter all widgets should apply |
| 83 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 83 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
| 84 | 84 | |
| 85 | 85 | echo $args['before_widget']; |
| 86 | 86 | |
| 87 | - if ( $title ) { |
|
| 88 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 87 | + if ($title) { |
|
| 88 | + echo $args['before_title'].$title.$args['after_title']; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | echo $cloud_html; |
@@ -7,174 +7,174 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_Topic_Taxonomy_Service { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * The Log service. |
|
| 12 | - * |
|
| 13 | - * @since 3.5.0 |
|
| 14 | - * @access private |
|
| 15 | - * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 16 | - */ |
|
| 17 | - private $log_service; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Taxonomy name. |
|
| 21 | - * |
|
| 22 | - * @since 3.5.0 |
|
| 23 | - */ |
|
| 24 | - const TAXONOMY_NAME = 'wl_topic'; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Taxonomy object type. |
|
| 28 | - * |
|
| 29 | - * @since 3.5.0 |
|
| 30 | - */ |
|
| 31 | - const TAXONOMY_OBJECT_TYPE = 'post'; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Taxonomy slug. |
|
| 35 | - * |
|
| 36 | - * @since 3.5.0 |
|
| 37 | - */ |
|
| 38 | - const TAXONOMY_SLUG = 'wl_topic'; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * A singleton instance of the Wordlift_Topic_Taxonomy_Service service. |
|
| 42 | - * |
|
| 43 | - * @since 3.5.0 |
|
| 44 | - * @access private |
|
| 45 | - * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service. |
|
| 46 | - */ |
|
| 47 | - private static $instance; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * Create a Wordlift_Topic_Taxonomy_Service instance. |
|
| 51 | - * |
|
| 52 | - * @since 3.5.0 |
|
| 53 | - * |
|
| 54 | - */ |
|
| 55 | - public function __construct() { |
|
| 56 | - |
|
| 57 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 58 | - |
|
| 59 | - // Set the singleton instance. |
|
| 60 | - self::$instance = $this; |
|
| 61 | - |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Get the singleton instance of the Entity service. |
|
| 66 | - * |
|
| 67 | - * @since 3.5.0 |
|
| 68 | - * @return Wordlift_Topic_Taxonomy_Service |
|
| 69 | - */ |
|
| 70 | - public static function get_instance() { |
|
| 71 | - |
|
| 72 | - return self::$instance; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Just register the topic taxonomy. |
|
| 77 | - * |
|
| 78 | - * @since 3.5.0 |
|
| 79 | - * |
|
| 80 | - */ |
|
| 81 | - public function init() { |
|
| 82 | - |
|
| 83 | - // See https://codex.wordpress.org/Function_Reference/register_taxonomy |
|
| 84 | - $labels = array( |
|
| 85 | - 'name' => _x( 'Topics', 'taxonomy general name', 'wordlift' ), |
|
| 86 | - 'singular_name' => _x( 'Topic', 'taxonomy singular name', 'wordlift' ), |
|
| 87 | - 'search_items' => __( 'Search Topics', 'wordlift' ), |
|
| 88 | - 'all_items' => __( 'All Topics', 'wordlift' ), |
|
| 89 | - 'parent_item' => __( 'Parent Topic', 'wordlift' ), |
|
| 90 | - 'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ), |
|
| 91 | - 'edit_item' => __( 'Edit Topic', 'wordlift' ), |
|
| 92 | - 'update_item' => __( 'Update Topic', 'wordlift' ), |
|
| 93 | - 'add_new_item' => __( 'Add New Topic', 'wordlift' ), |
|
| 94 | - 'new_item_name' => __( 'New Topic', 'wordlift' ), |
|
| 95 | - 'menu_name' => __( 'Topics', 'wordlift' ), |
|
| 96 | - ); |
|
| 97 | - |
|
| 98 | - $capabilities = array( |
|
| 99 | - 'manage_terms' => null, |
|
| 100 | - 'edit_terms' => null, |
|
| 101 | - 'delete_terms' => null, |
|
| 102 | - 'assign_terms' => 'edit_posts', |
|
| 103 | - ); |
|
| 104 | - |
|
| 105 | - $args = array( |
|
| 106 | - 'labels' => $labels, |
|
| 107 | - 'capabilities' => $capabilities, |
|
| 108 | - 'hierarchical' => true, |
|
| 109 | - 'show_admin_column' => false, |
|
| 110 | - 'show_ui' => false, |
|
| 111 | - 'rewrite' => array( |
|
| 112 | - 'slug' => self::TAXONOMY_SLUG, |
|
| 113 | - ), |
|
| 114 | - ); |
|
| 115 | - |
|
| 116 | - // Register taxonomy |
|
| 117 | - register_taxonomy( |
|
| 118 | - self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args |
|
| 119 | - ); |
|
| 120 | - |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Get or create a taxonomy term from a given entity topic. |
|
| 125 | - * |
|
| 126 | - * @since 3.5.0 |
|
| 127 | - * |
|
| 128 | - */ |
|
| 129 | - public function get_or_create_term_from_topic_entity( $topic ) { |
|
| 130 | - |
|
| 131 | - // Define taxonomy term slug |
|
| 132 | - $term_slug = sanitize_title( $topic->post_title ); |
|
| 133 | - // Look for an existing taxonomy term with a given slug |
|
| 134 | - if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) { |
|
| 135 | - return (int) $term->term_id; |
|
| 136 | - } |
|
| 137 | - // Otherwise create a new term and return it |
|
| 138 | - $result = wp_insert_term( |
|
| 139 | - $topic->post_title, |
|
| 140 | - self::TAXONOMY_NAME, |
|
| 141 | - array( |
|
| 142 | - 'slug' => $term_slug, |
|
| 143 | - 'description' => $topic->post_content, |
|
| 144 | - ) |
|
| 145 | - ); |
|
| 146 | - |
|
| 147 | - return (int) $result['term_id']; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Set a topic for a given post. |
|
| 152 | - * |
|
| 153 | - * @since 3.5.0 |
|
| 154 | - * |
|
| 155 | - */ |
|
| 156 | - public function set_topic_for( $post_id, $topic_id ) { |
|
| 157 | - // Retrieve the topic entity post |
|
| 158 | - $topic_entity_post = get_post( $topic_id ); |
|
| 159 | - // If current topic does not exist in db false is returned |
|
| 160 | - if ( null === $topic_entity_post ) { |
|
| 161 | - return false; |
|
| 162 | - } |
|
| 163 | - // Create the proper taxonomy term if needed |
|
| 164 | - $term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post ); |
|
| 165 | - // Link the term to the current post |
|
| 166 | - wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false ); |
|
| 167 | - return true; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Unlink any topic for a given post. |
|
| 172 | - * |
|
| 173 | - * @since 3.5.0 |
|
| 174 | - * |
|
| 175 | - */ |
|
| 176 | - public function unlink_topic_for( $post_id ) { |
|
| 177 | - wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME ); |
|
| 178 | - } |
|
| 10 | + /** |
|
| 11 | + * The Log service. |
|
| 12 | + * |
|
| 13 | + * @since 3.5.0 |
|
| 14 | + * @access private |
|
| 15 | + * @var \Wordlift_Log_Service $log_service The Log service. |
|
| 16 | + */ |
|
| 17 | + private $log_service; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Taxonomy name. |
|
| 21 | + * |
|
| 22 | + * @since 3.5.0 |
|
| 23 | + */ |
|
| 24 | + const TAXONOMY_NAME = 'wl_topic'; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Taxonomy object type. |
|
| 28 | + * |
|
| 29 | + * @since 3.5.0 |
|
| 30 | + */ |
|
| 31 | + const TAXONOMY_OBJECT_TYPE = 'post'; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Taxonomy slug. |
|
| 35 | + * |
|
| 36 | + * @since 3.5.0 |
|
| 37 | + */ |
|
| 38 | + const TAXONOMY_SLUG = 'wl_topic'; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * A singleton instance of the Wordlift_Topic_Taxonomy_Service service. |
|
| 42 | + * |
|
| 43 | + * @since 3.5.0 |
|
| 44 | + * @access private |
|
| 45 | + * @var \Wordlift_Topic_Taxonomy_Service $instance A singleton instance of Wordlift_Topic_Taxonomy_Service. |
|
| 46 | + */ |
|
| 47 | + private static $instance; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * Create a Wordlift_Topic_Taxonomy_Service instance. |
|
| 51 | + * |
|
| 52 | + * @since 3.5.0 |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | + public function __construct() { |
|
| 56 | + |
|
| 57 | + $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 58 | + |
|
| 59 | + // Set the singleton instance. |
|
| 60 | + self::$instance = $this; |
|
| 61 | + |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Get the singleton instance of the Entity service. |
|
| 66 | + * |
|
| 67 | + * @since 3.5.0 |
|
| 68 | + * @return Wordlift_Topic_Taxonomy_Service |
|
| 69 | + */ |
|
| 70 | + public static function get_instance() { |
|
| 71 | + |
|
| 72 | + return self::$instance; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Just register the topic taxonomy. |
|
| 77 | + * |
|
| 78 | + * @since 3.5.0 |
|
| 79 | + * |
|
| 80 | + */ |
|
| 81 | + public function init() { |
|
| 82 | + |
|
| 83 | + // See https://codex.wordpress.org/Function_Reference/register_taxonomy |
|
| 84 | + $labels = array( |
|
| 85 | + 'name' => _x( 'Topics', 'taxonomy general name', 'wordlift' ), |
|
| 86 | + 'singular_name' => _x( 'Topic', 'taxonomy singular name', 'wordlift' ), |
|
| 87 | + 'search_items' => __( 'Search Topics', 'wordlift' ), |
|
| 88 | + 'all_items' => __( 'All Topics', 'wordlift' ), |
|
| 89 | + 'parent_item' => __( 'Parent Topic', 'wordlift' ), |
|
| 90 | + 'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ), |
|
| 91 | + 'edit_item' => __( 'Edit Topic', 'wordlift' ), |
|
| 92 | + 'update_item' => __( 'Update Topic', 'wordlift' ), |
|
| 93 | + 'add_new_item' => __( 'Add New Topic', 'wordlift' ), |
|
| 94 | + 'new_item_name' => __( 'New Topic', 'wordlift' ), |
|
| 95 | + 'menu_name' => __( 'Topics', 'wordlift' ), |
|
| 96 | + ); |
|
| 97 | + |
|
| 98 | + $capabilities = array( |
|
| 99 | + 'manage_terms' => null, |
|
| 100 | + 'edit_terms' => null, |
|
| 101 | + 'delete_terms' => null, |
|
| 102 | + 'assign_terms' => 'edit_posts', |
|
| 103 | + ); |
|
| 104 | + |
|
| 105 | + $args = array( |
|
| 106 | + 'labels' => $labels, |
|
| 107 | + 'capabilities' => $capabilities, |
|
| 108 | + 'hierarchical' => true, |
|
| 109 | + 'show_admin_column' => false, |
|
| 110 | + 'show_ui' => false, |
|
| 111 | + 'rewrite' => array( |
|
| 112 | + 'slug' => self::TAXONOMY_SLUG, |
|
| 113 | + ), |
|
| 114 | + ); |
|
| 115 | + |
|
| 116 | + // Register taxonomy |
|
| 117 | + register_taxonomy( |
|
| 118 | + self::TAXONOMY_NAME, self::TAXONOMY_OBJECT_TYPE, $args |
|
| 119 | + ); |
|
| 120 | + |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Get or create a taxonomy term from a given entity topic. |
|
| 125 | + * |
|
| 126 | + * @since 3.5.0 |
|
| 127 | + * |
|
| 128 | + */ |
|
| 129 | + public function get_or_create_term_from_topic_entity( $topic ) { |
|
| 130 | + |
|
| 131 | + // Define taxonomy term slug |
|
| 132 | + $term_slug = sanitize_title( $topic->post_title ); |
|
| 133 | + // Look for an existing taxonomy term with a given slug |
|
| 134 | + if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) { |
|
| 135 | + return (int) $term->term_id; |
|
| 136 | + } |
|
| 137 | + // Otherwise create a new term and return it |
|
| 138 | + $result = wp_insert_term( |
|
| 139 | + $topic->post_title, |
|
| 140 | + self::TAXONOMY_NAME, |
|
| 141 | + array( |
|
| 142 | + 'slug' => $term_slug, |
|
| 143 | + 'description' => $topic->post_content, |
|
| 144 | + ) |
|
| 145 | + ); |
|
| 146 | + |
|
| 147 | + return (int) $result['term_id']; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Set a topic for a given post. |
|
| 152 | + * |
|
| 153 | + * @since 3.5.0 |
|
| 154 | + * |
|
| 155 | + */ |
|
| 156 | + public function set_topic_for( $post_id, $topic_id ) { |
|
| 157 | + // Retrieve the topic entity post |
|
| 158 | + $topic_entity_post = get_post( $topic_id ); |
|
| 159 | + // If current topic does not exist in db false is returned |
|
| 160 | + if ( null === $topic_entity_post ) { |
|
| 161 | + return false; |
|
| 162 | + } |
|
| 163 | + // Create the proper taxonomy term if needed |
|
| 164 | + $term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post ); |
|
| 165 | + // Link the term to the current post |
|
| 166 | + wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false ); |
|
| 167 | + return true; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Unlink any topic for a given post. |
|
| 172 | + * |
|
| 173 | + * @since 3.5.0 |
|
| 174 | + * |
|
| 175 | + */ |
|
| 176 | + public function unlink_topic_for( $post_id ) { |
|
| 177 | + wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME ); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | 180 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function __construct() { |
| 56 | 56 | |
| 57 | - $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' ); |
|
| 57 | + $this->log_service = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service'); |
|
| 58 | 58 | |
| 59 | 59 | // Set the singleton instance. |
| 60 | 60 | self::$instance = $this; |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // See https://codex.wordpress.org/Function_Reference/register_taxonomy |
| 84 | 84 | $labels = array( |
| 85 | - 'name' => _x( 'Topics', 'taxonomy general name', 'wordlift' ), |
|
| 86 | - 'singular_name' => _x( 'Topic', 'taxonomy singular name', 'wordlift' ), |
|
| 87 | - 'search_items' => __( 'Search Topics', 'wordlift' ), |
|
| 88 | - 'all_items' => __( 'All Topics', 'wordlift' ), |
|
| 89 | - 'parent_item' => __( 'Parent Topic', 'wordlift' ), |
|
| 90 | - 'parent_item_colon' => __( 'Parent Topic:', 'wordlift' ), |
|
| 91 | - 'edit_item' => __( 'Edit Topic', 'wordlift' ), |
|
| 92 | - 'update_item' => __( 'Update Topic', 'wordlift' ), |
|
| 93 | - 'add_new_item' => __( 'Add New Topic', 'wordlift' ), |
|
| 94 | - 'new_item_name' => __( 'New Topic', 'wordlift' ), |
|
| 95 | - 'menu_name' => __( 'Topics', 'wordlift' ), |
|
| 85 | + 'name' => _x('Topics', 'taxonomy general name', 'wordlift'), |
|
| 86 | + 'singular_name' => _x('Topic', 'taxonomy singular name', 'wordlift'), |
|
| 87 | + 'search_items' => __('Search Topics', 'wordlift'), |
|
| 88 | + 'all_items' => __('All Topics', 'wordlift'), |
|
| 89 | + 'parent_item' => __('Parent Topic', 'wordlift'), |
|
| 90 | + 'parent_item_colon' => __('Parent Topic:', 'wordlift'), |
|
| 91 | + 'edit_item' => __('Edit Topic', 'wordlift'), |
|
| 92 | + 'update_item' => __('Update Topic', 'wordlift'), |
|
| 93 | + 'add_new_item' => __('Add New Topic', 'wordlift'), |
|
| 94 | + 'new_item_name' => __('New Topic', 'wordlift'), |
|
| 95 | + 'menu_name' => __('Topics', 'wordlift'), |
|
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | 98 | $capabilities = array( |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | * @since 3.5.0 |
| 127 | 127 | * |
| 128 | 128 | */ |
| 129 | - public function get_or_create_term_from_topic_entity( $topic ) { |
|
| 129 | + public function get_or_create_term_from_topic_entity($topic) { |
|
| 130 | 130 | |
| 131 | 131 | // Define taxonomy term slug |
| 132 | - $term_slug = sanitize_title( $topic->post_title ); |
|
| 132 | + $term_slug = sanitize_title($topic->post_title); |
|
| 133 | 133 | // Look for an existing taxonomy term with a given slug |
| 134 | - if ( $term = get_term_by( 'slug', $term_slug, self::TAXONOMY_NAME ) ) { |
|
| 134 | + if ($term = get_term_by('slug', $term_slug, self::TAXONOMY_NAME)) { |
|
| 135 | 135 | return (int) $term->term_id; |
| 136 | 136 | } |
| 137 | 137 | // Otherwise create a new term and return it |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | * @since 3.5.0 |
| 154 | 154 | * |
| 155 | 155 | */ |
| 156 | - public function set_topic_for( $post_id, $topic_id ) { |
|
| 156 | + public function set_topic_for($post_id, $topic_id) { |
|
| 157 | 157 | // Retrieve the topic entity post |
| 158 | - $topic_entity_post = get_post( $topic_id ); |
|
| 158 | + $topic_entity_post = get_post($topic_id); |
|
| 159 | 159 | // If current topic does not exist in db false is returned |
| 160 | - if ( null === $topic_entity_post ) { |
|
| 160 | + if (null === $topic_entity_post) { |
|
| 161 | 161 | return false; |
| 162 | 162 | } |
| 163 | 163 | // Create the proper taxonomy term if needed |
| 164 | - $term_id = $this->get_or_create_term_from_topic_entity( $topic_entity_post ); |
|
| 164 | + $term_id = $this->get_or_create_term_from_topic_entity($topic_entity_post); |
|
| 165 | 165 | // Link the term to the current post |
| 166 | - wp_set_post_terms( $post_id, $term_id, self::TAXONOMY_NAME, false ); |
|
| 166 | + wp_set_post_terms($post_id, $term_id, self::TAXONOMY_NAME, false); |
|
| 167 | 167 | return true; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @since 3.5.0 |
| 174 | 174 | * |
| 175 | 175 | */ |
| 176 | - public function unlink_topic_for( $post_id ) { |
|
| 177 | - wp_delete_object_term_relationships( $post_id, self::TAXONOMY_NAME ); |
|
| 176 | + public function unlink_topic_for($post_id) { |
|
| 177 | + wp_delete_object_term_relationships($post_id, self::TAXONOMY_NAME); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | } |
@@ -16,20 +16,20 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_NewRelic_Adapter { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Tell NewRelic to ignore this "transaction" for the Apdex. |
|
| 21 | - * |
|
| 22 | - * @see https://github.com/insideout10/wordlift-plugin/issues/521 |
|
| 23 | - * |
|
| 24 | - * @since 3.11.3 |
|
| 25 | - */ |
|
| 26 | - static function ignore_apdex() { |
|
| 19 | + /** |
|
| 20 | + * Tell NewRelic to ignore this "transaction" for the Apdex. |
|
| 21 | + * |
|
| 22 | + * @see https://github.com/insideout10/wordlift-plugin/issues/521 |
|
| 23 | + * |
|
| 24 | + * @since 3.11.3 |
|
| 25 | + */ |
|
| 26 | + static function ignore_apdex() { |
|
| 27 | 27 | |
| 28 | - // Ensure PHP agent and the function are available. |
|
| 29 | - if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) { |
|
| 30 | - newrelic_ignore_apdex(); |
|
| 31 | - } |
|
| 28 | + // Ensure PHP agent and the function are available. |
|
| 29 | + if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) { |
|
| 30 | + newrelic_ignore_apdex(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | static function ignore_apdex() { |
| 27 | 27 | |
| 28 | 28 | // Ensure PHP agent and the function are available. |
| 29 | - if ( extension_loaded( 'newrelic' ) && function_exists( 'newrelic_ignore_apdex' ) ) { |
|
| 29 | + if (extension_loaded('newrelic') && function_exists('newrelic_ignore_apdex')) { |
|
| 30 | 30 | newrelic_ignore_apdex(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; |
|
| 16 | + exit; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -28,113 +28,113 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class Wordlift_Admin_Entity_Taxonomy_List_Page { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread |
|
| 33 | - * SEO related settings for the term. |
|
| 34 | - * |
|
| 35 | - * @see https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/ |
|
| 36 | - * |
|
| 37 | - * @since 3.11.0 |
|
| 38 | - * |
|
| 39 | - * @param array $actions An array of action links to be displayed. Default |
|
| 40 | - * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
|
| 41 | - * @param object $term Term object. |
|
| 42 | - * |
|
| 43 | - * @return array $actions An array of action links to be displayed. Default |
|
| 44 | - * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
|
| 45 | - */ |
|
| 46 | - function wl_entity_type_row_actions( $actions, $term ) { |
|
| 47 | - |
|
| 48 | - $url = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" ); |
|
| 49 | - $actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>'; |
|
| 50 | - |
|
| 51 | - // Hacks for pre 4.7 compatibility: |
|
| 52 | - // * remove the quick edit. |
|
| 53 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 54 | - // * remove the edit link. |
|
| 55 | - unset( $actions['edit'] ); |
|
| 56 | - |
|
| 57 | - return $actions; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Override the capabilities related to managing the entity type terms |
|
| 62 | - * for multisite super admin to prevent it from manipulating it in any |
|
| 63 | - * way. |
|
| 64 | - * |
|
| 65 | - * @since 3.12.0 |
|
| 66 | - * |
|
| 67 | - * @param array $caps The user's current capabilities. |
|
| 68 | - * @param string $cap Capability name. |
|
| 69 | - * @param int $user_id The user ID. |
|
| 70 | - * @param array $args Adds the context to the cap. Typically the object ID. |
|
| 71 | - * |
|
| 72 | - * @return array Array containing the do_not_allow capability for super admin |
|
| 73 | - * when editing and deleting entity type terms capabilities |
|
| 74 | - * are being "approved" |
|
| 75 | - */ |
|
| 76 | - function restrict_super_admin( $caps, $cap, $user_id, $args ) { |
|
| 77 | - |
|
| 78 | - switch ( $cap ) { |
|
| 79 | - case 'wl_entity_type_edit_term': |
|
| 80 | - case 'wl_entity_type_delete_term': |
|
| 81 | - $caps[] = 'do_not_allow'; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - return $caps; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Override the capabilities related to managing the entity type terms |
|
| 89 | - * required for WordPress < 4.7 to get access to the admin page. |
|
| 90 | - * |
|
| 91 | - * Before 4.7, WordPress checks whether the user has permission to access |
|
| 92 | - * the `edit-tags.php` page. So we need to provide temporary the permission |
|
| 93 | - * otherwise the user will get an `access not allowed` when trying to access |
|
| 94 | - * the page. |
|
| 95 | - * |
|
| 96 | - * @see https://github.com/insideout10/wordlift-plugin/issues/512 |
|
| 97 | - * |
|
| 98 | - * @since 3.12.0 |
|
| 99 | - * |
|
| 100 | - * @param array $caps The user's current capabilities. |
|
| 101 | - * @param string $cap Capability name. |
|
| 102 | - * @param int $user_id The user ID. |
|
| 103 | - * @param array $args Adds the context to the cap. Typically the object ID. |
|
| 104 | - * |
|
| 105 | - * @return array Array containing the manage_options capability |
|
| 106 | - */ |
|
| 107 | - function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) { |
|
| 108 | - |
|
| 109 | - // Bail out if we're not dealing with the `wl_entity_type_edit_term` |
|
| 110 | - // capability. |
|
| 111 | - if ( 'wl_entity_type_edit_term' !== $cap ) { |
|
| 112 | - return $caps; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); |
|
| 116 | - |
|
| 117 | - // Bail out if the `path` cannot be determined. |
|
| 118 | - if ( null === $path ) { |
|
| 119 | - return $caps; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - // Bail out if a specific term is being handled. |
|
| 123 | - if ( isset( $_REQUEST['action'] ) ) { |
|
| 124 | - return $caps; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - // Split the path and check if the page is the `edit-tags.php`. We can't |
|
| 128 | - // use WP's own function because this is called very early. |
|
| 129 | - $components = explode( '/', $path ); |
|
| 130 | - if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) { |
|
| 131 | - return $caps; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - // Give permission to the user. |
|
| 135 | - $mapped[] = 'manage_options'; |
|
| 136 | - |
|
| 137 | - return $mapped; |
|
| 138 | - } |
|
| 31 | + /** |
|
| 32 | + * Hook to `wl_entity_type_row_actions` to add an "action" link to Thread |
|
| 33 | + * SEO related settings for the term. |
|
| 34 | + * |
|
| 35 | + * @see https://developer.wordpress.org/reference/hooks/taxonomy_row_actions/ |
|
| 36 | + * |
|
| 37 | + * @since 3.11.0 |
|
| 38 | + * |
|
| 39 | + * @param array $actions An array of action links to be displayed. Default |
|
| 40 | + * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
|
| 41 | + * @param object $term Term object. |
|
| 42 | + * |
|
| 43 | + * @return array $actions An array of action links to be displayed. Default |
|
| 44 | + * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
|
| 45 | + */ |
|
| 46 | + function wl_entity_type_row_actions( $actions, $term ) { |
|
| 47 | + |
|
| 48 | + $url = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" ); |
|
| 49 | + $actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>'; |
|
| 50 | + |
|
| 51 | + // Hacks for pre 4.7 compatibility: |
|
| 52 | + // * remove the quick edit. |
|
| 53 | + unset( $actions['inline hide-if-no-js'] ); |
|
| 54 | + // * remove the edit link. |
|
| 55 | + unset( $actions['edit'] ); |
|
| 56 | + |
|
| 57 | + return $actions; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Override the capabilities related to managing the entity type terms |
|
| 62 | + * for multisite super admin to prevent it from manipulating it in any |
|
| 63 | + * way. |
|
| 64 | + * |
|
| 65 | + * @since 3.12.0 |
|
| 66 | + * |
|
| 67 | + * @param array $caps The user's current capabilities. |
|
| 68 | + * @param string $cap Capability name. |
|
| 69 | + * @param int $user_id The user ID. |
|
| 70 | + * @param array $args Adds the context to the cap. Typically the object ID. |
|
| 71 | + * |
|
| 72 | + * @return array Array containing the do_not_allow capability for super admin |
|
| 73 | + * when editing and deleting entity type terms capabilities |
|
| 74 | + * are being "approved" |
|
| 75 | + */ |
|
| 76 | + function restrict_super_admin( $caps, $cap, $user_id, $args ) { |
|
| 77 | + |
|
| 78 | + switch ( $cap ) { |
|
| 79 | + case 'wl_entity_type_edit_term': |
|
| 80 | + case 'wl_entity_type_delete_term': |
|
| 81 | + $caps[] = 'do_not_allow'; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + return $caps; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Override the capabilities related to managing the entity type terms |
|
| 89 | + * required for WordPress < 4.7 to get access to the admin page. |
|
| 90 | + * |
|
| 91 | + * Before 4.7, WordPress checks whether the user has permission to access |
|
| 92 | + * the `edit-tags.php` page. So we need to provide temporary the permission |
|
| 93 | + * otherwise the user will get an `access not allowed` when trying to access |
|
| 94 | + * the page. |
|
| 95 | + * |
|
| 96 | + * @see https://github.com/insideout10/wordlift-plugin/issues/512 |
|
| 97 | + * |
|
| 98 | + * @since 3.12.0 |
|
| 99 | + * |
|
| 100 | + * @param array $caps The user's current capabilities. |
|
| 101 | + * @param string $cap Capability name. |
|
| 102 | + * @param int $user_id The user ID. |
|
| 103 | + * @param array $args Adds the context to the cap. Typically the object ID. |
|
| 104 | + * |
|
| 105 | + * @return array Array containing the manage_options capability |
|
| 106 | + */ |
|
| 107 | + function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) { |
|
| 108 | + |
|
| 109 | + // Bail out if we're not dealing with the `wl_entity_type_edit_term` |
|
| 110 | + // capability. |
|
| 111 | + if ( 'wl_entity_type_edit_term' !== $cap ) { |
|
| 112 | + return $caps; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); |
|
| 116 | + |
|
| 117 | + // Bail out if the `path` cannot be determined. |
|
| 118 | + if ( null === $path ) { |
|
| 119 | + return $caps; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + // Bail out if a specific term is being handled. |
|
| 123 | + if ( isset( $_REQUEST['action'] ) ) { |
|
| 124 | + return $caps; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + // Split the path and check if the page is the `edit-tags.php`. We can't |
|
| 128 | + // use WP's own function because this is called very early. |
|
| 129 | + $components = explode( '/', $path ); |
|
| 130 | + if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) { |
|
| 131 | + return $caps; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + // Give permission to the user. |
|
| 135 | + $mapped[] = 'manage_options'; |
|
| 136 | + |
|
| 137 | + return $mapped; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @since 3.11.0 |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | * @return array $actions An array of action links to be displayed. Default |
| 44 | 44 | * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
| 45 | 45 | */ |
| 46 | - function wl_entity_type_row_actions( $actions, $term ) { |
|
| 46 | + function wl_entity_type_row_actions($actions, $term) { |
|
| 47 | 47 | |
| 48 | - $url = admin_url( "admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id" ); |
|
| 49 | - $actions['wl-seo'] = '<a href="' . esc_url( $url ) . '">' . __( 'SEO Settings', 'wordlift' ) . '</a>'; |
|
| 48 | + $url = admin_url("admin.php?page=wl_entity_type_settings&tag_ID=$term->term_id"); |
|
| 49 | + $actions['wl-seo'] = '<a href="'.esc_url($url).'">'.__('SEO Settings', 'wordlift').'</a>'; |
|
| 50 | 50 | |
| 51 | 51 | // Hacks for pre 4.7 compatibility: |
| 52 | 52 | // * remove the quick edit. |
| 53 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 53 | + unset($actions['inline hide-if-no-js']); |
|
| 54 | 54 | // * remove the edit link. |
| 55 | - unset( $actions['edit'] ); |
|
| 55 | + unset($actions['edit']); |
|
| 56 | 56 | |
| 57 | 57 | return $actions; |
| 58 | 58 | } |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * when editing and deleting entity type terms capabilities |
| 74 | 74 | * are being "approved" |
| 75 | 75 | */ |
| 76 | - function restrict_super_admin( $caps, $cap, $user_id, $args ) { |
|
| 76 | + function restrict_super_admin($caps, $cap, $user_id, $args) { |
|
| 77 | 77 | |
| 78 | - switch ( $cap ) { |
|
| 78 | + switch ($cap) { |
|
| 79 | 79 | case 'wl_entity_type_edit_term': |
| 80 | 80 | case 'wl_entity_type_delete_term': |
| 81 | 81 | $caps[] = 'do_not_allow'; |
@@ -104,30 +104,30 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return array Array containing the manage_options capability |
| 106 | 106 | */ |
| 107 | - function enable_admin_access_pre_47( $caps, $cap, $user_id, $args ) { |
|
| 107 | + function enable_admin_access_pre_47($caps, $cap, $user_id, $args) { |
|
| 108 | 108 | |
| 109 | 109 | // Bail out if we're not dealing with the `wl_entity_type_edit_term` |
| 110 | 110 | // capability. |
| 111 | - if ( 'wl_entity_type_edit_term' !== $cap ) { |
|
| 111 | + if ('wl_entity_type_edit_term' !== $cap) { |
|
| 112 | 112 | return $caps; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); |
|
| 115 | + $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); |
|
| 116 | 116 | |
| 117 | 117 | // Bail out if the `path` cannot be determined. |
| 118 | - if ( null === $path ) { |
|
| 118 | + if (null === $path) { |
|
| 119 | 119 | return $caps; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // Bail out if a specific term is being handled. |
| 123 | - if ( isset( $_REQUEST['action'] ) ) { |
|
| 123 | + if (isset($_REQUEST['action'])) { |
|
| 124 | 124 | return $caps; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Split the path and check if the page is the `edit-tags.php`. We can't |
| 128 | 128 | // use WP's own function because this is called very early. |
| 129 | - $components = explode( '/', $path ); |
|
| 130 | - if ( 'edit-tags.php' !== $components[ count( $components ) - 1 ] ) { |
|
| 129 | + $components = explode('/', $path); |
|
| 130 | + if ('edit-tags.php' !== $components[count($components) - 1]) { |
|
| 131 | 131 | return $caps; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -15,34 +15,34 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | function wl_prefixes_list() { |
| 17 | 17 | |
| 18 | - // If the parameter is false, default prefixes have never been installed. |
|
| 19 | - if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) { |
|
| 18 | + // If the parameter is false, default prefixes have never been installed. |
|
| 19 | + if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) { |
|
| 20 | 20 | |
| 21 | - $prefixes = array( |
|
| 22 | - array( |
|
| 23 | - 'prefix' => 'geo', |
|
| 24 | - 'namespace' => 'http://www.w3.org/2003/01/geo/wgs84_pos#', |
|
| 25 | - ), |
|
| 26 | - array( |
|
| 27 | - 'prefix' => 'dct', |
|
| 28 | - 'namespace' => 'http://purl.org/dc/terms/', |
|
| 29 | - ), |
|
| 30 | - array( |
|
| 31 | - 'prefix' => 'rdfs', |
|
| 32 | - 'namespace' => 'http://www.w3.org/2000/01/rdf-schema#', |
|
| 33 | - ), |
|
| 34 | - array( |
|
| 35 | - 'prefix' => 'owl', |
|
| 36 | - 'namespace' => 'http://www.w3.org/2002/07/owl#', |
|
| 37 | - ), |
|
| 38 | - array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ), |
|
| 39 | - array( |
|
| 40 | - 'prefix' => 'xsd', |
|
| 41 | - 'namespace' => 'http://www.w3.org/2001/XMLSchema#', |
|
| 42 | - ), |
|
| 43 | - ); |
|
| 44 | - add_option( 'wl_option_prefixes', $prefixes ); |
|
| 45 | - } |
|
| 21 | + $prefixes = array( |
|
| 22 | + array( |
|
| 23 | + 'prefix' => 'geo', |
|
| 24 | + 'namespace' => 'http://www.w3.org/2003/01/geo/wgs84_pos#', |
|
| 25 | + ), |
|
| 26 | + array( |
|
| 27 | + 'prefix' => 'dct', |
|
| 28 | + 'namespace' => 'http://purl.org/dc/terms/', |
|
| 29 | + ), |
|
| 30 | + array( |
|
| 31 | + 'prefix' => 'rdfs', |
|
| 32 | + 'namespace' => 'http://www.w3.org/2000/01/rdf-schema#', |
|
| 33 | + ), |
|
| 34 | + array( |
|
| 35 | + 'prefix' => 'owl', |
|
| 36 | + 'namespace' => 'http://www.w3.org/2002/07/owl#', |
|
| 37 | + ), |
|
| 38 | + array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ), |
|
| 39 | + array( |
|
| 40 | + 'prefix' => 'xsd', |
|
| 41 | + 'namespace' => 'http://www.w3.org/2001/XMLSchema#', |
|
| 42 | + ), |
|
| 43 | + ); |
|
| 44 | + add_option( 'wl_option_prefixes', $prefixes ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $prefixes; |
|
| 47 | + return $prefixes; |
|
| 48 | 48 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | function wl_prefixes_list() { |
| 17 | 17 | |
| 18 | 18 | // If the parameter is false, default prefixes have never been installed. |
| 19 | - if ( false === ( $prefixes = get_option( 'wl_option_prefixes' ) ) ) { |
|
| 19 | + if (false === ($prefixes = get_option('wl_option_prefixes'))) { |
|
| 20 | 20 | |
| 21 | 21 | $prefixes = array( |
| 22 | 22 | array( |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | 'prefix' => 'owl', |
| 36 | 36 | 'namespace' => 'http://www.w3.org/2002/07/owl#', |
| 37 | 37 | ), |
| 38 | - array( 'prefix' => 'schema', 'namespace' => 'http://schema.org/' ), |
|
| 38 | + array('prefix' => 'schema', 'namespace' => 'http://schema.org/'), |
|
| 39 | 39 | array( |
| 40 | 40 | 'prefix' => 'xsd', |
| 41 | 41 | 'namespace' => 'http://www.w3.org/2001/XMLSchema#', |
| 42 | 42 | ), |
| 43 | 43 | ); |
| 44 | - add_option( 'wl_option_prefixes', $prefixes ); |
|
| 44 | + add_option('wl_option_prefixes', $prefixes); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return $prefixes; |
@@ -58,137 +58,137 @@ |
||
| 58 | 58 | // return sizeof( $results ); |
| 59 | 59 | // } |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * The {@link Wordlift_Entity_Service} instance. |
|
| 63 | - * |
|
| 64 | - * @since 3.12.2 |
|
| 65 | - * @access private |
|
| 66 | - * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 67 | - */ |
|
| 68 | - private $entity_service; |
|
| 69 | - /** |
|
| 70 | - * @var |
|
| 71 | - */ |
|
| 72 | - private $sparql_service; |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Create a {@link Wordlift_Admin_Status_Page} instance. |
|
| 76 | - * |
|
| 77 | - * @since 3.12.2 |
|
| 78 | - * |
|
| 79 | - * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 80 | - * @param \Wordlift_Sparql_Service $sparql_service The {@link Wordlift_Sparql_Service} instance. |
|
| 81 | - */ |
|
| 82 | - public function __construct( $entity_service, $sparql_service ) { |
|
| 83 | - |
|
| 84 | - $this->entity_service = $entity_service; |
|
| 85 | - $this->sparql_service = $sparql_service; |
|
| 86 | - |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Get the list of entity URIs. |
|
| 91 | - * |
|
| 92 | - * @since 3.12.2 |
|
| 93 | - * @return array An array of entity URIs. |
|
| 94 | - */ |
|
| 95 | - protected function get_entity_uris() { |
|
| 96 | - |
|
| 97 | - // Get the entity IDs. |
|
| 98 | - $ids = $this->entity_service->get( array( |
|
| 99 | - 'numberposts' => - 1, |
|
| 100 | - 'fields' => 'ids', |
|
| 101 | - 'post_status' => 'publish', |
|
| 102 | - ) ); |
|
| 103 | - |
|
| 104 | - // Create a reference to the entity service for the closure. |
|
| 105 | - $entity_service = $this->entity_service; |
|
| 106 | - |
|
| 107 | - // Combine IDs with URIs. |
|
| 108 | - return array_combine( $ids, array_map( function ( $item ) use ( $entity_service ) { |
|
| 109 | - return $entity_service->get_uri( $item ); |
|
| 110 | - }, $ids ) ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Get the list of URIs in the Linked Data Cloud. |
|
| 115 | - * |
|
| 116 | - * @since 3.12.2 |
|
| 117 | - * @return array|null An array of URIs. |
|
| 118 | - */ |
|
| 119 | - protected function get_linked_data_uris() { |
|
| 120 | - |
|
| 121 | - // Prepare the query to get the URIs from the Linked Data Cloud. |
|
| 122 | - $query = Wordlift_Query_Builder::new_instance() |
|
| 123 | - ->select( 'DISTINCT ?s' ) |
|
| 124 | - ->statement( '?s', Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' ) |
|
| 125 | - ->build(); |
|
| 126 | - |
|
| 127 | - // Execute the query. |
|
| 128 | - $response = $this->sparql_service->select( $query ); |
|
| 129 | - |
|
| 130 | - // If the response is an error, return null. |
|
| 131 | - if ( is_a( $response, 'WP_Error' ) ) { |
|
| 132 | - return null; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - // Split the response into single URIs. |
|
| 136 | - $uris = preg_split( "/(\r\n|\n|\r)/", $response['body'] ); |
|
| 137 | - |
|
| 138 | - // Remove the header. |
|
| 139 | - unset( $uris[0] ); |
|
| 140 | - |
|
| 141 | - // Finally return the URIs. |
|
| 142 | - return $uris; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Get the page title. Will be translated. |
|
| 147 | - * |
|
| 148 | - * @since 3.11.0 |
|
| 149 | - * |
|
| 150 | - * @return string The page title. |
|
| 151 | - */ |
|
| 152 | - function get_page_title() { |
|
| 153 | - |
|
| 154 | - return _x( 'Status Report', 'Page title', 'wordlift' ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * Get the menu title. Will be translated. |
|
| 159 | - * |
|
| 160 | - * @since 3.11.0 |
|
| 161 | - * |
|
| 162 | - * @return string The menu title. |
|
| 163 | - */ |
|
| 164 | - function get_menu_title() { |
|
| 165 | - |
|
| 166 | - return _x( 'Status Report', 'Menu title', 'wordlift' ); |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * Get the menu slug. |
|
| 171 | - * |
|
| 172 | - * @since 3.11.0 |
|
| 173 | - * |
|
| 174 | - * @return string The menu slug. |
|
| 175 | - */ |
|
| 176 | - function get_menu_slug() { |
|
| 177 | - |
|
| 178 | - return 'wl_status_report'; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Get the partial file name, used in the {@link render} function. |
|
| 183 | - * |
|
| 184 | - * @since 3.11.0 |
|
| 185 | - * |
|
| 186 | - * @return string The partial file name. |
|
| 187 | - */ |
|
| 188 | - function get_partial_name() { |
|
| 189 | - |
|
| 190 | - |
|
| 191 | - return 'wordlift-admin-status-page.php'; |
|
| 192 | - } |
|
| 61 | + /** |
|
| 62 | + * The {@link Wordlift_Entity_Service} instance. |
|
| 63 | + * |
|
| 64 | + * @since 3.12.2 |
|
| 65 | + * @access private |
|
| 66 | + * @var \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 67 | + */ |
|
| 68 | + private $entity_service; |
|
| 69 | + /** |
|
| 70 | + * @var |
|
| 71 | + */ |
|
| 72 | + private $sparql_service; |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Create a {@link Wordlift_Admin_Status_Page} instance. |
|
| 76 | + * |
|
| 77 | + * @since 3.12.2 |
|
| 78 | + * |
|
| 79 | + * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
|
| 80 | + * @param \Wordlift_Sparql_Service $sparql_service The {@link Wordlift_Sparql_Service} instance. |
|
| 81 | + */ |
|
| 82 | + public function __construct( $entity_service, $sparql_service ) { |
|
| 83 | + |
|
| 84 | + $this->entity_service = $entity_service; |
|
| 85 | + $this->sparql_service = $sparql_service; |
|
| 86 | + |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Get the list of entity URIs. |
|
| 91 | + * |
|
| 92 | + * @since 3.12.2 |
|
| 93 | + * @return array An array of entity URIs. |
|
| 94 | + */ |
|
| 95 | + protected function get_entity_uris() { |
|
| 96 | + |
|
| 97 | + // Get the entity IDs. |
|
| 98 | + $ids = $this->entity_service->get( array( |
|
| 99 | + 'numberposts' => - 1, |
|
| 100 | + 'fields' => 'ids', |
|
| 101 | + 'post_status' => 'publish', |
|
| 102 | + ) ); |
|
| 103 | + |
|
| 104 | + // Create a reference to the entity service for the closure. |
|
| 105 | + $entity_service = $this->entity_service; |
|
| 106 | + |
|
| 107 | + // Combine IDs with URIs. |
|
| 108 | + return array_combine( $ids, array_map( function ( $item ) use ( $entity_service ) { |
|
| 109 | + return $entity_service->get_uri( $item ); |
|
| 110 | + }, $ids ) ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Get the list of URIs in the Linked Data Cloud. |
|
| 115 | + * |
|
| 116 | + * @since 3.12.2 |
|
| 117 | + * @return array|null An array of URIs. |
|
| 118 | + */ |
|
| 119 | + protected function get_linked_data_uris() { |
|
| 120 | + |
|
| 121 | + // Prepare the query to get the URIs from the Linked Data Cloud. |
|
| 122 | + $query = Wordlift_Query_Builder::new_instance() |
|
| 123 | + ->select( 'DISTINCT ?s' ) |
|
| 124 | + ->statement( '?s', Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' ) |
|
| 125 | + ->build(); |
|
| 126 | + |
|
| 127 | + // Execute the query. |
|
| 128 | + $response = $this->sparql_service->select( $query ); |
|
| 129 | + |
|
| 130 | + // If the response is an error, return null. |
|
| 131 | + if ( is_a( $response, 'WP_Error' ) ) { |
|
| 132 | + return null; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + // Split the response into single URIs. |
|
| 136 | + $uris = preg_split( "/(\r\n|\n|\r)/", $response['body'] ); |
|
| 137 | + |
|
| 138 | + // Remove the header. |
|
| 139 | + unset( $uris[0] ); |
|
| 140 | + |
|
| 141 | + // Finally return the URIs. |
|
| 142 | + return $uris; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Get the page title. Will be translated. |
|
| 147 | + * |
|
| 148 | + * @since 3.11.0 |
|
| 149 | + * |
|
| 150 | + * @return string The page title. |
|
| 151 | + */ |
|
| 152 | + function get_page_title() { |
|
| 153 | + |
|
| 154 | + return _x( 'Status Report', 'Page title', 'wordlift' ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * Get the menu title. Will be translated. |
|
| 159 | + * |
|
| 160 | + * @since 3.11.0 |
|
| 161 | + * |
|
| 162 | + * @return string The menu title. |
|
| 163 | + */ |
|
| 164 | + function get_menu_title() { |
|
| 165 | + |
|
| 166 | + return _x( 'Status Report', 'Menu title', 'wordlift' ); |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * Get the menu slug. |
|
| 171 | + * |
|
| 172 | + * @since 3.11.0 |
|
| 173 | + * |
|
| 174 | + * @return string The menu slug. |
|
| 175 | + */ |
|
| 176 | + function get_menu_slug() { |
|
| 177 | + |
|
| 178 | + return 'wl_status_report'; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Get the partial file name, used in the {@link render} function. |
|
| 183 | + * |
|
| 184 | + * @since 3.11.0 |
|
| 185 | + * |
|
| 186 | + * @return string The partial file name. |
|
| 187 | + */ |
|
| 188 | + function get_partial_name() { |
|
| 189 | + |
|
| 190 | + |
|
| 191 | + return 'wordlift-admin-status-page.php'; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param \Wordlift_Entity_Service $entity_service The {@link Wordlift_Entity_Service} instance. |
| 80 | 80 | * @param \Wordlift_Sparql_Service $sparql_service The {@link Wordlift_Sparql_Service} instance. |
| 81 | 81 | */ |
| 82 | - public function __construct( $entity_service, $sparql_service ) { |
|
| 82 | + public function __construct($entity_service, $sparql_service) { |
|
| 83 | 83 | |
| 84 | 84 | $this->entity_service = $entity_service; |
| 85 | 85 | $this->sparql_service = $sparql_service; |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | protected function get_entity_uris() { |
| 96 | 96 | |
| 97 | 97 | // Get the entity IDs. |
| 98 | - $ids = $this->entity_service->get( array( |
|
| 99 | - 'numberposts' => - 1, |
|
| 98 | + $ids = $this->entity_service->get(array( |
|
| 99 | + 'numberposts' => -1, |
|
| 100 | 100 | 'fields' => 'ids', |
| 101 | 101 | 'post_status' => 'publish', |
| 102 | - ) ); |
|
| 102 | + )); |
|
| 103 | 103 | |
| 104 | 104 | // Create a reference to the entity service for the closure. |
| 105 | 105 | $entity_service = $this->entity_service; |
| 106 | 106 | |
| 107 | 107 | // Combine IDs with URIs. |
| 108 | - return array_combine( $ids, array_map( function ( $item ) use ( $entity_service ) { |
|
| 109 | - return $entity_service->get_uri( $item ); |
|
| 110 | - }, $ids ) ); |
|
| 108 | + return array_combine($ids, array_map(function($item) use ($entity_service) { |
|
| 109 | + return $entity_service->get_uri($item); |
|
| 110 | + }, $ids)); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -120,23 +120,23 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // Prepare the query to get the URIs from the Linked Data Cloud. |
| 122 | 122 | $query = Wordlift_Query_Builder::new_instance() |
| 123 | - ->select( 'DISTINCT ?s' ) |
|
| 124 | - ->statement( '?s', Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' ) |
|
| 123 | + ->select('DISTINCT ?s') |
|
| 124 | + ->statement('?s', Wordlift_Query_Builder::RDFS_TYPE_URI, '?o') |
|
| 125 | 125 | ->build(); |
| 126 | 126 | |
| 127 | 127 | // Execute the query. |
| 128 | - $response = $this->sparql_service->select( $query ); |
|
| 128 | + $response = $this->sparql_service->select($query); |
|
| 129 | 129 | |
| 130 | 130 | // If the response is an error, return null. |
| 131 | - if ( is_a( $response, 'WP_Error' ) ) { |
|
| 131 | + if (is_a($response, 'WP_Error')) { |
|
| 132 | 132 | return null; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Split the response into single URIs. |
| 136 | - $uris = preg_split( "/(\r\n|\n|\r)/", $response['body'] ); |
|
| 136 | + $uris = preg_split("/(\r\n|\n|\r)/", $response['body']); |
|
| 137 | 137 | |
| 138 | 138 | // Remove the header. |
| 139 | - unset( $uris[0] ); |
|
| 139 | + unset($uris[0]); |
|
| 140 | 140 | |
| 141 | 141 | // Finally return the URIs. |
| 142 | 142 | return $uris; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | function get_page_title() { |
| 153 | 153 | |
| 154 | - return _x( 'Status Report', 'Page title', 'wordlift' ); |
|
| 154 | + return _x('Status Report', 'Page title', 'wordlift'); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | function get_menu_title() { |
| 165 | 165 | |
| 166 | - return _x( 'Status Report', 'Menu title', 'wordlift' ); |
|
| 166 | + return _x('Status Report', 'Menu title', 'wordlift'); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function wl_configuration_get_key() { |
| 13 | 13 | |
| 14 | - return Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 14 | + return Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function wl_configuration_get_redlink_dataset_uri() { |
| 28 | 28 | |
| 29 | - return Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
|
| 29 | + return Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function wl_configuration_get_analyzer_url() { |
| 43 | 43 | |
| 44 | - // If the WordLift Key is set, we use WordLift. |
|
| 45 | - $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 44 | + // If the WordLift Key is set, we use WordLift. |
|
| 45 | + $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 46 | 46 | |
| 47 | - // Return a NULL URL if the key isn't set. |
|
| 48 | - if ( empty( $key ) ) { |
|
| 49 | - return null; |
|
| 50 | - } |
|
| 47 | + // Return a NULL URL if the key isn't set. |
|
| 48 | + if ( empty( $key ) ) { |
|
| 49 | + return null; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key" |
|
| 53 | - . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' ); |
|
| 52 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key" |
|
| 53 | + . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' ); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | function wl_configuration_get_query_select_url() { |
| 65 | 65 | |
| 66 | - // If the WordLift Key is set, we use WordLift. |
|
| 67 | - $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 66 | + // If the WordLift Key is set, we use WordLift. |
|
| 67 | + $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 68 | 68 | |
| 69 | - if ( empty( $key ) ) { |
|
| 70 | - return null; |
|
| 71 | - } |
|
| 69 | + if ( empty( $key ) ) { |
|
| 70 | + return null; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q="; |
|
| 73 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q="; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | function wl_configuration_get_query_update_url() { |
| 84 | 84 | |
| 85 | - // If the WordLift Key is set, we use WordLift. |
|
| 86 | - $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 87 | - if ( empty( $key ) ) { |
|
| 88 | - return null; |
|
| 89 | - } |
|
| 85 | + // If the WordLift Key is set, we use WordLift. |
|
| 86 | + $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 87 | + if ( empty( $key ) ) { |
|
| 88 | + return null; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries"; |
|
| 91 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries"; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function wl_configuration_get_dataset_index_url() { |
| 103 | 103 | |
| 104 | - // If the WordLift Key is set, we use WordLift. |
|
| 105 | - $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 106 | - if ( empty( $key ) ) { |
|
| 107 | - return null; |
|
| 108 | - } |
|
| 104 | + // If the WordLift Key is set, we use WordLift. |
|
| 105 | + $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
|
| 106 | + if ( empty( $key ) ) { |
|
| 107 | + return null; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index"; |
|
| 110 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index"; |
|
| 111 | 111 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
| 46 | 46 | |
| 47 | 47 | // Return a NULL URL if the key isn't set. |
| 48 | - if ( empty( $key ) ) { |
|
| 48 | + if (empty($key)) { |
|
| 49 | 49 | return null; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "analyses?key=$key" |
|
| 53 | - . ( defined( 'WL_EXCLUDE_IMAGES_REGEX' ) ? '&exclimage=' . urlencode( WL_EXCLUDE_IMAGES_REGEX ) : '' ); |
|
| 52 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."analyses?key=$key" |
|
| 53 | + . (defined('WL_EXCLUDE_IMAGES_REGEX') ? '&exclimage='.urlencode(WL_EXCLUDE_IMAGES_REGEX) : ''); |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | // If the WordLift Key is set, we use WordLift. |
| 67 | 67 | $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
| 68 | 68 | |
| 69 | - if ( empty( $key ) ) { |
|
| 69 | + if (empty($key)) { |
|
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries?q="; |
|
| 73 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/queries?q="; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // If the WordLift Key is set, we use WordLift. |
| 86 | 86 | $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
| 87 | - if ( empty( $key ) ) { |
|
| 87 | + if (empty($key)) { |
|
| 88 | 88 | return null; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/queries"; |
|
| 91 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/queries"; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // If the WordLift Key is set, we use WordLift. |
| 105 | 105 | $key = Wordlift_Configuration_Service::get_instance()->get_key(); |
| 106 | - if ( empty( $key ) ) { |
|
| 106 | + if (empty($key)) { |
|
| 107 | 107 | return null; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/index"; |
|
| 110 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/index"; |
|
| 111 | 111 | } |