Skip to content

Commit

Permalink
Merge pull request #1279 from keymanapp/chore/merge-master-to-staging…
Browse files Browse the repository at this point in the history
…-a18s1

chore: Merge master to staging for Sprint A18S1
  • Loading branch information
mcdurdin authored May 29, 2024
2 parents 9f67460 + d05f55f commit a1ee6a7
Show file tree
Hide file tree
Showing 1,801 changed files with 67,256 additions and 10,730 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
permissions: write-all
steps:
- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].5
with:
sparse-checkout: |
README.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.5.2
uses: actions/checkout@v4.1.5

# Build the docker image and create link to vendor/ dependencies
- name: Build the Docker image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
Expand Down
58 changes: 37 additions & 21 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -53,83 +53,91 @@ RewriteRule "^keyboard/(?!redir.php)([^/?]+)/([^/?]+)(/)?$" "keyboard/redir.php?
# RewriteCond "%{DOCUMENT_ROOT}/$1/XX.0" -d
# RewriteRule "^(.+)/current-version(/.*)?$" "$1/XX.0$2"


# Redirect unversioned paths to current-version/ path

# /products first
RedirectMatch "/products/(android|iphone-and-ipad|linux|mac|web|windows)/(?!current-version|version-history|\d+\.\d+)(.*)" "/products/$1/current-version/$2"
RedirectMatch "/products/(android|iphone-and-ipad|linux|mac|web|windows)/(?!latest-version|current-version|version-history|\d+\.\d+)(.*)" "/products/$1/current-version/$2"

# /developer/engine/ for Android and iOS
RedirectMatch "/developer/engine/(android|iphone-and-ipad)/(?!current-version|\d+\.\d+)(.*)" "/developer/engine/$1/current-version/$2"
RedirectMatch "/developer/engine/(android|iphone-and-ipad)/(?!latest-version|current-version|\d+\.\d+)(.*)" "/developer/engine/$1/current-version/$2"

# /developer/engine/web
RedirectMatch "/developer/engine/web/(?!faq|history|current-version|\d+\.\d+)(.*)" "/developer/engine/web/current-version/$1"
RedirectMatch "/developer/engine/web/(?!latest-version|faq|history|current-version|\d+\.\d+)(.*)" "/developer/engine/web/current-version/$1"

# latest-version:18.0
# alpha or beta version reference
RewriteCond "%{DOCUMENT_ROOT}/$1/18.0" -d
RewriteRule "^(.+)/latest-version(/.*)?$" "$1/18.0$2" [DPI]

# current-version:16.0
# current-version:17.0
RewriteCond "%{DOCUMENT_ROOT}/$1/17.0" -d
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/17.0$2" [DPI]

# version:16.0
RewriteCond "%{DOCUMENT_ROOT}/$1/16.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/16.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/16.0$2" [DPI]

# version:15.0
RewriteCond "%{DOCUMENT_ROOT}/$1/15.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/15.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/15.0$2" [DPI]

# version:14.0
RewriteCond "%{DOCUMENT_ROOT}/$1/14.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/14.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/14.0$2" [DPI]

# version:13.0
RewriteCond "%{DOCUMENT_ROOT}/$1/13.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/13.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/13.0$2" [DPI]

# version:12.0
RewriteCond "%{DOCUMENT_ROOT}/$1/12.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/12.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/12.0$2" [DPI]

# version:11.0
RewriteCond "%{DOCUMENT_ROOT}/$1/11.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/11.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/11.0$2" [DPI]

# version:10.0
RewriteCond "%{DOCUMENT_ROOT}/$1/10.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/10.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/10.0$2" [DPI]

# the following version fallbacks are for APIs such as /developer/cloud versions

# version:9.0
RewriteCond "%{DOCUMENT_ROOT}/$1/9.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/9.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/9.0$2" [DPI]

# version:8.0
RewriteCond "%{DOCUMENT_ROOT}/$1/8.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/8.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/8.0$2" [DPI]

# version:7.0
RewriteCond "%{DOCUMENT_ROOT}/$1/7.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/7.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/7.0$2" [DPI]

# version:6.0
RewriteCond "%{DOCUMENT_ROOT}/$1/6.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/6.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/6.0$2" [DPI]

# version:5.0
RewriteCond "%{DOCUMENT_ROOT}/$1/5.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/5.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/5.0$2" [DPI]

# version:4.0
RewriteCond "%{DOCUMENT_ROOT}/$1/4.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/4.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/4.0$2" [DPI]

# version:3.0
RewriteCond "%{DOCUMENT_ROOT}/$1/3.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/3.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/3.0$2" [DPI]

# version:2.0
RewriteCond "%{DOCUMENT_ROOT}/$1/2.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/2.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/2.0$2" [DPI]

# version:1.0
RewriteCond "%{DOCUMENT_ROOT}/$1/1.0" -d
RewriteRule "^(.+)/current-version(/.*)?$" "$1/1.0$2" [DPI]
RewriteRule "^(.+)/(?:current|latest)-version(/.*)?$" "$1/1.0$2" [DPI]

# Static redirection
Redirect "/desktop" "/products/windows"
Expand Down Expand Up @@ -166,6 +174,10 @@ Redirect "/kb" "/knowledge-base"
# Redirect to kb handler
RewriteRule "^knowledge-base/(\d+)$" "/knowledge-base/index.php?id=$1" [L]

# Redirect error code shortlinks
# We could choose to enable this in the future, but for now we use the kmn.sh
# redirects instead.
# RedirectMatch "/go/(km\d+)$" "/developer/latest-version/reference/errors/$1"

#
# PHP and Markdown rewriting
Expand Down Expand Up @@ -195,6 +207,10 @@ RewriteCond "$1.php" -f
RewriteCond "$1" !-d
RewriteRule "^(.+)\.php$" "$1" [R,L]

# Remove .php extension and redirect - but only for Keyman Developer API docs for now
RewriteCond "$1.md" -f
RewriteRule "^(developer/(current-version|\d+\.\d+)/reference/api/.+)\.md$" "$1" [R,END]

