wp/wp-includes/js/utils.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
   113 		var d = new Date();
   113 		var d = new Date();
   114 
   114 
   115 		if ( typeof( expires ) === 'object' && expires.toGMTString ) {
   115 		if ( typeof( expires ) === 'object' && expires.toGMTString ) {
   116 			expires = expires.toGMTString();
   116 			expires = expires.toGMTString();
   117 		} else if ( parseInt( expires, 10 ) ) {
   117 		} else if ( parseInt( expires, 10 ) ) {
   118 			d.setTime( d.getTime() + ( parseInt( expires, 10 ) * 1000 ) ); // time must be in milliseconds
   118 			d.setTime( d.getTime() + ( parseInt( expires, 10 ) * 1000 ) ); // Time must be in milliseconds.
   119 			expires = d.toGMTString();
   119 			expires = d.toGMTString();
   120 		} else {
   120 		} else {
   121 			expires = '';
   121 			expires = '';
   122 		}
   122 		}
   123 
   123 
   151 	}
   151 	}
   152 
   152 
   153 	return '';
   153 	return '';
   154 };
   154 };
   155 
   155 
   156 // Both name and value must be only ASCII letters, numbers or underscore
   156 /*
   157 // and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
   157  * Both name and value must be only ASCII letters, numbers or underscore
   158 // The value is converted and stored as string.
   158  * and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
       
   159  * The value is converted and stored as string.
       
   160  */
   159 window.setUserSetting = function( name, value, _del ) {
   161 window.setUserSetting = function( name, value, _del ) {
   160 	if ( 'object' !== typeof userSettings ) {
   162 	if ( 'object' !== typeof userSettings ) {
   161 		return false;
   163 		return false;
   162 	}
   164 	}
   163 
   165 
   190 
   192 
   191 window.deleteUserSetting = function( name ) {
   193 window.deleteUserSetting = function( name ) {
   192 	return setUserSetting( name, '', 1 );
   194 	return setUserSetting( name, '', 1 );
   193 };
   195 };
   194 
   196 
   195 // Returns all settings as js object.
   197 // Returns all settings as JS object.
   196 window.getAllUserSettings = function() {
   198 window.getAllUserSettings = function() {
   197 	if ( 'object' !== typeof userSettings ) {
   199 	if ( 'object' !== typeof userSettings ) {
   198 		return {};
   200 		return {};
   199 	}
   201 	}
   200 
   202