/contrib/integration/session/php/cppcms_api.php

https://gitlab.com/anonymous0/cppcms-ng · PHP · 335 lines · 246 code · 77 blank · 12 comment · 27 complexity · 976f1e081554e1b3638b254d1111149c MD5 · raw file

  1. <?php
  2. /* ----------------------------------------------------------------------------
  3. * This file was automatically generated by SWIG (http://www.swig.org).
  4. * Version 2.0.11
  5. *
  6. * This file is not intended to be easily readable and contains a number of
  7. * coding conventions designed to improve portability and efficiency. Do not make
  8. * changes to this file unless you know what you are doing--modify the SWIG
  9. * interface file instead.
  10. * ----------------------------------------------------------------------------- */
  11. // Try to load our extension if it's not already loaded.
  12. if (!extension_loaded('cppcms_api')) {
  13. if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
  14. if (!dl('php_cppcms_api.dll')) return;
  15. } else {
  16. // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
  17. if (PHP_SHLIB_SUFFIX === 'dylib') {
  18. if (!dl('cppcms_api.so')) return;
  19. } else {
  20. if (!dl('cppcms_api.'.PHP_SHLIB_SUFFIX)) return;
  21. }
  22. }
  23. }
  24. abstract class cppcms_api {
  25. const SESSION_FIXED = SESSION_FIXED;
  26. const SESSION_RENEW = SESSION_RENEW;
  27. const SESSION_BROWSER = SESSION_BROWSER;
  28. const ERROR_OK = ERROR_OK;
  29. const ERROR_GENERAL = ERROR_GENERAL;
  30. const ERROR_RUNTIME = ERROR_RUNTIME;
  31. const ERROR_INVALID_ARGUMENT = ERROR_INVALID_ARGUMENT;
  32. const ERROR_LOGIC = ERROR_LOGIC;
  33. const ERROR_ALLOC = ERROR_ALLOC;
  34. }
  35. /* PHP Proxy Classes */
  36. class CppCMSAPIPool {
  37. public $_cPtr=null;
  38. protected $_pData=array();
  39. function __set($var,$value) {
  40. if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
  41. $this->_pData[$var] = $value;
  42. }
  43. function __isset($var) {
  44. if ($var === 'thisown') return true;
  45. return array_key_exists($var, $this->_pData);
  46. }
  47. function __get($var) {
  48. if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
  49. return $this->_pData[$var];
  50. }
  51. function __construct($res=null) {
  52. if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_session_pool') {
  53. $this->_cPtr=$res;
  54. return;
  55. }
  56. $this->_cPtr=new_CppCMSAPIPool();
  57. }
  58. function error() {
  59. return CppCMSAPIPool_error($this->_cPtr);
  60. }
  61. function error_message() {
  62. return CppCMSAPIPool_error_message($this->_cPtr);
  63. }
  64. function error_clear() {
  65. return CppCMSAPIPool_error_clear($this->_cPtr);
  66. }
  67. function init($conf) {
  68. return CppCMSAPIPool_init($this->_cPtr,$conf);
  69. }
  70. function init_from_json($conf) {
  71. return CppCMSAPIPool_init_from_json($this->_cPtr,$conf);
  72. }
  73. }
  74. class CppCMSAPISession {
  75. public $_cPtr=null;
  76. protected $_pData=array();
  77. function __set($var,$value) {
  78. if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
  79. $this->_pData[$var] = $value;
  80. }
  81. function __isset($var) {
  82. if ($var === 'thisown') return true;
  83. return array_key_exists($var, $this->_pData);
  84. }
  85. function __get($var) {
  86. if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
  87. return $this->_pData[$var];
  88. }
  89. function __construct($res=null) {
  90. if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_session') {
  91. $this->_cPtr=$res;
  92. return;
  93. }
  94. $this->_cPtr=new_CppCMSAPISession();
  95. }
  96. function error() {
  97. return CppCMSAPISession_error($this->_cPtr);
  98. }
  99. function error_message() {
  100. return CppCMSAPISession_error_message($this->_cPtr);
  101. }
  102. function error_clear() {
  103. return CppCMSAPISession_error_clear($this->_cPtr);
  104. }
  105. function init($pool) {
  106. return CppCMSAPISession_init($this->_cPtr,$pool);
  107. }
  108. function clear() {
  109. return CppCMSAPISession_clear($this->_cPtr);
  110. }
  111. function is_set($key) {
  112. return CppCMSAPISession_is_set($this->_cPtr,$key);
  113. }
  114. function erase($key) {
  115. return CppCMSAPISession_erase($this->_cPtr,$key);
  116. }
  117. function get_exposed($key) {
  118. return CppCMSAPISession_get_exposed($this->_cPtr,$key);
  119. }
  120. function set_exposed($key,$is_exposed) {
  121. return CppCMSAPISession_set_exposed($this->_cPtr,$key,$is_exposed);
  122. }
  123. function get_first_key() {
  124. return CppCMSAPISession_get_first_key($this->_cPtr);
  125. }
  126. function get_next_key() {
  127. return CppCMSAPISession_get_next_key($this->_cPtr);
  128. }
  129. function get_csrf_token() {
  130. return CppCMSAPISession_get_csrf_token($this->_cPtr);
  131. }
  132. function set($key,$value) {
  133. return CppCMSAPISession_set($this->_cPtr,$key,$value);
  134. }
  135. function get($key) {
  136. return CppCMSAPISession_get($this->_cPtr,$key);
  137. }
  138. function set_binary_as_hex($key,$value) {
  139. return CppCMSAPISession_set_binary_as_hex($this->_cPtr,$key,$value);
  140. }
  141. function get_binary_as_hex($key) {
  142. return CppCMSAPISession_get_binary_as_hex($this->_cPtr,$key);
  143. }
  144. function get_binary_len($key) {
  145. return CppCMSAPISession_get_binary_len($this->_cPtr,$key);
  146. }
  147. function reset_session() {
  148. return CppCMSAPISession_reset_session($this->_cPtr);
  149. }
  150. function set_default_age() {
  151. return CppCMSAPISession_set_default_age($this->_cPtr);
  152. }
  153. function set_age($t) {
  154. return CppCMSAPISession_set_age($this->_cPtr,$t);
  155. }
  156. function get_age() {
  157. return CppCMSAPISession_get_age($this->_cPtr);
  158. }
  159. function set_default_expiration() {
  160. return CppCMSAPISession_set_default_expiration($this->_cPtr);
  161. }
  162. function set_expiration($t) {
  163. return CppCMSAPISession_set_expiration($this->_cPtr,$t);
  164. }
  165. function get_expiration() {
  166. return CppCMSAPISession_get_expiration($this->_cPtr);
  167. }
  168. function set_on_server($is_on_server) {
  169. return CppCMSAPISession_set_on_server($this->_cPtr,$is_on_server);
  170. }
  171. function get_on_server() {
  172. return CppCMSAPISession_get_on_server($this->_cPtr);
  173. }
  174. function get_session_cookie_name() {
  175. return CppCMSAPISession_get_session_cookie_name($this->_cPtr);
  176. }
  177. function load($session_cookie_value) {
  178. return CppCMSAPISession_load($this->_cPtr,$session_cookie_value);
  179. }
  180. function save() {
  181. return CppCMSAPISession_save($this->_cPtr);
  182. }
  183. function cookie_first() {
  184. $r=CppCMSAPISession_cookie_first($this->_cPtr);
  185. if (is_resource($r)) {
  186. $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
  187. if (class_exists($c)) return new $c($r);
  188. return new CppCMSAPICookie($r);
  189. }
  190. return $r;
  191. }
  192. function cookie_next() {
  193. $r=CppCMSAPISession_cookie_next($this->_cPtr);
  194. if (is_resource($r)) {
  195. $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
  196. if (class_exists($c)) return new $c($r);
  197. return new CppCMSAPICookie($r);
  198. }
  199. return $r;
  200. }
  201. }
  202. class CppCMSAPICookie {
  203. public $_cPtr=null;
  204. protected $_pData=array();
  205. function __set($var,$value) {
  206. if ($var === 'thisown') return swig_cppcms_api_alter_newobject($this->_cPtr,$value);
  207. $this->_pData[$var] = $value;
  208. }
  209. function __isset($var) {
  210. if ($var === 'thisown') return true;
  211. return array_key_exists($var, $this->_pData);
  212. }
  213. function __get($var) {
  214. if ($var === 'thisown') return swig_cppcms_api_get_newobject($this->_cPtr);
  215. return $this->_pData[$var];
  216. }
  217. function __construct($res=null) {
  218. if (is_resource($res) && get_resource_type($res) === '_p_cppcms_capi_cookie') {
  219. $this->_cPtr=$res;
  220. return;
  221. }
  222. $this->_cPtr=new_CppCMSAPICookie();
  223. }
  224. function header() {
  225. return CppCMSAPICookie_header($this->_cPtr);
  226. }
  227. function header_content() {
  228. return CppCMSAPICookie_header_content($this->_cPtr);
  229. }
  230. function name() {
  231. return CppCMSAPICookie_name($this->_cPtr);
  232. }
  233. function value() {
  234. return CppCMSAPICookie_value($this->_cPtr);
  235. }
  236. function path() {
  237. return CppCMSAPICookie_path($this->_cPtr);
  238. }
  239. function domain() {
  240. return CppCMSAPICookie_domain($this->_cPtr);
  241. }
  242. function max_age_defined() {
  243. return CppCMSAPICookie_max_age_defined($this->_cPtr);
  244. }
  245. function max_age() {
  246. return CppCMSAPICookie_max_age($this->_cPtr);
  247. }
  248. function expires_defined() {
  249. return CppCMSAPICookie_expires_defined($this->_cPtr);
  250. }
  251. function expires() {
  252. return CppCMSAPICookie_expires($this->_cPtr);
  253. }
  254. function is_secure() {
  255. return CppCMSAPICookie_is_secure($this->_cPtr);
  256. }
  257. }
  258. ?>