예제 #1
0
 public function testCompile()
 {
     $field = new Time("test", "Test");
     $expected = "<label for=\"test\">Test</label><input type=\"time\" name=\"test\"  value=\"\" />";
     $value = $field->compile();
     $this->assertEquals($expected, $value);
 }
 /**
  * Tests delete time method that it raises and error if invalid data is passed in
  * @group time
  * @dataProvider getInvalidData
  * @expectedException PHPUnit_Framework_Error
  * @param $data
  */
 public function testTimeDeleteMethodWithInvalidData($data)
 {
     $entity = new Time();
     $date = $data['time_delete'];
     $entity->setTimeDelete($date);
     $this->assertEquals($date, $entity->getTimeDelete());
 }
예제 #3
0
 /**
  * @param string $format
  * @param string $value
  * @return \WallaceMaxters\Timer\Time
  */
 public function fromFormat($format, $value)
 {
     $matches = $this->getMatches($format, $value);
     $time = new Time($matches['h'], $matches['i'], $matches['s']);
     if ($this->isNegativeSign($matches['r'])) {
         $time->multiply(-1);
     }
     return $time;
 }
예제 #4
0
파일: MockTime.php 프로젝트: plista/core
 public function currentMicro()
 {
     // if no time was set, we return the fallback value
     if ($this->nextCurrentMicro < 0.0) {
         return $this->realTime->currentMicro();
     }
     // return the previously set value and reset the internal var
     $current = $this->nextCurrentMicro;
     $this->nextCurrentMicro = -1.0;
     return $current;
 }
예제 #5
0
 static function start()
 {
     if (!Lock::isOn('cron-running-' . $_ENV['projectName'])) {
         if (Lock::on('cron-running-' . $_ENV['projectName'])) {
             Debug::out('Starting');
             Control::req('scripts/crons/config');
             while (!Lock::isOn('cron-off-' . $_ENV['projectName'])) {
                 $time = new Time();
                 //+	ensure running only every minute {
                 $parseTime = $time->format('YmdHi');
                 if (self::$lastParsedTime == $parseTime) {
                     sleep(2);
                     continue;
                 }
                 self::$lastParsedTime = $parseTime;
                 //+	}
                 //+	execute run items {
                 $run = self::getRun($time);
                 foreach ($run as $i) {
                     $item = self::$list[$i];
                     if (self::$running[$i]) {
                         $pid = pcntl_waitpid(self::$running[$i], $status, WNOHANG);
                         if ($pid == 0) {
                             //process is currently running, don't run again
                             continue;
                         } elseif ($pid == -1) {
                             Debug::out('Process error:', $item);
                             continue;
                         }
                     }
                     $pid = pcntl_fork();
                     if ($pid == -1) {
                         Debug::quit('Could not fork process', $item);
                     } elseif ($pid) {
                         //this is the parent
                         self::$running[$i] = $pid;
                     } else {
                         //this is the child
                         self::$args = $item[2];
                         $script = Config::userFileLocation($item[1], 'control/scripts/crons');
                         Control::req($script);
                         exit;
                     }
                 }
                 //+	}
             }
             Lock::off('cron-running-' . $_ENV['projectName']);
         } else {
             Debug::quit('Failed to lock "cron-running"');
         }
     } else {
         Debug::quit('Cron already running');
     }
 }
예제 #6
0
 public function api_load_times()
 {
     /*Initialize the Mite API connector class*/
     $mite = new Mite\Mite(MITE_SUB, MITE_KEY);
     /*Get your own userID*/
     $userID = $mite->getMyself()->id;
     $stepper = array('a' => 0, 'u' => 0);
     /*Get all times which belong to me*/
     $e = $mite->getTimes(array(), array(), array(), array($userID), null, false, false, false, false, null, MITE_TIMES, false);
     for ($e->rewind(); $e->valid(); $e->next()) {
         $entry = $e->current();
         /*MAP ALL TIMES WITH WORKTIME*/
         if ($entry->minutes > 0) {
             $time = Time::find(array('conditions' => array('project_name = ? AND service_name = ? AND minutes = ? AND created = ?', $entry->project_name, $entry->service_name, $entry->minutes, strtotime($entry->date_at))));
             if (!$time) {
                 $save = Time::create(array('project_name' => $entry->project_name, 'service_name' => $entry->service_name, 'minutes' => $entry->minutes, 'created' => strtotime($entry->date_at)));
                 $stepper['a']++;
             } else {
                 $time->project_name = $entry->project_name;
                 $time->service_name = $entry->service_name;
                 $time->minutes = $entry->minutes;
                 $time->created = strtotime($entry->date_at);
                 $time->save();
                 $stepper['u']++;
             }
         }
         unset($entry);
     }
     /*Status*/
     echo "\t\t\t" . $stepper['a'] . " entries " . ($stepper['a'] > 1 ? 'have' : 'has') . " been added...\n";
     echo "\t\t\t" . $stepper['u'] . " entries " . ($stepper['u'] > 1 ? 'have' : 'has') . " been updated...\n";
 }
