Source for file IHttpRequest.php

Documentation is available at IHttpRequest.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see http://nettephp.com
  12. 12:  *
  13. 13:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  14. 14:  * @license    http://nettephp.com/license  Nette license
  15. 15:  * @link       http://nettephp.com
  16. 16:  * @category   Nette
  17. 17:  * @package    Nette\Web
  18. 18:  */
  19. 19:  
  20. 20:  
  21. 21:  
  22. 22: /**
  23. 23:  * IHttpRequest provides access scheme for request sent via HTTP.
  24. 24:  *
  25. 25:  * @author     David Grudl
  26. 26:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  27. 27:  * @package    Nette\Web
  28. 28:  */
  29. 29: interface IHttpRequest
  30. 30: {
  31. 31:     /**#@+ HTTP request method */
  32. 32:     const
  33. 33:         GET 'GET',
  34. 34:         POST 'POST',
  35. 35:         HEAD 'HEAD',
  36. 36:         PUT 'PUT',
  37. 37:         DELETE 'DELETE';
  38. 38:     /**#@-*/
  39. 39:  
  40. 40:     /**
  41. 41:      * Returns URL object.
  42. 42:      * @return UriScript 
  43. 43:      */
  44. 44:     function getUri();
  45. 45:  
  46. 46:     /********************* query, post, files & cookies ****************d*g**/
  47. 47:  
  48. 48:     /**
  49. 49:      * Returns variable provided to the script via URL query ($_GET).
  50. 50:      * If no key is passed, returns the entire array.
  51. 51:      * @param  string key
  52. 52:      * @param  mixed  default value
  53. 53:      * @return mixed 
  54. 54:      */
  55. 55:     function getQuery($key NULL$default NULL);
  56. 56:  
  57. 57:     /**
  58. 58:      * Returns variable provided to the script via POST method ($_POST).
  59. 59:      * If no key is passed, returns the entire array.
  60. 60:      * @param  string key
  61. 61:      * @param  mixed  default value
  62. 62:      * @return mixed 
  63. 63:      */
  64. 64:     function getPost($key NULL$default NULL);
  65. 65:  
  66. 66:     /**
  67. 67:      * Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded").
  68. 68:      * @return string 
  69. 69:      */
  70. 70:     function getPostRaw();
  71. 71:  
  72. 72:     /**
  73. 73:      * Returns uploaded file.
  74. 74:      * @param  string key (or more keys)
  75. 75:      * @return HttpUploadedFile 
  76. 76:      */
  77. 77:     function getFile($key);
  78. 78:  
  79. 79:     /**
  80. 80:      * Returns uploaded files.
  81. 81:      * @return array 
  82. 82:      */
  83. 83:     function getFiles();
  84. 84:  
  85. 85:     /**
  86. 86:      * Returns variable provided to the script via HTTP cookies.
  87. 87:      * @param  string key
  88. 88:      * @param  mixed  default value
  89. 89:      * @return mixed 
  90. 90:      */
  91. 91:     function getCookie($key$default NULL);
  92. 92:  
  93. 93:     /**
  94. 94:      * Returns variables provided to the script via HTTP cookies.
  95. 95:      * @return array 
  96. 96:      */
  97. 97:     function getCookies();
  98. 98:  
  99. 99:     /********************* method & headers ****************d*g**/
  100. 100:  
  101. 101:     /**
  102. 102:      * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
  103. 103:      * @return string 
  104. 104:      */
  105. 105:     function getMethod();
  106. 106:  
  107. 107:     /**
  108. 108:      * Checks HTTP request method.
  109. 109:      * @param  string 
  110. 110:      * @return bool 
  111. 111:      */
  112. 112:     function isMethod($method);
  113. 113:  
  114. 114:     /**
  115. 115:      * Return the value of the HTTP header. Pass the header name as the
  116. 116:      * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
  117. 117:      * @param  string 
  118. 118:      * @param  mixed 
  119. 119:      * @return mixed 
  120. 120:      */
  121. 121:     function getHeader($header$default NULL);
  122. 122:  
  123. 123:     /**
  124. 124:      * Returns all HTTP headers.
  125. 125:      * @return array 
  126. 126:      */
  127. 127:     function getHeaders();
  128. 128:  
  129. 129:     /**
  130. 130:      * Is the request is sent via secure channel (https).
  131. 131:      * @return bool 
  132. 132:      */
  133. 133:     function isSecured();
  134. 134:  
  135. 135:     /**
  136. 136:      * Is AJAX request?
  137. 137:      * @return bool 
  138. 138:      */
  139. 139:     function isAjax();
  140. 140:  
  141. 141:     /**
  142. 142:      * Returns the IP address of the remote client.
  143. 143:      * @return string 
  144. 144:      */
  145. 145:     function getRemoteAddress();
  146. 146:  
  147. 147:     /**
  148. 148:      * Returns the host of the remote client.
  149. 149:      * @return string 
  150. 150:      */
  151. 151:     function getRemoteHost();
  152. 152: