<?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 $description;
// 关键词
private $keywords;
// 链接
private $links = array();
//css 样式
private $styles = array();
// js脚本
private $scripts = array();
// 图片
private $image;
// url
private $url;
// 类型
private $type;
// 价格
private $price;
/**
*
* 设置标题
* @param string $title
*/
public function setTitle($title) {
$this->title = $title;
}
/**
*
* 获取标题
* @return string
*/
public function getTitle() {
return $this->title;
}
/**
*
* 设置描述
* @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') {
$this->styles[$href] = array(
'href' => $href,
'rel' => $rel,
'media' => $media
);
}
/**
*
* 获取样式
* @return array
*/
public function getStyles() {
return $this->styles;
}
/**
*
* 添加js
* @param string $href
* @param string $postion
*/
public function addScript($href, $postion = 'header') {
$this->scripts[$postion][$href] = $href;
}
/**
*
* 获取js
* @param string $postion
*
* @return array
*/
public function getScripts($postion = 'header') {
if (isset($this->scripts[$postion])) {
return $this->scripts[$postion];
} else {
return array();
}
}
}
【opencart3源码分析】文档类document.php
猜你喜欢
转载自blog.csdn.net/qq2942713658/article/details/81415967
今日推荐
周排行