本文整理汇总了PHP中Themes::activate_theme方法的典型用法代码示例。如果您正苦于以下问题:PHP Themes::activate_theme方法的具体用法?PHP Themes::activate_theme怎么用?PHP Themes::activate_theme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Themes
的用法示例。
在下文中一共展示了Themes::activate_theme方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_activate_theme
/**
* Activates a theme.
*/
public function get_activate_theme()
{
$theme_name = $this->handler_vars['theme_name'];
$theme_dir = $this->handler_vars['theme_dir'];
if (isset($theme_name) && isset($theme_dir)) {
Themes::activate_theme($theme_name, $theme_dir);
}
Session::notice(sprintf(_t("Activated theme '%s'"), $theme_name));
Utils::redirect(URL::get('admin', 'page=themes'));
}
示例2: get_activate_theme
/**
* Activates a theme.
*/
public function get_activate_theme()
{
$theme_name = $this->handler_vars['theme_name'];
$theme_dir = $this->handler_vars['theme_dir'];
$activated = false;
if (isset($theme_name) && isset($theme_dir)) {
$activated = Themes::activate_theme($theme_name, $theme_dir);
}
if ($activated) {
Session::notice(_t("Activated theme '%s'", array($theme_name)));
}
Utils::redirect(URL::get('admin', 'page=themes'));
}
示例3: get_activate_theme
/**
* Activates a theme.
*/
public function get_activate_theme()
{
$theme_name = $_GET['theme_name'];
$theme_dir = $_GET['theme_dir'];
$activated = false;
if (isset($theme_name) && isset($theme_dir)) {
$activated = Themes::activate_theme($theme_name, $theme_dir);
}
if ($activated) {
Session::notice(_t("Activated theme '%s'", array($theme_name)));
}
Utils::redirect(URL::get('display_themes'));
}
示例4: activate_theme
public function activate_theme()
{
$theme_dir = $this->handler_vars['theme_dir'];
if (!isset($theme_dir) || empty($theme_dir)) {
return;
}
// set the user_id in the session in case theme activation methods need it
if (!($u = User::get_by_name($this->handler_vars['admin_username']))) {
// @todo die gracefully
die(_t('No admin user found'));
}
$u->remember();
$themes = Themes::get_all_data();
$theme = $themes[$theme_dir];
Themes::activate_theme((string) $theme['info']->name, $theme_dir);
// unset the user_id session variable
Session::clear_userid($_SESSION['user_id']);
unset($_SESSION['user_id']);
}
示例5: create_default_options
/**
* Write the default options
*/
private function create_default_options()
{
// Create the default options
Options::set( 'installed', true );
Options::set( 'title', $this->handler_vars['blog_title'] );
Options::set( 'pagination', '5' );
Options::set( 'atom_entries', '5' );
Options::set( 'theme_name', 'k2' );
Options::set( 'theme_dir', 'k2' );
Themes::activate_theme( 'k2', 'k2' );
Options::set( 'comments_require_id', 1 );
Options::set( 'locale', $this->handler_vars['locale'] );
Options::set( 'timezone', 'UTC' );
Options::set( 'dateformat', 'Y-m-d' );
Options::set( 'timeformat', 'g:i a' );
Options::set( 'log_min_severity', 3 ); // the default logging level - 3 should be 'info'
Options::set( 'spam_percentage', 100 );
// generate a random-ish number to use as the salt for
// a SHA1 hash that will serve as the unique identifier for
// this installation. Also for use in cookies
Options::set( 'GUID', sha1( Utils::nonce() ) );
// Let's prepare the EventLog here, as well
EventLog::register_type( 'default', 'habari' );
EventLog::register_type( 'user', 'habari' );
EventLog::register_type( 'authentication', 'habari' );
EventLog::register_type( 'content', 'habari' );
EventLog::register_type( 'comment', 'habari' );
// Add the cronjob to trim the log so that it doesn't get too big
CronTab::add_daily_cron( 'trim_log', array( 'EventLog', 'trim' ), _t( 'Trim the log table' ) );
// Add the cronjob to check for plugin updates
CronTab::add_daily_cron( 'update_check', array( 'Update', 'cron' ), _t( 'Perform a check for plugin updates.' ) );
return true;
}