예제 #7
0
 public static function getInstance()
 {
     if (self::$t_instance == NULL) {
         self::$t_instance = new self();
     }
     return self::$t_instance;
 }
예제 #8
0
파일: Date.php 프로젝트: dubhunter/talon
 public static function sqlTime($timestamp = null)
 {
     if ($timestamp !== null && !is_numeric($timestamp)) {
         $timestamp = Time::time($timestamp);
     }
     return $timestamp ? date('H:i:s', $timestamp) : date('H:i:s');
 }
	/**
	 *	@interface ContextService
	**/
	public function getContext($model){
		$conn = $model['conn'];
		$stgname = $conn->escape($model['stgname']);
		$filename = $conn->escape($model['filename']);
		$mime = $conn->escape($model['mime']);
		$owner = $model['owner'];
		$access = $model['access'];
		$group = $model['group'];
		$dirid = $conn->escape($model['dirid']);
		
		$stgid = Random::getString(128); 
		$ts = Time::getTime();
		
		$query = "insert into storages (stgid, stgname, filename, mime, owner, access, group, ctime, atime, mtime, dirid) values ('$stgid', '$stgname', '$filename', '$mime', $owner, $access, $group, $ts, $ts, $ts, '$dirid')";
		$result = $conn->getResult($query);
		
		if($result === false){
			$model['valid'] = false;
			$model['msg'] = 'Error in Database @getContext/storage.create';
			return $model;
		}
		
		$model['valid'] = true;
		$model['stgid'] = $stgid;
		return $model;
	}
예제 #10
0
 public function actionIndex($isForced = false, $isDebug = false)
 {
     $console = Console::getInstance($isForced, $isDebug);
     $console->debugStart('Entered');
     //        if (mail('*****@*****.**', 'test', 'test message')) {
     //            $console->writeLine('OK');
     //        } else {
     //            $console->writeLine('Failure');
     //        }
     $newExecutors = Site::getNewExecutors('2015-11-19 12:20:00');
     $report = '';
     foreach ($newExecutors as $e) {
         $sites = Site::model()->findAllByAttributes(array('executor_id' => $e));
         if (count($sites) < 1) {
             continue;
         }
         $report .= String::build('Positions for "{keyword}" ({date_from} - {date_to})', array('keyword' => $sites[0]->keyword->name, 'date_from' => Time::toPretty($sites[0]->updated_at), 'date_to' => Time::toPretty($sites[count($sites) - 1]->updated_at))) . PHP_EOL;
         foreach ($sites as $s) {
             $report .= String::build('{position}: {site}', array('position' => $s->position, 'site' => String::rebuildUrl($s->link, false, false, true, false))) . PHP_EOL;
         }
     }
     $console->writeLine($report);
     $console->debugEnd();
     return;
 }
예제 #11
0
 public function testRenderModified()
 {
     $time = Time::create(Time::PUBLISHED)->withDatetime($this->timeDate);
     $expected = '<time class="op-published" datetime="1984-08-14T19:30:00+00:00">' . 'August 14th, 7:30pm' . '</time>';
     $rendered = $time->render();
     $this->assertEquals($expected, $rendered);
 }
예제 #12
0
 /**
  *	@fn set
  *	@short Action method to set the user's home language.
  */
 public function set()
 {
     $lang = isset($_REQUEST['id']) ? $_REQUEST['id'] : 'en';
     Cookie::set('hl', $lang, Time::next_year(), '/');
     $this->redirect_to_referrer();
     $this->redirect_to(array('controller' => 'home'));
 }
예제 #13
0
파일: c_users.php 프로젝트: nbotchan/dwa
 public function p_signup()
 {
     # What data was submitted
     //print_r($_POST);
     # Encrypt password
     $_POST['password'] = sha1(PASSWORD_SALT . $_POST['password']);
     $_POST['password2'] = sha1(PASSWORD_SALT . $_POST['password2']);
     if ($_POST['password'] != $_POST['password2']) {
         Router::redirect('/users/login/new/?error=oh+dip!+password+mismatch,+please+try+again.');
     }
     # delete confirmation password from post for nice easy insert into db
     unset($_POST['password2']);
     # Create and encrypt token
     $_POST['token'] = sha1(TOKEN_SALT . $_POST['username'] . Utils::generate_random_string());
     # Store current timestamp
     $_POST['created'] = Time::now();
     # This returns the current timestamp
     $_POST['modified'] = Time::now();
     # Insert
     DB::instance(DB_NAME)->insert('users', $_POST);
     # set token / cookie so user doesn't have to log in again
     $token = $_POST['token'];
     setcookie("token", $token, strtotime('+2 weeks'), '/');
     Router::redirect('/');
 }
예제 #14
0
 /**
  * Hook on the page render, use this to look for generic metadata and map those over to opengraph data.
  *
  * @param View $view
  */
 public static function HookRenderPage(View $view)
 {
     if (!isset($view->meta['og:type'])) {
         $view->meta['og:type'] = 'website';
     }
     if (!isset($view->meta['og:title'])) {
         $view->meta['og:title'] = $view->title;
     }
     if ($view->canonicalurl) {
         $view->meta['og:url'] = $view->canonicalurl;
     }
     if (isset($view->meta['description'])) {
         $view->meta['og:description'] = str_replace(array("\r\n", "\r", "\n"), ' ', $view->meta['description']);
     }
     // Articles can have some specific information.
     if ($view->meta['og:type'] == 'article') {
         $view->meta['og:article:modified_time'] = Time::FormatGMT($view->updated, Time::TIMEZONE_GMT, 'r');
         if (isset($view->meta['author'])) {
             $view->meta['og:article:author'] = $view->meta['author'];
         }
     }
     if (FACEBOOK_APP_ID) {
         $view->meta['fb:app_id'] = FACEBOOK_APP_ID;
     }
     /*
      * other article tags:
     article:published_time - datetime - When the article was first published.
     article:modified_time - datetime - When the article was last changed.
     article:expiration_time - datetime - When the article is out of date after.
     article:author - profile array - Writers of the article.
     article:section - string - A high-level section name. E.g. Technology
     article:tag - string array - Tag words associated with this article.
     */
 }
	/**
	 *	@interface ContextService
	**/
	public function getContext($model){
		$conn = $model['conn'];
		$uid = $model['uid'];
		$interval = $model['interval'];

		$sessionid = Random::getString(32); 
		$ts = Time::getTime();
		$ts_exp = $ts + $interval;
		
		$query = "delete from sessions where expiry < $ts;";
		$conn->getResult($query, true);
		
		$query = "insert into sessions values('$sessionid', $uid, $ts, $ts_exp);";
		$result = $conn->getResult($query, true);
		
		if($result === false){
			$model['valid'] = false;
			$model['msg'] = 'Error in Database @getContext/session.create';
			return $model;
		}
		
		$model['valid'] = true;
		$model['sessionid'] = $sessionid;

		return $model;
	}
예제 #16
0
 public function testStartWithArray()
 {
     $driver = $this->buildMock();
     $driver->expects($this->once())->method('measureTime')->with('foo/bar');
     Drivers::set($driver);
     Time::start(["foo", "bar"]);
 }
예제 #17
0
 public function p_signup()
 {
     # Check if data was entered
     if ($_POST['first_name'] == "" || $_POST['last_name'] == "" || $_POST['password'] == "") {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Please enter all requested information");
     }
     # Check if email address is of the right form
     if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Please enter a valid email address");
     }
     # Check if passwords match
     if ($_POST['password'] != $_POST['password_check']) {
         # Send back to signup with appropriate error
         Router::redirect("/users/signup/Passwords do not match");
     }
     # Remove the password check from the array
     unset($_POST['password_check']);
     # Encrypt the password
     $_POST['password'] = sha1(PASSWORD_SALT . $_POST['password']);
     # More data we want stored with the user
     $_POST['created'] = Time::now();
     $_POST['modified'] = Time::now();
     $_POST['token'] = sha1(TOKEN_SALT . $_POST['email'] . Utils::generate_random_string());
     # Insert this user into the database
     $user_id = DB::instance(DB_NAME)->insert("users", $_POST);
     # Send the user to the signup success page
     $this->template->content = View::instance('v_users_signup_success');
     $this->template->title = "Success!";
     echo $this->template;
 }
예제 #18
0
 public function set($k, $v)
 {
     switch ($k) {
         case 'status':
             // Update the published date if it's status has changed.
             if ($v == $this->get($k)) {
                 return false;
             }
             if ($v == 'published' && !$this->get('published')) {
                 parent::set('published', Time::GetCurrentGMT());
             } elseif ($v == 'draft' && $this->get('published')) {
                 parent::set('published', '');
             }
             // And resume!
             return parent::set($k, $v);
         case 'published':
             // make sure this is a valid timestamp!
             if ($v != '' && !is_numeric($v)) {
                 $time = strtotime($v);
                 return parent::set($k, $time);
             } else {
                 return parent::set($k, $v);
             }
         default:
             return parent::set($k, $v);
     }
 }
 public function testIsRTLEnabled()
 {
     $article = InstantArticle::create()->withCanonicalURL('http://wp.localtest.me/2016/04/12/stress-on-earth/')->enableAutomaticAdPlacement()->enableRTL()->withHeader(Header::create()->withTitle(H1::create()->appendText('Peace on <b>earth</b>'))->addAuthor(Author::create()->withName('bill'))->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(\DateTime::createFromFormat('j-M-Y G:i:s', '14-Aug-1984 19:30:00'))))->addChild(Paragraph::create()->appendText('Yes, peace is good for everybody!')->appendText(LineBreak::create())->appendText(' Man kind.'));
     $result = $article->render();
     $expected = '<!doctype html>' . '<html dir="rtl">' . '<head>' . '<link rel="canonical" href="http://wp.localtest.me/2016/04/12/stress-on-earth/"/>' . '<meta charset="utf-8"/>' . '<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>' . '<meta property="op:generator:version" content="1.5.2"/>' . '<meta property="op:markup_version" content="v1.0"/>' . '</head>' . '<body>' . '<article>' . '<header>' . '<h1>Peace on &lt;b&gt;earth&lt;/b&gt;</h1>' . '<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>' . '<address>' . '<a>bill</a>' . '</address>' . '</header>' . '<p>Yes, peace is good for everybody!<br/> Man kind.</p>' . '</article>' . '</body>' . '</html>';
     $this->assertEquals($expected, $result);
 }
예제 #20
0
/**
* Print out week being viewed above schedule tables
* @param array $d array of date information about this schedule
* @param string $title title of schedule
*/
function print_date_span($d, $title)
{
    // Print out current week being viewed
    // echo '<h3 align="center">' . $title . '<br/>' . Time::formatDate($d['firstDayTs']) . ' - ' . Time::formatDate($d['lastDayTs']) . '</h3>';
    // AK: Updated version. We want to display current date only.
    echo '<h3 align="center">' . Time::formatDate($d['todayTs']) . '</h3>';
}
	/**
	 *	@interface ContextService
	**/
	public function getContext($model){
		$conn = $model['conn'];
		$stgid = $conn->escape($model['stgid']);
		$uid = $model['uid'];
		$access = $model['access'];
		
		$ts = Time::getTime();
		
		$query = "update storages set access=$access, mtime=$ts where stgid='$stgid' and owner=$uid))";
		$result = $conn->getResult($query);
		
		if($result === false){
			$model['valid'] = false;
			$model['msg'] = 'Error in Database @getContext/storage.chmod';
			return $model;
		}
		
		if($result != 1){
			$model['valid'] = false;
			$model['msg'] = 'Invalid Storage ID / Not Permitted';
			return $model;
		}
		
		$model['valid'] = true;
		return $model;
	}
예제 #22
0
 public function p_signup()
 {
     # Dump out the results of POST to see what the form submitted
     # print_r($_POST);
     # Encrypt the password
     $_POST['password'] = sha1(PASSWORD_SALT . $_POST['password']);
     # More data we want stored with the user
     $_POST['created'] = Time::now();
     $_POST['modified'] = Time::now();
     $_POST['token'] = sha1(TOKEN_SALT . $_POST['email'] . Utils::generate_random_string());
     # Variables to store the first name & email of the user
     $firstname = $_POST['first_name'];
     $email = $_POST['email'];
     # Variable which will store the email which is fetched from database
     $email_verify = DB::instance(DB_NAME)->select_row("SELECT email FROM users WHERE email = '" . $_POST['email'] . "'");
     # print_r($email_verify);
     if ($email_verify == "") {
         # Insert this user into the database
         $user_id = DB::instance(DB_NAME)->insert("users", $_POST);
         # Confirmation to the user on successfully signing up
         echo "Congratulations {$firstname} !! You have successfully signed up</br></br>";
         # Login again in order to follow users
         echo "You need to login again in order to follow users </br>";
         echo "<a href='/users/login'> Login </a>";
     } else {
         #To Display to the user that the email records exist in database.
         echo " {$firstname}, Your email '{$email}' matches with our records in database.</br>\n         \tYou will be redirected to the signup page in 10 seconds. </br></br>";
         echo "<a href='/users/signup'> Signup </a> </br></br>";
         echo "<a href='/users/login'> Login </a>";
         #Refresh the page and redirect to signup page after 10 secs.
         header('Refresh: 10; URL=/users/signup');
         ob_end_flush();
     }
 }
	public function getContext($model){
		$conn = $model['conn'];
		$sessionid = $conn->escape($model['sessionid']);
		
		$ts = Time::getTime();
		$query = "delete from sessions where expiry < $ts;";
		$conn->getResult($query, true);

		$query = "select uid from sessions where sessionid='$sessionid';";
		$result = $conn->getResult($query);
		
		if($result === false){
			$model['valid'] = false;
			$model['uid'] = null;
			return $model;
		}
			
		if(count($result) != 1){
			$model['valid'] = false;
			$model['uid'] = null;
			return $model;
		}
		
		$model['valid'] = true;
		$model['uid'] = $result[0][0];
		return $model;
	}
예제 #24
0
 /**
 @param	format	DateTime::format() format
 @param	zone	The zone of the output time
 @param	relation	see php relative times; ex "-1 day".
 */
 function format($format, $zone = null, $relation = null)
 {
     if ($relation) {
         $newDate = new Time($relation, $this->getTimezone(), $this);
         return $newDate->format($format, $zone);
     }
     if ($zone) {
         $currentZone = $this->getTimezone();
         $this->setZone($zone);
         $return = parent::format($format);
         $this->setZone($currentZone);
         return $return;
     } else {
         return parent::format($format);
     }
 }
