public function __construct($action, $submit_value, $method, $sticky, $message_type, $format, $multiple_errors)
 {
     $this->fields = new stdClass();
     $this->action = $action;
     $this->method = $method;
     $this->submit_value = $submit_value;
     $this->sticky = $sticky;
     $this->format = $format;
     $this->message_type = $message_type;
     $this->multiple_errors = $multiple_errors;
     if ($message_type == 'flash') {
         $this->flash = Flash::getInstance();
     }
     if ($message_type == 'list') {
         $this->messages = array();
     }
 }
 public function __construct($render = false)
 {
     $this->render = $render;
     $this->flash = Flash::getInstance();
 }
Exemplo n.º 3
0
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
session_name('nibble');
ini_set('session.gc_maxlifetime', 30 * 60);
session_set_cookie_params(30 * 60);
session_start();
include dirname(__FILE__) . '/nibble-flash-messaging/Flash.class.php';
$flash = Flash::getInstance();
$flash->message('Simple message example');
$flash->flashMessage('Message content goes here, 5s lifetime', 'Message title goes here', 5000);
$flash->message('Sticky error message', 'Sticky message', 0, true, 'error');
include dirname(__FILE__) . '/nibble-forms/NibbleForm.class.php';
$form = NibbleForm::getInstance('', 'Submit this form', 'post', true, 'flash');
$form->username = new Text('Please enter your username', true, 20, '/[a-zA-Z0-9]+/');
$form->email = new Email('Please enter your email', false);
$form->email->addConfirmation('Please confirm your email');
$form->captcha = new Captcha();
/*$form->password = new Password('Please enter your password', 11, true, true, 12);
  $form->password->addConfirmation('Please confirm your password');
  $form->checkbox = new Checkbox('Please select one of the following', array(
    'One' => 'Choice one, dont choose',
    'car' => 'Choice two',
    'Choice three',
    'Choice four'
  ),true,2);
  $form->select = new MultipleSelect('Please select at least two of the following', array(
    'One'=>'Choice one',
    'Choice two',
    'Choice three'
Exemplo n.º 4
0
 /**
  * @desc Render flash messages
  */
 public function flash()
 {
     foreach (Flash::getInstance()->messages as $message) {
         echo $message;
     }
 }