当前位置: 首页>>代码示例>>PHP>>正文


PHP Messages::instance方法代码示例

本文整理汇总了PHP中Messages::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::instance方法的具体用法?PHP Messages::instance怎么用?PHP Messages::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Messages的用法示例。


在下文中一共展示了Messages::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_create

 public function action_create()
 {
     \View::set_global('title', 'Add New Group');
     if (\Input::post()) {
         $val = $this->validate('create');
         if ($val->run()) {
             try {
                 $group_id = \Sentry::group()->create(array('name' => \Input::post('title'), 'level' => 80));
                 \Messages::success('Group successfully created.');
                 \Response::redirect(\Input::post('update', false) ? \Uri::create('admin/user/group/update/' . $item->id) : \Uri::admin('current'));
             } catch (\Sentry\SentryGroupException $e) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create group</strong>');
                 // Uncomment lines below to show database errors
                 $errors = $e->getMessage();
                 \Messages::error($errors);
             }
         } else {
             if ($val->error() != array()) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create group</strong>');
                 foreach ($val->error() as $e) {
                     \Messages::error($e->get_message());
                 }
             }
         }
     }
     // Keep existing messages
     \Messages::instance()->shutdown();
     \Response::redirect('admin/user/group/list');
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:31,代码来源:group.php

示例2: getInstance

 /**
  * Singeltone Get Instance
  *
  * @return Messages
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:redknight,项目名称:frot,代码行数:12,代码来源:Messages.php

示例3: get_instance

 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Messages();
     }
     return self::$instance;
 }
开发者ID:chrobaks,项目名称:jsoncreator,代码行数:7,代码来源:Messages.class.php

示例4: register

 /**
  * Register JSON config file.
  *
  * @param $config
  * @param $repos
  * @param $type
  *
  * @return bool
  */
 public function register($config, $repos, $type)
 {
     if (empty($config)) {
         return false;
     }
     if (null === ($config = json_decode($config, true))) {
         $error = new \WP_Error('json_invalid', 'JSON ' . json_last_error_msg());
         Messages::instance()->create_error_message($error);
         return false;
     }
     $this->add_headers($config, $repos, $type);
 }
开发者ID:afragen,项目名称:github-updater,代码行数:21,代码来源:Additions.php

示例5: render

 public function render($types = array('error', 'warning', 'success', 'info'))
 {
     $res = '';
     if (\Messages::any()) {
         $res .= '<br/>';
     }
     foreach ($types as $type) {
         foreach (\Messages::instance()->get($type) as $message) {
             $res .= '<div class="alert alert-' . $message['type'] . '">' . $message['body'] . '</div>' . "\n";
         }
     }
     \Messages::reset();
     return $res;
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:14,代码来源:twig.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param object $type
  */
 public function __construct($type)
 {
     parent::$hours = 12;
     $this->type = $type;
     $this->response = $this->get_transient();
     if (!isset(self::$options['gitlab_access_token'])) {
         self::$options['gitlab_access_token'] = null;
     }
     if (!isset(self::$options['gitlab_enterprise_token'])) {
         self::$options['gitlab_enterprise_token'] = null;
     }
     if (empty(self::$options['gitlab_access_token']) || empty(self::$options['gitlab_enterprise_token']) && !empty($type->enterprise)) {
         Messages::instance()->create_error_message('gitlab');
     }
     add_site_option('github_updater', self::$options);
 }
开发者ID:afragen,项目名称:github-updater,代码行数:21,代码来源:GitLab_API.php

示例7: action_create

 public function action_create()
 {
     \View::set_global('title', 'Add Discount Codes');
     if (\Input::post()) {
         $val = Model_Discountcode::validate('create');
         if (\Input::post('type') != 'free shipping') {
             $val->add('type_value', 'Amount')->add_rule('required')->add_rule('numeric')->add_rule('numeric_min', 1);
         }
         if ($val->run()) {
             // Get POST values
             $insert = \Input::post();
             if (isset($insert['active_from']) && $insert['active_from']) {
                 $insert['active_from'] = date('Y-m-d', strtotime(str_replace('/', '-', $insert['active_from'])));
             }
             if (isset($insert['active_to']) && $insert['active_to']) {
                 $insert['active_to'] = date('Y-m-d', strtotime(str_replace('/', '-', $insert['active_to'])));
             }
             $item = Model_Discountcode::forge($insert);
             try {
                 $item->save();
                 \Messages::success('Discount code successfully created.');
                 \Response::redirect(\Uri::create('admin/discountcode/update/' . $item->id));
             } catch (\Database_Exception $e) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create discount</strong>');
                 // Uncomment lines below to show database errors
                 $errors = $e->getMessage();
                 \Messages::error($errors);
             }
         } else {
             if ($val->error() != array()) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create discount code</strong>');
                 foreach ($val->error() as $e) {
                     \Messages::error($e->get_message());
                 }
             }
         }
     }
     // Keep existing messages
     \Messages::instance()->shutdown();
     \Theme::instance()->set_partial('content', $this->view_dir . 'create');
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:43,代码来源:discountcode.php

