mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-05-21 05:40:47 +00:00
WEB: Fix PHP array key warnings
This commit is contained in:
@@ -29,6 +29,7 @@ class CompatibilityModel extends BasicModel
|
||||
if ($version === 'DEV') {
|
||||
$version = "99.99.99";
|
||||
}
|
||||
$cachekey = $version;
|
||||
$version = \explode('.', $version);
|
||||
$data = CompatibilityQuery::create()
|
||||
->withColumn("max(release_date)")
|
||||
@@ -44,7 +45,7 @@ class CompatibilityModel extends BasicModel
|
||||
->filterByReleaseDate($releaseDate, Criteria::LESS_EQUAL)
|
||||
->endUse()
|
||||
->find();
|
||||
$this->saveToCache($data, $version);
|
||||
$this->saveToCache($data, $cachekey);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class DownloadsModel extends BasicModel
|
||||
$sections[$category] = new DownloadsSection([
|
||||
'anchor' => $category,
|
||||
'title' => $sectionsData[$category]['title'],
|
||||
'notes' => $sectionsData[$category]['notes']
|
||||
'notes' => $sectionsData[$category]['notes'] ?? null
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class DownloadsModel extends BasicModel
|
||||
$sections[$category]->addSubsection(new DownloadsSection([
|
||||
'anchor' => $subCategory,
|
||||
'title' => $sectionsData[$subCategory]['title'],
|
||||
'notes' => $sectionsData[$subCategory]['notes']
|
||||
'notes' => $sectionsData[$subCategory]['notes'] ?? null
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class GameDownloadsModel extends BasicModel
|
||||
$sections[$category] = new DownloadsSection([
|
||||
'anchor' => $category,
|
||||
'title' => $sectionsData[$category]['title'],
|
||||
'notes' => $sectionsData[$category]['notes']
|
||||
'notes' => $sectionsData[$category]['notes'] ?? null
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class GameDownloadsModel extends BasicModel
|
||||
$sections[$category]->addSubsection(new DownloadsSection([
|
||||
'anchor' => $gameId,
|
||||
'title' => $gameName,
|
||||
'notes' => $sectionsData[$gameId]['notes']
|
||||
'notes' => $sectionsData[$gameId]['notes'] ?? null
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ class Article extends BasicObject
|
||||
public function __construct($data)
|
||||
{
|
||||
parent::__construct($data);
|
||||
$this->url = $data['url'];
|
||||
$this->language = $data['language'];
|
||||
$this->source = $data['source'];
|
||||
$this->date = $data['date'];
|
||||
$this->url = $data['url'] ?? null;
|
||||
$this->language = $data['language'] ?? null;
|
||||
$this->source = $data['source'] ?? null;
|
||||
$this->date = $data['date'] ?? null;
|
||||
}
|
||||
|
||||
/* Get the URL. */
|
||||
|
||||
@@ -12,8 +12,8 @@ abstract class BasicObject
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->description = $data['description'];
|
||||
$this->name = $data['name'];
|
||||
$this->description = $data['description'] ?? null;
|
||||
$this->name = $data['name'] ?? null;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
||||
@@ -16,8 +16,8 @@ class File extends BasicObject
|
||||
{
|
||||
parent::__construct($data);
|
||||
$this->category_icon = $data['category_icon'];
|
||||
$this->extra_info = $data['extra_info'];
|
||||
$this->type = strtolower($data['type']);
|
||||
$this->extra_info = $data['extra_info'] ?? null;
|
||||
$this->type = strtolower($data['type'] ?? '');
|
||||
$this->user_agent = isset($data["user_agent"]) ? $data["user_agent"] : "";
|
||||
|
||||
$fname = "";
|
||||
@@ -93,7 +93,8 @@ class File extends BasicObject
|
||||
* Get the filesize/last modified information and put it in
|
||||
* $this->extra_info.
|
||||
*/
|
||||
if ($attributes['extra_info'] == 'true') {
|
||||
if (isset($attributes['extra_info'])
|
||||
&& $attributes['extra_info'] == 'true') {
|
||||
if (is_file($fname) && is_readable($fname)) {
|
||||
$this->extra_info['date'] = date('F j, Y, g:i a', @filemtime($fname));
|
||||
if (!is_null($data['extra_info'])) {
|
||||
|
||||
@@ -52,8 +52,8 @@ class CompatibilityPage extends Controller
|
||||
/* Display the index page. */
|
||||
public function index($args)
|
||||
{
|
||||
$version = $args['version'];
|
||||
$target = $args['game'];
|
||||
$version = $args['version'] ?? null;
|
||||
$target = $args['game'] ?? null;
|
||||
|
||||
$versions = VersionQuery::create()
|
||||
->orderByMajor('desc')
|
||||
|
||||
@@ -22,7 +22,7 @@ class NewsPage extends Controller
|
||||
/* Display the index page. */
|
||||
public function index($args)
|
||||
{
|
||||
$filename = $args['date'];
|
||||
$filename = $args['date'] ?? null;
|
||||
|
||||
if ($filename != null) {
|
||||
if (strtolower($filename) == 'archive' || $filename == '') {
|
||||
|
||||
@@ -18,8 +18,8 @@ class ScreenshotsPage extends Controller
|
||||
/* Display the index page. */
|
||||
public function index($args)
|
||||
{
|
||||
$category = $args['category'];
|
||||
$game = $args['game'];
|
||||
$category = $args['category'] ?? null;
|
||||
$game = $args['game'] ?? null;
|
||||
|
||||
$this->addJSFiles(
|
||||
array(
|
||||
@@ -27,7 +27,7 @@ class ScreenshotsPage extends Controller
|
||||
)
|
||||
);
|
||||
|
||||
if (!empty($category)) {
|
||||
if ($category) {
|
||||
return $this->getCategory($category, $game);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<{if $article}article{else}section{/if} class="box" {if $id}id="{$id}" {/if}>
|
||||
{if $head}
|
||||
<{if isset($article)}article{else}section{/if} class="box" {if isset($id)}id="{$id}" {/if}>
|
||||
{if isset($head)}
|
||||
<header class="head">
|
||||
{$head}
|
||||
</header>
|
||||
{/if}
|
||||
{if $intro}
|
||||
{if isset($intro)}
|
||||
<section class="intro">
|
||||
{$intro}
|
||||
</section>
|
||||
@@ -12,4 +12,4 @@
|
||||
<section class="content">
|
||||
{$content}
|
||||
</section>
|
||||
</{if $article}article{else}section{/if}>
|
||||
</{if isset($article)}article{else}section{/if}>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<section class="round-box">
|
||||
{if $header}
|
||||
{if isset($header)}
|
||||
<header class="header">
|
||||
{$header}
|
||||
</header>
|
||||
{/if}
|
||||
<section class="content{if $class} {$class}{/if}">
|
||||
<section class="content{if isset($class)} {$class}{/if}">
|
||||
{$content}
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<link rel="stylesheet" href="/css/{$filename}">
|
||||
{/foreach}
|
||||
|
||||
{if $smarty.cookies.cookie_consent == "true"}
|
||||
{if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "true"}
|
||||
<!-- Matomo -->
|
||||
<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
@@ -155,7 +155,7 @@
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{if $smarty.cookies.cookie_consent == "true"}
|
||||
{if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "true"}
|
||||
{* Google analytics javascript. *}
|
||||
<script src="https://www.google-analytics.com/urchin.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
@@ -164,7 +164,7 @@
|
||||
urchinTracker();
|
||||
</script>
|
||||
{* End Google analytics javascript. *}
|
||||
{else if $smarty.cookies.cookie_consent == "false"}
|
||||
{else if isset($smarty.cookies.cookie_consent) && $smarty.cookies.cookie_consent == "false"}
|
||||
{* Do nothing *}
|
||||
{else}
|
||||
{include file='components/cookie.tpl'}
|
||||
|
||||
Reference in New Issue
Block a user