Plugin Directory

Changeset 2658501


Ignore:
Timestamp:
01/16/2022 09:49:23 PM (4 years ago)
Author:
winrid
Message:

3.10.3 - Comment count accuracy has been improved.

Location:
fastcomments
Files:
37 added
2 edited

Legend:

Unmodified
Added
Removed
  • fastcomments/trunk/README.txt

    r2656982 r2658501  
    44Requires at least: 4.6
    55Tested up to: 5.8
    6 Stable tag: 3.10.2
     6Stable tag: 3.10.3
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
     
    5757= What does it cost to use FastComments? =
    5858
    59 FastComments has three different tiers, the lowest level allowing a million page loads a month.
     59FastComments has different tiers available. Whether you're an individual creator or a larger businesses, there's a tier for you.
    6060See our pricing page here: https://fastcomments.com/traffic-pricing
    6161
     
    8585
    8686== Changelog ==
     87
     88= 3.10.3 =
     89* Comment count accuracy has been improved.
    8790
    8891= 3.10.2 =
  • fastcomments/trunk/fastcomments-wordpress-plugin.php

    r2656982 r2658501  
    44Plugin URI: https://fastcomments.com
    55Description: Live Comments, Fast. A comment system that will delight your users and developers.
    6 Version: 3.10.2
     6Version: 3.10.3
    77Author: winrid @ FastComments
    88License: GPL-2.0+
     
    2121$fastcomments_public->setup_api_listeners(); // TODO able to do this without new()?
    2222
    23 
    2423// Returns the FastComments embed comments template
    25 function fc_comments_template()
    26 {
     24function fc_comments_template() {
    2725    $path = plugin_dir_path(__FILE__) . 'public/fastcomments-widget-view.php';
    2826    if (!file_exists($path)) {
     
    3230}
    3331
     32// Returns the FastComments embed comments template
     33// This method takes more arguments, like post id, but we found it not to be reliable.
     34function fc_comment_count_template($text_no_comments = "") {
     35    global $post;
     36    $post_id = -1;
     37    if (isset($post) && $post->ID) {
     38        $post_id = $post->ID;
     39    }
     40    // we add opacity here to prevent flash of content when rendering the original text and then loading our script. We have a style override for users without JS.
     41    return "<span class=\"fast-comments-count\" data-fast-comments-url-id=\"$post_id\" style=\"opacity: 0;\"'>$text_no_comments</span>";
     42}
     43
     44// Sets up the FastComments embed comment count script if needed. This is done this way, with wp_footer, to prevent loading an external script.
     45function fc_add_comment_count_scripts() {
     46    global $post;
     47
     48    if (!isset($post) || is_singular()) {
     49        return;
     50    }
     51
     52    global $FASTCOMMENTS_VERSION;
     53    wp_enqueue_script('fastcomments_widget_count', 'https://cdn.fastcomments.com/js/embed-widget-comment-count-bulk.min.js', array(), $FASTCOMMENTS_VERSION, true);
     54}
     55
     56// Sets up the FastComments embed comment count script if needed. This is done this way, with wp_footer, to prevent loading an external script.
     57function fc_add_comment_count_config() {
     58    global $post;
     59
     60    if (!isset($post) || is_singular()) {
     61        return;
     62    }
     63
     64    $jsonFcConfig = json_encode(array(
     65        "tenantId" => get_option('fastcomments_tenant_id')
     66    ));
     67    echo "<script>window.FastCommentsBulkCountConfig = $jsonFcConfig;</script>";
     68    echo "<noscript><style>.fast-comments-count { opacity: 1 !important; }</style></noscript>";
     69}
     70
    3471// Comments can load as long as we have a tenant id.
    35 if(get_option('fastcomments_tenant_id')) {
     72if (get_option('fastcomments_tenant_id')) {
    3673    add_filter('comments_template', 'fc_comments_template', 100);
     74    add_filter('comments_number', 'fc_comment_count_template', 100);
     75    add_filter('wp_enqueue_scripts', 'fc_add_comment_count_scripts', 100);
     76    add_filter('wp_footer', 'fc_add_comment_count_config', 100);
    3777}
    3878
     
    4484    $fastcomments->log('debug', 'End cron tick.');
    4585}
     86
    4687add_action('fastcomments_cron_hook', 'fastcomments_cron');
    4788
Note: See TracChangeset for help on using the changeset viewer.