Sure thing, here is the code in question.
Also I’ll post a new issue, but I’m gonna go ahead and open an email ticket as well so I can help you get it resolved quickly in the case we need to give more private details.
add_filter("bricks/code/echo_function_names", function () {
return [
"date",
"get_the_title_with_autobreak_subtext",
"have_rows",
"echo",
"FallbackText",
"HasDiscount",
"DiscountedPrice",
"DiscountValue",
"LifetimeDealsRemaining",
"NextFriday",
"wpf_has_tag",
"wpf_get_tag",
"PluginActiveInstalls",
"PluginRatingCount",
"PluginRating",
"PluginRatings",
"PluginDownloads",
"PluginCurrentVersion",
"TotalPopupViewsLastCalculated",
"EstViewsByDateTime",
"EstPopupViewsPerSecond",
"TotalPopupsViewed",
"EstViewsAfterSeconds",
"EstPopupViewsCurrently",
];
});
function TotalPopupsViewed()
{
return 23075292335;
}
function EstPopupViewsPerSecond($seconds = null)
{
// Average of 14 million popups per week
$weeklyViews = 14000000;
$dailyViews = $weeklyViews / 7;
$viewsPerSecond = $dailyViews / 86400; // 86400 seconds in a day
if ($seconds !== null) {
return $viewsPerSecond * $seconds;
}
return $viewsPerSecond;
}
function TotalPopupViewsLastCalculated()
{
return new DateTime("2024-05-26");
}
function EstViewsByDateTime($date = "today")
{
$lastCalculated = TotalPopupViewsLastCalculated();
$targetDate = new DateTime($date);
$interval = $lastCalculated->diff($targetDate);
$daysDifference = $interval->days;
$viewsPerSecond = EstPopupViewsPerSecond();
$estimatedViews = $daysDifference * 86400 * $viewsPerSecond;
return TotalPopupsViewed() + $estimatedViews;
}
function EstPopupViewsCurrently()
{
$new_date = (new DateTime())->format("Y-m-d");
return EstViewsByDateTime($new_date);
}
function EstViewsAfterSeconds($seconds = 86400)
{
$newDate = date("Y-m-d", strtotime("+ " . $seconds . " seconds"));
return EstViewsByDateTime($newDate);
}