本文整理汇总了PHP中message::info方法的典型用法代码示例。如果您正苦于以下问题:PHP message::info方法的具体用法?PHP message::info怎么用?PHP message::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message
的用法示例。
在下文中一共展示了message::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
public function handler()
{
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
module::set_var("sitemap_xtra", "path", $form->sitemap->sitemap_path->value);
module::set_var("sitemap_xtra", "base_url", $form->sitemap->sitemap_base_url->value);
module::set_var("sitemap_xtra", "zip", $form->sitemap->sitemap_zip->value);
module::set_var("sitemap_xtra", "ping_yandex", $form->sitemap->sitemap_ping_yandex->value);
module::set_var("sitemap_xtra", "ping_google", $form->sitemap->sitemap_ping_google->value);
module::set_var("sitemap_xtra", "ping_bing", $form->sitemap->sitemap_ping_bing->value);
module::set_var("sitemap_xtra", "ping_ask", $form->sitemap->sitemap_ping_ask->value);
module::set_var("sitemap_xtra", "robots_txt", $form->sitemap->sitemap_robots_txt->value);
module::set_var("sitemap_xtra", "albums", $form->albums->sitemap_albums->value);
module::set_var("sitemap_xtra", "albums_freq", $form->albums->sitemap_albums_freq->value);
module::set_var("sitemap_xtra", "albums_prio", $form->albums->sitemap_albums_prio->value);
module::set_var("sitemap_xtra", "photos", $form->photos->sitemap_photos->value);
module::set_var("sitemap_xtra", "photos_freq", $form->photos->sitemap_photos_freq->value);
module::set_var("sitemap_xtra", "photos_prio", $form->photos->sitemap_photos_prio->value);
module::set_var("sitemap_xtra", "movies", $form->movies->sitemap_movies->value);
module::set_var("sitemap_xtra", "movies_freq", $form->movies->sitemap_movies_freq->value);
module::set_var("sitemap_xtra", "movies_prio", $form->movies->sitemap_movies_prio->value);
module::set_var("sitemap_xtra", "pages", $form->pages->sitemap_pages->value);
module::set_var("sitemap_xtra", "pages_freq", $form->pages->sitemap_pages_freq->value);
module::set_var("sitemap_xtra", "pages_prio", $form->pages->sitemap_pages_prio->value);
if ($form->build_sitemap->sitemap_build->value) {
if ($status = $this->_build_sitemap()) {
message::info($status);
}
}
message::success(t("Settings have been saved"));
url::redirect("admin/sitemap_xtra");
}
print $this->_get_view($form);
}
示例2: change
public function change()
{
access::verify_csrf();
$active_provider = module::get_var("gallery", "identity_provider", "user");
$providers = identity::providers();
$new_provider = Input::instance()->post("provider");
if ($new_provider != $active_provider) {
module::deactivate($active_provider);
// Switch authentication
identity::reset();
module::set_var("gallery", "identity_provider", $new_provider);
module::install($new_provider);
module::activate($new_provider);
module::event("identity_provider_changed", $active_provider, $new_provider);
module::uninstall($active_provider);
message::success(t("Changed to %description", array("description" => $providers->{$new_provider})));
try {
Session::instance()->destroy();
} catch (Exception $e) {
// We don't care if there was a problem destroying the session.
}
url::redirect(item::root()->abs_url());
}
message::info(t("The selected provider \"%description\" is already active.", array("description" => $providers->{$new_provider})));
url::redirect("admin/identity");
}
示例3: index
public function index()
{
if ($_POST) {
config::set('akismet.api_key', $this->input->post('akismet_api_key'));
message::info(__('Settings changed successfully'), 'admin/akismet');
} else {
$this->head->title->append(__('Settings'));
$this->template->title .= __('Settings');
$this->template->content = new View('akismet/settings');
$this->template->content->akismet_api_key = config::get('akismet.api_key');
}
}
示例4: index
public function index()
{
if ($_POST) {
config::set('google_analytics.id', $this->input->post('google_analytics_id'));
message::info('Settings changed successfully', 'admin/google_analytics');
} else {
$this->head->title->append('Settings');
$this->template->title .= 'Settings';
$this->template->content = new View('google_analytics/settings');
$this->template->content->google_analytics_id = config::get('google_analytics.id');
}
}
示例5: index
public function index()
{
$this->head->title->append(__('Settings'));
$this->template->title = __('Settings');
$form = Formo::factory()->plugin('csrf')->add('text', 'site_title', array('label' => __('Site title'), 'value' => config::get('s7n.site_title')))->add_select('theme', theme::available(), array('label' => __('Theme'), 'value' => config::get('s7n.theme')))->add('submit', 'submit', array('label' => __('Save')));
if ($form->validate()) {
config::set('s7n.site_title', $form->site_title->value);
config::set('s7n.theme', $form->theme->value);
message::info(__('Settings edited successfully'), 'admin/settings');
}
$this->template->content = View::factory('settings/settings', $form->get(TRUE));
}
示例6: delete
public function delete($id)
{
$user = ORM::factory('user', (int) $id);
if (!$user->loaded) {
message::error(__('Invalid ID'), 'admin/user');
}
if ($user->id === Auth::instance()->get_user()->id) {
message::error(__('You can\'t delete yourself'), 'admin/user');
}
$user->remove(ORM::factory('role', 'login'));
$user->remove(ORM::factory('role', 'admin'));
$user->delete();
message::info(__('User deleted successfully'), 'admin/user');
}
示例7: move
static function move($source, $target)
{
access::required("view", $source);
access::required("view", $target);
access::required("edit", $source);
access::required("edit", $target);
$parent = $source->parent();
if ($parent->album_cover_item_id == $source->id) {
if ($parent->children_count() > 1) {
foreach ($parent->children(2) as $child) {
if ($child->id != $source->id) {
$new_cover_item = $child;
break;
}
}
item::make_album_cover($new_cover_item);
} else {
item::remove_album_cover($parent);
}
}
$orig_name = $source->name;
$source->parent_id = $target->id;
$source->save();
if ($orig_name != $source->name) {
switch ($source->type) {
case "album":
message::info(t("Album <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
case "photo":
message::info(t("Photo <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
case "movie":
message::info(t("Movie <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
}
}
// If the target has no cover item, make this it.
if ($target->album_cover_item_id == null) {
item::make_album_cover($source);
}
}
示例8: checkLogin
public static function checkLogin()
{
$username = type::post('username', 'string', '');
$password = type::post('password', 'string', '');
if ($username == '' || $password == '') {
echo message::info(lang::get('login_form_notfull'), true);
return;
}
$sql = sql::factory();
$sql->query('SELECT password, salt, id FROM ' . sql::table('community_user') . ' WHERE `username` = "' . $sql->escape($username) . '"');
if (!$sql->num()) {
echo message::danger(sprintf(lang::get('login_no_user'), $email), true);
return;
}
$sql->result();
if (!userLogin::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
echo message::danger(lang::get('login_pwd_false'), true);
return;
}
$_SESSION['community-login'] = $sql->get('id');
self::checkSession();
// Für spätere Foren-Bridges
extension::get('COMMUNITY_USER_LOGIN', $password);
}
示例9: uninstall
public function uninstall($module)
{
require_once MODPATH . $module . '/helpers/' . $module . '_installer.php';
call_user_func($module . '_installer::uninstall');
message::info(__('Module uninstalled successfully'), 'admin/modules');
}
示例10: _save_api_key
private function _save_api_key($form)
{
$new_key = $form->sharing->api_key->value;
if ($new_key) {
list($connected, $valid) = l10n_client::validate_api_key($new_key);
if (!$valid) {
$form->sharing->api_key->add_error($connected ? "invalid" : "no_connection", 1);
}
} else {
$valid = true;
}
if ($valid) {
$old_key = l10n_client::api_key();
l10n_client::api_key($new_key);
if ($old_key && !$new_key) {
message::success(t("Your API key has been cleared."));
} else {
if ($old_key && $new_key && $old_key != $new_key) {
message::success(t("Your API key has been changed."));
} else {
if (!$old_key && $new_key) {
message::success(t("Your API key has been saved."));
} else {
if ($old_key && $new_key && $old_key == $new_key) {
message::info(t("Your API key was not changed."));
}
}
}
}
log::success(t("gallery"), t("l10n_client API key changed."));
url::redirect("admin/languages");
} else {
// Show the page with form errors
$this->index($form);
}
}
示例11: add
/**
* This is the task code that adds photos and albums. It first examines all the target files
* and creates a set of Server_Add_File_Models, then runs through the list of models and adds
* them one at a time.
*/
static function add($task)
{
$mode = $task->get("mode", "init");
$start = microtime(true);
switch ($mode) {
case "init":
$task->set("mode", "build-file-list");
$task->percent_complete = 0;
$task->status = t("Starting up");
batch::start();
break;
case "build-file-list":
// 0% to 10%
// We can't fit an arbitrary number of paths in a task, so store them in a separate table.
// Don't use an iterator here because we can't get enough control over it when we're dealing
// with a deep hierarchy and we don't want to go over our time quota. The queue is in the
// form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We
// have this extra level of abstraction because we don't know its Item_Model id yet.
$queue = $task->get("queue");
$paths = unserialize(module::get_var("videos", "authorized_paths"));
while ($queue && microtime(true) - $start < 0.5) {
list($file, $parent_entry_id) = array_shift($queue);
// Ignore the staging directories as directories to be imported.
if (empty($paths[$file])) {
$entry = ORM::factory("videos_file");
$entry->task_id = $task->id;
$entry->file = $file;
$entry->parent_id = $parent_entry_id;
$entry->save();
$entry_id = $entry->id;
} else {
$entry_id = null;
}
$file = preg_quote($file);
foreach (glob("{$file}/*") as $child) {
if (is_dir($child)) {
$queue[] = array($child, $entry_id);
} else {
$ext = strtolower(pathinfo($child, PATHINFO_EXTENSION));
//if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) &&
if (in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) && filesize($child) > 0) {
$child_entry = ORM::factory("videos_file");
$child_entry->task_id = $task->id;
$child_entry->file = $child;
$child_entry->parent_id = $entry_id;
$child_entry->save();
}
}
}
}
// We have no idea how long this can take because we have no idea how deep the tree
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
// over 10% in percent_complete.
$task->set("queue", $queue);
$task->percent_complete = min($task->percent_complete + 0.1, 10);
$task->status = t2("Found one file", "Found %count files", ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
if (!$queue) {
$task->set("mode", "add-files");
$task->set("total_files", ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
$task->percent_complete = 10;
}
break;
case "add-files":
// 10% to 100%
$completed_files = $task->get("completed_files", 0);
$total_files = $task->get("total_files");
// Ordering by id ensures that we add them in the order that we created the entries, which
// will create albums first. Ignore entries which already have an Item_Model attached,
// they're done.
$entries = ORM::factory("videos_file")->where("task_id", "=", $task->id)->where("item_id", "IS", null)->order_by("id", "ASC")->limit(10)->find_all();
if ($entries->count() == 0) {
// Out of entries, we're done.
$task->set("mode", "done");
}
$owner_id = identity::active_user()->id;
foreach ($entries as $entry) {
if (microtime(true) - $start > 0.5) {
break;
}
// Look up the parent item for this entry. By now it should exist, but if none was
// specified, then this belongs as a child of the current item.
$parent_entry = ORM::factory("videos_file", $entry->parent_id);
if (!$parent_entry->loaded()) {
$parent = ORM::factory("item", $task->get("item_id"));
} else {
$parent = ORM::factory("item", $parent_entry->item_id);
}
$name = basename($entry->file);
$title = item::convert_filename_to_title($name);
if (is_dir($entry->file)) {
$album = ORM::factory("item");
$album->type = "album";
$album->parent_id = $parent->id;
$album->name = $name;
$album->title = $title;
//.........这里部分代码省略.........
示例12: move
static function move($source, $target)
{
access::required("view", $source);
access::required("view", $target);
access::required("edit", $source);
access::required("edit", $target);
$parent = $source->parent();
if ($parent->album_cover_item_id == $source->id) {
if ($parent->children_count() > 1) {
foreach ($parent->children(2) as $child) {
if ($child->id != $source->id) {
$new_cover_item = $child;
break;
}
}
item::make_album_cover($new_cover_item);
} else {
item::remove_album_cover($parent);
}
}
$source->parent_id = $target->id;
// Moving may result in name or slug conflicts. If that happens, try up to 5 times to pick a
// random name (or slug) to avoid the conflict.
$orig_name = $source->name;
$orig_name_filename = pathinfo($source->name, PATHINFO_FILENAME);
$orig_name_extension = pathinfo($source->name, PATHINFO_EXTENSION);
$orig_slug = $source->slug;
for ($i = 0; $i < 5; $i++) {
try {
$source->save();
if ($orig_name != $source->name) {
switch ($source->type) {
case "album":
message::info(t("Album <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
case "photo":
message::info(t("Photo <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
case "movie":
message::info(t("Movie <b>%old_name</b> renamed to <b>%new_name</b> to avoid a conflict", array("old_name" => $orig_name, "new_name" => $source->name)));
break;
}
}
break;
} catch (ORM_Validation_Exception $e) {
$rand = rand(10, 99);
$errors = $e->validation->errors();
if (isset($errors["name"])) {
$source->name = $orig_name_filename . "-{$rand}." . $orig_name_extension;
unset($errors["name"]);
}
if (isset($errors["slug"])) {
$source->slug = $orig_slug . "-{$rand}";
unset($errors["slug"]);
}
if ($errors) {
// There were other validation issues-- we don't know how to handle those
throw $e;
}
}
}
// If the target has no cover item, make this it.
if ($target->album_cover_item_id == null) {
item::make_album_cover($source);
}
}
示例13: logout
public static function logout()
{
unset($_SESSION['login']);
self::$isLogin = false;
echo message::info(lang::get('login_logout_success'), true);
}
示例14: add
/**
* This is the task code that adds photos and albums. It first examines all the target files
* and creates a set of Server_Add_File_Models, then runs through the list of models and adds
* them one at a time.
*/
static function add($task)
{
$mode = $task->get("mode", "init");
$start = microtime(true);
switch ($mode) {
case "init":
$task->set("mode", "build-file-list");
$task->percent_complete = 0;
$task->status = t("Starting up");
batch::start();
break;
case "build-file-list":
// 0% to 10%
// We can't fit an arbitrary number of paths in a task, so store them in a separate table.
// Don't use an iterator here because we can't get enough control over it when we're dealing
// with a deep hierarchy and we don't want to go over our time quota. The queue is in the
// form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We
// have this extra level of abstraction because we don't know its Item_Model id yet.
$queue = $task->get("queue");
while ($queue && microtime(true) - $start < 0.5) {
list($file, $parent_entry_id) = array_shift($queue);
$entry = ORM::factory("server_add_file");
$entry->task_id = $task->id;
$entry->file = $file;
$entry->parent_id = $parent_entry_id;
$entry->save();
foreach (glob("{$file}/*") as $child) {
if (is_dir($child)) {
$queue[] = array($child, $entry->id);
} else {
$ext = strtolower(pathinfo($child, PATHINFO_EXTENSION));
if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4"))) {
$child_entry = ORM::factory("server_add_file");
$child_entry->task_id = $task->id;
$child_entry->file = $child;
$child_entry->parent_id = $entry->id;
$child_entry->save();
}
}
}
}
// We have no idea how long this can take because we have no idea how deep the tree
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
// over 10% in percent_complete.
$task->set("queue", $queue);
$task->percent_complete = min($task->percent_complete + 0.1, 10);
$task->status = t2("Found one file", "Found %count files", Database::instance()->where("task_id", $task->id)->count_records("server_add_files"));
if (!$queue) {
$task->set("mode", "add-files");
$task->set("total_files", database::instance()->count_records("server_add_files", array("task_id" => $task->id)));
$task->percent_complete = 10;
}
break;
case "add-files":
// 10% to 100%
$completed_files = $task->get("completed_files", 0);
$total_files = $task->get("total_files");
// Ordering by id ensures that we add them in the order that we created the entries, which
// will create albums first. Ignore entries which already have an Item_Model attached,
// they're done.
$entries = ORM::factory("server_add_file")->where("task_id", $task->id)->where("item_id", null)->orderby("id", "ASC")->limit(10)->find_all();
if ($entries->count() == 0) {
// Out of entries, we're done.
$task->set("mode", "done");
}
$owner_id = user::active()->id;
foreach ($entries as $entry) {
if (microtime(true) - $start > 0.5) {
break;
}
// Look up the parent item for this entry. By now it should exist, but if none was
// specified, then this belongs as a child of the current item.
$parent_entry = ORM::factory("server_add_file", $entry->parent_id);
if (!$parent_entry->loaded) {
$parent = ORM::factory("item", $task->get("item_id"));
} else {
$parent = ORM::factory("item", $parent_entry->item_id);
}
$name = basename($entry->file);
$title = item::convert_filename_to_title($name);
if (is_dir($entry->file)) {
$album = album::create($parent, $name, $title, null, $owner_id);
$entry->item_id = $album->id;
} else {
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) {
$photo = photo::create($parent, $entry->file, $name, $title, null, $owner_id);
$entry->item_id = $photo->id;
} else {
if (in_array($extension, array("flv", "mp4"))) {
$movie = movie::create($parent, $entry->file, $name, $title, null, $owner_id);
$entry->item_id = $movie->id;
} else {
// This should never happen, because we don't add stuff to the list that we can't
// process. But just in, case.. set this to a non-null value so that we skip this
//.........这里部分代码省略.........
示例15: create_theme
//.........这里部分代码省略.........
$target = "{$theme_path}css/" . basename($css);
if (!file_exists($target)) {
copy($css, $target);
$task->log(t("Copied css file: %path", array("path" => basename($target))));
}
$completed++;
}
if (empty($parameters["standard_css"])) {
$task->status = t("Standard css copied");
$task->set("mode", "copy_javascript");
}
break;
case "copy_javascript":
$task->status = t("Copying javascript");
while (!empty($parameters["js"]) && microtime(true) - $start < 1.5) {
$js = array_shift($parameters["js"]);
$target = "{$theme_path}js/" . str_replace(array("admin_", "site_"), "", basename($js));
if (!file_exists($target)) {
copy($js, $target);
$task->log(t("Copied js file: %path", array("path" => basename($target))));
}
$completed++;
}
if (empty($parameters["js"])) {
$task->status = t("Javascript copied");
$task->set("mode", "generate_screen_css");
}
break;
case "generate_screen_css":
$file = "{$theme_path}/css/screen.css";
foreach (array("screen", "screen-rtl") as $file) {
$css_file = "{$theme_path}/css/{$file}.css";
$v = new View(($is_admin ? "admin" : "site") . "_{$file}.css");
$v->display_name = $task->get("display_name");
foreach ($parameters["colors"] as $color => $value) {
$v->{$color} = $value;
}
ob_start();
print $v->render();
file_put_contents($css_file, ob_get_contents());
ob_end_clean();
}
$completed++;
$task->log(t("Generated screen css: %path", array("path" => $file)));
$task->status = t("Screen css generated");
$task->set("mode", "generate_thumbnail");
break;
case "generate_thumbnail":
themeroller::generate_thumbnail($parameters["thumbnail"], $parameters["thumbnail_parts"], "{$theme_path}thumbnail.png");
$task->status = t("Thumbnail generated");
$task->set("mode", "generate_theme_info");
$completed++;
$task->log(t("Generated theme thumbnail: %path", array("path" => "{$theme_path}thumbnail.png")));
break;
case "generate_theme_info":
$file = "{$theme_path}/theme.info";
$v = new View("theme.info");
$v->display_name = $task->get("display_name");
$v->description = $task->get("description");
$v->user_name = $task->get("user_name");
$v->author_url = $task->get("author_url");
$v->info_url = $task->get("info_url");
$v->discuss_url = $task->get("discuss_url");
$v->is_admin = $is_admin;
$v->definition = json_encode($parameters["colors"]);
ob_start();
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
$completed++;
$task->log(t("Generated theme info: %path", array("path" => "{$theme_path}theme.info")));
$task->status = t("Theme info generated");
$task->set("mode", "done");
break;
case "done":
themeroller::recursive_directory_delete($task->get("path"));
$display_name = $task->get("display_name");
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
$completed = $task->get("total_activites");
Cache::instance()->delete("create_theme_cache:{$task->id}");
$message = t("Successfully generated: %name", array("name" => $display_name));
message::info($message);
$task->log($message);
$task->status = t("'%name' generated", array("name" => $display_name));
}
$task->set("completed", $completed);
if (!$task->done) {
Cache::instance()->set("create_theme_cache:{$task->id}", serialize($parameters));
$task->percent_complete = $completed / $task->get("total_activites") * 100;
}
} catch (Exception $e) {
Kohana_Log::add("error", (string) $e);
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
$task->log((string) $e);
}
}