Plugin Directory

Changeset 3697680


Ignore:
Timestamp:
09/15/2026 08:44:47 PM (8 weeks ago)
Author:
ezbizi
Message:

1.8.0 - if EzBizi stops recognising a site's token for a week the chat and form stop showing rather than collecting messages nobody will receive, and an administrator is told why; published values keep working. Also 1.7.1: the chat bubble sits higher, clear of sticky bars.

Location:
ezbizi
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ezbizi/tags/1.8.0/enquiries.php

    r3697670 r3697680  
    5959 * guessing at somebody's colours.
    6060 */
     61/**
     62 * How long EzBizi has been refusing this site, in seconds, or 0 if it is not.
     63 *
     64 * Its own function because two different things ask: the widgets, which stop
     65 * drawing, and the notice that tells an administrator why.
     66 */
     67function ezbizi_refused_for() {
     68    $since = (int) get_option(EZBIZI_REFUSED_SINCE, 0);
     69
     70    return $since > 0 ? max(0, time() - $since) : 0;
     71}
     72
    6173function ezbizi_widget_config($kind) {
     74    /*
     75     * A site EzBizi has been refusing for a week draws no widgets.
     76     *
     77     * The deploy desk found the hole: the guard below asks whether a key is
     78     * ABSENT, and a site whose token the server rejects still has the last
     79     * good payload, key and all. So a pairing that had ended went on showing a
     80     * chat box on every page. The values are a different question and keep
     81     * publishing — a phone number that is a week stale is still the right
     82     * phone number, while a chat box is a promise that somebody is listening.
     83     */
     84    if (ezbizi_refused_for() > EZBIZI_REFUSED_MAX) {
     85        return array();
     86    }
     87
    6288    $payload = ezbizi_payload();
    6389
    … …  
    269295    $anchor = '';
    270296
     297    /*
     298     * 88px up, not 20.
     299     *
     300     * Jose photographed the launcher sitting in a-1chimney.com's yellow call
     301     * bar. A sticky strip along the bottom — a phone number, a cookie notice,
     302     * a book-now bar — is ordinary on the sites this plugin is installed on,
     303     * and the one place a bottom-anchored bubble is guaranteed to collide with
     304     * something is the bottom. Clearing a typical bar costs a little empty
     305     * space on sites that have none.
     306     */
    271307    if ($position === 'bottom-right') {
    272         $anchor = 'position:fixed;right:20px;bottom:20px;z-index:2147483000';
     308        $anchor = 'position:fixed;right:20px;bottom:88px;z-index:2147483000';
    273309    } elseif ($position === 'bottom-left') {
    274         $anchor = 'position:fixed;left:20px;bottom:20px;z-index:2147483000';
     310        $anchor = 'position:fixed;left:20px;bottom:88px;z-index:2147483000';
    275311    }
    276312
  • ezbizi/tags/1.8.0/ezbizi.php

    r3697670 r3697680  
    44 * Plugin URI:        https://ezbizi.com
    55 * Description:       Publishes your company details — phone, address, licence, hours — from EzBizi, so one change updates every page of this site.
    6  * Version:           1.7.0
     6 * Version:           1.8.0
    77 * Requires at least: 6.0
    88 * Requires PHP:      7.4
    … …  
    4747}
    4848
    49 const EZBIZI_VERSION = '1.7.0';
     49const EZBIZI_VERSION = '1.8.0';
    5050const EZBIZI_CACHE_KEY = 'ezbizi_payload';
    5151const EZBIZI_LAST_GOOD = 'ezbizi_last_good';
    … …  
    5656const EZBIZI_REFRESHING = 'ezbizi_refreshing';
    5757
     58/*
     59 * When EzBizi started REFUSING this site's token, as distinct from failing to
     60 * answer. Cleared by any successful read.
     61 *
     62 * A 401 or 403 is the server saying it does not recognise this site any more.
     63 * A timeout, a 500 or a DNS failure is us having a bad day, and a site must
     64 * never hide anything because of that — those keep serving the last good
     65 * payload exactly as before.
     66 */
     67const EZBIZI_REFUSED_SINCE = 'ezbizi_refused_since';
     68
     69/*
     70 * How long a refusal has to last before the widgets stop drawing. Seven days.
     71 *
     72 * Not immediately, because rotating a token leaves a real gap while somebody
     73 * pastes the new one, and the public key the widgets use is a separate
     74 * credential that usually still works through it — blanking a working chat
     75 * over a thirty-second gap would be the worse mistake.
     76 *
     77 * Not never, which is what it was: a site whose pairing has genuinely ended
     78 * went on drawing a chat box on every page, and a visitor typing into it is
     79 * being promised a conversation nobody is going to receive.
     80 */
     81const EZBIZI_REFUSED_MAX = 604800;
     82
    5883require_once __DIR__ . '/service-account.php';
    5984require_once __DIR__ . '/enquiries.php';
    … …  
    180205    ));
    181206
    182     if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
     207    $code = is_wp_error($response) ? 0 : (int) wp_remote_retrieve_response_code($response);
     208
     209    if ($code !== 200) {
     210        /*
     211         * Refused is not the same as unreachable, and only one of them is
     212         * about this site. 401 and 403 are EzBizi saying it does not recognise
     213         * the token; anything else is a bad day at our end and must change
     214         * nothing here. Stamped once, so the clock measures how long the
     215         * refusal has lasted rather than restarting on every page view.
     216         */
     217        if (($code === 401 || $code === 403) && ! get_option(EZBIZI_REFUSED_SINCE, false)) {
     218            update_option(EZBIZI_REFUSED_SINCE, time(), false);
     219        }
     220
    183221        /*
    184222         * Cache the FAILURE briefly too. Without this, a site whose token was
    … …  
    197235        return get_option(EZBIZI_LAST_GOOD, $empty);
    198236    }
     237
     238    // Answered, so whatever was wrong is over.
     239    delete_option(EZBIZI_REFUSED_SINCE);
    199240
    200241    // Stamped so ezbizi_payload() can tell "five minutes stale" from "this site
    … …  
    353394
    354395    if ($settings['token'] !== '') {
     396        /*
     397         * A token that is present and refused is a different sentence from no
     398         * token at all, and it has to be SAID: past the ceiling the chat and
     399         * the form stop drawing, and a widget that vanishes without explanation
     400         * reads as the plugin breaking rather than as the pairing ending.
     401         */
     402        $refused = function_exists('ezbizi_refused_for') ? ezbizi_refused_for() : 0;
     403
     404        if ($refused > EZBIZI_REFUSED_MAX) {
     405            printf(
     406                '<div class="notice notice-error"><p>%s <a href="%s">%s</a></p></div>',
     407                esc_html(sprintf(
     408                    /* translators: %s: how long, e.g. "8 days". */
     409                    __(
     410                        'EzBizi has been refusing this site\'s token for %s, so the chat and contact form have stopped showing. Your published values are unaffected. Issue a new site token in Web Management and paste it here.',
     411                        'ezbizi'
     412                    ),
     413                    human_time_diff(time() - $refused)
     414                )),
     415                esc_url(admin_url('admin.php?page=ezbizi')),
     416                esc_html__('Open EzBizi settings', 'ezbizi')
     417            );
     418        }
     419
    355420        return;
    356421    }
  • ezbizi/tags/1.8.0/readme.txt

    r3697670 r3697680  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.7.0
     7Stable tag: 1.8.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    196196== Changelog ==
    197197
     198= 1.8.0 =
     199* If EzBizi stops recognising this site's token for a week, the chat and
     200  contact form stop showing rather than collecting messages nobody will
     201  receive, and an administrator is told why. Your published values keep
     202  working — a phone number that is a week old is still your phone number.
     203
     204= 1.7.1 =
     205* The chat bubble sits higher, so it no longer lands on a sticky bar along the
     206  bottom of the page.
     207
    198208= 1.7.0 =
    199209* The live chat has been rebuilt. It now opens a proper panel with a coloured
  • ezbizi/trunk/enquiries.php

    r3697670 r3697680  
    5959 * guessing at somebody's colours.
    6060 */
     61/**
     62 * How long EzBizi has been refusing this site, in seconds, or 0 if it is not.
     63 *
     64 * Its own function because two different things ask: the widgets, which stop
     65 * drawing, and the notice that tells an administrator why.
     66 */
     67function ezbizi_refused_for() {
     68    $since = (int) get_option(EZBIZI_REFUSED_SINCE, 0);
     69
     70    return $since > 0 ? max(0, time() - $since) : 0;
     71}
     72
    6173function ezbizi_widget_config($kind) {
     74    /*
     75     * A site EzBizi has been refusing for a week draws no widgets.
     76     *
     77     * The deploy desk found the hole: the guard below asks whether a key is
     78     * ABSENT, and a site whose token the server rejects still has the last
     79     * good payload, key and all. So a pairing that had ended went on showing a
     80     * chat box on every page. The values are a different question and keep
     81     * publishing — a phone number that is a week stale is still the right
     82     * phone number, while a chat box is a promise that somebody is listening.
     83     */
     84    if (ezbizi_refused_for() > EZBIZI_REFUSED_MAX) {
     85        return array();
     86    }
     87
    6288    $payload = ezbizi_payload();
    6389
    … …  
    269295    $anchor = '';
    270296
     297    /*
     298     * 88px up, not 20.
     299     *
     300     * Jose photographed the launcher sitting in a-1chimney.com's yellow call
     301     * bar. A sticky strip along the bottom — a phone number, a cookie notice,
     302     * a book-now bar — is ordinary on the sites this plugin is installed on,
     303     * and the one place a bottom-anchored bubble is guaranteed to collide with
     304     * something is the bottom. Clearing a typical bar costs a little empty
     305     * space on sites that have none.
     306     */
    271307    if ($position === 'bottom-right') {
    272         $anchor = 'position:fixed;right:20px;bottom:20px;z-index:2147483000';
     308        $anchor = 'position:fixed;right:20px;bottom:88px;z-index:2147483000';
    273309    } elseif ($position === 'bottom-left') {
    274         $anchor = 'position:fixed;left:20px;bottom:20px;z-index:2147483000';
     310        $anchor = 'position:fixed;left:20px;bottom:88px;z-index:2147483000';
    275311    }
    276312
  • ezbizi/trunk/ezbizi.php

    r3697670 r3697680  
    44 * Plugin URI:        https://ezbizi.com
    55 * Description:       Publishes your company details — phone, address, licence, hours — from EzBizi, so one change updates every page of this site.
    6  * Version:           1.7.0
     6 * Version:           1.8.0
    77 * Requires at least: 6.0
    88 * Requires PHP:      7.4
    … …  
    4747}
    4848
    49 const EZBIZI_VERSION = '1.7.0';
     49const EZBIZI_VERSION = '1.8.0';
    5050const EZBIZI_CACHE_KEY = 'ezbizi_payload';
    5151const EZBIZI_LAST_GOOD = 'ezbizi_last_good';
    … …  
    5656const EZBIZI_REFRESHING = 'ezbizi_refreshing';
    5757
     58/*
     59 * When EzBizi started REFUSING this site's token, as distinct from failing to
     60 * answer. Cleared by any successful read.
     61 *
     62 * A 401 or 403 is the server saying it does not recognise this site any more.
     63 * A timeout, a 500 or a DNS failure is us having a bad day, and a site must
     64 * never hide anything because of that — those keep serving the last good
     65 * payload exactly as before.
     66 */
     67const EZBIZI_REFUSED_SINCE = 'ezbizi_refused_since';
     68
     69/*
     70 * How long a refusal has to last before the widgets stop drawing. Seven days.
     71 *
     72 * Not immediately, because rotating a token leaves a real gap while somebody
     73 * pastes the new one, and the public key the widgets use is a separate
     74 * credential that usually still works through it — blanking a working chat
     75 * over a thirty-second gap would be the worse mistake.
     76 *
     77 * Not never, which is what it was: a site whose pairing has genuinely ended
     78 * went on drawing a chat box on every page, and a visitor typing into it is
     79 * being promised a conversation nobody is going to receive.
     80 */
     81const EZBIZI_REFUSED_MAX = 604800;
     82
    5883require_once __DIR__ . '/service-account.php';
    5984require_once __DIR__ . '/enquiries.php';
    … …  
    180205    ));
    181206
    182     if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
     207    $code = is_wp_error($response) ? 0 : (int) wp_remote_retrieve_response_code($response);
     208
     209    if ($code !== 200) {
     210        /*
     211         * Refused is not the same as unreachable, and only one of them is
     212         * about this site. 401 and 403 are EzBizi saying it does not recognise
     213         * the token; anything else is a bad day at our end and must change
     214         * nothing here. Stamped once, so the clock measures how long the
     215         * refusal has lasted rather than restarting on every page view.
     216         */
     217        if (($code === 401 || $code === 403) && ! get_option(EZBIZI_REFUSED_SINCE, false)) {
     218            update_option(EZBIZI_REFUSED_SINCE, time(), false);
     219        }
     220
    183221        /*
    184222         * Cache the FAILURE briefly too. Without this, a site whose token was
    … …  
    197235        return get_option(EZBIZI_LAST_GOOD, $empty);
    198236    }
     237
     238    // Answered, so whatever was wrong is over.
     239    delete_option(EZBIZI_REFUSED_SINCE);
    199240
    200241    // Stamped so ezbizi_payload() can tell "five minutes stale" from "this site
    … …  
    353394
    354395    if ($settings['token'] !== '') {
     396        /*
     397         * A token that is present and refused is a different sentence from no
     398         * token at all, and it has to be SAID: past the ceiling the chat and
     399         * the form stop drawing, and a widget that vanishes without explanation
     400         * reads as the plugin breaking rather than as the pairing ending.
     401         */
     402        $refused = function_exists('ezbizi_refused_for') ? ezbizi_refused_for() : 0;
     403
     404        if ($refused > EZBIZI_REFUSED_MAX) {
     405            printf(
     406                '<div class="notice notice-error"><p>%s <a href="%s">%s</a></p></div>',
     407                esc_html(sprintf(
     408                    /* translators: %s: how long, e.g. "8 days". */
     409                    __(
     410                        'EzBizi has been refusing this site\'s token for %s, so the chat and contact form have stopped showing. Your published values are unaffected. Issue a new site token in Web Management and paste it here.',
     411                        'ezbizi'
     412                    ),
     413                    human_time_diff(time() - $refused)
     414                )),
     415                esc_url(admin_url('admin.php?page=ezbizi')),
     416                esc_html__('Open EzBizi settings', 'ezbizi')
     417            );
     418        }
     419
    355420        return;
    356421    }
  • ezbizi/trunk/readme.txt

    r3697670 r3697680  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.7.0
     7Stable tag: 1.8.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    196196== Changelog ==
    197197
     198= 1.8.0 =
     199* If EzBizi stops recognising this site's token for a week, the chat and
     200  contact form stop showing rather than collecting messages nobody will
     201  receive, and an administrator is told why. Your published values keep
     202  working — a phone number that is a week old is still your phone number.
     203
     204= 1.7.1 =
     205* The chat bubble sits higher, so it no longer lands on a sticky bar along the
     206  bottom of the page.
     207
    198208= 1.7.0 =
    199209* The live chat has been rebuilt. It now opens a proper panel with a coloured
Note: See TracChangeset for help on using the changeset viewer.