Plugin Directory

Changeset 3317199


Ignore:
Timestamp:
06/24/2025 07:47:58 PM (9 months ago)
Author:
Disqus
Message:

Preparing for 3.1.3 release

Location:
disqus-comment-system/trunk
Files:
4 added
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • disqus-comment-system/trunk/README.txt

    r3184124 r3317199  
    33Tags: disqus, comments, engagement, threaded, email, notification, spam, avatars, community, profile, widget
    44Requires at least: 4.4
    5 Tested up to: 6.6.3
    6 Stable tag: 3.1.2
     5Tested up to: 6.8
     6Stable tag: 3.1.3
    77Requires PHP: 5.6
    88
     
    129129
    130130== Changelog ==
     131= 3.1.3 =
     132* Fixed bug with Disqus SSO and Gravatar Images
     133* Switched DISQUSVERSION to constant (issue #139)
     134* Fixed comment data issue if post author is null (issue #140)
     135* Fixed various conditions missing type checks (issue #141)
     136
    131137= 3.1.2 =
    132138* Add Disqus Polls Information
  • disqus-comment-system/trunk/admin/class-disqus-admin.php

    r2538249 r3317199  
    160160    public function dsq_filter_rest_url( $rest_url ) {
    161161        $rest_url_parts = parse_url( $rest_url );
    162         if ( array_key_exists( 'host', $rest_url_parts ) ) {
     162        if ( is_array( $rest_url_parts ) && array_key_exists( 'host', $rest_url_parts ) ) {
    163163            $rest_host = $rest_url_parts['host'];
    164164            if ( array_key_exists( 'port', $rest_url_parts ) ) {
  • disqus-comment-system/trunk/disqus.php

    r3184124 r3317199  
    1616 * Plugin URI:        https://disqus.com/
    1717 * Description:       Disqus helps publishers increase engagement and build loyal audiences. Supports syncing comments to your database for easy backup.
    18  * Version:           3.1.2
     18 * Version:           3.1.3
    1919 * Author:            Disqus
    2020 * Author URI:        https://disqus.com/
     
    2525 */
    2626
    27 $DISQUSVERSION = '3.1.2';
    28 
    2927// If this file is called directly, abort.
    3028if ( ! defined( 'WPINC' ) ) {
    3129    die;
    3230}
     31
     32define( 'DISQUS_VERSION', '3.1.3' );
    3333
    3434/**
     
    7070 */
    7171function run_disqus() {
    72     global $DISQUSVERSION;
    73 
    74     $plugin = new Disqus( $DISQUSVERSION );
     72    $plugin = new Disqus( DISQUS_VERSION );
    7573    $plugin->run();
    7674
  • disqus-comment-system/trunk/public/class-disqus-public.php

    r3062199 r3317199  
    5757        $payload_user = array();
    5858        if ( $user->ID ) {
     59            $avatar_url = self::ensure_gravatar_extension( get_avatar_url( $user->ID, 92 ) );
    5960            $payload_user['id'] = $user->ID;
    6061            $payload_user['username'] = $user->display_name;
    61             $payload_user['avatar'] = get_avatar_url( $user->ID, 92 );
     62            $payload_user['avatar'] = $avatar_url;
    6263            $payload_user['email'] = $user->user_email;
    6364            $payload_user['url'] = $user->user_url;
     
    7980     */
    8081    public static function embed_vars_for_post( $post ) {
    81         global $DISQUSVERSION;
    82 
    8382        $embed_vars = array(
    8483            'disqusConfig' => array(
    85                 'integration' => 'wordpress ' . $DISQUSVERSION,
     84                'integration' => 'wordpress ' . DISQUS_VERSION . ' ' . get_bloginfo( 'version' ),
    8685            ),
    8786            'disqusIdentifier' => Disqus_Public::dsq_identifier_for_post( $post ),
     
    109108            $embed_vars['disqusConfig']['remote_auth_s3'] = Disqus_Public::remote_auth_s3_for_user( $user, $secret_key );
    110109        }
    111 
    112110        return $embed_vars;
    113111    }
     
    360358        return true;
    361359    }
     360
     361    /**
     362     * By default, WP uses Gravatar for its avatars without an image extension, but our SSO payload expects an extension,
     363     * so this function ensures a Gravatar URL ends with .jpg before query params and leaves other URLs unchanged.
     364     * Source: https://docs.gravatar.com/sdk/images/
     365     *
     366     * @since     3.1.3
     367     * @access    private
     368     * @param     string $avatar_url     The avatar URL to check.
     369     * @param     string $ext            The extension to append, default is '.jpg'.
     370     * @return    string                 The modified avatar URL with the correct extension.
     371     */
     372    private static function ensure_gravatar_extension( $avatar_url, $ext = '.jpg' ) {
     373        if ( '.' !== $ext[0] ) {
     374            $ext = '.' . $ext;
     375        }
     376
     377        $query_pos = strpos( $avatar_url, '?' );
     378        $base = ( false !== $query_pos ) ? substr( $avatar_url, 0, $query_pos ) : $avatar_url;
     379        if ( substr( $base, -strlen( $ext ) ) === $ext ) {
     380            return $avatar_url;
     381        }
     382
     383        if ( false !== stripos( $avatar_url, 'gravatar.com' ) ) {
     384            if ( false !== $query_pos ) {
     385                return substr( $avatar_url, 0, $query_pos ) . $ext . substr( $avatar_url, $query_pos );
     386            } else {
     387                return $avatar_url . $ext;
     388            }
     389        }
     390        return $avatar_url;
     391    }
    362392}
  • disqus-comment-system/trunk/rest-api/class-disqus-rest-api.php

    r3019922 r3317199  
    500500
    501501        // Add additional non-database options here.
    502         $settings['disqus_installed'] = trim( $settings['disqus_forum_url'] ) !== '';
     502        $settings['disqus_installed'] = isset( $settings['disqus_forum_url'] ) && trim( $settings['disqus_forum_url'] ) !== '';
    503503
    504504        return $settings;
     
    733733    private function comment_data_from_post( $post ) {
    734734        $thread = array_key_exists( 'threadData', $post ) ? $post['threadData'] : $post['thread'];
    735         $author = $post['author'];
     735        $author = isset( $post['author'] ) ? $post['author'] : null;
    736736
    737737        $wp_post_id = null;
     
    783783        // if the user has not set the permission for their API application.
    784784        $author_email = null;
    785         if ( isset( $author['email'] ) ) {
    786             $author_email = $author['email'];
    787         } elseif ( $author['isAnonymous'] ) {
    788             $author_email = 'anonymized-' . md5( $author['name'] ) . '@disqus.com';
    789         } else {
    790             $author_email = 'user-' . $author['id'] . '@disqus.com';
     785        if ( $author ) {
     786            if ( isset( $author['email'] ) ) {
     787                $author_email = $author['email'];
     788            } elseif ( isset( $author['isAnonymous'] ) && $author['isAnonymous'] ) {
     789                $author_email = 'anonymized-' . md5( $author['name'] ) . '@disqus.com';
     790            } elseif ( isset( $author['id'] ) ) {
     791                $author_email = 'user-' . $author['id'] . '@disqus.com';
     792            }
    791793        }
    792794
     
    805807        return array(
    806808            'comment_post_ID' => (int) $wp_post_id,
    807             'comment_author' => $author['name'],
     809            'comment_author' => $author && isset( $author['name'] ) ? $author['name'] : 'Anonymous',
    808810            'comment_author_email' => $author_email,
    809811            'comment_author_IP' => $post['ipAddress'],
    810             'comment_author_url' => isset( $author['url'] ) ? $author['url'] : '',
     812            'comment_author_url' => $author && isset( $author['url'] ) ? $author['url'] : '',
    811813            'comment_content' => $post['raw_message'],
    812814            'comment_date' => $post['createdAt'],
Note: See TracChangeset for help on using the changeset viewer.