本文整理汇总了PHP中Templates::get_default方法的典型用法代码示例。如果您正苦于以下问题:PHP Templates::get_default方法的具体用法?PHP Templates::get_default怎么用?PHP Templates::get_default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Templates
的用法示例。
在下文中一共展示了Templates::get_default方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($data = array())
{
parent::__construct();
$this->entityType = 'article';
if (!empty($data['id'])) {
$CMS = new CMS();
$this->id = $data['id'];
$this->populate_object($CMS->get_entity_data($this));
}
$this->populate_object($data);
if (empty($this->template)) {
$templates = new Templates();
$defaultTemplate = $templates->get_default();
$this->template = $defaultTemplate['path'];
}
}
示例2: collect_article_files
private function collect_article_files($entity)
{
$files = array();
/* HTML OF ARTICLE */
$html = $this->get_html_content($entity);
/* VERIFY TEMPLATE */
if (file_exists($entity->template)) {
$template = $entity->template;
} else {
$templates = new Templates();
$defaultTemplate = $templates->get_default();
$template = $defaultTemplate['path'];
}
/* COLLECT ADDITIONAL FILES FROM A TEMPLATE (CMS) */
ob_start();
include_once $template;
ob_get_clean();
$templateFiles = $this->get_files_from_template($entity);
/* DOWNLOAD COLLECTED FILES FROM TEMPLATE FILES */
foreach ($templateFiles as $file) {
if (is_array($file)) {
foreach ($file as $key => $path) {
$files[$key] = $this->save_file(basename($key), $path);
}
} else {
if (is_string($file)) {
$files[$this->build_asset_path($file)] = $this->save_file(basename($file), $file);
}
}
}
/* PARSE HTML AND DOWNLOAD LINKED IMAGES / MEDIA / CSS / JS FILES */
$collected = $this->get_linked_assets_from_html($html, $entity);
$files = array_merge($files, $collected["assets"]);
$files["index.html"] = $this->make_file("index", (string) $collected["html"]);
/* VERIFY ARTICLE FILES */
foreach ($files as $key => $file) {
$size = filesize($file);
if ($size < 1 || $size === FALSE) {
unset($files[$key]);
}
}
/* CREATE ARTICLE MANIFEST */
$files["manifest.xml"] = $this->make_file("manifest", $this->create_article_manifest($files));
return $files;
}