From fd3a3056f171fe269c12fd2e9a332ab4fb45af03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sat, 14 Dec 2013 23:28:04 +0100 Subject: [PATCH] fml fix update --- application/core/FML/Script/Pages.php | 17 +++++++++++------ application/core/FML/Script/Tooltips.php | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/application/core/FML/Script/Pages.php b/application/core/FML/Script/Pages.php index 90f33e2b..31981cc9 100644 --- a/application/core/FML/Script/Pages.php +++ b/application/core/FML/Script/Pages.php @@ -97,13 +97,18 @@ class Pages implements Constants, Globals, Includes, Labels, ScriptFeature { } $constant .= '"__FML__Pages__Id__" => ["' . $page[2] . '"], '; $constant .= '"__FML__Pages__Ids__" => ['; - $subIndex = 0; - foreach ($page[1] as $pageId) { - $constant .= '"' . $pageId . '"'; - if ($subIndex < count($page[1]) - 1) { - $constant .= ', '; + if (count($page[1]) <= 0) { + $constant .= '""'; + } + else { + $subIndex = 0; + foreach ($page[1] as $pageId) { + $constant .= '"' . $pageId . '"'; + if ($subIndex < count($page[1]) - 1) { + $constant .= ', '; + } + $subIndex++; } - $subIndex++; } $constant .= ']]'; if ($index < count($this->pages) - 1) { diff --git a/application/core/FML/Script/Tooltips.php b/application/core/FML/Script/Tooltips.php index a69a2ada..46053a2c 100644 --- a/application/core/FML/Script/Tooltips.php +++ b/application/core/FML/Script/Tooltips.php @@ -47,13 +47,18 @@ class Tooltips implements Constants, Labels, ScriptFeature { */ public function getConstants() { $constant = '['; - $index = 0; - foreach ($this->tooltips as $hoverId => $tooltipId) { - $constant .= '"' . $hoverId . '" => "' . $tooltipId . '"'; - if ($index < count($this->tooltips) - 1) { - $constant .= ','; + if (count($this->tooltips) <= 0) { + $constant .= '"" => ""'; + } + else { + $index = 0; + foreach ($this->tooltips as $hoverId => $tooltipId) { + $constant .= '"' . $hoverId . '" => "' . $tooltipId . '"'; + if ($index < count($this->tooltips) - 1) { + $constant .= ','; + } + $index++; } - $index++; } $constant .= ']'; $constants = array();