CreateHeader.inc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /**
  3. * Create header
  4. *
  5. * @category Phpdocx
  6. * @package elements
  7. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  8. * (http://www.2mdc.com)
  9. * @license LGPL
  10. * @version 1.0
  11. * @link http://www.phpdocx.com
  12. * @since File available since Release 1.0
  13. */
  14. include_once dirname(__FILE__) . '/CreateElement.inc';
  15. /**
  16. * Create header
  17. *
  18. * @category Phpdocx
  19. * @package elements
  20. * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
  21. * (http://www.2mdc.com)
  22. * @license http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
  23. * @version 1.0
  24. * @link http://www.phpdocx.com
  25. * @since Class available since Release 1.0
  26. */
  27. class CreateHeader extends CreateElement
  28. {
  29. /**
  30. *
  31. * @var CreateFooter
  32. * @access private
  33. * @static
  34. */
  35. private static $_instance = NULL;
  36. /**
  37. * Construct
  38. *
  39. * @access public
  40. */
  41. public function __construct()
  42. {
  43. }
  44. /**
  45. * Destruct
  46. *
  47. * @access public
  48. */
  49. public function __destruct()
  50. {
  51. }
  52. /**
  53. *
  54. * @return string
  55. * @access public
  56. */
  57. public function __toString()
  58. {
  59. return $this->_xml;
  60. }
  61. /**
  62. *
  63. * @return CreateHeader
  64. * @access public
  65. * @static
  66. */
  67. public static function getInstance()
  68. {
  69. if (self::$_instance == NULL) {
  70. self::$_instance = new CreateHeader();
  71. }
  72. return self::$_instance;
  73. }
  74. /**
  75. * Generate w:p
  76. *
  77. * @access protected
  78. */
  79. protected function generateP()
  80. {
  81. $xml = '<' . CreateElement::NAMESPACEWORD .
  82. ':p>__GENERATEP__</' . CreateElement::NAMESPACEWORD .
  83. ':p>__GENERATEHDR__';
  84. $this->_xml = str_replace('__GENERATEHDR__', $xml, $this->_xml);
  85. }
  86. /**
  87. * Generate hdr token
  88. *
  89. * @access protected
  90. */
  91. protected function generateHDR()
  92. {
  93. //$this->_xml = '__GENERATEHDR____GENERATEHDRIMG__';
  94. $this->_xml = '__GENERATEHDR__';
  95. }
  96. /**
  97. * Create header
  98. *
  99. * @access public
  100. * @param string args[0]
  101. * @param array args[1]
  102. */
  103. public function createHeader()
  104. {
  105. $this->_xml = '';
  106. $args = func_get_args();
  107. $text = CreateText::getInstance();
  108. $text->createText($args[0], $args[1]);
  109. $this->generateHDR();
  110. $this->_xml = str_replace(
  111. // '__GENERATEHDR__', (string) $text . '__GENERATEHDR__',
  112. '__GENERATEHDR__', (string) $text,
  113. $this->_xml
  114. );
  115. }
  116. }