Skip to content

Commit

Permalink
Merge pull request #1387 from insideout10/release/3.31.4
Browse files Browse the repository at this point in the history
Release/3.31.4
  • Loading branch information
akshayraje authored Jun 1, 2021
2 parents 6a83c9b + c370390 commit babd092
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 67 deletions.
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.31.3",
"version": "3.31.4",
"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.31.3",
"version": "3.31.4",
"description": "WordLift Plugin application for the web site public front-end.",
"main": "index.js",
"repository": "https://github.com/insideout10/wordlift-plugin",
Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-wordlift-content-filter-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private function link( $matches ) {
$attributes = apply_filters( 'wl_anchor_data_attributes', $default_attributes, $post->ID );
$attributes_html = '';
foreach ( $attributes as $key => $value ) {
$attributes_html .= 'data-' . esc_html( $key ) . '="' . esc_attr( $value ) . '"';
$attributes_html .= ' data-' . esc_html( $key ) . '="' . esc_attr( $value ) . '" ';
}

// Return the link.
Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-wordlift.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ public function __construct() {
self::$instance = $this;

$this->plugin_name = 'wordlift';
$this->version = '3.31.3';
$this->version = '3.31.4';
$this->load_dependencies();
$this->set_locale();
$this->define_admin_hooks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public static function create( $entity_service ) {
Wordlift_Schema_Service::FIELD_TOTAL_TIME,
) );

$property_getter->register( new Wordlift_Required_Property_Service( $entity_service ), apply_filters( 'wl_required_property', array() ) );
add_action( 'after_setup_theme', function () use ( $property_getter, $entity_service ) {
$property_getter->register( new Wordlift_Required_Property_Service( $entity_service ), apply_filters( 'wl_required_property', array() ) );
} );

return $property_getter;
}
Expand Down
14 changes: 12 additions & 2 deletions src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,21 @@ You can open your datasets to the public, attaching to it a free or a commercial

== Changelog ==

= 3.31.3 (2021-04-19) =
= 3.31.4 (2021-06-01) =

* Enhancement: Added `wl_videoobject_procedure_post_types` and `wl_videoobject_embedded_videos` filters

