本文整理汇总了PHP中Session::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::notice方法的具体用法?PHP Session::notice怎么用?PHP Session::notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::notice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_preview_theme
/**
* Configures a theme to be active for the current user's session.
*/
public function get_preview_theme()
{
$theme_name = $this->handler_vars['theme_name'];
$theme_dir = $this->handler_vars['theme_dir'];
if (isset($theme_name) && isset($theme_dir)) {
if (Themes::get_theme_dir() == $theme_dir) {
Themes::cancel_preview();
Session::notice(_t("Ended the preview of the theme '%s'", array($theme_name)));
} else {
if (Themes::preview_theme($theme_name, $theme_dir)) {
Session::notice(_t("Previewing theme '%s'", array($theme_name)));
}
}
}
Utils::redirect(URL::get('admin', 'page=themes'));
}
示例2: action_plugin_ui
public function action_plugin_ui($plugin_id, $action)
{
if ($plugin_id == $this->plugin_id()) {
$frequencies = array('manually' => _t('Manually', 'exportsnapshot'), 'hourly' => _t('Hourly', 'exportsnapshot'), 'daily' => _t('Daily', 'exportsnapshot'), 'weekly' => _t('Weekly', 'exportsnapshot'), 'monthly' => _t('Monthly', 'exportsnapshot'));
$types = array('blogml' => _t('BlogML', 'exportsnapshot'), 'wxr' => _t('WXR', 'exportsnapshot'));
switch ($action) {
case _t('Configure'):
$ui = new FormUI('export');
$ui->append('text', 'exportsnapshot_max_snapshots', 'option:exportsnapshot__max_snapshots', _t('Max Snapshots to Save:', 'exportsnapshot'));
$ui->append('select', 'exportsnapshot_freq', 'option:exportsnapshot__frequency', _t('Auto Snapshot frequency:', 'exportsnapshot'), $frequencies);
$ui->append('select', 'exportsnapshot_type', 'option:exportsnapshot__type', _t('Type of export:', 'exportsnapshot'), $types);
$ui->append('submit', 'save', _t('Save'));
$ui->on_success(array($this, 'updated_config'));
$ui->out();
break;
case _t('Take Snapshot'):
self::run('manual');
Session::notice(_t('Snapshot saved!', 'exportsnapshot'));
//CronTab::add_single_cron('snapshot_single', array( 'ExportSnapshot', 'run' ), HabariDateTime::date_create(), 'Run a single snapshot.' );
//Session::notice( _t( 'Snapshot scheduled for next cron run.' ) );
// don't display the configuration page, just redirect back to the plugin page
Utils::redirect(URL::get('admin', 'page=plugins'));
break;
}
}
}
示例3: filter_rssblocks_update
public function filter_rssblocks_update($success, $force = false)
{
EventLog::log('Running rrsblocks update');
$blocks = DB::get_results('SELECT b.* FROM {blocks} b WHERE b.type = ?', array('rssblock'), 'Block');
Plugins::act('get_blocks', $blocks);
$success = true;
foreach ($blocks as $block) {
$cachename = array('rssblock', md5($block->feed_url));
if ($force || Cache::expired($cachename)) {
$r = new RemoteRequest($block->feed_url);
$r->set_timeout(10);
$r->execute();
$feed = $r->get_response_body();
try {
if (is_string($feed)) {
new SimpleXMLElement($feed);
// This throws an exception if the feed isn't valid
Cache::set($cachename, $feed, 3600, true);
}
} catch (Exception $e) {
$success = false;
}
}
}
Session::notice('ran rssblocks update');
return $success;
}
示例4: action_plugin_activation
public function action_plugin_activation($file)
{
if (realpath($file) == __FILE__) {
Modules::add('Technorati');
Session::notice(_t('Please set your Technorati API Key in the configuration.'));
Options::set('technorati__apikey', '');
}
}
示例5: updated_config
public function updated_config(FormUI $ui)
{
Session::notice(_t('Settings saved.', 's3siloplugin'));
$ui->save();
if (is_null(Options::get('s3_bucket'))) {
Session::notice(_t('Please select a bucket from your S3 account.', 's3siloplugin'));
}
Utils::redirect();
}
示例6: updated_config
public function updated_config(FormUI $ui)
{
$blacklist = explode("\n", $ui->blacklist->value);
$blacklist = array_unique($blacklist);
natsort($blacklist);
$_POST[$ui->blacklist->field] = implode("\n", $blacklist);
Session::notice(_t('Blacklist saved.', 'simpleblacklist'));
$ui->save();
}
示例7: action_theme_activated
/**
* On theme activation, activate some default blocks
*/
public function action_theme_activated()
{
$blocks = $this->get_blocks('primary', '', $this);
if (count($blocks) == 0) {
$block = new Block(array('title' => _t('Posts'), 'type' => 'grayposts'));
$block->add_to_area('primary');
Session::notice(_t('Added default blocks to theme areas.'));
}
}
示例8: action_theme_activated
/**
* Add the K2 menu block to the nav area upon theme activation if there's nothing already there
*/
public function action_theme_activated()
{
$blocks = $this->get_blocks('nav', 0, $this);
if (count($blocks) == 0) {
$block = new Block(array('title' => _t('K2 Menu'), 'type' => 'k2_menu'));
$block->add_to_area('nav');
Session::notice(_t('Added K2 Menu block to Nav area.'));
}
}
示例9: filter_do_replace
/**
* Handler FormUI success action and do the replacement
**/
public function filter_do_replace($show_form, $form)
{
if (DB::query('UPDATE {posts} SET content = REPLACE(content, ? , ?)', array($form->search->value, $form->replace->value))) {
Session::notice(sprintf(_t('Successfully replaced \'%s\' with \'%s\' in all posts'), $form->search->value, $form->replace->value));
Utils::redirect(URL::get('admin', array('page' => 'plugins', 'configure' => Plugins::id_from_file(__FILE__), 'configaction' => _t('Replace'))), false);
} else {
Session::error(_t('There was an error with replacement.'));
}
return false;
}
示例10: act_uninstall
public function act_uninstall($handler, $theme)
{
try {
$package = HabariPackages::remove($handler->handler_vars['guid']);
Session::notice("{$package->name} {$package->version} was uninstalled.");
} catch (Exception $e) {
Session::error('Could not complete uninstall: ' . $e->getMessage());
if (DEBUG) {
Utils::debug($e);
}
}
}
示例11: updated_config
/**
* Save updated configuration
*/
public function updated_config($ui)
{
$msg = _t("Maintenance Mode configuration updated");
$msg .= "<br/>";
if ($ui->in_maintenance->value === FALSE) {
$msg .= _t("The site is not in maintenance mode");
} else {
$msg .= _t("The site is in maintenance mode");
}
Session::notice($msg);
$ui->save();
}
示例12: ajax_tags
/**
* Handles AJAX from /admin/tags
* Used to delete and rename tags
*/
public function ajax_tags($handler_vars)
{
Utils::check_request_method(array('POST'));
$wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
if ($handler_vars['digest'] != $wsse['digest']) {
Session::error(_t('WSSE authentication failed.'));
echo Session::messages_get(true, array('Format', 'json_messages'));
return;
}
$tag_names = array();
$theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
$this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
$action = $this->handler_vars['action'];
switch ($action) {
case 'delete':
foreach ($_POST as $id => $delete) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $delete) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->term_display;
Tags::vocabulary()->delete_term($tag);
}
}
$msg_status = _n(_t('Tag %s has been deleted.', array(implode('', $tag_names))), _t('%d tags have been deleted.', array(count($tag_names))), count($tag_names));
Session::notice($msg_status);
break;
case 'rename':
if (!isset($this->handler_vars['master'])) {
Session::error(_t('Error: New name not specified.'));
echo Session::messages_get(true, array('Format', 'json_messages'));
return;
}
$master = $this->handler_vars['master'];
$tag_names = array();
foreach ($_POST as $id => $rename) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $rename) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->term_display;
}
}
Tags::vocabulary()->merge($master, $tag_names);
$msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
Session::notice($msg_status);
break;
}
$this->theme->tags = Tags::vocabulary()->get_tree();
$this->theme->max = Tags::vocabulary()->max_count();
echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
}
示例13: action_plugin_activation
public function action_plugin_activation($file)
{
if ($file == str_replace('\\', '/', $this->get_file())) {
CpgDb::registerTables();
//Options::set( 'cpg__db_version', CpgDb::DB_VERSION );
CpgOptions::setDbVersion(CpgDb::DB_VERSION);
if (CpgDb::install()) {
Session::notice(_t('Created the CPG database tables.', 'cpg'));
} else {
Session::error(_t('Could not install CPG database tables.', 'cpg'));
}
}
}
示例14: action_admin_theme_get_rules
function action_admin_theme_get_rules($handler, $theme)
{
$handler_vars = $handler->handler_vars;
if (isset($handler_vars['names'])) {
foreach ($handler_vars['names'] as $key => $name) {
$changes = array('name' => $name, 'parse_regex' => $handler_vars['regexes'][$key], 'action' => $handler_vars['actions'][$key], 'priority' => $handler_vars['priorities'][$key], 'description' => $handler_vars['descriptions'][$key]);
self::add_rewrite_rule($key, $changes);
}
Session::notice(_t('Rewrite rules updated.'));
Utils::redirect();
}
$theme->display('rules');
exit;
}
示例15: action_template_header
function action_template_header($theme)
{
// Add the HTML5 shiv for IE < 9
Stack::add('template_header_javascript', array('http://cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.js', null, '<!--[if lt IE 9]>%s<![endif]-->'), 'html5_shiv');
// Add this line to your config.php to show an error and a notice, and
// to process the raw LESS code via javascript instead of the rendered CSS: define('DEBUG_THEME', 1);
if (defined('DEBUG_THEME')) {
Session::error('This is a <b>sample error</b>');
Session::notice('This is a <b>sample notice</b> for ' . $_SERVER['REQUEST_URI']);
Stack::add('template_header_javascript', $theme->get_url('/less/less-1.3.0.min.js'), 'less');
Stack::add('template_stylesheet', array($theme->get_url('/less/style.less'), null, array('type' => null, 'rel' => 'stylesheet/less')), 'style');
} else {
Stack::add('template_stylesheet', $theme->get_url('/css/style.css'), 'style');
}
}