2014-01-12 00:51:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\ManiaCode;
|
|
|
|
|
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* ManiaCode Element for going to a link
|
2014-01-12 00:51:46 +01:00
|
|
|
*
|
2014-06-21 03:18:21 +02:00
|
|
|
* @author steeffeen
|
2017-03-25 18:40:15 +01:00
|
|
|
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
|
2014-06-21 03:18:21 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
2017-03-25 18:40:15 +01:00
|
|
|
class Go_To implements Element
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string $link Link
|
|
|
|
*/
|
|
|
|
protected $link = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new Go_To Element
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $link (optional) Link
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public static function create($link = null)
|
|
|
|
{
|
|
|
|
return new static($link);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new Go_To Element
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $link (optional) Link
|
|
|
|
*/
|
|
|
|
public function __construct($link = null)
|
|
|
|
{
|
|
|
|
if ($link) {
|
|
|
|
$this->setLink($link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the link
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getLink()
|
|
|
|
{
|
|
|
|
return $this->link;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the link
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $link Link
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setLink($link)
|
|
|
|
{
|
|
|
|
$this->link = (string)$link;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Element::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument)
|
|
|
|
{
|
|
|
|
$domElement = $domDocument->createElement("goto");
|
|
|
|
|
|
|
|
$linkElement = $domDocument->createElement("link", $this->link);
|
|
|
|
$domElement->appendChild($linkElement);
|
|
|
|
|
|
|
|
return $domElement;
|
|
|
|
}
|
|
|
|
|
2014-01-12 00:51:46 +01:00
|
|
|
}
|