document.php (2451B)
1 <?php 2 /** 3 * @package OpenCart 4 * @author Daniel Kerr 5 * @copyright Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/) 6 * @license https://opensource.org/licenses/GPL-3.0 7 * @link https://www.opencart.com 8 */ 9 10 /** 11 * Document class 12 */ 13 class Document { 14 private $title; 15 private $description; 16 private $keywords; 17 private $links = array(); 18 private $styles = array(); 19 private $scripts = array(); 20 21 /** 22 * 23 * 24 * @param string $title 25 */ 26 public function setTitle($title) { 27 $this->title = $title; 28 } 29 30 /** 31 * 32 * 33 * @return string 34 */ 35 public function getTitle() { 36 return $this->title; 37 } 38 39 /** 40 * 41 * 42 * @param string $description 43 */ 44 public function setDescription($description) { 45 $this->description = $description; 46 } 47 48 /** 49 * 50 * 51 * @param string $description 52 * 53 * @return string 54 */ 55 public function getDescription() { 56 return $this->description; 57 } 58 59 /** 60 * 61 * 62 * @param string $keywords 63 */ 64 public function setKeywords($keywords) { 65 $this->keywords = $keywords; 66 } 67 68 /** 69 * 70 * 71 * @return string 72 */ 73 public function getKeywords() { 74 return $this->keywords; 75 } 76 77 /** 78 * 79 * 80 * @param string $href 81 * @param string $rel 82 */ 83 public function addLink($href, $rel) { 84 $this->links[$href] = array( 85 'href' => $href, 86 'rel' => $rel 87 ); 88 } 89 90 /** 91 * 92 * 93 * @return array 94 */ 95 public function getLinks() { 96 return $this->links; 97 } 98 99 /** 100 * 101 * 102 * @param string $href 103 * @param string $rel 104 * @param string $media 105 */ 106 public function addStyle($href, $rel = 'stylesheet', $media = 'screen') { 107 $this->styles[$href] = array( 108 'href' => $href, 109 'rel' => $rel, 110 'media' => $media 111 ); 112 } 113 114 /** 115 * 116 * 117 * @return array 118 */ 119 public function getStyles() { 120 return $this->styles; 121 } 122 123 /** 124 * 125 * 126 * @param string $href 127 * @param string $postion 128 */ 129 public function addScript($href, $postion = 'header') { 130 $this->scripts[$postion][$href] = $href; 131 } 132 133 /** 134 * 135 * 136 * @param string $postion 137 * 138 * @return array 139 */ 140 public function getScripts($postion = 'header') { 141 if (isset($this->scripts[$postion])) { 142 return $this->scripts[$postion]; 143 } else { 144 return array(); 145 } 146 } 147 }