Updated FML to newest version

This commit is contained in:
Jocy
2017-04-02 16:32:57 +02:00
parent 83710a9269
commit c5926aded2
21 changed files with 1425 additions and 995 deletions

View File

@ -215,15 +215,19 @@ class Dico
* Remove entries of the given id
*
* @api
* @param string $entryId Entry id that should be removed
* @param string $entryId Entry id that should be removed
* @param string $language (optional) Only remove entry from the given language
* @return static
*/
public function removeEntry($entryId)
public function removeEntry($entryId, $language = null)
{
$entryId = (string)$entryId;
foreach ($this->entries as $language => $entries) {
if (isset($this->entries[$language][$entryId])) {
unset($this->entries[$language][$entryId]);
foreach ($this->entries as $languageKey => $entries) {
if ($language && $language !== $languageKey) {
continue;
}
if (isset($this->entries[$languageKey][$entryId])) {
unset($this->entries[$languageKey][$entryId]);
}
}
return $this;
@ -245,6 +249,19 @@ class Dico
return $this;
}
/**
* Remove entries
*
* @api
* @return static
* @deprecated Use removeAllEntries()
* @see Dico::removeAllEntries()
*/
public function removeEntries()
{
return $this->removeAllEntries();
}
/**
* Remove all entries
*

View File

@ -2,7 +2,9 @@
namespace FML\Elements;
use FML\Stylesheet\Style;
use FML\Types\BackgroundColorable;
use FML\Types\BgColorable;
use FML\Types\Renderable;
use FML\Types\Styleable;
use FML\Types\TextFormatable;
@ -10,11 +12,13 @@ use FML\Types\TextFormatable;
/**
* Format Element
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @deprecated Use Style
* @see Style
*/
class Format implements BackgroundColorable, Renderable, Styleable, TextFormatable
class Format implements BackgroundColorable, BgColorable, Renderable, Styleable, TextFormatable
{
/**
@ -22,6 +26,11 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab
*/
protected $backgroundColor = null;
/**
* @var string $focusBackgroundColor Focus background color
*/
protected $focusBackgroundColor = null;
/**
* @var string $style Style
*/
@ -64,7 +73,7 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab
}
/**
* @see BgColorable::getBackgroundColor()
* @see BackgroundColorable::getBackgroundColor()
*/
public function getBackgroundColor()
{
@ -72,7 +81,7 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab
}
/**
* @see BgColorable::setBackgroundColor()
* @see BackgroundColorable::setBackgroundColor()
*/
public function setBackgroundColor($backgroundColor)
{
@ -80,6 +89,32 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab
return $this;
}
/**
* @deprecated Use setBackgroundColor()
* @see Format::setBackgroundColor()
*/
public function setBgColor($bgColor)
{
return $this->setBackgroundColor($bgColor);
}
/**
* @see BackgroundColorable::getFocusBackgroundColor()
*/
public function getFocusBackgroundColor()
{
return $this->focusBackgroundColor;
}
/**
* @see BackgroundColorable::setFocusBackgroundColor()
*/
public function setFocusBackgroundColor($focusBackgroundColor)
{
$this->focusBackgroundColor = (string)$focusBackgroundColor;
return $this;
}
/**
* @see Styleable::getStyle()
*/
@ -191,6 +226,9 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab
if ($this->backgroundColor) {
$domElement->setAttribute("bgcolor", $this->backgroundColor);
}
if ($this->focusBackgroundColor) {
$domElement->setAttribute("bgcolorfocus", $this->focusBackgroundColor);
}
if ($this->style) {
$domElement->setAttribute("style", $this->style);
}

View File

@ -2,6 +2,7 @@
namespace FML\Elements;
use FML\Stylesheet\Style;
use FML\Types\Container;
use FML\Types\Identifiable;
use FML\Types\Renderable;
@ -113,14 +114,23 @@ class FrameModel implements Container, Identifiable, Renderable
/**
* @see Container::addChild()
*/
public function addChild(Renderable $childElement)
public function addChild(Renderable $child)
{
if (!in_array($childElement, $this->children, true)) {
array_push($this->children, $childElement);
if (!in_array($child, $this->children, true)) {
array_push($this->children, $child);
}
return $this;
}
/**
* @deprecated Use addChild()
* @see FrameModel::addChild()
*/
public function add(Renderable $child)
{
return $this->addChild($child);
}
/**
* @see Container::addChildren()
*/
@ -142,15 +152,29 @@ class FrameModel implements Container, Identifiable, Renderable
}
/**
* @see Container::getFormat()
* @deprecated Use removeAllChildren()
* @see FrameModel::removeAllChildren()
*/
public function getFormat()
public function removeChildren()
{
return $this->removeAllChildren();
}
/**
* @deprecated Use Style
* @see Style
*/
public function getFormat($createIfEmpty = true)
{
if (!$this->format && $createIfEmpty) {
$this->setFormat(new Format());
}
return $this->format;
}
/**
* @see Container::setFormat()
* @deprecated Use Style
* @see Style
*/
public function setFormat(Format $format = null)
{