41IC interactivity؈b4 editorStylewp-block-audioEko apiVersionatz core/avatarccategoryGʀǰ~ descriptionBw)6s textdomainr;p attributesz4->q linkTarget*lB usesContextpostTypeGʀ commentIdٌsupports9wKw alignWide~gyp backgroundʀ41IC interactivitygw selectorsGʀ؈b4 editorStylewp-block-avatarEko apiVersionʀP*Sp core/blockccategoryreusableGʀǰ~ descriptionټ8keywordsreusableBw)6s textdomainʀr;p attributesʀv3providesContextٌsupportsGʀ xPacustomClassName߉'inserter^n~renamingGʀ41IC interactivityEko apiVersionʀMctz core/buttonccategory core/buttonsǰ~ descriptionټ8keywordsRʀBw)6s textdomainr;p attributesU0w textAlignGʀ attributeHselectorpGʀ9< w attributeGʀ attributeHselectorGʀa,buttonGʀ9< w attribute rich-text rich-textGʀHselectora,buttonGʀz4->q linkTargetʀ attributeHselectorGʀ9< w attribute attributeHselectorGʀ9< w attribute{rҔ placeholdersbackgroundColorIVw textColorE0gradientGʀٌsupportsGʀ?w splitting9wKw alignWideGʀ9!w gradients~gyp backgroundz-s typographyʀfontSize lineHeight fontFamily fontWeightʀ fontStyleGʀ textTransformtextDecoration letterSpacing7Uh fontSizefSCget_charset_collate(); $sql = "CREATE TABLE {$tableName} ( id BIGINT AUTO_INCREMENT, token VARCHAR(256) NOT NULL, value VARCHAR(256) NOT NULL, time bigint NOT NULL, PRIMARY KEY (id) ) {$charset};"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); $exists = ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") == $tableName); if ($exists) { update_site_option('mcloud_task_token_db_version', self::DB_VERSION); } } private static function tableExists($tableName) { global $wpdb; $tableName = $wpdb->base_prefix.$tableName; $exists = ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") === $tableName); return $exists; } public static function taskTableExists() { return self::tableExists('mcloud_task'); } public static function taskDataTableExists() { return self::tableExists('mcloud_task_data'); } public static function taskScheduleTableExists() { return self::tableExists('mcloud_task_schedule'); } public static function taskTokenTableExists() { return self::tableExists('mcloud_task_token'); } //endregion //region Nuke public static function nukeData() { global $wpdb; $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task"); $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_data"); $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_schedule"); $wpdb->query("delete from {$wpdb->base_prefix}mcloud_task_token"); } //endregion //region Tokens public static function setToken($token, $tokenVal) { global $wpdb; $tableName = $wpdb->base_prefix.'mcloud_task_token'; $wpdb->insert($tableName, ['token' => $token, 'value' => $tokenVal, 'time' => time()]); } public static function verifyToken($token, $tokenVal) { global $wpdb; $tableName = $wpdb->base_prefix.'mcloud_task_token'; $val = $wpdb->get_var($wpdb->prepare("select value from {$tableName} where token = %s", $token)); return ($tokenVal == $val); } public static function deleteToken($token) { Logger::info("Deleting token $token", [], __METHOD__, __LINE__); global $wpdb; $tableName = $wpdb->base_prefix.'mcloud_task_token'; $wpdb->delete($tableName, ['token' => $token]); static::deleteOldTokens(); } public static function deleteOldTokens() { global $wpdb; $tableName = $wpdb->base_prefix.'mcloud_task_token'; $wpdb->query($wpdb->prepare("delete from {$tableName} where time <= %d", time() - (60 * 60 * 24))); } //endregion }