mirror of
https://github.com/standardebooks/web.git
synced 2025-07-10 00:30:28 -04:00
Add warnings pointing to latest manual version on all old manual pages
This commit is contained in:
parent
e56c6b4642
commit
8deafc7543
4 changed files with 36 additions and 5 deletions
23
lib/Manual.php
Normal file
23
lib/Manual.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?
|
||||
|
||||
class Manual{
|
||||
public static function GetLatestVersion(){
|
||||
$dirs = glob(MANUAL_PATH . '/*', GLOB_ONLYDIR);
|
||||
sort($dirs);
|
||||
return str_replace(MANUAL_PATH . '/', '', $dirs[sizeof($dirs) - 1]);
|
||||
}
|
||||
|
||||
public static function GetRequestedVersion(){
|
||||
try{
|
||||
if(preg_match_all('|/manual/([0-9]+\.[0-9]+\.[0-9]+)|ius', $_SERVER['REQUEST_URI'], $matches)){
|
||||
return($matches[1][0]);
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue