Skip to content

Commit

Permalink
Merge pull request #1453 from insideout10/release/3.32.3
Browse files Browse the repository at this point in the history
Release/3.32.3
  • Loading branch information
akshayraje authored Aug 2, 2021
2 parents c37da80 + 7060ead commit 972fd5d
Show file tree
Hide file tree
Showing 41 changed files with 1,617 additions and 168 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ jobs:
ACF_PRO_KEY: ${{ secrets.ACF_PRO_KEY }}
ACF_PRO_ENABLED: ${{ matrix.acf-pro-enabled }}
WORDLIFT_API_URL: ${{ secrets.WORDLIFT_API_URL }}
YOUTUBE_DATA_API_KEY: ${{ secrets.YOUTUBE_DATA_API_KEY }}
VIMEO_API_KEY: ${{ secrets.VIMEO_API_KEY }}
WORDLIFT_KEY: ${{ secrets.WORDLIFT_KEY }}
WL_DATASET_NG: ${{ matrix.dataset-ng }}

services:
db:
# WP set up uses SET storage_engine=InnoDB; which is removed after MySQL 5.6
Expand All @@ -154,7 +157,7 @@ jobs:
- name: phpunit
run: >
docker run --workdir /github/workspace --rm -v "/var/run/docker.sock":"/var/run/docker.sock" \
-e ACF_PRO_ENABLED -e ACF_PRO_KEY -e WORDLIFT_API_URL -e WORDLIFT_KEY -e WL_DATASET_NG \
-e ACF_PRO_ENABLED -e YOUTUBE_DATA_API_KEY -e VIMEO_API_KEY -e ACF_PRO_KEY -e WORDLIFT_API_URL -e WORDLIFT_KEY -e WL_DATASET_NG \
-v $GITHUB_WORKSPACE:"/github/workspace" \
--network $(docker network ls --format="{{ .Name }}" --filter "Name=^github_network_") \
ziodave/wordpress-tests:${{ matrix.image }} -c ${{ matrix.phpunit-xml }} --stop-on-error --stop-on-fail
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wordlift-plugin",
"description": "WordLift brings the power of Artificial Intelligence to organize content. Attract new readers and get their true attention with top notch semantic seo.",
"private": true,
"version": "3.32.2",
"version": "3.32.3",
"author": "WordLift",
"homepage": "https://wordift.io/",
"license": "GPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion src-js/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordlift-plugin",
"version": "3.32.2",
"version": "3.32.3",
"description": "WordLift Plugin application for the web site public front-end.",
"main": "index.js",
"repository": "https://github.com/insideout10/wordlift-plugin",
Expand Down
41 changes: 25 additions & 16 deletions src/admin/class-wordlift-admin-settings-analytics-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ class Wordlift_Admin_Settings_Analytics_Page extends Wordlift_Admin_Page {
/**
* Create a {@link Wordlift_Admin_Settings_Page} instance.
*
* @param \Wordlift_Configuration_Service $configuration_service The wordlift configuration service.
* @param \Wordlift_Admin_Input_Element $input_element An input element class to output input boxes in a settings form.
* @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A radio element input class for use in a settings form.
*
* @since 3.21.0
*
* @param \Wordlift_Configuration_Service $configuration_service The wordlift configuration service.
* @param \Wordlift_Admin_Input_Element $input_element An input element class to output input boxes in a settings form.
* @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A radio element input class for use in a settings form.
*/
public function __construct( $configuration_service, $input_element, $radio_input_element ) {

Expand All @@ -80,8 +81,8 @@ public function __construct( $configuration_service, $input_element, $radio_inpu
/**
* Get the singleton instance of the Notice service.
*
* @since 3.21.0
* @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service.
* @since 3.21.0
*/
public static function get_instance() {

Expand Down Expand Up @@ -140,8 +141,8 @@ public function get_partial_name() {
* Returns the string to use for the tab slug on main admin settings page.
*
* @method get_admin_page_tab_slug
* @since 3.21.0
* @return string
* @since 3.21.0
*/
public function get_admin_page_tab_slug() {
return 'analytics';
Expand All @@ -151,14 +152,18 @@ public function get_admin_page_tab_slug() {
* Adds pages to the tabs menu on the main admin settings page.
*
* @method add_admin_page_tab
* @param array $tabs an array of tab titles and slugs to use when building a tabbed menu on option pages.
*
* @since 3.21.0
* @param array $tabs an array of tab titles and slugs to use when building a tabbed menu on option pages.
*/
public function add_admin_page_tab( $tabs ) {
$tabs[] = array(
'title' => $this->get_menu_title(),
'slug' => $this->get_admin_page_tab_slug(),
);
if ( apply_filters( 'wl_feature__enable__analytics', true ) ) {
$tabs[] = array(
'title' => $this->get_menu_title(),
'slug' => $this->get_admin_page_tab_slug(),
);
}

return $tabs;
}

Expand Down Expand Up @@ -250,9 +255,10 @@ public function admin_init() {
* TODO: Needs a feedback method to pass back error messages.
*
* @method validate_entity_uri
* @since 3.21.0
* @param string $uri a sting representing an entity ID that can be converted to a uri.
* @param string $uri a sting representing an entity ID that can be converted to a uri.
*
* @return int
* @since 3.21.0
*/
public function validate_entity_uri( $uri ) {
// Basic validation is to ensure number is between 1 and 20.
Expand All @@ -262,6 +268,7 @@ public function validate_entity_uri( $uri ) {
// if we are out of range then pass the default value.
$uri = $this->configuration_service->get_analytics_entity_uri_dimension();
}

return absint( $uri );
}

Expand All @@ -271,9 +278,10 @@ public function validate_entity_uri( $uri ) {
* TODO: Needs a feedback method to pass back error messages.
*
* @method validate_entity_type
* @since 3.21.0
* @param string $type This is an entity type ID in string form - really a number.
* @param string $type This is an entity type ID in string form - really a number.
*
* @return int
* @since 3.21.0
*/
public function validate_entity_type( $type ) {
// Basic validation is to ensure number is between 1 and 20.
Expand All @@ -283,6 +291,7 @@ public function validate_entity_type( $type ) {
// if we are out of range then pass the default value.
$type = $this->configuration_service->get_analytics_entity_type_dimension();
}

return absint( $type );
}

Expand All @@ -292,11 +301,11 @@ public function validate_entity_type( $type ) {
* If a new entity is being created for the publisher, create it and set The
* publisher setting.
*
* @since 3.21.0
*
* @param array $input The configuration settings array.
*
* @return array The sanitized input array.
* @since 3.21.0
*
*/
public function sanitize_callback( $input ) {
if ( ! check_admin_referer( 'wl_analytics_settings-options' ) ) {
Expand Down
29 changes: 15 additions & 14 deletions src/admin/class-wordlift-admin-settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ class Wordlift_Admin_Settings_Page extends Wordlift_Admin_Page {
/**
* Create a {@link Wordlift_Admin_Settings_Page} instance.
*
* @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
* @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
* @param \Wordlift_Admin_Input_Element $input_element A {@link Wordlift_Admin_Input_Element} element renderer.
* @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
* @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
* @param \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
* @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
*
* @since 3.11.0
*
* @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
* @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
* @param \Wordlift_Admin_Input_Element $input_element A {@link Wordlift_Admin_Input_Element} element renderer.
* @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
* @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
* @param \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
* @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
*/
function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $country_select_element, $publisher_element, $radio_input_element ) {

Expand All @@ -116,13 +117,14 @@ function __construct( $configuration_service, $entity_service, $input_element, $
$this->publisher_element = $publisher_element;

self::$instance = $this;

}

/**
* Get the singleton instance of the Notice service.
*
* @since 3.14.0
* @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service.
* @since 3.14.0
*/
public static function get_instance() {

Expand Down Expand Up @@ -200,7 +202,6 @@ public function enqueue_scripts() {
* @since 3.11.0
*/
function admin_init() {

// Register WordLift's general settings, providing our own sanitize callback
// which will also check whether the user filled the WL Publisher form.
register_setting(
Expand All @@ -222,7 +223,7 @@ function admin_init() {
'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']',
'value' => $this->configuration_service->get_key(),
'description' => __( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' )
. ' [' . get_option( 'home' ) . ']',
. ' [' . get_option( 'home' ) . ']',
);

// Before we were used to validate the key beforehand, but this means
Expand Down Expand Up @@ -357,11 +358,11 @@ function admin_init() {
* Filter the {@link Wordlift_Admin_Input_Element} in order to add the
* `readonly` flag to the `wl-entity-base-path` input.
*
* @since 3.17.0
*
* @param array $args An array of {@link Wordlift_Admin_Input_Element} parameters.
*
* @return array The updated array.
* @since 3.17.0
*
*/
public function entity_path_input_element_params( $args ) {

Expand All @@ -383,11 +384,11 @@ public function entity_path_input_element_params( $args ) {
* If a new entity is being created for the publisher, create it and set The
* publisher setting.
*
* @since 3.11.0
*
* @param array $input The configuration settings array.
*
* @return array The sanitized input array.
* @since 3.11.0
*
*/
function sanitize_callback( $input ) {

Expand Down
4 changes: 2 additions & 2 deletions src/admin/class-wordlift-admin-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function hide_notices() {
public function admin_menu() {
/**
*
* @see https://github.com/insideout10/wordlift-plugin/issues/1209
* @see https://github.com/insideout10/wordlift-plugin/issues/1209
* @since 3.27.7
*/
// @todo: find another way to do this, since this is adding an empty space in WP's dashboard menu.
Expand Down Expand Up @@ -271,7 +271,7 @@ public function save_configuration( $params ) {
// `key`, holding WL's key,
// `vocabulary`, holding the vocabulary path,
// `wl-site-language`, with the language code (e.g. `en`),
// `wl-country-code` with the country code (e.g. `us`),
// `wl-country-code` with the country code (e.g. `us`),
// `share-diagnostic`, the user preferences about sharing data with us.
// `user_type`, the user type either `personal` or `company`,
// `name`, with the `personal` or `company`'s name,
Expand Down
24 changes: 14 additions & 10 deletions src/admin/class-wordlift-admin-term-adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ public function edit_form_fields( $tag, $taxonomy ) {

$values = get_term_meta( $tag->term_id, self::META_KEY );

/**
* @since 3.31.3
* @see https://github.com/insideout10/wordlift-plugin/issues/1446
* This field should be hidden by default
*/
if ( ! $values ) {
return;
}

?>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="wl-entity-id"><?php _ex( 'Entity', 'term entity', 'wordlift' ); ?></label></th>
Expand All @@ -101,16 +110,11 @@ public function edit_form_fields( $tag, $taxonomy ) {
*/
public function add_action( $taxonomy ) {
/**
* Filter: wl_feature__enable__taxonomy_term_entity_mapping.
*
* @param bool whether to show the taxonomy term to entity mapping field.
*
* @return bool
* @since 3.27.6
*/
if ( apply_filters( 'wl_feature__enable__taxonomy_term_entity_mapping', true ) ) {
add_action( "{$taxonomy}_edit_form_fields", array( $this, 'edit_form_fields' ), 10, 2 );
}
* Filter wl_feature__enable__taxonomy_term_entity_mapping renamed to wl_feature__enable__term-entity.
**/

add_action( "{$taxonomy}_edit_form_fields", array( $this, 'edit_form_fields' ), 10, 2 );

}

/**
Expand Down
1 change: 0 additions & 1 deletion src/includes/class-wordlift-configuration-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ public function get_package_type() {
*
*/
public function set_package_type( $value ) {

$this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value );
}

Expand Down
11 changes: 7 additions & 4 deletions src/includes/class-wordlift-entity-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,17 @@ public function get_alternative_labels( $post_id ) {
* Retrieve the labels for an entity, i.e. the title + the synonyms.
*
* @param int $post_id The entity {@link WP_Post} id.
* @param int $object_type The object type {@link Object_Type_Enum}
*
* @return array An array with the entity title and labels.
* @since 3.12.0
*
*/
public function get_labels( $post_id ) {

return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
public function get_labels( $post_id, $object_type = Object_Type_Enum::POST ) {
if ( $object_type === Object_Type_Enum::POST ) {
return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
}
// Term Reference dont have synonyms yet.
return array();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-wordlift-post-adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function locale() {
* @param $post_id int
* @param $references int[]
*/
public function add_mentions( $post_id, &$references ) {
public function add_references( $post_id, &$references ) {
$tags = get_the_tags( $post_id );

if ( $tags && ! is_wp_error( $tags ) ) {
Expand Down
Loading

0 comments on commit 972fd5d

Please sign in to comment.