REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.45 KB
Close
//proc/thread-self/root/home/byroehnu/geniuskidsacademy.org/wp-content/plugins/elementor/core/utils/ab-test.php
Text
Base64
<?php namespace Elementor\Core\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Core A/B Testing utility class * * Provides A/B testing functionality for Core features. * Uses WordPress transients for caching and user-specific variation assignment. */ class Ab_Test { const PREFIX_CACHE_KEY = '_elementor_ab_test_'; const CACHE_TTL = 90 * DAY_IN_SECONDS; /** * Get variation for a specific test * * @param string $test_name The name of the A/B test * @param int $user_id Optional user ID, defaults to current user * @return int Returns 1 or 2 for variation assignment */ public static function get_variation( $test_name, $user_id = null ): int { if ( null === $user_id ) { $user_id = get_current_user_id(); } $variation_id = self::get_variation_id_from_cache( $test_name, $user_id ); if ( false === $variation_id ) { $variation_id = self::get_random_variation(); self::set_variation_id_from_cache( $test_name, $user_id, $variation_id ); } return absint( $variation_id ); } /** * Check if user should see the feature (50% probability) * * @param string $test_name The name of the A/B test * @param int $user_id Optional user ID, defaults to current user * @return bool True if user should see the feature */ public static function should_show_feature( $test_name, $user_id = null ): bool { $variation = self::get_variation( $test_name, $user_id ); return 1 === $variation; // Only variation 1 sees the feature } /** * Get variation ID from cache * * @param string $test_name The name of the A/B test * @param int $user_id User ID * @return int|false Variation ID or false if not cached */ private static function get_variation_id_from_cache( $test_name, $user_id ) { $cache_key = self::PREFIX_CACHE_KEY . $test_name . '_' . $user_id; return get_transient( $cache_key ); } /** * Set variation ID in cache * * @param string $test_name The name of the A/B test * @param int $user_id User ID * @param int $variation_id Variation ID to cache */ private static function set_variation_id_from_cache( $test_name, $user_id, $variation_id ): void { $cache_key = self::PREFIX_CACHE_KEY . $test_name . '_' . $user_id; set_transient( $cache_key, $variation_id, self::CACHE_TTL ); } /** * Generate random variation (1 or 2) * * @return int Random variation ID */ private static function get_random_variation(): int { return mt_rand( 1, 2 ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 4 × Files: 12
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
api
DIR
-
drwxr-xr-x
2026-03-14 01:49:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
import-export
DIR
-
drwxr-xr-x
2026-03-14 01:49:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
promotions
DIR
-
drwxr-xr-x
2026-03-14 01:49:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
svg
DIR
-
drwxr-xr-x
2026-03-14 01:49:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ab-test.php
2.45 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
assets-config-provider.php
1.49 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
assets-translation-loader.php
2.51 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
collection.php
10.13 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
exceptions.php
709 B
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
force-locale.php
3.55 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
hints.php
14.81 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
http.php
981 B
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
plugins-manager.php
2.84 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
static-collection.php
1.09 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
str.php
1001 B
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
version.php
3.78 KB
lrw-r--r--
2026-02-04 08:59:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).