# Redirect folder without / to include /
RewriteCond "{DOCUMENT_ROOT}/$1" -d
RewriteCond "{DOCUMENT_ROOT}/$1.php" !-f
Expand Down
3 changes: 2 additions & 1 deletion _includes/includes/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
echo ' <meta name="robots" content="none">';
}
?>
<title><?php echo $title; ?></title>
<title><?php echo htmlentities($title); ?></title>
<?php
/* Our local CDN version is identical to this file:
<script
Expand Down Expand Up @@ -98,6 +98,7 @@ function downloadJSAtOnload() {
}
}
if(!isset($kmw_dev_path)) {
$kmw_version_number = '16.0.147'; // TEMP: work around keymanapp/keyman#11467, roll back to 16.0-stable until fixed
?>
<script src='https://s.keyman.com/kmw/engine/<?=$kmw_version_number?>/keymanweb.js'></script>
<?php
Expand Down
2 changes: 1 addition & 1 deletion _includes/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<div class="header">
<a id="home-link" href="/"><img id="logo" src="<?php echo cdn("img/logo1.png"); ?>" alt='Keyman Logo' /></a>
<img id="header-bottom" src="<?php echo cdn("img/headerbar.png"); ?>" alt='Header bottom' />
<a id="help" href="http://keyman.com"><p id="keyman-help">Keyman.com Homepage</p><img src="<?php echo cdn("img/helpIcon.png"); ?>"></a>
<a id="help" href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>"><p id="keyman-help">Keyman.com Homepage</p><img src="<?php echo cdn("img/helpIcon.png"); ?>"></a>
</div>
22 changes: 18 additions & 4 deletions _includes/includes/index-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ function get_file_titles($base) {
continue;
}

if(preg_match('/developer\/(current-version|latest-version|\d+\.\d+)\/reference\/api/', $file)) {
// Performance cost -- there are many files in this folder. This is a
// temporary fix until we move to better API documentation hosting in the
// future
continue;
}

if(is_dir($file)) {
if(file_exists($file.'/index.md')) {
$dirs[$basefile] = get_file_title_md($file.'/index.md');
Expand Down Expand Up @@ -59,6 +66,8 @@ function get_file_title_md($filename) {

if(preg_match('/^title: (.+)$/mi', $s, $sub)) {
$title = $sub[1];
} else if(preg_match('/^(#)+ (.+)$/m', $s, $sub)) {
$title = $sub[2];
} else {
$title = 'Untitled page.md';
}
Expand All @@ -82,11 +91,13 @@ function build_index_content() {

$index_content = "<ul>";
foreach($items as $file => $title) {
$hetitle = htmlentities($title);
$hesttitle = htmlentities(strip_tags($title));
$cleanfile = str_replace('.md', '', str_replace('.php', '', $file));
if($file == $this_file) {
$index_content .= "<li class='current'>$title</li>";
$index_content .= "<li class='current'>$hetitle</li>";
} else {
$index_content .= "<li><a href='$cleanfile' title='".strip_tags($title)."'>$title</a></li>";
$index_content .= "<li><a href='$cleanfile' title='$hesttitle'>$hetitle</a></li>";
}
}
$index_content .= "</ul>";
Expand All @@ -97,10 +108,13 @@ function build_index_content() {
$title = get_file_title_md($base . 'index.md');
else
$title = get_file_title($base . 'index.php');
$hetitle = htmlentities($title);
$hesttitle = htmlentities(strip_tags($title));

if(($this_file == 'index.php' || $this_file == 'index.md') && $depth == 0) {
$index_content = "<ul><li><div class='current'>$title</div>$index_content</li></ul>";
$index_content = "<ul><li><div class='current'>$hetitle</div>$index_content</li></ul>";
} else {
$index_content = "<ul><li><a href='$path'>$title</a>$index_content</li></ul>";
$index_content = "<ul><li><a href='$path'>$hetitle</a>$index_content</li></ul>";
}
$path = '../' . $path;
$base = $base . '../';
Expand Down
2 changes: 1 addition & 1 deletion _includes/includes/no-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<?php } ?>
<div id="no-menu-spacer"></div>
<img id="header-bottom" src="<?php echo cdn("img/headerbar.png"); ?>" alt='Header bottom' />
<a id="help" href="//keyman.com">
<a id="help" href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>">
<p id="keyman-help">Keyman.com</p><img src="<?php echo cdn("img/helpIcon.png"); ?>">
</a>
</div>
Expand Down
3 changes: 2 additions & 1 deletion _includes/includes/page-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function __construct() {
} else {
$this->currentVersion = $this::getCurrentVersion($this->versions);
if($this->versionedPath == 'current-version') $this->versionedPath = $this->currentVersion;
if($this->versionedPath == 'latest-version') $this->versionedPath = $this->versions[0];
}
}
}
Expand Down Expand Up @@ -97,7 +98,7 @@ static function WriteSelector() {
/// Test that the url is in a versioned folder (only support products|developer at present)
///
static private function ParseURL($url, &$basePath, &$versionedPath, &$subPath) {
if(preg_match('/^(\/(products|developer).*)\/(\d+\.\d+|current-version)\/(.*)$/', $url, $matches)) {
if(preg_match('/^(\/(products|developer).*)\/(\d+\.\d+|latest-version|current-version)\/(.*)$/', $url, $matches)) {
$basePath = $matches[1];
$versionedPath = $matches[3];
$subPath = $matches[4];
Expand Down
4 changes: 2 additions & 2 deletions _includes/includes/phone-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
<div class="phone-menu-item">
<h3>Contact and Search</h3>
<ul>
<li><a href="http://keyman.com/contact">Contact Us</a></li>
<li><a href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>/contact">Contact Us</a></li>
<li><a href="/search/">Search Help</a></li>
</ul>
</div>
<div class="phone-menu-item">
<h3>Keyman.com Homepage</h3>
<ul>
<li><a href="http://keyman.com">Keyman.com</a></li>
<li><a href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>">Keyman.com</a></li>
</ul>
</div>
</div>
Expand Down
37 changes: 5 additions & 32 deletions _includes/includes/servervars.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,19 @@
require_once($_SERVER['DOCUMENT_ROOT'].'/cdn/deploy/cdn.php');
}

$site_url = 'help.keyman.com';
$keyman_com = \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com;

// We allow the site to strip off everything post its basic siteurl

function GetHostSuffix() {
global $site_url;
$name = $_SERVER['SERVER_NAME'];
if(stripos($name, $site_url.'.') == 0) {
return substr($name, strlen($site_url), 1024);
}
return '';
}

$site_suffix = GetHostSuffix();

// $site_protocol is used only by util.php at this time.
$site_protocol = (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';

if($site_suffix == '') {
$TestServer = false;

$site_tavultesoft = 'www.tavultesoft.com';
$site_securetavultesoft = 'secure.tavultesoft.com';
$resourceDomain="r.keymanweb.com";
$staticDomainRoot="https://s.keyman.com";
} else {
$TestServer = true;
$site_tavultesoft = 'testsite.tavultesoft.local';
$site_securetavultesoft = 'secure.testsite.tavultesoft.local';
$resourceDomain="r.keymanweb.com";
$staticDomainRoot="http://s.keyman.com{$site_suffix}";
}

$staticDomain = "s.keyman.com{$site_suffix}/help";
$TestServer = false;

$downloadsDomain = "downloads.keyman.com"; //{$site_suffix}";
$site_tavultesoft = 'www.tavultesoft.com';
$site_securetavultesoft = 'secure.tavultesoft.com';
$downloadsDomain = "downloads.keyman.com";

function cdn($file) {
global $cdn, $staticDomain, $TestServer;
global $cdn, $TestServer;
$use_cdn = !$TestServer || (isset($_REQUEST['cdn']) && $_REQUEST['cdn'] == 'force');
if($use_cdn && $cdn && array_key_exists('/'.$file, $cdn)) {
return "/cdn/deploy{$cdn['/'.$file]}";
Expand Down
4 changes: 2 additions & 2 deletions _includes/includes/top-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<img id="show-phone-menu" src="<?php echo cdn("img/phonehide.png"); ?>" />
<a id="home-link" href="/"><img id="logo" src="<?php echo cdn(KeymanHosts::Instance()->Tier() == KeymanHosts::TIER_PRODUCTION ? "img/logo2.png" : "img/logo2dev.png"); ?>" alt='Keyman Logo' /></a>
<img id="header-bottom" src="<?php echo cdn("img/headerbar.png"); ?>" alt='Header bottom' />
<a id="help" href="http://keyman.com"><p id="keyman-help">Keyman.com</p><img src="<?php echo cdn("img/helpIcon.png"); ?>"></a>
<a id="help" href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>"><p id="keyman-help">Keyman.com</p><img src="<?php echo cdn("img/helpIcon.png"); ?>"></a>
</div>
<div id="top-menu-bg"></div>
<div id="top-menu1">
Expand Down Expand Up @@ -53,7 +53,7 @@
</div>
</div>
<div class="menu-item" id="tavultesoft">
<a href="http://keyman.com/contact/" ><h3>Contact Us</h3></a>
<a href="<?= \Keyman\Site\Common\KeymanHosts::Instance()->keyman_com ?>/contact/" ><h3>Contact Us</h3></a>
</div>

<div class="menu-pseudo-item" id="menu-search">
Expand Down
1 change: 1 addition & 0 deletions _includes/kmdev.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?php
// DEPRECATED: This is used only by Keyman Developer 6.0 documentation
include( "kmdevhtml.php" );
?>
2 changes: 2 additions & 0 deletions _includes/kmdevhtml.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
// DEPRECATED: This is used only by Keyman Developer 6.0 documentation

//include_once( "version.out" );

$nl = "\r\n";
Expand Down
1 change: 1 addition & 0 deletions _includes/kmdist.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
// DEPRECATED: This is used only by Keyman Desktop 6.0 documentation
if( getenv( "KMDOCS_RTF" ) !== false ){
include( "kmdistrtf.php" );
}
Expand Down
1 change: 1 addition & 0 deletions _includes/kmdisthtml.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
// DEPRECATED: This is used only by Keyman Desktop 6.0 documentation

function dispatcher( $func, $args ) {
switch( $func ) {
Expand Down
1 change: 1 addition & 0 deletions _includes/kmdistrtf.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
// DEPRECATED: This is used only by Keyman Desktop 6.0 documentation
include_once("version.out");

include( "kmhelp.php" );
Expand Down
Loading

0 comments on commit a1ee6a7

Please sign in to comment.