本文整理汇总了PHP中Messages::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::add方法的具体用法?PHP Messages::add怎么用?PHP Messages::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMessagesRespectFormat
/**
* Test the Messages::get method.
*
* @group laravel
*/
public function testMessagesRespectFormat()
{
$this->messages->add('email', 'test');
$this->assertEquals('<p>test</p>', $this->messages->first('email', '<p>:message</p>'));
$this->assertEquals(array('<p>test</p>'), $this->messages->get('email', '<p>:message</p>'));
$this->assertEquals(array('<p>test</p>'), $this->messages->all('<p>:message</p>'));
}
示例2: handleNode
/**
* Обработка узла: разделение на подмножества, переход к следующему узлу,
* формирование ответа.
*/
function handleNode()
{
$this->callId = CallId::getID();
self::$messages->open($this->callId);
self::$messages->add([], "Нули на предыдущих этапах:" . $this->history());
if ($this->branchnBound->solved) {
$lastBranch = new BranchAndBound([], $this->branchnBound->minBorder);
$lastBranch->rowRam = key($this->branchnBound->table);
$lastBranch->columnRam = key(current($this->branchnBound->table));
$lastBranch->includeVet = true;
$lastBranch2 = new BranchAndBound([], INF);
$lastBranch2->rowRam = key($this->branchnBound->table);
$lastBranch2->columnRam = key(current($this->branchnBound->table));
$this->childrens[] = new Node($lastBranch2, $this);
$this->childrens[] = new Node($lastBranch, $this);
$this->makeAnswer();
return;
}
$devideResult = $this->branchnBound->devide();
self::$messages->close();
if (is_array($devideResult)) {
$this->addNewNodes($devideResult);
} else {
$this->removeMyselfFromMins();
$this->addMyselfToMins();
$this->chooseForWorkFromMins();
}
}
示例3: __construct
function __construct($step_table, $url_is_tab = false)
{
global $CFG;
$this->table = $step_table;
$this->url_is_tab = $CFG->url == $step_table ? $CFG->is_tab : $url_is_tab;
if (!DB::tableExists($step_table)) {
if (DB::createTable($step_table, array('name' => 'vchar', 'group_id' => 'int', 'user_id' => 'int', 'supervisor_id' => 'int', 'days_available' => 'int', 'step_order' => 'int'))) {
Messages::add($CFG->table_created);
}
}
}
示例4: add
public function add()
{
if (isset($_POST['text'])) {
// add a new message under current credentials
if (Messages::add($_POST['text'], Fari_User::getCredentials())) {
// handle with JSON
echo json_encode(array('status' => 'success'));
} else {
echo json_encode(array('status' => 'fail'));
}
}
}
示例5: post_edit
public function post_edit()
{
$rules = array('id' => 'required|exists:gallery', 'title' => 'required|max:255');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
Messages::add('error', $validation->errors->all());
return Redirect::to('admin/' . $this->views . '/edit')->with_input();
} else {
$gallery = Gallery::find(Input::get('id'));
$gallery->title = Input::get('title');
$gallery->description = Input::get('description');
$gallery->created_by = $this->data['user']->id;
$gallery->save();
Messages::add('success', 'Gallery Saved');
return Redirect::to('admin/' . $this->views . '');
}
}
示例6: upload
/**
* Attempts to upload a file, adds it to the database and removes other database entries for that file type if they are asked to be removed
* @param string $field The name of the $_FILES field you want to upload
* @param boolean $upload_type The type of upload ('news', 'gallery', 'section') etc
* @param boolean $type_id The ID of the item (above) that the upload is linked to
* @param boolean $remove_existing Setting this to true will remove all existing uploads of the passed in type (useful for replacing news article images when a new on
* @param boolean $title Sets the title of the upload
* @param boolean $path_to_store Sets the path to the upload (where it should go)
* @return object Returns the upload object so we can work with the uploaded file and details
*/
public static function upload($details = array())
{
$upload_details = array('remove_existing_for_link' => true, 'path_to_store' => path('public') . 'uploads/', 'resizing' => array('small' => array('w' => 200, 'h' => 200), 'thumb' => array('w' => 200, 'h' => 200)));
if (!empty($details)) {
$required_keys = array('upload_field_name', 'upload_type', 'upload_link_id', 'title');
$continue = true;
foreach ($required_keys as $key) {
if (!isset($details[$key]) || empty($details[$key])) {
Messages::add('error', 'Your upload array details are not complete... please fill this in properly.');
$continue = false;
}
}
if ($continue) {
$configuration = $details + $upload_details;
$input = Input::file($configuration['upload_field_name']);
if ($input && $input['error'] == UPLOAD_ERR_OK) {
if ($configuration['remove_existing_for_link']) {
static::remove($configuration['upload_type'], $configuration['upload_link_id']);
}
$ext = File::extension($input['name']);
$filename = Str::slug($configuration['upload_type'] . '-' . $configuration['upload_link_id'] . '-' . Str::limit(md5($input['name']), 10, false) . '-' . $configuration['title'], '-');
Input::upload($configuration['upload_field_name'], $configuration['path_to_store'], $filename . '.' . $ext);
$upload = new Upload();
$upload->link_type = $configuration['upload_type'];
$upload->link_id = $configuration['upload_link_id'];
$upload->filename = $filename . '.' . $ext;
if (Koki::is_image($configuration['path_to_store'] . $filename . '.' . $ext)) {
$upload->small_filename = $filename . '_small' . '.' . $ext;
$upload->thumb_filename = $filename . '_thumb' . '.' . $ext;
$upload->image = 1;
}
$upload->extension = $ext;
$upload->user_id = Auth::user()->id;
$upload->save();
if (Koki::is_image($configuration['path_to_store'] . $filename . '.' . $ext)) {
WideImage::load($configuration['path_to_store'] . $upload->filename)->resize($configuration['resizing']['small']['w'], $configuration['resizing']['small']['h'])->saveToFile($configuration['path_to_store'] . $upload->small_filename);
WideImage::load($configuration['path_to_store'] . $upload->small_filename)->crop('center', 'center', $configuration['resizing']['thumb']['w'], $configuration['resizing']['thumb']['h'])->saveToFile($configuration['path_to_store'] . $upload->thumb_filename);
}
return true;
}
}
} else {
Messages::add('error', 'Your upload array details are empty... please fill this in properly.');
}
return false;
}
示例7: receivePayment
function receivePayment()
{
global $CFG;
if (empty($_REQUEST['tx'])) {
return false;
}
$auth_info = Link::executeScript($CFG->paypal_submit_url, array('tx' => $_REQUEST['tx'], 'at' => $CFG->paypal_tocken, 'cmd' => '_notify-synch'));
$is_approved = stristr($auth_info, 'SUCCESS');
if ($is_approved) {
$auth_info = str_ireplace('SUCCESS', '', $auth_info);
Messages::add($CFG->paypal_success_message);
self::$item_count = mb_substr_count($auth_info, 'item_number');
return self::parseInfo($auth_info);
} else {
Errors::add($CFG->paypal_failure_message);
return false;
}
}
示例8: post_edit
public function post_edit()
{
$rules = array('id' => 'required|exists:news', 'title' => 'required|max:255', 'content' => 'required', 'image' => 'image|max:2500');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
Messages::add('error', $validation->errors->all());
return Redirect::to('admin/' . $this->views . '/edit/' . Input::get('id'))->with_input();
} else {
$article = News::find(Input::get('id'));
$article->title = Input::get('title');
$article->url_title = Str::slug(Input::get('title'), '-');
$article->content = Input::get('content');
$article->save();
$upload_details = array('upload_field_name' => 'image', 'upload_type' => 'news', 'upload_link_id' => $article->id, 'remove_existing_for_link' => false, 'title' => $article->title, 'path_to_store' => path('public') . 'uploads/', 'resizing' => array('small' => array('w' => 200, 'h' => 200), 'thumb' => array('w' => 150, 'h' => 150)));
$upload = Uploadr::upload($upload_details);
Messages::add('success', 'News article saved');
return Redirect::to('admin/' . $this->views . '/edit/' . Input::get('id'));
}
}
示例9: post_index
public function post_index()
{
$rules = array('issue' => 'required');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
Messages::add('error', 'Please make sure you fill out the form to let us know what problem you are having.');
return Redirect::to('admin/' . $this->views . '')->with_input();
} else {
// Get the Swift Mailer instance
$mailer = IoC::resolve('mailer');
// Construct the message
$message = Swift_Message::newInstance('Message From Website')->setFrom(array($this->data['user']->email => $this->data['user']->fullname))->setTo(array('david@koki.co' => 'Framework Support For ' . COMPANY_NAME))->setBody('<p><strong>' . $this->data['user']->fullname . ' has emailed you:</strong></p>
<q>' . Input::get('issue') . '</q>
<p><strong>Email Address: </strong> ' . $this->data['user']->email . '</p>
<p><strong>IP Address: </strong> ' . Request::ip() . '</p>
<p><strong>User Agent: </strong> ' . Request::server('HTTP_USER_AGENT') . '</p>', 'text/html');
// Send the email
$mailer->send($message);
Messages::add('success', '<strong>Support Issue Sent</strong> We\'ll be in touch shortly.');
return Redirect::to('admin/help');
}
}
示例10: post_edit
public function post_edit()
{
$rules = array('id' => 'required|exists:news', 'title' => 'required|max:255', 'content' => 'required', 'image' => 'image|max:2500');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
Messages::add('error', $validation->errors->all());
return Redirect::to('admin/' . $this->views . '/edit')->with_input();
} else {
$article = News::find(Input::get('id'));
$article->title = Input::get('title');
$article->url_title = Str::slug(Input::get('title'), '-');
$article->content = Input::get('content');
$article->save();
$upload = Uploadr::upload('image', 'news', $article->id, true);
if ($upload) {
WideImage::load('./uploads/' . $upload->filename)->resize(200, 200)->saveToFile('./uploads/' . $upload->small_filename);
WideImage::load('./uploads/' . $upload->small_filename)->crop('center', 'center', 150, 150)->saveToFile('./uploads/' . $upload->thumb_filename);
}
Messages::add('success', 'News article saved');
return Redirect::to('admin/' . $this->views . '');
}
}
示例11: post_delsparepart
public function post_delsparepart()
{
$sparepart = array('id' => 'required|exists:spareparts');
$validation = Validator::make(Input::all(), $sparepart);
if ($validation->fails()) {
Messages::add('error', 'You tried to delete a sparepart that doesn\'t exist.');
return Redirect::to($this->views . '');
} else {
$sp = Sparepart::find(Input::get('id'));
$sp->delete();
Messages::add('success', 'Sparepart Removed');
return Redirect::to($this->views . '');
}
}
示例12: elseif
}
}
*/
if (!empty($_REQUEST['message'])) {
if ($_REQUEST['message'] == 'settings-personal-message') {
Messages::add(Lang::string('settings-personal-message'));
} elseif ($_REQUEST['message'] == 'settings-settings-message') {
Messages::add(Lang::string('settings-settings-message'));
} elseif ($_REQUEST['message'] == 'settings-account-deactivated') {
Messages::add(Lang::string('settings-account-deactivated'));
} elseif ($_REQUEST['message'] == 'settings-account-reactivated') {
Messages::add(Lang::string('settings-account-reactivated'));
} elseif ($_REQUEST['message'] == 'settings-account-locked') {
Messages::add(Lang::string('settings-account-locked'));
} elseif ($_REQUEST['message'] == 'settings-account-unlocked') {
Messages::add(Lang::string('settings-account-unlocked'));
}
}
if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') {
$notice = Lang::string('settings-change-notice');
}
$cur_sel = array();
if ($CFG->currencies) {
foreach ($CFG->currencies as $key => $currency) {
if (is_numeric($key) || $currency['currency'] == 'BTC') {
continue;
}
$cur_sel[$key] = $currency;
}
}
$page_title = Lang::string('settings');
示例13: elseif
Errors::add(Lang::string('settings-request-expired'));
}
if (!is_array(Errors::$errors)) {
Messages::add(Lang::string('security-success-message'));
$step4 = true;
} else {
$step3 = true;
}
} else {
$step3 = true;
}
}
if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') {
$notice = Lang::string('settings-change-notice');
} elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'security-disabled-message') {
Messages::add(Lang::string('security-disabled-message'));
}
if (User::$info['verified_authy'] == 'Y' || $step2) {
API::add('Content', 'getRecord', array('security-setup'));
} elseif (User::$info['verified_google'] == 'Y' || $step4) {
API::add('Content', 'getRecord', array('security-setup-google'));
} elseif ($step1) {
API::add('Content', 'getRecord', array('security-token'));
} elseif ($step3) {
API::add('Content', 'getRecord', array('security-google'));
API::add('User', 'getGoogleSecret');
} else {
API::add('Content', 'getRecord', array('security-explain'));
}
$query = API::send();
$content = $query['Content']['getRecord']['results'][0];
示例14: Messages
<?php
session_start();
require_once '../scripts/session/class.messages.php';
$msg = new Messages();
if (isset($_SESSION['id'])) {
//echo '<br>';
//echo "Welcome user " .$_SESSION['id']."<a href='../scripts/session/logout.php'> logout</a>";
} else {
header("Location: ../index.php");
echo $msg->add('e', '<div style="width: 100%px;" class="alert alert-danger">Debes autenticarte!</p>');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Dashboard">
<meta name="keyword" content="Informe de, equipos microinformatica, prosegur">
<title>Web de informes GLPI</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!--external css-->
<link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="assets/css/zabuto_calendar.css">
<link rel="stylesheet" type="text/css" href="assets/js/gritter/css/jquery.gritter.css" />
示例15: preg_replace
$type1 = !empty($_REQUEST['type']) ? preg_replace("/[^0-9]/", "", $_REQUEST['type']) : false;
$page1 = !empty($_REQUEST['page']) ? preg_replace("/[^0-9]/", "", $_REQUEST['page']) : false;
$trans_realized1 = !empty($_REQUEST['transactions']) ? preg_replace("/[^0-9]/", "", $_REQUEST['transactions']) : false;
$bypass = !empty($_REQUEST['bypass']);
API::add('Transactions', 'get', array(1, $page1, 30, $currency1, 1, $start_date1, $type1, $order_by1, $order_desc1));
$query = API::send();
$total = $query['Transactions']['get']['results'][0];
API::add('Transactions', 'get', array(false, $page1, 30, $currency1, 1, $start_date1, $type1, $order_by1, $order_desc1));
API::add('Transactions', 'getTypes');
$query = API::send();
$transactions = $query['Transactions']['get']['results'][0];
$transaction_types = $query['Transactions']['getTypes']['results'][0];
$pagination = Content::pagination('transactions.php', $page1, $total, 30, 5, false);
$currency_info = $currency1 ? $CFG->currencies[strtoupper($currency1)] : array();
if ($trans_realized1 > 0) {
Messages::add(str_replace('[transactions]', $trans_realized1, Lang::string('transactions-done-message')));
}
$page_title = Lang::string('transactions');
if (!$bypass) {
include 'includes/head.php';
?>
<div class="page_title">
<div class="container">
<div class="title"><h1><?php
echo $page_title;
?>
</h1></div>
<div class="pagenation"> <a href="<?php
echo Lang::url('index.php');
?>
"><?php