示例8: action_create

 public function action_create()
 {
     \View::set_global('title', 'Add New Attribute Option');
     if (\Input::post()) {
         $val = Model_Attribute_Option::validate('create');
         if ($val->run()) {
             // Get POST values
             $insert = \Input::post();
             $insert['title'] = $insert['option_title'];
             $item = Model_Attribute_Option::forge($insert);
             try {
                 $item->save();
                 \Messages::success('Attribute option successfully created.');
                 if (!\Request::is_hmvc()) {
                     \Response::redirect(\Input::referrer(\Uri::create('admin/attribute/list')));
                 }
             } catch (\Database_Exception $e) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create attribute option</strong>');
                 // Uncomment lines below to show database errors
                 $errors = $e->getMessage();
                 \Messages::error($errors);
             }
         } else {
             if ($val->error() != array()) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create attribute option</strong>');
                 foreach ($val->error() as $e) {
                     \Messages::error($e->get_message());
                 }
             }
         }
     }
     // Keep existing messages
     \Messages::instance()->shutdown();
     if (!\Request::is_hmvc()) {
         \Response::redirect(\Input::referrer(\Uri::create('admin/attribute/list')));
     }
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:39,代码来源:option.php

示例9: action_index

 /**
  * The basic welcome message
  * 
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     // Keep existing messages
     \Messages::instance()->shutdown();
     \Response::redirect('admin/application/list');
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:12,代码来源:hotspot.php

示例10: action_create

 public function action_create($group_type = false)
 {
     \View::set_global('title', 'Add New Group');
     if (\Input::post()) {
         $val = Model_Group::validate('create');
         if ($val->run()) {
             // Get POST values
             $insert = \Input::post();
             $item = Model_Group::forge($insert);
             try {
                 $item->save();
                 \Messages::success('Group successfully created.');
                 \Response::redirect(\Input::post('update', false) ? \Uri::create('admin/product/group/update/' . $item->id) : \Input::referrer(\Uri::admin('current')));
             } catch (\Database_Exception $e) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create group</strong>');
                 // Uncomment lines below to show database errors
                 $errors = $e->getMessage();
                 \Messages::error($errors);
             }
         } else {
             if ($val->error() != array()) {
                 // show validation errors
                 \Messages::error('<strong>There was an error while trying to create group</strong>');
                 foreach ($val->error() as $e) {
                     \Messages::error($e->get_message());
                 }
             }
         }
     }
     // Keep existing messages
     \Messages::instance()->shutdown();
     \Response::redirect('admin/product/group/list' . ($group_type ? '/' . $group_type : ''));
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:34,代码来源:group.php

示例11: api

 /**
  * Call the API and return a json decoded body.
  * Create error messages.
  *
  * @see http://developer.github.com/v3/
  *
  * @param string $url
  *
  * @return boolean|object
  */
 protected function api($url)
 {
     add_filter('http_request_args', array(&$this, 'http_request_args'), 10, 2);
     $type = $this->return_repo_type();
     $response = wp_remote_get($this->get_api_url($url));
     $code = (int) wp_remote_retrieve_response_code($response);
     $allowed_codes = array(200, 404);
     if (is_wp_error($response)) {
         Messages::instance()->create_error_message($response);
         return false;
     }
     if (!in_array($code, $allowed_codes, false)) {
         self::$error_code = array_merge(self::$error_code, array($this->type->repo => array('repo' => $this->type->repo, 'code' => $code, 'name' => $this->type->name, 'git' => $this->type->type)));
         if ('github' === $type['repo']) {
             GitHub_API::ratelimit_reset($response, $this->type->repo);
         }
         Messages::instance()->create_error_message($type['repo']);
         return false;
     }
     return json_decode(wp_remote_retrieve_body($response));
 }
开发者ID:afragen,项目名称:github-updater,代码行数:31,代码来源:API.php

