PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/leaf/modules/mod_cookie/class_cookie.php

https://github.com/ivansoriasolis/Vidali
PHP | 46 lines | 21 code | 13 blank | 12 comment | 5 complexity | d1330af47556577579dfae8d98af4806 MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php
  2. /***********************************************************************
  3. * LeafWork 2.0
  4. * ---------------------------------------------------------------------
  5. * File: class_cookie.php
  6. * Author: MoisĂŠs Lodeiro <moises.lodeiro@gmail.com>
  7. * Licence: GPLv3
  8. * ---------------------------------------------------------------------
  9. * DESC
  10. * ---------------------------------------------------------------------
  11. * Dependencias: Ninguna.
  12. * ---------------------------------------------------------------------
  13. **********************************************************************/
  14. class cookie {
  15. static private $cookie;
  16. public function __construct(){
  17. self::$cookie = $_COOKIE;
  18. }
  19. public function get(){
  20. if( func_num_args() == 0 )
  21. return self::$cookie;
  22. else
  23. return ( isset( self::$cookie[ func_get_arg(1) ] )?( self::$cookie[ func_get_arg(1) ] ):( null ));
  24. }
  25. public function set(){
  26. if( func_num_args() == 1 ){
  27. self::$cookie = func_get_arg(0);
  28. $_COOKIE = self::$cookie;
  29. }elseif( func_num_args == 2 )
  30. self::$cookie[func_get_arg(0)] = func_get_arg(1);
  31. }
  32. }
  33. ?>