Plugin Directory

Changeset 3039236


Ignore:
Timestamp:
02/21/2024 02:30:51 PM (2 years ago)
Author:
diagnoseo
Message:

global reviewedBy schema options added

Location:
diagnoseo
Files:
3 edited
37 copied

Legend:

Unmodified
Added
Removed
  • diagnoseo/tags/1.2.27/diagnoseo.php

    r3039163 r3039236  
    44 * Plugin URI: https://diagnoseo.com/wordpress-seo-plugin/
    55 * Description: Powerful SEO plugin for WordPress. The most lightweight and complete SEO solution on the market! It includes best-in-class content analyzer and keyword placement checkpoints.
    6  * Version: 1.2.26
     6 * Version: 1.2.27
    77 * Author: DiagnoSEO
    88 * Author URI: https://diagnoseo.com/
  • diagnoseo/tags/1.2.27/includes/structured-data.php

    r3032390 r3039236  
    4848        $type    = '@type';
    4949        $context = '@context';
     50        $id      = '@id';
    5051
    5152        switch ( $post_data->post_type ) {
     
    7273            $schema->author->$type = 'Person';
    7374            $schema->author->name  = get_the_author_meta( 'display_name', $post_data->post_author );
     75
     76            $reviewedby_name = get_option( 'diagnoseo_reviewedby_name', '' );
     77            $reviewedby_url  = get_option( 'diagnoseo_reviewedby_url', '' );
     78
     79            if ( ! empty( $reviewedby_name ) ) {
     80                if ( 'WebPage' === $schema_type ) {
     81                    $schema->reviewedBy = diagnoseo_get_reviewedby_schema( null ); // phpcs:ignore
     82                } else {
     83                    $main_entity             = new stdClass();
     84                    $main_entity->$type      = 'WebPage';
     85                    $main_entity->$id        = get_the_permalink( $post_data->ID );
     86                    $main_entity->name       = get_the_title( $post_data->ID );
     87                    $main_entity->reviewedBy = diagnoseo_get_reviewedby_schema( null ); // phpcs:ignore
     88
     89                    $schema->mainEntityOfPage = $main_entity; // phpcs:ignore
     90                }
     91            }
    7492        }
    7593    }
     
    11071125 */
    11081126function diagnoseo_get_reviewedby_schema( $data ) {
    1109     if ( empty( $data->reviewedby_name ) ) {
     1127    if ( empty( $data->reviewedby_name ) && empty( get_option( 'diagnoseo_reviewedby_name' ) ) ) {
    11101128        return '';
    11111129    }
     
    11141132
    11151133    $schema        = new stdClass();
    1116     $schema->$type = $data->reviewedby_type;
    1117     $schema->name  = $data->reviewedby_name;
    1118     if ( ! empty( $data->reviewedby_url ) ) {
    1119         $schema->url = $data->reviewedby_url;
    1120     }
     1134    $schema->$type = empty( $data->reviewedby_type ) ? get_option( 'diagnoseo_reviewedby_type', 'Person' ) : $data->reviewedby_type;
     1135    $schema->name  = empty( $data->reviewedby_name ) ? get_option( 'diagnoseo_reviewedby_name', '' ) : $data->reviewedby_name;
     1136    $schema->url   = empty( $data->reviewedby_url ) ? get_option( 'diagnoseo_reviewedby_url', '' ) : $data->reviewedby_url;
    11211137
    11221138    return $schema;
     
    11331149    global $post;
    11341150
    1135     $schema        = new stdClass();
    1136     $schema->$type = 'WebPage';
    1137     $schema->$id   = get_the_permalink( $post->ID );
    1138     $schema->name  = get_the_title( $post->ID );
    1139     if ( ! empty( $data->reviewedby_name ) ) {
    1140         $schema->reviewedBy = diagnoseo_get_reviewedby_schema( $data ); // phpcs:ignore
    1141     }
     1151    $schema             = new stdClass();
     1152    $schema->$type      = 'WebPage';
     1153    $schema->$id        = get_the_permalink( $post->ID );
     1154    $schema->name       = get_the_title( $post->ID );
     1155    $schema->reviewedBy = diagnoseo_get_reviewedby_schema( $data ); // phpcs:ignore
    11421156
    11431157    return $schema;
  • diagnoseo/tags/1.2.27/readme.txt

    r3039163 r3039236  
    44Requires at least: 4.7
    55Tested up to: 6.4.3
    6 Stable tag: 1.2.26
     6Stable tag: 1.2.27
    77Requires PHP: 5.0
    88License: GPLv2 or later
  • diagnoseo/trunk/diagnoseo.php

    r3039163 r3039236  
    44 * Plugin URI: https://diagnoseo.com/wordpress-seo-plugin/
    55 * Description: Powerful SEO plugin for WordPress. The most lightweight and complete SEO solution on the market! It includes best-in-class content analyzer and keyword placement checkpoints.
    6  * Version: 1.2.26
     6 * Version: 1.2.27
    77 * Author: DiagnoSEO
    88 * Author URI: https://diagnoseo.com/
  • diagnoseo/trunk/includes/structured-data.php

    r3032390 r3039236  
    4848        $type    = '@type';
    4949        $context = '@context';
     50        $id      = '@id';
    5051
    5152        switch ( $post_data->post_type ) {
     
    7273            $schema->author->$type = 'Person';
    7374            $schema->author->name  = get_the_author_meta( 'display_name', $post_data->post_author );
     75
     76            $reviewedby_name = get_option( 'diagnoseo_reviewedby_name', '' );
     77            $reviewedby_url  = get_option( 'diagnoseo_reviewedby_url', '' );
     78
     79            if ( ! empty( $reviewedby_name ) ) {
     80                if ( 'WebPage' === $schema_type ) {
     81                    $schema->reviewedBy = diagnoseo_get_reviewedby_schema( null ); // phpcs:ignore
     82                } else {
     83                    $main_entity             = new stdClass();
     84                    $main_entity->$type      = 'WebPage';
     85                    $main_entity->$id        = get_the_permalink( $post_data->ID );
     86                    $main_entity->name       = get_the_title( $post_data->ID );
     87                    $main_entity->reviewedBy = diagnoseo_get_reviewedby_schema( null ); // phpcs:ignore
     88
     89                    $schema->mainEntityOfPage = $main_entity; // phpcs:ignore
     90                }
     91            }
    7492        }
    7593    }
     
    11071125 */
    11081126function diagnoseo_get_reviewedby_schema( $data ) {
    1109     if ( empty( $data->reviewedby_name ) ) {
     1127    if ( empty( $data->reviewedby_name ) && empty( get_option( 'diagnoseo_reviewedby_name' ) ) ) {
    11101128        return '';
    11111129    }
     
    11141132
    11151133    $schema        = new stdClass();
    1116     $schema->$type = $data->reviewedby_type;
    1117     $schema->name  = $data->reviewedby_name;
    1118     if ( ! empty( $data->reviewedby_url ) ) {
    1119         $schema->url = $data->reviewedby_url;
    1120     }
     1134    $schema->$type = empty( $data->reviewedby_type ) ? get_option( 'diagnoseo_reviewedby_type', 'Person' ) : $data->reviewedby_type;
     1135    $schema->name  = empty( $data->reviewedby_name ) ? get_option( 'diagnoseo_reviewedby_name', '' ) : $data->reviewedby_name;
     1136    $schema->url   = empty( $data->reviewedby_url ) ? get_option( 'diagnoseo_reviewedby_url', '' ) : $data->reviewedby_url;
    11211137
    11221138    return $schema;
     
    11331149    global $post;
    11341150
    1135     $schema        = new stdClass();
    1136     $schema->$type = 'WebPage';
    1137     $schema->$id   = get_the_permalink( $post->ID );
    1138     $schema->name  = get_the_title( $post->ID );
    1139     if ( ! empty( $data->reviewedby_name ) ) {
    1140         $schema->reviewedBy = diagnoseo_get_reviewedby_schema( $data ); // phpcs:ignore
    1141     }
     1151    $schema             = new stdClass();
     1152    $schema->$type      = 'WebPage';
     1153    $schema->$id        = get_the_permalink( $post->ID );
     1154    $schema->name       = get_the_title( $post->ID );
     1155    $schema->reviewedBy = diagnoseo_get_reviewedby_schema( $data ); // phpcs:ignore
    11421156
    11431157    return $schema;
  • diagnoseo/trunk/readme.txt

    r3039163 r3039236  
    44Requires at least: 4.7
    55Tested up to: 6.4.3
    6 Stable tag: 1.2.26
     6Stable tag: 1.2.27
    77Requires PHP: 5.0
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.