PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.8
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.8
1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 0.8.6 All 33 releases
desktop-mode / includes / games / config.php

config.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.8, at includes/games/config.php

59 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation — Games framework config.
4 *
5 * Framework-level values every game receives on its launch-context
6 * `config` (merged in by the `serverGames` payload builder; a game's
7 * own `config` keys win on collision):
8 *
9 * - `wordsUrl` — URL of the shared dictionary asset
10 * (`assets/games/words.txt`). The word list is a
11 * framework asset, not a per-game one: it is
12 * identical for every player, which is what lets
13 * seeded games generate the same puzzle worldwide.
14 *
15 * @package OpenStation
16 */
17
18 defined( 'ABSPATH' ) || exit;
19
20 /**
21 * URL of the shared games dictionary asset, cache-busted on content
22 * change (the browser caches the ~150 KB list across sessions
23 * otherwise).
24 *
25 * @return string The dictionary URL.
26 */
27 function openstation_games_words_url() {
28 $words_file = OPENSTATION_DIR . 'assets/games/words.txt';
29 $words_url = OPENSTATION_URL . 'assets/games/words.txt';
30 if ( file_exists( $words_file ) ) {
31 $words_url = add_query_arg( 'ver', (string) filemtime( $words_file ), $words_url );
32 }
33
34 /**
35 * Filters the URL of the shared games dictionary asset.
36 *
37 * Seeded games generate identical puzzles worldwide only while
38 * every player resolves the same word list — swap the URL for
39 * all users (a translated list, a themed list), not per user.
40 *
41 * @param string $words_url The dictionary URL (with `ver` cache-bust).
42 */
43 return (string) apply_filters( 'openstation_games_words_url', $words_url );
44 }
45
46 /**
47 * The framework-level `config` keys merged into every game's launch
48 * context. A game's own `config` wins on collision.
49 *
50 * @internal
51 *
52 * @return array Framework config keys.
53 */
54 function openstation_games_framework_config() {
55 return array(
56 'wordsUrl' => esc_url_raw( openstation_games_words_url() ),
57 );
58 }
59