示例12: action_login

 public function action_login()
 {
     if (!(\Sentry::check() && !\Sentry::user()->is_admin())) {
         \View::set_global('title', 'Login');
         if (\Input::post('login')) {
             $val = \User\Controller_Validate::forge('login');
             if ($val->run()) {
                 try {
                     if (\Sentry::user_exists(\Input::param('identity')) && !\Sentry::user(\Input::param('identity'))->is_admin()) {
                         // check the credentials.
                         $valid_login = \Sentry::login(\Input::param('identity'), \Input::param('password'), true);
                         if ($valid_login) {
                             \Messages::success('You have logged in successfully');
                             //								\Response::redirect(\Input::referrer(\Uri::front_create('user/account/dashboard')));
                             \Response::redirect(\Uri::front_create('order/checkout/cost'));
                         } else {
                             \Messages::error('Email and/or password is incorrect');
                         }
                     } else {
                         \Messages::error('Email and/or password is incorrect');
                     }
                 } catch (\Sentry\SentryAuthException $e) {
                     // show validation errors
                     //\Messages::error('<h4>There was an error while trying to login</h4>');
                     $errors = $e->getMessage();
                     \Messages::error($errors);
                 } catch (\Sentry\SentryException $e) {
                     // show validation errors
                     //\Messages::error('<h4>There was an error while trying to login</h4>');
                     $errors = $e->getMessage();
                     \Messages::error($errors);
                 }
             } else {
                 if ($val->error() != array()) {
                     // show validation errors
                     foreach ($val->error() as $e) {
                         \Messages::error($e->get_message());
                     }
                 }
             }
         }
     }
     //Keep existing messages
     \Messages::instance()->shutdown();
     \Response::redirect(\Uri::front_create('order/checkout/address'));
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:46,代码来源:checkout+copy.php

示例13: action_index

 /**
  * The index action
  * 
  * @access public
  * @return void
  */
 public function action_index()
 {
     //Keep existing messages
     \Messages::instance()->shutdown();
     \Response::redirect(\Uri::front_create('user/account/dashboard'));
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:12,代码来源:account.php

示例14: showMessages

 /**
  * Displays ALL success or failure messages
  */
 public function showMessages()
 {
     $messages = Messages::instance();
     $messages->showMessages($this);
 }
开发者ID:hotarucms,项目名称:hotarucms,代码行数:8,代码来源:Hotaru.php

示例15: display_front

 /**
  * Get all messages in HTML form
  * Reset messages after that
  *
  * @return  array
  */
 public static function display_front($align = 'left')
 {
     $output = '';
     foreach (array('error', 'warning', 'success', 'info') as $type) {
         $messages = \Messages::instance()->get($type);
         if (!empty($messages)) {
             // Open message container before first message
             $output === '' and $output = '<div class="message_container" style="display: none;">' . "\n";
             $output .= '<div class="popup" id="signUp">' . "\n";
             $output .= '<div class="legend">' . "\n";
             if ($type == 'error') {
                 $type = 'Oops!';
             }
             if ($type == 'success') {
                 $welcome_message = 'Thanks for registering with Evan Evans. We have sent an email to your nominated address with a link to activate your account. Sometimes inboxes can be a little overprotective so you may need to check your junk or spam folders.';
                 $activate_message = 'You have been sent an email to activate you new password.';
                 $newsletter_message = 'Thanks for signing up for our newsletter!';
                 foreach ($messages as $message) {
                     if ($message['body'] === $welcome_message) {
                         $type = 'Welcome!';
                     } else {
                         if ($message['body'] === $activate_message) {
                             $type = 'Just one more step';
                         } else {
                             if ($message['body'] === $newsletter_message) {
                                 $type = 'We`ll be in touch';
                             }
                         }
                     }
                 }
             }
             $output .= '<h2>' . ucfirst($type) . '</h2>' . "\n";
             $output .= '</div>' . "\n";
             $output .= '<div class="container_12">' . "\n";
             $output .= '<div class="grid_12">' . "\n";
             foreach ($messages as $message) {
                 $output .= "\t\t" . '' . $message['body'] . '<br />' . "\n";
             }
             $output .= '</div>' . "\n";
             $output .= '</div>' . "\n";
             $output .= '<div class="clear"></div>' . "\n";
             $output .= '</div>' . "\n";
         }
     }
     \Messages::reset();
     // Close message container after last message
     $output !== '' and $output .= '</div>' . "\n";
     return $output;
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:55,代码来源:messages.php


注:本文中的Messages::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。