Skip to content
Browse files

Session functions: Implemented some deprecated ones and put in _exper…

…imental, moved some to not nonporting, move test files to test directory
  • Loading branch information...
1 parent ff0e9ff commit 4c64dcd9857ac31b7f8b693d2354111ec78a7a77 @brettz9 brettz9 committed Aug 28, 2010
View
10 _experimental/session/session_is_registered.js
@@ -0,0 +1,10 @@
+function session_is_registered (name) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Brett Zamir (http://brett-zamir.me)
+ // % note 1: Deprecated in PHP
+ // * example 1: session_is_registered('someUnregisteredGlobalVarName');
+ // * returns 1: false
+
+ var obj = this.$_SESSION ? this : window; // Can be stored on the namespaced object
+ return !!(obj.$_SESSION) && typeof obj.$_SESSION[name] !== 'undefined';
+}
View
24 _experimental/session/session_register.js
@@ -0,0 +1,24 @@
+function session_register () {
+ // http://kevin.vanzonneveld.net
+ // + original by: Brett Zamir (http://brett-zamir.me)
+ // % note 1: Deprecated in PHP
+ // * example 1: session_register('someVarName');
+ // * returns 1: true
+
+ var name = '', obj = this.$_SESSION ? this : window; // Allow storage on the namespaced object
+
+ if (!this.$_SESSION && !window.$_SESSION) {
+ window.$_SESSION = {};
+ }
+
+ for (var i = 0, argc = arguments.length; i < argc; i++) {
+ if (typeof arguments[i] !== 'string') {
+ this.session_register(arguments[i]); // Probably an array
+ }
+ else {
+ name = arguments[i];
+ obj.$_SESSION[name] = window[name];
+ }
+ }
+ return true;
+}
View
13 _experimental/session/session_unregister.js
@@ -0,0 +1,13 @@
+function session_unregister (name) {
+ // http://kevin.vanzonneveld.net
+ // + original by: Brett Zamir (http://brett-zamir.me)
+ // % note 1: Deprecated in PHP
+ // * example 1: session_unregister('someVarName');
+ // * returns 1: true
+
+ var obj = this.$_SESSION ? this : window; // Allow storage on the namespaced object
+ if (obj.$_SESSION) {
+ delete obj.$_SESSION[name];
+ }
+ return true;
+}
View
0 _unported/session/session_cache_expire.js → _notporting/session/session_cache_expire.js
File renamed without changes.
View
0 _unported/session/session_cache_limiter.js → _notporting/session/session_cache_limiter.js
File renamed without changes.
View
0 _unported/session/session_save_path.js → _notporting/session/session_save_path.js
File renamed without changes.
View
0 _unported/session/session_write_close.js → _notporting/session/session_write_close.js
File renamed without changes.
View
3 _unported/session/session_is_registered.js
@@ -1,3 +0,0 @@
-function session_is_registered () {
-
-}
View
3 _unported/session/session_register.js
@@ -1,3 +0,0 @@
-function session_register () {
-
-}
View
3 _unported/session/session_unregister.js
@@ -1,3 +0,0 @@
-function session_unregister () {
-
-}
View
0 _unported/session/php.default.min.js → tests/functions/session/php.default.min.js 100755 → 100644
File renamed without changes.
View
0 _unported/session/session.js → tests/functions/session/session.js 100755 → 100644
File renamed without changes.
View
0 _unported/session/test.html → tests/functions/session/test.html 100755 → 100644
File renamed without changes.
View
2 _unported/session/test2.html → tests/functions/session/test2.html 100755 → 100644
@@ -6,7 +6,7 @@
<link rel="stylesheet" href="http://github.com/jquery/qunit/raw/master/qunit/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://github.com/jquery/qunit/raw/master/qunit/qunit.js"></script>
<script type="text/javascript" src="php.default.min.js"></script>
-<script type="text/javascript" src="session_start.js"></script>
+<script type="text/javascript" src="session.js"></script>
<script>

0 comments on commit 4c64dcd

Please sign in to comment.
Something went wrong with that request. Please try again.