2014-04-24 14:58:15 +07:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* PHPWord
|
|
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
2014-05-04 21:03:28 +04:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
2014-04-24 14:58:15 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace PhpOffice\PhpWord\Writer\HTML\Element;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Link element HTML writer
|
|
|
|
|
*
|
|
|
|
|
* @since 0.10.0
|
|
|
|
|
*/
|
|
|
|
|
class Link extends Element
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Write link
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function write()
|
|
|
|
|
{
|
2014-04-26 16:05:29 +07:00
|
|
|
$html = "<a href=\"{$this->element->getTarget()}\">{$this->element->getText()}</a>" . PHP_EOL;
|
2014-04-24 14:58:15 +07:00
|
|
|
if (!$this->withoutP) {
|
2014-04-26 16:05:29 +07:00
|
|
|
$html = '<p>' . $html . '</p>' . PHP_EOL;
|
2014-04-24 14:58:15 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
|
}
|
|
|
|
|
}
|