Changeset 3317199
- Timestamp:
- 06/24/2025 07:47:58 PM (9 months ago)
- Location:
- disqus-comment-system/trunk
- Files:
-
- 4 added
- 4 deleted
- 5 edited
-
README.txt (modified) (2 diffs)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.2.js (deleted)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.2.js.map (deleted)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.2.min.js (deleted)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.2.min.js.map (deleted)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.3.js (added)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.3.js.map (added)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.3.min.js (added)
-
admin/bundles/js/en.disqus-admin.bundle.3.1.3.min.js.map (added)
-
admin/class-disqus-admin.php (modified) (1 diff)
-
disqus.php (modified) (3 diffs)
-
public/class-disqus-public.php (modified) (4 diffs)
-
rest-api/class-disqus-rest-api.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
disqus-comment-system/trunk/README.txt
r3184124 r3317199 3 3 Tags: disqus, comments, engagement, threaded, email, notification, spam, avatars, community, profile, widget 4 4 Requires at least: 4.4 5 Tested up to: 6. 6.36 Stable tag: 3.1. 25 Tested up to: 6.8 6 Stable tag: 3.1.3 7 7 Requires PHP: 5.6 8 8 … … 129 129 130 130 == 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 131 137 = 3.1.2 = 132 138 * Add Disqus Polls Information -
disqus-comment-system/trunk/admin/class-disqus-admin.php
r2538249 r3317199 160 160 public function dsq_filter_rest_url( $rest_url ) { 161 161 $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 ) ) { 163 163 $rest_host = $rest_url_parts['host']; 164 164 if ( array_key_exists( 'port', $rest_url_parts ) ) { -
disqus-comment-system/trunk/disqus.php
r3184124 r3317199 16 16 * Plugin URI: https://disqus.com/ 17 17 * Description: Disqus helps publishers increase engagement and build loyal audiences. Supports syncing comments to your database for easy backup. 18 * Version: 3.1. 218 * Version: 3.1.3 19 19 * Author: Disqus 20 20 * Author URI: https://disqus.com/ … … 25 25 */ 26 26 27 $DISQUSVERSION = '3.1.2';28 29 27 // If this file is called directly, abort. 30 28 if ( ! defined( 'WPINC' ) ) { 31 29 die; 32 30 } 31 32 define( 'DISQUS_VERSION', '3.1.3' ); 33 33 34 34 /** … … 70 70 */ 71 71 function run_disqus() { 72 global $DISQUSVERSION; 73 74 $plugin = new Disqus( $DISQUSVERSION ); 72 $plugin = new Disqus( DISQUS_VERSION ); 75 73 $plugin->run(); 76 74 -
disqus-comment-system/trunk/public/class-disqus-public.php
r3062199 r3317199 57 57 $payload_user = array(); 58 58 if ( $user->ID ) { 59 $avatar_url = self::ensure_gravatar_extension( get_avatar_url( $user->ID, 92 ) ); 59 60 $payload_user['id'] = $user->ID; 60 61 $payload_user['username'] = $user->display_name; 61 $payload_user['avatar'] = get_avatar_url( $user->ID, 92 );62 $payload_user['avatar'] = $avatar_url; 62 63 $payload_user['email'] = $user->user_email; 63 64 $payload_user['url'] = $user->user_url; … … 79 80 */ 80 81 public static function embed_vars_for_post( $post ) { 81 global $DISQUSVERSION;82 83 82 $embed_vars = array( 84 83 'disqusConfig' => array( 85 'integration' => 'wordpress ' . $DISQUSVERSION,84 'integration' => 'wordpress ' . DISQUS_VERSION . ' ' . get_bloginfo( 'version' ), 86 85 ), 87 86 'disqusIdentifier' => Disqus_Public::dsq_identifier_for_post( $post ), … … 109 108 $embed_vars['disqusConfig']['remote_auth_s3'] = Disqus_Public::remote_auth_s3_for_user( $user, $secret_key ); 110 109 } 111 112 110 return $embed_vars; 113 111 } … … 360 358 return true; 361 359 } 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 } 362 392 } -
disqus-comment-system/trunk/rest-api/class-disqus-rest-api.php
r3019922 r3317199 500 500 501 501 // 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'] ) !== ''; 503 503 504 504 return $settings; … … 733 733 private function comment_data_from_post( $post ) { 734 734 $thread = array_key_exists( 'threadData', $post ) ? $post['threadData'] : $post['thread']; 735 $author = $post['author'];735 $author = isset( $post['author'] ) ? $post['author'] : null; 736 736 737 737 $wp_post_id = null; … … 783 783 // if the user has not set the permission for their API application. 784 784 $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 } 791 793 } 792 794 … … 805 807 return array( 806 808 'comment_post_ID' => (int) $wp_post_id, 807 'comment_author' => $author ['name'],809 'comment_author' => $author && isset( $author['name'] ) ? $author['name'] : 'Anonymous', 808 810 'comment_author_email' => $author_email, 809 811 'comment_author_IP' => $post['ipAddress'], 810 'comment_author_url' => isset( $author['url'] ) ? $author['url'] : '',812 'comment_author_url' => $author && isset( $author['url'] ) ? $author['url'] : '', 811 813 'comment_content' => $post['raw_message'], 812 814 'comment_date' => $post['createdAt'],
Note: See TracChangeset
for help on using the changeset viewer.