mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Improve some type safety
This commit is contained in:
parent
cae117951b
commit
905aef22fa
6 changed files with 19 additions and 2 deletions
|
@ -10,8 +10,12 @@ parameters:
|
|||
|
||||
# Ignore errors caused by no type hints on class properties, as that's not available till PHP 7.4
|
||||
- '#Property .+? has no typehint specified.#'
|
||||
|
||||
# Ignore errors caused by missing phpdoc strings for arrays
|
||||
- '#Method .+? has parameter .+? with no value type specified in iterable type array.#'
|
||||
level:
|
||||
7
|
||||
paths:
|
||||
- %rootDir%/../../../lib
|
||||
- %rootDir%/../../../www
|
||||
- %rootDir%/../../../scripts
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?
|
||||
use function Safe\apcu_fetch;
|
||||
use function Safe\ksort;
|
||||
use function Safe\preg_replace;
|
||||
use function Safe\touch;
|
||||
use function Safe\unlink;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?
|
||||
use function Safe\file_get_contents;
|
||||
use function Safe\file_put_contents;
|
||||
use function Safe\rename;
|
||||
use function Safe\tempnam;
|
||||
|
@ -34,9 +35,9 @@ class OpdsFeed{
|
|||
$xml->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/');
|
||||
$xml->registerXPathNamespace('schema', 'http://schema.org/');
|
||||
|
||||
$feedEntry = $xml->xpath('/feed/entry[id="' . $this->Id . '"]/updated')[0];
|
||||
$feedEntry = ($xml->xpath('/feed/entry[id="' . $this->Id . '"]/updated') ?? [])[0];
|
||||
$feedEntry[0] = $updatedTimestamp;
|
||||
file_put_contents(WEB_ROOT . '/opds/index.xml', str_replace(" ns=", " xmlns=", $xml->asXml()));
|
||||
file_put_contents(WEB_ROOT . '/opds/index.xml', str_replace(" ns=", " xmlns=", $xml->asXml() ?? ''));
|
||||
exec('se clean ' . WEB_ROOT . '/opds/index.xml');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?
|
||||
use function Safe\file_get_contents;
|
||||
use function Safe\getopt;
|
||||
use function Safe\krsort;
|
||||
use function Safe\preg_replace;
|
||||
use function Safe\strtotime;
|
||||
|
||||
$longopts = array("webroot:", "weburl:");
|
||||
$options = getopt("", $longopts);
|
||||
$webRoot = $options["webroot"] ?? "/standardebooks.org/web";
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?
|
||||
require_once('Core.php');
|
||||
use function Safe\glob;
|
||||
use function Safe\preg_replace;
|
||||
use function Safe\sort;
|
||||
|
||||
// Redirect to the latest version of the manual
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?
|
||||
require_once('Core.php');
|
||||
use Safe\DateTime;
|
||||
|
||||
$now = new DateTime('now', new DateTimeZone('UTC'));
|
||||
$ebooks = [];
|
||||
|
||||
try{
|
||||
$query = HttpInput::GetString('query', false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue