Skip to content

Commit acbdc4d

Browse files
committed
Merge origin/master
Conflicts: .gitignore CHANGELOG
2 parents 9aedca3 + cb4c901 commit acbdc4d

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ nbproject/
22
/public_html/config.php
33
!/public_html/config.php.new
44
/public_html/inc/popup_notice.php
5-
/private/
5+
/private/

public_html/inc/popup_notice.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,31 @@
88
// time. probably a good idea to have some sort
99
// of cookie based solution to check whether users
1010
// have seen the pop up lately as to not bother
11-
// them too much.
11+
// them too much.
12+
13+
14+
// This is for displaying a popup notice that is at the same time a MailChimp signup form for calculator update notices
15+
if (!(isset($_COOKIE['MCPopupCount']))) {
16+
$popupcount = 1;
17+
} else {
18+
$popupcount = $_COOKIE['MCPopupCount'] + 1;
19+
}
20+
if ($popupcount < 12) { // we only gonna show the notice 12 times in total
21+
if ($popupcount <= 3) {
22+
$notice_frequency = 86400; // time between Update Notice popups in seconds. 3600 = 1 hour, 86400 = 1 day
23+
} elseif ($popupcount <= 6) {
24+
$notice_frequency = 86400*3; // time between Update Notice popups in seconds. 3600 = 1 hour, 86400 = 1 day
25+
} elseif ($popupcount <= 10) {
26+
$notice_frequency = 86400*7; // time between Update Notice popups in seconds. 3600 = 1 hour, 86400 = 1 day
27+
} else {
28+
$notice_frequency = 86400*10; // time between Update Notice popups in seconds. 3600 = 1 hour, 86400 = 1 day
29+
}
30+
if (!(isset($_COOKIE['MCPopup']))) {
31+
setcookie('MCPopup', 'MCPopup', time() + $notice_frequency, '/') ;
32+
setcookie('MCPopupCount', $popupcount, time() + 86400*365, '/') ;
33+
setcookie('MCPopupClosed', '', time() - 3600, '/') ;
34+
// now we can actually output the javascipt code that pops up the popup
35+
echo ' <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>';
36+
echo ' <script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us19.list-manage.com","uuid":"74a392f7e778f1f1c3f4f2aa3","lid":"9eff2395e5","uniqueMethods":true}) })</script>';
37+
}
38+
}

0 commit comments

Comments
 (0)