tasianmedia / cookiejar Goto Github PK
View Code? Open in Web Editor NEWA Cookie toolkit Extra for MODX Revolution
Home Page: http://modx.com/extras/package/cookiejar
A Cookie toolkit Extra for MODX Revolution
Home Page: http://modx.com/extras/package/cookiejar
I included a mention of your extra in a blog post, and after looking at the code, had a few ideas for you I wanted to mention:
$expires = !empty($expires) ? time() + intval( ($expires * 86400)) : '';
Add the cookie name and value to the $_COOKIE array so the value will be available later in the page without a reload.
Log an error if setCookie() fails.
if (isset($name)) {
$success = setcookie($name,$value,intval($expires),$path,$domain,$secure,$httponly);
} else {
$modx->log(modX::LOG_LEVEL_ERROR, 'setCookie() - &name is required');
}
if ($success) {
/* Make cookie available immediately */
$_COOKIE[$name] = $value;
} else {
$modx->log(modX::LOG_LEVEL_ERROR, 'Cookie not set');
}
I didn't do a pull request because I wasn't sure what you'd want to do about existing installs that use seconds (e.g., convert them in the update package, or introduce a new property: &units which defaults to seconds).
Set default val for $result
to fix undefined variable notice in logs.
Can you change the log from ERROR to DEBUG?
My MODX error log is filling up with "getCookie() - Cookie name not recognised." My boss thinks it is an error, but it isn't. Most visitors won't have the cookie I am looking for on that page. It is only for special visitors to another page that get that cookie.
The getCookie does not work if your cookie has a period in the name e.g. if your cookie is named "local.user", however, setCookie works fine with cookies named that way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.