Plugin Directory

Changeset 3745311


Ignore:
Timestamp:
10/14/2026 04:50:54 AM (3 days ago)
Author:
zubbin
Message:

Release 2.2.16 via Zubbin admin publisher

Location:
zubbin-uptime-node
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • zubbin-uptime-node/tags/2.2.16/includes/admin.php

    r3650343 r3745311  
    1818    add_action('admin_post_zubbin_un_start_checkout', [__CLASS__, 'start_checkout']);
    1919    add_action('admin_post_zubbin_un_open_portal', [__CLASS__, 'open_portal']);
     20    add_action('admin_post_zubbin_un_open_dashboard', [__CLASS__, 'open_dashboard']);
    2021  }
    2122
    … …  
    3334    add_action("admin_post_zubbin_un_start_checkout", [__CLASS__, "start_checkout"]);
    3435    add_action("admin_post_zubbin_un_open_portal", [__CLASS__, "open_portal"]);
     36    add_action("admin_post_zubbin_un_open_dashboard", [__CLASS__, "open_dashboard"]);
    3537  }
    3638  /**
    … …  
    110112    echo '<span style="display:inline-flex;align-items:center;padding:8px 14px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-weight:800;">' . esc_html($planName) . '</span>';
    111113    echo '<span style="font-size:13px;color:#64748b;font-weight:700;">' . esc_html($statusMeta) . '</span>';
     114    if ($connected) self::dashboard_button(__('Open my Z UpTime dashboard', 'zubbin-uptime-node'), false);
    112115    echo '</div>';
    113116
    … …  
    128131      echo '<div style="margin:16px 0;padding:16px 18px;border:1px solid #fcd34d;background:#fffbeb;border-radius:12px;">';
    129132      echo '<div style="font-weight:800;color:#92400e;margin-bottom:6px;">This site is monitoring, but not yet linked to your account</div>';
    130       echo '<div style="color:#78350f;">Enter this claim code in your Z UpTime dashboard to take ownership:</div>';
     133      echo '<div style="color:#78350f;margin-bottom:10px;">Create your free account and open your dashboard in one click:</div>';
     134      self::dashboard_button(__('Create my account & open dashboard', 'zubbin-uptime-node'), true);
     135      echo '<div style="color:#78350f;margin-top:12px;">Already have an account? Enter this claim code in your Z UpTime dashboard:</div>';
    131136      echo '<div style="margin:10px 0;font-size:22px;font-weight:900;letter-spacing:.12em;color:#1f2937;">' . esc_html($claimCode) . '</div>';
    132137      if ($connectUrl !== '') {
    … …  
    134139      }
    135140      echo ' <span style="color:#92400e;font-size:13px;">…or paste your registration token under <strong>Settings</strong> for instant ownership.</span>';
     141      echo '</div>';
     142    }
     143
     144    if ($siteStatus === 'pending_upgrade') {
     145      echo '<div style="margin:16px 0;padding:16px 18px;border:1px solid #fcd34d;background:#fffbeb;border-radius:12px;">';
     146      echo '<div style="font-weight:800;color:#92400e;margin-bottom:6px;">' . esc_html__('Connected — upgrade to start monitoring', 'zubbin-uptime-node') . '</div>';
     147      echo '<div style="color:#78350f;margin-bottom:10px;">' . esc_html__('This site is linked to your Z UpTime account, but your plan\'s site limit is already reached, so it is not being monitored yet. Upgrade your plan and monitoring starts automatically.', 'zubbin-uptime-node') . '</div>';
     148      self::dashboard_button(__('Open my dashboard to upgrade', 'zubbin-uptime-node'), true);
    136149      echo '</div>';
    137150    }
    … …  
    17941807  }
    17951808
     1809  /** A small admin-post form: only administrators see it, and it carries a nonce. */
     1810  static function dashboard_button($label, $primary = true) {
     1811    echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="display:inline-block;margin:0;">';
     1812    echo '<input type="hidden" name="action" value="zubbin_un_open_dashboard" />';
     1813    wp_nonce_field('zubbin_un_open_dashboard');
     1814    echo '<button type="submit" class="button' . ($primary ? ' button-primary' : '') . '">' . esc_html($label) . '</button>';
     1815    echo '</form>';
     1816  }
     1817
     1818  /**
     1819   * "Open my Z UpTime dashboard". Only an administrator can press it, which is
     1820   * the proof of ownership the server needs to create an account for an unclaimed
     1821   * site. For a site that already has an account, the server emails that account
     1822   * a sign-in link instead — it never logs anyone straight into an existing account.
     1823   */
     1824  static function open_dashboard() {
     1825    if (!current_user_can('manage_options')) wp_die('Forbidden');
     1826    check_admin_referer('zubbin_un_open_dashboard');
     1827
     1828    $back = admin_url('admin.php?page=zubbin_un');
     1829    $s = ZUBBIN_UN_Settings::get();
     1830    if (!ZUBBIN_UN_Settings::paired($s)) {
     1831      set_transient('zubbin_un_flash_notice', ['type' => 'warning', 'message' => __('This site is not connected to Z UpTime yet. Use the Onboarding tab first.', 'zubbin-uptime-node')], 60);
     1832      wp_safe_redirect($back);
     1833      exit;
     1834    }
     1835
     1836    $user = wp_get_current_user();
     1837    $r = Zubbin_Uptime_Api_Client::dashboard_link((string) $user->user_email, (string) $user->display_name);
     1838    $body = is_array($r['body'] ?? null) ? $r['body'] : [];
     1839
     1840    // Keep the ownership state the server reports (e.g. unclaimed → active).
     1841    if (!empty($body['status'])) {
     1842      $status = sanitize_text_field((string) $body['status']);
     1843      $update = ['site_status' => $status];
     1844      if ($status !== 'unclaimed') $update['claim_code'] = '';
     1845      ZUBBIN_UN_Settings::save($update);
     1846    }
     1847
     1848    if (($body['action'] ?? '') === 'redirect' && !empty($body['url'])) {
     1849      $target = esc_url_raw((string) $body['url']);
     1850      $host = wp_parse_url($target, PHP_URL_HOST);
     1851      if ($host) {
     1852        add_filter('allowed_redirect_hosts', function ($hosts) use ($host) {
     1853          if (!in_array($host, $hosts, true)) $hosts[] = $host;
     1854          return $hosts;
     1855        });
     1856      }
     1857      wp_safe_redirect($target);
     1858      exit;
     1859    }
     1860
     1861    $ok = !empty($body['success']);
     1862    $msg = (string) ($body['message'] ?? $body['error'] ?? '');
     1863    if ($msg === '') {
     1864      $msg = $ok
     1865        ? __('Check your email for a sign-in link.', 'zubbin-uptime-node')
     1866        : sprintf(
     1867            /* translators: %s: HTTP status */
     1868            __('Could not reach Z UpTime (HTTP %s). Please try again in a minute.', 'zubbin-uptime-node'),
     1869            (string) (int) ($r['status'] ?? 0)
     1870          );
     1871    }
     1872    set_transient('zubbin_un_flash_notice', ['type' => $ok ? 'success' : 'warning', 'message' => $msg], 60);
     1873    wp_safe_redirect($back);
     1874    exit;
     1875  }
     1876
    17961877  static function open_portal() {
    17971878    if (!current_user_can('manage_options')) wp_die('Forbidden');
  • zubbin-uptime-node/tags/2.2.16/includes/class-zubbin-uptime-api-client.php

    r3611964 r3745311  
    392392            'billing_period' => $cadence === 'yearly' ? 'yearly' : 'monthly',
    393393            'return_url' => admin_url('admin.php?page=zubbin_un&tab=upgrade'),
     394        ]);
     395    }
     396
     397    /**
     398     * Ask Z UpTime for a way into the customer dashboard on behalf of the logged-in
     399     * WordPress administrator. The server either returns a one-time login URL (a new
     400     * account was just created for this site) or emails a sign-in link to the
     401     * account that owns the site.
     402     */
     403    public static function dashboard_link(string $adminEmail, string $adminName): array
     404    {
     405        $settings = self::settings();
     406
     407        return self::request('POST', '/api/wp/portal-link', [
     408            'site_token'  => (string) ($settings['site_token'] ?? ''),
     409            'admin_email' => $adminEmail,
     410            'admin_name'  => $adminName,
    394411        ]);
    395412    }
  • zubbin-uptime-node/tags/2.2.16/readme.txt

    r3650345 r3745311  
    33Tags: uptime, uptime monitoring, site health, monitoring, security
    44Requires at least: 6.0
    5 Tested up to: 7.0
     5Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 2.2.15
     7Stable tag: 2.2.16
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9191
    9292== Changelog ==
     93
     94= 2.2.16 =
     95* New: "Open my Z UpTime dashboard" button in the plugin screen. For a site that is not linked to an account yet it
     96  creates your free account and opens the dashboard in one click — no claim code to copy.
     97* New: if your plan's site limit is reached, the site is still linked to your account and the plugin says so, with a
     98  link to upgrade. Previously it was left unlinked.
     99* Tested up to WordPress 7.1.
    93100
    94101= 2.2.15 =
  • zubbin-uptime-node/tags/2.2.16/zubbin-uptime-node.php

    r3650343 r3745311  
    33 * Plugin Name: Z UpTime by Zubbin – Uptime & Site Health Monitoring
    44 * Description: WordPress site connector for the Zubbin monitoring platform. Sends heartbeat and inventory data to Zubbin for uptime and health monitoring.
    5  * Version: 2.2.15
     5 * Version: 2.2.16
    66 * Author: Zubbin
    77 * Text Domain: zubbin-uptime-node
    … …  
    1515if (!defined('ABSPATH')) exit;
    1616
    17 define('ZUBBIN_UN_VERSION', '2.2.15');
     17define('ZUBBIN_UN_VERSION', '2.2.16');
    1818
    1919// Can be overridden in wp-config.php:
  • zubbin-uptime-node/trunk/includes/admin.php

    r3650343 r3745311  
    1818    add_action('admin_post_zubbin_un_start_checkout', [__CLASS__, 'start_checkout']);
    1919    add_action('admin_post_zubbin_un_open_portal', [__CLASS__, 'open_portal']);
     20    add_action('admin_post_zubbin_un_open_dashboard', [__CLASS__, 'open_dashboard']);
    2021  }
    2122
    … …  
    3334    add_action("admin_post_zubbin_un_start_checkout", [__CLASS__, "start_checkout"]);
    3435    add_action("admin_post_zubbin_un_open_portal", [__CLASS__, "open_portal"]);
     36    add_action("admin_post_zubbin_un_open_dashboard", [__CLASS__, "open_dashboard"]);
    3537  }
    3638  /**
    … …  
    110112    echo '<span style="display:inline-flex;align-items:center;padding:8px 14px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-weight:800;">' . esc_html($planName) . '</span>';
    111113    echo '<span style="font-size:13px;color:#64748b;font-weight:700;">' . esc_html($statusMeta) . '</span>';
     114    if ($connected) self::dashboard_button(__('Open my Z UpTime dashboard', 'zubbin-uptime-node'), false);
    112115    echo '</div>';
    113116
    … …  
    128131      echo '<div style="margin:16px 0;padding:16px 18px;border:1px solid #fcd34d;background:#fffbeb;border-radius:12px;">';
    129132      echo '<div style="font-weight:800;color:#92400e;margin-bottom:6px;">This site is monitoring, but not yet linked to your account</div>';
    130       echo '<div style="color:#78350f;">Enter this claim code in your Z UpTime dashboard to take ownership:</div>';
     133      echo '<div style="color:#78350f;margin-bottom:10px;">Create your free account and open your dashboard in one click:</div>';
     134      self::dashboard_button(__('Create my account & open dashboard', 'zubbin-uptime-node'), true);
     135      echo '<div style="color:#78350f;margin-top:12px;">Already have an account? Enter this claim code in your Z UpTime dashboard:</div>';
    131136      echo '<div style="margin:10px 0;font-size:22px;font-weight:900;letter-spacing:.12em;color:#1f2937;">' . esc_html($claimCode) . '</div>';
    132137      if ($connectUrl !== '') {
    … …  
    134139      }
    135140      echo ' <span style="color:#92400e;font-size:13px;">…or paste your registration token under <strong>Settings</strong> for instant ownership.</span>';
     141      echo '</div>';
     142    }
     143
     144    if ($siteStatus === 'pending_upgrade') {
     145      echo '<div style="margin:16px 0;padding:16px 18px;border:1px solid #fcd34d;background:#fffbeb;border-radius:12px;">';
     146      echo '<div style="font-weight:800;color:#92400e;margin-bottom:6px;">' . esc_html__('Connected — upgrade to start monitoring', 'zubbin-uptime-node') . '</div>';
     147      echo '<div style="color:#78350f;margin-bottom:10px;">' . esc_html__('This site is linked to your Z UpTime account, but your plan\'s site limit is already reached, so it is not being monitored yet. Upgrade your plan and monitoring starts automatically.', 'zubbin-uptime-node') . '</div>';
     148      self::dashboard_button(__('Open my dashboard to upgrade', 'zubbin-uptime-node'), true);
    136149      echo '</div>';
    137150    }
    … …  
    17941807  }
    17951808
     1809  /** A small admin-post form: only administrators see it, and it carries a nonce. */
     1810  static function dashboard_button($label, $primary = true) {
     1811    echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="display:inline-block;margin:0;">';
     1812    echo '<input type="hidden" name="action" value="zubbin_un_open_dashboard" />';
     1813    wp_nonce_field('zubbin_un_open_dashboard');
     1814    echo '<button type="submit" class="button' . ($primary ? ' button-primary' : '') . '">' . esc_html($label) . '</button>';
     1815    echo '</form>';
     1816  }
     1817
     1818  /**
     1819   * "Open my Z UpTime dashboard". Only an administrator can press it, which is
     1820   * the proof of ownership the server needs to create an account for an unclaimed
     1821   * site. For a site that already has an account, the server emails that account
     1822   * a sign-in link instead — it never logs anyone straight into an existing account.
     1823   */
     1824  static function open_dashboard() {
     1825    if (!current_user_can('manage_options')) wp_die('Forbidden');
     1826    check_admin_referer('zubbin_un_open_dashboard');
     1827
     1828    $back = admin_url('admin.php?page=zubbin_un');
     1829    $s = ZUBBIN_UN_Settings::get();
     1830    if (!ZUBBIN_UN_Settings::paired($s)) {
     1831      set_transient('zubbin_un_flash_notice', ['type' => 'warning', 'message' => __('This site is not connected to Z UpTime yet. Use the Onboarding tab first.', 'zubbin-uptime-node')], 60);
     1832      wp_safe_redirect($back);
     1833      exit;
     1834    }
     1835
     1836    $user = wp_get_current_user();
     1837    $r = Zubbin_Uptime_Api_Client::dashboard_link((string) $user->user_email, (string) $user->display_name);
     1838    $body = is_array($r['body'] ?? null) ? $r['body'] : [];
     1839
     1840    // Keep the ownership state the server reports (e.g. unclaimed → active).
     1841    if (!empty($body['status'])) {
     1842      $status = sanitize_text_field((string) $body['status']);
     1843      $update = ['site_status' => $status];
     1844      if ($status !== 'unclaimed') $update['claim_code'] = '';
     1845      ZUBBIN_UN_Settings::save($update);
     1846    }
     1847
     1848    if (($body['action'] ?? '') === 'redirect' && !empty($body['url'])) {
     1849      $target = esc_url_raw((string) $body['url']);
     1850      $host = wp_parse_url($target, PHP_URL_HOST);
     1851      if ($host) {
     1852        add_filter('allowed_redirect_hosts', function ($hosts) use ($host) {
     1853          if (!in_array($host, $hosts, true)) $hosts[] = $host;
     1854          return $hosts;
     1855        });
     1856      }
     1857      wp_safe_redirect($target);
     1858      exit;
     1859    }
     1860
     1861    $ok = !empty($body['success']);
     1862    $msg = (string) ($body['message'] ?? $body['error'] ?? '');
     1863    if ($msg === '') {
     1864      $msg = $ok
     1865        ? __('Check your email for a sign-in link.', 'zubbin-uptime-node')
     1866        : sprintf(
     1867            /* translators: %s: HTTP status */
     1868            __('Could not reach Z UpTime (HTTP %s). Please try again in a minute.', 'zubbin-uptime-node'),
     1869            (string) (int) ($r['status'] ?? 0)
     1870          );
     1871    }
     1872    set_transient('zubbin_un_flash_notice', ['type' => $ok ? 'success' : 'warning', 'message' => $msg], 60);
     1873    wp_safe_redirect($back);
     1874    exit;
     1875  }
     1876
    17961877  static function open_portal() {
    17971878    if (!current_user_can('manage_options')) wp_die('Forbidden');
  • zubbin-uptime-node/trunk/includes/class-zubbin-uptime-api-client.php

    r3611964 r3745311  
    392392            'billing_period' => $cadence === 'yearly' ? 'yearly' : 'monthly',
    393393            'return_url' => admin_url('admin.php?page=zubbin_un&tab=upgrade'),
     394        ]);
     395    }
     396
     397    /**
     398     * Ask Z UpTime for a way into the customer dashboard on behalf of the logged-in
     399     * WordPress administrator. The server either returns a one-time login URL (a new
     400     * account was just created for this site) or emails a sign-in link to the
     401     * account that owns the site.
     402     */
     403    public static function dashboard_link(string $adminEmail, string $adminName): array
     404    {
     405        $settings = self::settings();
     406
     407        return self::request('POST', '/api/wp/portal-link', [
     408            'site_token'  => (string) ($settings['site_token'] ?? ''),
     409            'admin_email' => $adminEmail,
     410            'admin_name'  => $adminName,
    394411        ]);
    395412    }
  • zubbin-uptime-node/trunk/readme.txt

    r3650345 r3745311  
    33Tags: uptime, uptime monitoring, site health, monitoring, security
    44Requires at least: 6.0
    5 Tested up to: 7.0
     5Tested up to: 7.1
    66Requires PHP: 8.0
    7 Stable tag: 2.2.15
     7Stable tag: 2.2.16
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9191
    9292== Changelog ==
     93
     94= 2.2.16 =
     95* New: "Open my Z UpTime dashboard" button in the plugin screen. For a site that is not linked to an account yet it
     96  creates your free account and opens the dashboard in one click — no claim code to copy.
     97* New: if your plan's site limit is reached, the site is still linked to your account and the plugin says so, with a
     98  link to upgrade. Previously it was left unlinked.
     99* Tested up to WordPress 7.1.
    93100
    94101= 2.2.15 =
  • zubbin-uptime-node/trunk/zubbin-uptime-node.php

    r3650343 r3745311  
    33 * Plugin Name: Z UpTime by Zubbin – Uptime & Site Health Monitoring
    44 * Description: WordPress site connector for the Zubbin monitoring platform. Sends heartbeat and inventory data to Zubbin for uptime and health monitoring.
    5  * Version: 2.2.15
     5 * Version: 2.2.16
    66 * Author: Zubbin
    77 * Text Domain: zubbin-uptime-node
    … …  
    1515if (!defined('ABSPATH')) exit;
    1616
    17 define('ZUBBIN_UN_VERSION', '2.2.15');
     17define('ZUBBIN_UN_VERSION', '2.2.16');
    1818
    1919// Can be overridden in wp-config.php:
Note: See TracChangeset for help on using the changeset viewer.