Plugin Directory


Ignore:
Timestamp:
10/23/2026 03:27:20 AM (13 days ago)
Author:
TigrouMeow
Message:

Version 3.8.7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ai-engine/trunk/classes/modules/workspace.php

    r3711046 r3760851  
    810810  public const DOC_MOBILE_URL = 'https://meowapps.com/fix-mcp-wordpress-connection/#workspace-mobile';
    811811
     812  /**
     813  * How many phones are paired with Workspace on this site, across every user.
     814  * Application Passwords live in one serialized user meta row per user, so the
     815  * LIKE narrows it to the users who have a Workspace device at all.
     816  */
     817  public static function count_paired_devices() {
     818    if ( !class_exists( 'WP_Application_Passwords' ) ) {
     819      return 0;
     820    }
     821    global $wpdb;
     822    $rows = $wpdb->get_col( $wpdb->prepare(
     823      "SELECT meta_value FROM {$wpdb->usermeta} WHERE meta_key = %s AND meta_value LIKE %s",
     824      WP_Application_Passwords::USERMETA_KEY_APPLICATION_PASSWORDS,
     825      '%' . $wpdb->esc_like( self::PAIR_APP_PREFIX ) . '%'
     826    ) );
     827    $count = 0;
     828    foreach ( (array) $rows as $row ) {
     829      foreach ( (array) maybe_unserialize( $row ) as $p ) {
     830        if ( isset( $p['name'] ) && strpos( $p['name'], self::PAIR_APP_PREFIX ) === 0 ) {
     831          $count++;
     832        }
     833      }
     834    }
     835    return $count;
     836  }
     837
    812838  private function pairing_available( $user = null ) {
    813839    if ( !class_exists( 'WP_Application_Passwords' ) || !function_exists( 'wp_is_application_passwords_available' ) ) {
Note: See TracChangeset for help on using the changeset viewer.