本文整理汇总了PHP中theme::save方法的典型用法代码示例。如果您正苦于以下问题:PHP theme::save方法的具体用法?PHP theme::save怎么用?PHP theme::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类theme
的用法示例。
在下文中一共展示了theme::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addThemeAction
/**
* Add a theme to the site
* @param string $thememodule
* @param string $name
* @param string $template
* @param string $patterntype
* @param string $url
* @return false
*/
protected function addThemeAction($thememodule, $name, $patterntype, $template, $url = '')
{
$name = \tools::sanitizeTechString($name);
if (!is_dir(PROFILE_PATH . $thememodule . '/themes/' . $name)) {
\tools::createDirectory(PROFILE_PATH . $thememodule . '/themes/' . $name, 0777);
if ($patterntype === 'template' && !empty($template)) {
list($oldModule, $oldName) = explode(';', $template);
$theme = array();
foreach (\app::$devices as $device) {
$theme[$device['name']] = \theme::get($oldModule, $oldName, $device['name']);
$theme[$device['name']]->setModule($thememodule);
$theme[$device['name']]->setName($name);
$theme[$device['name']]->onMove('theme', $thememodule, $name, $device['name'], TRUE);
}
if (is_dir('modules/' . $thememodule . '/themes/' . $oldName . '/')) {
\tools::copy_dir('modules/' . $thememodule . '/themes/' . $oldName . '/', PROFILE_PATH . $thememodule . '/themes/' . $name . '/');
} else {
\tools::copy_dir(PROFILE_PATH . $thememodule . '/themes/' . $oldName . '/', PROFILE_PATH . $thememodule . '/themes/' . $name . '/');
}
foreach (\app::$devices as $device) {
$theme[$device['name']]->save();
}
} else {
$theme = new \theme('container', $name, $thememodule);
$theme->save();
}
/* Set theme in preview mode */
setcookie('THEMEMODULE', $thememodule, time() + 60 * 60 * 24 * 30, '/');
setcookie('THEME', $name, time() + 60 * 60 * 24 * 30, '/');
$return = array('eval' => 'top.window.location.reload()', 'notification' => t('The Theme has been created'), 'notificationType' => 'positive');
} else {
$return = array('notification' => t('The Theme has not been created, theme already exists'), 'notificationType' => 'negative');
}
return $this->returnResult($return);
}
示例2: get
/**
* Serialize and Save this theme object
* @param string $module
* @param string $name
*/
public static function get($module, $name)
{
$file = stream_resolve_include_path($module . '/themes/' . $name . '/theme.' . \app::$config['dev']['serialization']);
if ($file) {
return \tools::unserialize(substr($file, 0, -4));
} else {
$theme = new theme('container', $name, $module);
$theme->save();
return $theme;
}
}