File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 require_once _KEYMANCOM_INCLUDES . '/includes/template.php ' ;
33 require_once _KEYMANCOM_INCLUDES . '/autoload.php ' ;
44 use Keyman \Site \Common \KeymanHosts ;
5+ use Keyman \Site \com \keyman \Util ;
56
67 // Required
78 head ([
110111 <tbody>
111112
112113<?php
113- $ data = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . '/cloud/4.0/keyboards?languageidtype=bcp47&version= ' .$ stable_version );
114+ $ data = Util:: call_api_keyman_com ( '/cloud/4.0/keyboards?languageidtype=bcp47&version= ' .$ stable_version );
114115 if ($ data === FALSE ) {
115116 // fallback if API is down, bad news anyway.
116117 $ data = file_get_contents ('keyboards.txt ' );
Original file line number Diff line number Diff line change 22require_once _KEYMANCOM_INCLUDES . '/includes/servervars.php ' ;
33
44use Keyman \Site \Common \KeymanHosts ;
5+ use Keyman \Site \com \keyman \Util ;
56
67function getKeymanWebHref ()
78{
8- $ json = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . "/version/web " );
9+ $ json = Util:: call_api_keyman_com ( "/version/web " );
910 if ($ json ) {
1011 $ json = json_decode ($ json );
1112 }
Original file line number Diff line number Diff line change 22require_once _KEYMANCOM_INCLUDES . '/includes/template.php ' ;
33require_once _KEYMANCOM_INCLUDES . '/includes/ui/downloads.php ' ;
44use Keyman \Site \Common \KeymanHosts ;
5+ use Keyman \Site \com \keyman \Util ;
56
67// Required
78head ([
1415<h2 class="red underline large">Keyman downloads - all versions</h2>
1516
1617<?php
17- $ data = json_decode (file_get_contents (KeymanHosts:: Instance ()-> SERVER_downloads_keyman_com . '/api/version/all ' ));
18+ $ data = @ json_decode (Util:: call_downloads_keyman_com ( '/api/version/all ' ));
1819
1920if ($ data === NULL ) {
2021 die ('Error decoding JSON data. ' );
Original file line number Diff line number Diff line change 55 require_once _KEYMANCOM_INCLUDES . '/includes/playstore.php ' ;
66 use Keyman \Site \Common \KeymanHosts ;
77 use Keyman \Site \com \keyman \Locale ;
8+ use Keyman \Site \com \keyman \Util ;
89
910 Locale::definePageScope ('LOCALE_DOWNLOADS ' , 'downloads ' );
1011
@@ -31,8 +32,7 @@ function array_key_first(array $arr) {
3132 }
3233
3334 // note: we currently ignore the tier parameter
34-
35- $ versions = @json_decode (file_get_contents (KeymanHosts::Instance ()->SERVER_downloads_keyman_com . "/api/version/2.0?targetVersion= $ version " ));
35+ $ versions = @json_decode (Util::call_downloads_keyman_com ("/api/version/2.0?targetVersion= $ version " ));
3636
3737 if (empty ($ versions ->android ))
3838 $ tier = 'unknown ' ;
@@ -47,8 +47,7 @@ function array_key_first(array $arr) {
4747 $ versionTier = $ version . ($ tier == 'stable ' ? "" : "- $ tier " );
4848
4949
50-
51- $ versionsData = @json_decode (file_get_contents (KeymanHosts::Instance ()->SERVER_downloads_keyman_com . "/api/version/all " ));
50+ $ versionsData = @json_decode (Util::call_downloads_keyman_com ("/api/version/all " ));
5251 if (!$ versionsData ) {
5352 die ("Failed to retrieve or parse the API data. " );
5453 }
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ protected static function LoadData() {
375375
376376 // Get Keyboard Metadata
377377
378- $ s = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . '/keyboard/ ' . rawurlencode (self ::$ id ));
378+ $ s = Util:: call_api_keyman_com ( '/keyboard/ ' . rawurlencode (self ::$ id ));
379379 if ($ s === FALSE ) {
380380 // Will fail later in the script
381381 self ::$ error .= error_get_last ()['message ' ] . "\n" ;
@@ -396,7 +396,7 @@ protected static function LoadData() {
396396
397397 // Get Program Download Versions and URLs
398398
399- $ s = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_downloads_keyman_com . '/api/version/1.0 ' );
399+ $ s = Util:: call_downloads_keyman_com ( '/api/version/1.0 ' );
400400 if ($ s === FALSE ) {
401401 // Will fail later in the script
402402 self ::$ error .= error_get_last ()['message ' ] . "\n" ;
Original file line number Diff line number Diff line change 22 require_once _KEYMANCOM_INCLUDES . '/includes/servervars.php ' ;
33 require_once _KEYMANCOM_INCLUDES . '/autoload.php ' ;
44 use Keyman \Site \Common \KeymanHosts ;
5+ use Keyman \Site \com \keyman \Util ;
56
67 if (!isset ($ _REQUEST ['id ' ])) {
78 header ('HTTP/1.0 404 id parameter is required ' );
1415 header ('Content-Type: application/json; charset=utf-8 ' );
1516 header ('Access-Control-Allow-Origin: * ' );
1617
17- $ kmw = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . "/cloud/4.0/keyboards/ $ id?version= $ version&languageidtype=bcp47 " );
18+ $ kmw = Util:: call_api_keyman_com ( "/cloud/4.0/keyboards/ $ id?version= $ version&languageidtype=bcp47 " );
1819 if ($ kmw === FALSE ) {
1920 header ('HTTP/1.0 404 Keyboard not found ' );
2021 exit ;
Original file line number Diff line number Diff line change 44 require_once ('./session.php ' );
55 require_once _KEYMANCOM_INCLUDES . '/autoload.php ' ;
66 use Keyman \Site \Common \KeymanHosts ;
7+ use Keyman \Site \com \keyman \Util ;
78
89 if (isset ($ _REQUEST ['legacy ' ])) {
910 $ id = find_id_by_legacy (clean_id ($ _REQUEST ['legacy ' ]));
@@ -27,7 +28,7 @@ function clean_id($id) {
2728 }
2829
2930 function find_id_by_legacy ($ legacy ) {
30- $ s = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . '/search/?q=k:legacy: ' .rawurlencode ($ legacy ));
31+ $ s = Util:: call_api_keyman_com ( '/search/?q=k:legacy: ' .rawurlencode ($ legacy ));
3132 if ($ s === FALSE ) {
3233 return null ;
3334 }
Original file line number Diff line number Diff line change 55 require_once _KEYMANCOM_INCLUDES . '/autoload.php ' ;
66 use Keyman \Site \Common \KeymanHosts ;
77 use Keyman \Site \com \keyman \Locale ;
8+ use Keyman \Site \com \keyman \Util ;
89
910 Locale::definePageScope ('LOCALE_KEYBOARDS_SHARE ' , 'keyboards/share ' );
1011
@@ -24,7 +25,7 @@ function clean_id($id) {
2425 }
2526
2627 function find_keyboard ($ id ) {
27- $ s = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . '/keyboard/ ' .$ id );
28+ $ s = Util:: call_api_keyman_com ( '/keyboard/ ' .$ id );
2829 if ($ s === FALSE ) {
2930 return null ;
3031 }
Original file line number Diff line number Diff line change 44 namespace Keyman \Site \com \keyman ;
55
66 use Keyman \Site \Common \KeymanHosts ;
7+ use Keyman \Site \com \keyman \Util ;
78
89 class KeymanDownloadVersions {
910 private static $ versions ;
@@ -18,7 +19,7 @@ class KeymanDownloadVersions {
1819
1920 static function getDownloadUrls () {
2021 if (empty (self ::$ versions ))
21- self ::$ versions = @json_decode (file_get_contents (KeymanHosts:: Instance ()-> SERVER_downloads_keyman_com . '/api/version/2.0 ' ));
22+ self ::$ versions = @json_decode (Util:: call_downloads_keyman_com ( '/api/version/2.0 ' ));
2223 return self ::$ versions ;
2324 }
2425
Original file line number Diff line number Diff line change 44
55namespace Keyman \Site \com \keyman ;
66use Keyman \Site \Common \KeymanHosts ;
7+ use Keyman \Site \com \keyman \Util ;
78
89class KeymanWebHost {
910 static function getKeymanWebUrlBase () {
10- $ json = @ file_get_contents (KeymanHosts:: Instance ()-> SERVER_api_keyman_com . "/version/web " );
11+ $ json = Util:: call_api_keyman_com ( "/version/web " );
1112 if ($ json ) {
1213 $ json = json_decode ($ json );
1314 }
You can’t perform that action at this time.
0 commit comments