Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
ziodave committed Mar 27, 2024
2 parents 13b2407 + 3883872 commit 504ca3c
Show file tree
Hide file tree
Showing 15 changed files with 783 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .bin/create-zip-file.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


rm -fr wordlift wordlift-*.zip ; cp -R src wordlift
zip -r -9 wordlift-3.52.5-0.zip wordlift
zip -r -9 wordlift-3.52.7-0.zip wordlift
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ docker-compose-custom.yml
.db/

# Ignore local copy of wordlift
/wordlift/
/wordlift/

# Ignore unneeded repo files from wp-background-processing
src/vendor/deliciousbrains/wp-background-processing/.circleci/
src/vendor/deliciousbrains/wp-background-processing/.github/
src/vendor/deliciousbrains/wp-background-processing/.phpcs.xml
src/vendor/deliciousbrains/wp-background-processing/Makefile
src/vendor/deliciousbrains/wp-background-processing/bin/
src/vendor/deliciousbrains/wp-background-processing/phpunit.xml
src/vendor/deliciousbrains/wp-background-processing/tests/
2 changes: 1 addition & 1 deletion src/classes/videoobject/jsonld/class-jsonld.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Jsonld {
*/
public function __construct( $video_storage ) {
add_action( 'wl_post_jsonld', array( $this, 'wl_post_jsonld' ), 10, 2 );
add_action( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 );
add_filter( 'wl_after_get_jsonld', array( $this, 'wl_after_get_jsonld' ), 10, 2 );
$this->video_storage = $video_storage;
}

Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-wordlift-entity-type-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function set( $post_id, $type_uri, $replace = true ) {
* or `$term` was not found.
* @since 3.20.0
*/
private function get_term_by_slug( $slug ) {
public function get_term_by_slug( $slug ) {

return get_term_by( 'slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
}
Expand Down
18 changes: 15 additions & 3 deletions src/includes/class-wordlift-jsonld-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ private function send_jsonld( $response ) {
* @since 3.15.1
*/
public function get_jsonld( $is_homepage = false, $post_id = null, $context = Jsonld_Context_Enum::UNKNOWN ) {

/**
* Filter name: wl_before_get_jsonld
*
* @var bool $is_homepage Whether the JSON-LD for the homepage is being requested.
* @var int|null $post_id The JSON-LD for the specified {@link WP_Post} id.
* @var int $context A context for the JSON-LD generation, valid values in Jsonld_Context_Enum.
*
* @since 3.52.7
*/
do_action( 'wl_before_get_jsonld', $is_homepage, $post_id, $context );

// Tell NewRelic to ignore us, otherwise NewRelic customers might receive
// e-mails with a low apdex score.
//
Expand Down Expand Up @@ -389,9 +401,9 @@ public function get_jsonld( $is_homepage = false, $post_id = null, $context = Js
}

$jsonld_arr = $graph->add_references( $references )
->add_relations( $relations )
->add_required_reference_infos( $references_infos )
->render( $context );
->add_relations( $relations )
->add_required_reference_infos( $references_infos )
->render( $context );

/**
* Filter name: wl_after_get_jsonld
Expand Down
7 changes: 6 additions & 1 deletion src/includes/class-wordlift-post-to-jsonld-converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ public function convert( $post_id, &$references = array(), &$references_infos =
// Get the entity name.
$jsonld['headline'] = $post->post_title;

$custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id );
// Convert entities as `Article`.
//
// @see https://github.com/insideout10/wordlift-plugin/issues/1731
$custom_fields = Wordlift_Entity_Service::get_instance()->is_entity( $post_id )
? $this->entity_type_service->get_custom_fields_for_term( $this->entity_type_service->get_term_by_slug( 'article' ) )
: $this->entity_type_service->get_custom_fields_for_post( $post_id );

if ( isset( $custom_fields ) ) {
$this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos );
Expand Down
7 changes: 7 additions & 0 deletions src/modules/include-exclude/includes/Jsonld_Interceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ public function __construct( $plugin_enabled ) {
}

public function register_hooks() {
add_action( 'wl_before_get_jsonld', array( $this, 'before_get_jsonld' ), 10, 2 );
add_filter( 'wl_after_get_jsonld', array( $this, 'after_get_jsonld' ) );
}

public function before_get_jsonld( $is_homepage = false, $post_id = null ) {
if ( null !== filter_input( INPUT_SERVER, 'HTTP_X_WORDLIFT_BYPASS_INCLUDE_EXCLUDE' ) ) {
clean_post_cache( $post_id );
}
}

public function after_get_jsonld( $jsonld_arr ) {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
@header( 'X-Wordlift-IncludeExclude-Stage-0: Filter Called with default ' . $this->plugin_enabled->get_configuration()->get_default() );
Expand Down
7 changes: 6 additions & 1 deletion src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tags: SEO, SERP, FAQ Markup, Schema Markup, structured data, schema.org, schema
Requires at least: 5.3
Tested up to: 6.4
Requires PHP: 5.6
Stable tag: 3.52.6
Stable tag: 3.52.7
License: GPLv2 or later

Search engines are looking for meaning, not keywords. WordLift tells Google how your content relates to your brand, products, and stakeholders.
Expand Down Expand Up @@ -143,6 +143,11 @@ You can open your datasets to the public, attaching to it a free or a commercial

== Changelog ==

= 3.52.7 (2024-03-27) =

* Update wp-background-processing.php
* Fix Article Wrapper using the entity properties

= 3.52.6 (2024-03-17) =

* Remove deprecation warnings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor/
/.idea
/.idea
*.cache
Loading

0 comments on commit 504ca3c

Please sign in to comment.