add theme
This commit is contained in:
15
wp/wp-content/themes/medicalalert/helpers/DateFormatter.php
Normal file
15
wp/wp-content/themes/medicalalert/helpers/DateFormatter.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Helpers;
|
||||
|
||||
class DateFormatter
|
||||
{
|
||||
public static function monthDayYear()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$dateString = strtotime($context->get($args));
|
||||
|
||||
return date("M d, Y", $dateString);
|
||||
};
|
||||
}
|
||||
}
|
||||
15
wp/wp-content/themes/medicalalert/helpers/Debug.php
Normal file
15
wp/wp-content/themes/medicalalert/helpers/Debug.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Helpers;
|
||||
|
||||
class Debug
|
||||
{
|
||||
public static function dd()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$args = $context->get($args);
|
||||
|
||||
return "<pre>".print_r($args, true)."</pre>";
|
||||
};
|
||||
}
|
||||
}
|
||||
13
wp/wp-content/themes/medicalalert/helpers/Form.php
Normal file
13
wp/wp-content/themes/medicalalert/helpers/Form.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Helpers;
|
||||
|
||||
class Form
|
||||
{
|
||||
public static function parseForm()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
return gravity_form($context->get($args), true, true, false, false, true, false, false);
|
||||
};
|
||||
}
|
||||
}
|
||||
53
wp/wp-content/themes/medicalalert/helpers/Ratings.php
Normal file
53
wp/wp-content/themes/medicalalert/helpers/Ratings.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Helpers;
|
||||
|
||||
class Ratings
|
||||
{
|
||||
public static function ratingsStars()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$numberOfStars = $context->get($args);
|
||||
if (!is_numeric($numberOfStars)) {
|
||||
return "The value you passed to this helper is not a number.";
|
||||
}
|
||||
|
||||
$output = "";
|
||||
for ($i=1; $i <= 5; $i++) {
|
||||
if ($i <= $numberOfStars) {
|
||||
$output .= "<i class='bi bi-star-fill'></i>";
|
||||
} else {
|
||||
$output .= "<i class='bi bi-star'></i>";
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
};
|
||||
}
|
||||
|
||||
public static function numberFormatter()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$totalCount = $context->get($args);
|
||||
if (!is_numeric($totalCount)) {
|
||||
return "The value you passed to this helper is not a number.";
|
||||
}
|
||||
|
||||
return number_format($totalCount);
|
||||
};
|
||||
}
|
||||
|
||||
public static function currencyFormatter()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$totalCount = $context->get($args);
|
||||
if ($totalCount === "Free") {
|
||||
return "Free";
|
||||
}
|
||||
|
||||
if (!is_numeric($totalCount)) {
|
||||
return "The value you passed to this helper is not a number.";
|
||||
}
|
||||
return "$" . number_format($totalCount, 2);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Helpers;
|
||||
|
||||
class StringFormatter
|
||||
{
|
||||
public static function productTitle()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$productTitle = $context->get($args);
|
||||
$parts = explode("(", $productTitle);
|
||||
|
||||
return trim($parts[0]);
|
||||
};
|
||||
}
|
||||
|
||||
public static function adminOrderLabel()
|
||||
{
|
||||
return function ($template, $context, $args, $source) {
|
||||
$label = $context->get($args);
|
||||
if (substr($label, 0, 21) === "Select if this person") {
|
||||
return "Caretaker is authorized";
|
||||
}
|
||||
|
||||
if ($label === "SESSpromoid") {
|
||||
return "Promotion ID";
|
||||
}
|
||||
|
||||
if ($label === "SESSpromotion_description") {
|
||||
return "Promotion Description";
|
||||
}
|
||||
|
||||
if ($label === "SESScoupon_code") {
|
||||
return "Coupon Code";
|
||||
}
|
||||
|
||||
return $label;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user