Files
dominik/public/system/library/document.php
T
2026-05-30 09:27:58 +03:00

170 lines
2.7 KiB
PHP

<?php
/**
* @package OpenCart
* @author Daniel Kerr
* @copyright Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link https://www.opencart.com
*/
/**
* Document class
*/
class Document {
private $title;
private $robots;
private $description;
private $keywords;
private $links = array();
private $styles = array();
private $scripts = array();
private $og_image;
/**
*
*
* @param string $title
*/
public function setTitle($title) {
$this->title = $title;
}
/**
*
*
* @return string
*/
public function getTitle() {
return $this->title;
}
public function setRobots($robots) {
$this->robots = $robots;
}
public function getRobots() {
return $this->robots;
}
/**
*
*
* @param string $description
*/
public function setDescription($description) {
$this->description = $description;
}
/**
*
*
* @param string $description
*
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
*
*
* @param string $keywords
*/
public function setKeywords($keywords) {
$this->keywords = $keywords;
}
/**
*
*
* @return string
*/
public function getKeywords() {
return $this->keywords;
}
/**
*
*
* @param string $href
* @param string $rel
*/
public function addLink($href, $rel) {
$this->links[$href] = array(
'href' => $href,
'rel' => $rel
);
}
/**
*
*
* @return array
*/
public function getLinks() {
return $this->links;
}
/**
*
*
* @param string $href
* @param string $rel
* @param string $media
*/
public function addStyle($href, $rel = 'stylesheet', $media = 'screen', $position = 'header') {
$this->styles[$position][$href] = array(
'href' => $href,
'rel' => $rel,
'media' => $media
);
}
/**
*
*
* @return array
*/
public function getStyles($position = 'header') {
if (isset($this->styles[$position])) {
return $this->styles[$position];
} else {
return array();
}
}
/**
*
*
* @param string $href
* @param string $position
*/
public function addScript($href, $position = 'header') {
$this->scripts[$position][$href] = $href;
}
/**
*
*
* @param string $position
*
* @return array
*/
public function getScripts($position = 'header') {
if (isset($this->scripts[$position])) {
return $this->scripts[$position];
} else {
return array();
}
}
public function setOgImage($image) {
$this->og_image = $image;
}
public function getOgImage() {
return $this->og_image;
}
}