2014-03-07 23:08:09 +01:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-03-26 16:33:20 +07:00
|
|
|
* PHPWord
|
2014-03-07 23:08:09 +01:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
2014-03-07 23:08:09 +01:00
|
|
|
*/
|
|
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
namespace PhpOffice\PhpWord;
|
2014-03-07 23:08:09 +01:00
|
|
|
|
2014-04-01 15:01:30 +07:00
|
|
|
use PhpOffice\PhpWord\Media;
|
|
|
|
|
use PhpOffice\PhpWord\Element\Footnote as FootnoteElement;
|
|
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Footnote
|
|
|
|
|
*/
|
2014-03-22 10:06:08 +04:00
|
|
|
class Footnote
|
2014-03-11 19:26:56 +07:00
|
|
|
{
|
|
|
|
|
/**
|
2014-04-01 15:01:30 +07:00
|
|
|
* Footnote elements
|
2014-03-11 19:26:56 +07:00
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2014-04-01 15:01:30 +07:00
|
|
|
private static $elements = array();
|
2014-03-11 19:26:56 +07:00
|
|
|
|
|
|
|
|
/**
|
2014-04-01 15:01:30 +07:00
|
|
|
* Add new footnote
|
2014-03-11 19:26:56 +07:00
|
|
|
*
|
2014-04-01 15:01:30 +07:00
|
|
|
* @param FootnoteElement $footnote
|
2014-03-28 13:50:53 +07:00
|
|
|
* @return int Reference ID
|
2014-03-11 19:26:56 +07:00
|
|
|
*/
|
2014-04-01 15:01:30 +07:00
|
|
|
public static function addFootnoteElement(FootnoteElement $footnote)
|
2014-03-11 19:26:56 +07:00
|
|
|
{
|
2014-04-01 15:01:30 +07:00
|
|
|
$refID = self::countFootnoteElements() + 1;
|
2014-03-11 19:26:56 +07:00
|
|
|
|
2014-04-01 15:01:30 +07:00
|
|
|
self::$elements[] = $footnote;
|
2014-03-11 19:26:56 +07:00
|
|
|
|
|
|
|
|
return $refID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Footnote Elements
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public static function getFootnoteElements()
|
|
|
|
|
{
|
2014-04-01 15:01:30 +07:00
|
|
|
return self::$elements;
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Footnote Elements Count
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public static function countFootnoteElements()
|
|
|
|
|
{
|
2014-04-01 15:01:30 +07:00
|
|
|
return count(self::$elements);
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
|
|
|
|
|
2014-04-05 00:57:50 +07:00
|
|
|
/**
|
|
|
|
|
* Reset footer elements
|
|
|
|
|
*/
|
|
|
|
|
public static function reset()
|
|
|
|
|
{
|
|
|
|
|
self::$elements = array();
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-11 19:26:56 +07:00
|
|
|
/**
|
|
|
|
|
* Add new Footnote Link Element
|
|
|
|
|
*
|
2014-03-17 07:26:25 +07:00
|
|
|
* @param string $linkSrc
|
2014-03-28 13:50:53 +07:00
|
|
|
* @return int Reference ID
|
2014-04-01 15:01:30 +07:00
|
|
|
* @deprecated 0.9.2
|
2014-04-03 11:34:06 +07:00
|
|
|
* @codeCoverageIgnore
|
2014-03-11 19:26:56 +07:00
|
|
|
*/
|
|
|
|
|
public static function addFootnoteLinkElement($linkSrc)
|
|
|
|
|
{
|
2014-04-05 19:02:49 +07:00
|
|
|
return Media::addElement('footnotes', 'link', $linkSrc);
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Footnote Link Elements
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
2014-04-01 15:01:30 +07:00
|
|
|
* @deprecated 0.9.2
|
2014-04-03 11:34:06 +07:00
|
|
|
* @codeCoverageIgnore
|
2014-03-11 19:26:56 +07:00
|
|
|
*/
|
|
|
|
|
public static function getFootnoteLinkElements()
|
|
|
|
|
{
|
2014-04-05 19:02:49 +07:00
|
|
|
return Media::getElements('footnotes', 'link');
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|
|
|
|
|
}
|