* Fix [#1384](https://github.com/insideout10/wordlift-plugin/issues/1384): HTML entities encoded in faceted search title
* Fix [#1382](https://github.com/insideout10/wordlift-plugin/issues/1382): Bulk import of videoobject issue in 4.7.0
* Fix: a11y error : no space between attributes
* Fix: Vocabulary endpoint to use `WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE` constant
* Fix: Trigger `wl_required_property` filter in `after_setup_theme` action

= 3.31.3 (2021-05-19) =

* Fix: wl-video-sitemap.xml has a 404 http code

= 3.31.2 (2021-04-18) =
= 3.31.2 (2021-05-18) =

* Enhancement [#1368](https://github.com/insideout10/wordlift-plugin/issues/1368): Add the matched entity markup to the term page

Expand Down
3 changes: 2 additions & 1 deletion src/shortcodes/wordlift_shortcode_faceted_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function wl_shortcode_faceted_search_origin( $request ) {
if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {

$serialized_entity = wl_serialize_entity( $entity );
$serialized_entity['label'] = wl_shortcode_faceted_search_get_the_title( $obj->ID );
$serialized_entity['label'] = html_entity_decode( wl_shortcode_faceted_search_get_the_title( $obj->ID ), ENT_QUOTES, 'UTF-8' );
$serialized_entity['counter'] = $obj->counter;
$serialized_entity['createdAt'] = $entity->post_date;
$serialized_entity['referencedPosts'] = Wordlift_Relation_Service::get_instance()->get_article_subjects(
Expand All @@ -249,6 +249,7 @@ function wl_shortcode_faceted_search_origin( $request ) {
// Add srcset attribute.
$post_results = array_map( function ( $post ) {
$post->srcset = Srcset_Util::get_srcset( $post->ID, Srcset_Util::FACETED_SEARCH_WIDGET );

return $post;
}, $post_results );

Expand Down
2 changes: 1 addition & 1 deletion src/wordlift.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: WordLift
* Plugin URI: https://wordlift.io
* Description: WordLift brings the power of AI to organize content, attract new readers and get their attention. To activate the plugin <a href="https://wordlift.io/">visit our website</a>.
* Version: 3.31.3
* Version: 3.31.4
* Author: WordLift, Insideout10
* Author URI: https://wordlift.io
* License: GPL-2.0+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ public function __construct( $state_storage_key ) {
}

public function next() {
$this->log->debug("Received video data source index as " . $this->get_state()->index);
$this->log->debug("Count set to " . $this->get_batch_size() );
$this->log->debug( "Received video data source index as " . $this->get_state()->index );
$this->log->debug( "Count set to " . $this->get_batch_size() );

return get_posts( array(
'fields' => 'ids',
'post_status' => 'any',
'numberposts' => $this->get_batch_size(),
'offset' => $this->get_state()->index,
/**
* @since 3.31.4
* Filter name : wl_videoobject_procedure_post_types
* @return array<string> An array of supported post types for the video import procedure.
*/
'post_type' => apply_filters( 'wl_videoobject_procedure_post_types', array( 'post' ) )
) );
}

Expand All @@ -32,6 +39,12 @@ public function count() {
'fields' => 'ids',
'numberposts' => - 1,
'post_status' => 'any',
/**
* @since 3.31.4
* Filter name : wl_videoobject_procedure_post_types
* @return array<string> An array of supported post types for the video import procedure.
*/
'post_type' => apply_filters( 'wl_videoobject_procedure_post_types', array( 'post' ) )
) ) );

}
Expand Down
10 changes: 10 additions & 0 deletions src/wordlift/videoobject/class-video-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public function process_video_urls( \WP_Post $post, $post_id ) {

$embedded_videos = $parser->get_videos( $post_id );

/**
* Filters the embedded videos on post contet, custom plugins can add their video urls
* by constructing \Default_Embedded_Video or implement Embedded_Video class
* @since 3.31.4
* Filter name : wl_videoobject_embedded_videos
* @param $embedded_videos array<Embedded_Video>
* @return array<Embedded_Video>
*/
$embedded_videos = apply_filters('wl_videoobject_embedded_videos', $embedded_videos);

$storage = Video_Storage_Factory::get_storage();

// Before sending api requests we need to check if there are any videos in
Expand Down
82 changes: 45 additions & 37 deletions src/wordlift/videoobject/pages/assets/videoobject-import-page.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
window.addEventListener("load", function () {
const startBtn = document.getElementById("wl-start-btn");
const stopBtn = document.getElementById("wl-stop-btn");
const startBtn = document.getElementById("wl-start-btn");
const stopBtn = document.getElementById("wl-stop-btn");
const {restUrl, nonce} = _wlVideoObjectImportSettings

const updateProgressBar = function () {
wp.apiRequest({ path: "wordlift/v1/videos/background/get_state", method: "POST" }).success(
(data) => {
let percentage = (data.index * 100.0) / data.count;
if ( percentage > 100 ) {
percentage = 100
}
document.querySelector(".wl-task__progress__bar").style.width =
percentage + "%";
const updateProgressBar = function () {
fetch(restUrl + "wordlift/v1/videos/background/get_state", {
method: "POST",
headers: {"X-WP-Nonce": nonce }
})
.then(response => response.json())
.catch(() => {
})
.then((data) => {
let percentage = (data.index * 100.0) / data.count;
if (percentage > 100) {
percentage = 100
}
document.querySelector(".wl-task__progress__bar").style.width =
percentage + "%";

if ("started" === data.state) {
if (!startBtn.classList.contains("hidden"))
startBtn.classList.add("hidden");
if (stopBtn.classList.contains("hidden"))
stopBtn.classList.remove("hidden");
} else {
if (startBtn.classList.contains("hidden"))
startBtn.classList.remove("hidden");
if (!stopBtn.classList.contains("hidden"))
stopBtn.classList.add("hidden");
}
if ("started" === data.state) {
if (!startBtn.classList.contains("hidden"))
startBtn.classList.add("hidden");
if (stopBtn.classList.contains("hidden"))
stopBtn.classList.remove("hidden");
} else {
if (startBtn.classList.contains("hidden"))
startBtn.classList.remove("hidden");
if (!stopBtn.classList.contains("hidden"))
stopBtn.classList.add("hidden");
}

setTimeout(updateProgressBar, 1000);
}
);
};
setTimeout(updateProgressBar, 1000);
});
};

setTimeout(updateProgressBar, 1000);
setTimeout(updateProgressBar, 1000);

startBtn.addEventListener("click", function () {
wp.apiRequest({
method: "POST",
path: "wordlift/v1/videos/background/start",
startBtn.addEventListener("click", function () {
fetch(restUrl + "wordlift/v1/videos/background/start", {
method: "POST",
headers: {"X-WP-Nonce": nonce }
}).then(() => {
});
});
});

stopBtn.addEventListener("click", function () {
wp.apiRequest({
method: "POST",
path: "wordlift/v1/videos/background/stop",
stopBtn.addEventListener("click", function () {
fetch(restUrl + "wordlift/v1/videos/background/stop", {
method: "POST",
headers: {"X-WP-Nonce": nonce }
}).then(() => {
});
});
});
});
24 changes: 11 additions & 13 deletions src/wordlift/videoobject/pages/class-import-videos-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,26 @@ public function __construct() {
public function admin_menu() {

add_submenu_page( 'wl_admin_menu',
__( 'Import all videos', 'wordlift' ),
__( 'Import all videos', 'wordlift' ),
'manage_options', 'wl_videos_import', array(
$this,
'render'
) );
__( 'Import all videos', 'wordlift' ),
__( 'Import all videos', 'wordlift' ),
'manage_options', 'wl_videos_import', array(
$this,
'render'
) );

}

public function render() {

wp_enqueue_style(
'wl-tasks-page',
plugin_dir_url( dirname( __FILE__ ) ) . 'tasks/admin/assets/tasks-page.css',
array(),
\Wordlift::get_instance()->get_version(),
'all' );
wp_enqueue_script(
'wl-dataset-sync-page',
'wl-videos-sync-page',
plugin_dir_url( __FILE__ ) . 'assets/videoobject-import-page.js',
array( 'wp-api' ),
\Wordlift::get_instance()->get_version() );
wp_localize_script( 'wl-videos-sync-page', '_wlVideoObjectImportSettings', array(
'restUrl' => get_rest_url(),
'nonce' => wp_create_nonce( 'wp_rest' )
) )

?>
<div class="wrap">
Expand Down
2 changes: 1 addition & 1 deletion src/wordlift/vocabulary/class-vocabulary-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function init_vocabulary() {
$configuration_service = \Wordlift_Configuration_Service::get_instance();

$api_service = new Default_Api_Service(
apply_filters( 'wl_api_base_url', 'https://api.wordlift.io' ),
apply_filters( 'wl_api_base_url', WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE ),
60,
User_Agent::get_user_agent(),
$configuration_service->get_key()
Expand Down
10 changes: 5 additions & 5 deletions tests/test-frontend-content-filter-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function test_content_with_entity() {
$content = '<span id="urn:enhancement-4b54b56d-7142-5dd3-adc6-27e51c70fdad" class="textannotation disambiguated wl-person" itemid="http://data.example.org/entity">Matt Mullenweg</span> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// The expected content with a link.
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg">Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg" >Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// Check that the expected content matches the function output.
$this->assertNotNull( $this->content_filter_service );
Expand All @@ -121,7 +121,7 @@ public function test_content_with_entity() {
$content = '<span id="urn:enhancement-4b54b56d-7142-5dd3-adc6-27e51c70fdad" class="textannotation disambiguated wl-person" itemid="http://data.example.org/entity">Matt Mullenweg</span> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// The expected content with a link.
$expected = '<a class=\'wl-entity-page-link\' title="Creator of WordPress" href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg">Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';
$expected = '<a class=\'wl-entity-page-link\' title="Creator of WordPress" href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg" >Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// Check that the expected content matches the function output.
$this->assertEquals( $expected, $this->content_filter_service->the_content( $content ) );
Expand Down Expand Up @@ -293,7 +293,7 @@ public function test_entity_default_no_link_entity_link() {
$content = '<span id="urn:enhancement-4b54b56d-7142-5dd3-adc6-27e51c70fdad" class="textannotation wl-link disambiguated wl-person" itemid="http://data.example.org/entity">Matt Mullenweg</span> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// The expected content with a link.
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg">Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg" >Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// Check that the expected content matches the function output.
$this->assertEquals( $expected, $this->content_filter_service->the_content( $content ) );
Expand All @@ -316,7 +316,7 @@ public function test_entity_default_link_entity_link() {
$content = '<span id="urn:enhancement-4b54b56d-7142-5dd3-adc6-27e51c70fdad" class="textannotation wl-link disambiguated wl-person" itemid="http://data.example.org/entity">Matt Mullenweg</span> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// The expected content with a link.
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg">Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg" >Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// Check that the expected content matches the function output.
$this->assertEquals( $expected, $this->content_filter_service->the_content( $content ) );
Expand All @@ -339,7 +339,7 @@ public function test_entity_default_link_entity_not_specified() {
$content = '<span id="urn:enhancement-4b54b56d-7142-5dd3-adc6-27e51c70fdad" class="textannotation disambiguated wl-person" itemid="http://data.example.org/entity">Matt Mullenweg</span> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// The expected content with a link.
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg">Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';
$expected = '<a class=\'wl-entity-page-link\' href=\'http://example.org/link\' data-id="http://example.org/matt-mullenweg" >Matt Mullenweg</a> would love to see what we\'re achieving with WordLift for <span id="urn:enhancement-7aa39603-d48f-8ac8-5437-c74b3b0e28ef" class="textannotation">WordPress</span>!';

// Check that the expected content matches the function output.
$this->assertEquals( $expected, $this->content_filter_service->the_content( $content ) );
Expand Down

0 comments on commit babd092

Please sign in to comment.