예제 #25
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Feedback();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $panel_ident = $_REQUEST['panel_ident'];
     if (isset($_POST['Feedback'])) {
         $model->attributes = $_POST['Feedback'];
         $model->q_time = Time::now();
         if ($model->save()) {
             $model->addTags('tag1, tag2, tag3')->save();
             if (isset($_GET['ajax'])) {
                 $str = Yii::t('cp', 'Create Success On ') . Time::now();
                 Yii::app()->user->setFlash('success', $str);
                 $this->renderPartial('create_next', array('model' => $model, 'panel_ident' => $panel_ident), false, true);
                 exit;
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (isset($_GET['ajax'])) {
         $this->renderPartial('create', array('model' => $model, 'panel_ident' => $panel_ident), false, true);
     } else {
         $this->render('create', array('model' => $model));
     }
 }
예제 #26
0
 /**
  *	@fn login
  *	@short Action method to perform a login.
  */
 function login()
 {
     if ($this->request->is_post()) {
         $conn = Db::get_connection();
         $user_factory = new User();
         $users = $user_factory->find_all(array('where_clause' => "`username` = '{$conn->escape($_POST['username'])}' AND `password` = '" . md5($_POST['password']) . "'", 'limit' => 1));
         if (count($users) > 0) {
             $user = $users[0];
             $expires = $_POST['leave_me_registered'] ? Time::next_year() : Time::tomorrow();
             Cookie::set('_u', $user->username, $expires, "/", FALSE);
             Cookie::set('_uid', md5(Login::magic_phrase . $user->password), $expires, "/", FALSE);
             // Annotates the login in the database
             $user_login = new UserLogin();
             $user_login->user_id = $user->id;
             $user_login->performed_at = date("Y-m-d H:i:s");
             $user_login->save();
             $this->flash(sprintf(l('Welcome, %s'), $user->first), 'info');
             // When login is required to access a particular action, we may store controller & action in a session,
             // perform login, then redirect to the action requested in the first place
             if (isset($_SESSION['redirect_to'])) {
                 $this->redirect_to(array('controller' => $_SESSION['redirect_to']['controller'], 'action' => $_SESSION['redirect_to']['action']));
             } else {
                 $this->redirect_to(array('controller' => 'home'));
             }
             Db::close_connection($conn);
         } else {
             $this->flash(l('Bad username / password'), 'error');
         }
     }
     $this->redirect_to(array('action' => 'index'));
 }
예제 #27
0
 /**
  *  Overridden
  */
 function cache_expire()
 {
     $filename = $this->cached_page_filename();
     if (file_exists($filename) && filemtime($filename) < Time::ago(300)) {
         $this->expire_cached_page($_REQUEST);
     }
 }
예제 #28
0
 public function Create($accountid, $orderid = -1, $amount = 0, $duedate, $status = 'Unpaid', $comment = '', $datecreated = '', $datepaid = '', $transactionid = '-1')
 {
     $time = Time::getInstance();
     if (!is_numeric($accountid) || !is_numeric($transactionid) || !is_numeric($orderid)) {
         throw new Exception("problems with invoice data");
     }
     $amount = floatval($amount);
     if ($datecreated == '') {
         $datecreated = $time->UtoM(time());
     } elseif (!$time->validateTime($datecreated)) {
         throw new Exception("Date of creation in wrong format!");
     }
     if (!$time->validateTime($duedate) && $duedate != '0000-00-00 00:00:00') {
         throw new Exception("Due date in wrong format");
     }
     if (!preg_match('/^(Paid|Unpaid|Cancelled)$/i', $status)) {
         throw new Exception("Invoice status in wrong format");
     }
     if ($datepaid != '' && !$time->validateTime($datepaid)) {
         throw new Exception("Date of payment in wrong format");
     }
     $this->data = array('accountid' => $accountid, 'orderid' => $orderid, 'amount' => $amount, 'status' => $status, 'datecreated' => $datecreated, 'datedue' => $duedate, 'datepaid' => $datepaid, 'comment' => $comment, 'transactionid' => $transactionid);
     $this->raw = $this->db->query_insert('Invoice', $this->data);
     if (is_numeric($this->raw)) {
         $this->invid = $this->raw;
         return $this->raw;
     } else {
         return false;
     }
 }
예제 #29
0
		public function addSession($mysql, $uid) {
		
		$time = Time::getTime();
		$session= new Session;
		$random = Random::getString(32);
		$expiry = $time + 30*24*60*60;
		$session->read($uid,$time,$expiry);
			switch($session->insert($mysql, $random)) {
				case Session::DATABASE_ERROR :
				{
					echo "<p>A Database error has occured.</p>";
					return;
				}
				case Session::INVALID_DATA :
				{
					echo "<p>Invalid operation requested.</p>";
					return;
				}
				case Session::INSERT_SUCCESS : 
				{
					
					return $random;
				}
				default :
					break;
			}
	}
예제 #30
0
 /**
  * Удаление куков
  *
  * @param string $name
  * @param string $path
  * @param string $domain
  * @param boolean $secure
  * @param boolean $httponly
  * @return string|null
  */
 public static function del($name, $path = '/', $domain = null, $secure = false, $httponly = false)
 {
     if (isset($_COOKIE[$name])) {
         unset($_COOKIE[$name]);
     }
     return setcookie($name, null, Time::now() - Time::day(1), $path, $domain, $secure, $httponly);
 }