/home
/deploy
/EHungry-2-joel
/Web
/classes
/RestaurantTip.class.php
<?
/**
* @property int $id
* @property int $restaurant_id
* @property string $tip
*/
class RestaurantTip extends BaseClass {
public static function clearCacheForRestaurant($rid) {
Cache::Delete('rtip_r_'.$rid);
}
public static function getForRestaurant($account, $restaurant) {
$cacheKey = 'rtip_r_'.$restaurant->id;
$tips = Cache::GetArray($cacheKey);
if ($tips) {
return $tips;
}
$tips = [];
if ($restaurant->restaurantTips && count($restaurant->restaurantTips)) {
$tips = $restaurant->restaurantTips;
} else {
$default_tips = $account->getSetting(\Setting::ACCOUNT_SHOW_TIPS_FORM_IN_CHECKOUT) && $account->template_id === \Template::DEFAULT_V4_ID ? ['10%', '15%', '20%'] : ['10%', '15%', '20%', '25%'];
foreach ($default_tips as $tipAmount) {
$tip = new self();
$tip->restaurant_id = $restaurant->id;
$tip->tip = $tipAmount;
$tips[] = $tip;
}
}
Cache::SetArray($cacheKey, $tips);
return $tips;
}
public static function deleteAllForRestaurant($rid) {
self::where('restaurant_id', $rid)->delete();
self::clearCacheForRestaurant($rid);
}
}
Arguments
"Too few arguments to function RestaurantTip::getForRestaurant(), 1 passed in /home/deploy/EHungry-2-joel/Web/templates4.0/customer/cartordertotal.php on line 320 and exactly 2 expected"
/home
/deploy
/EHungry-2-joel
/Web
/templates4.0
/customer
/cartordertotal.php
<table></table>
</div>
<div class="popover-footer-btns">
<button type="button" class="btn btn-outline-secondary" onclick="$('#taxes-and-fees').popover('hide')">Close</button>
</div>
</div>
</div>
</td>
</tr>
<? }
$tipValue = [];
if ($restaurant->getAllowTips()) {
if (!$handler->params['tip'] && ($cart->getTip() || $cart->isTipType(Cart::TIP_TYPE_NO_TIP) || $cart->isTipType(Cart::TIP_TYPE_CUSTOM))) {
$handler->params['tip'] = $cart->getReadableTipAmount();
}
$tippableAmount = $cart->total_without_tips;
$restaurantTips = RestaurantTip::getForRestaurant($restaurant);
foreach ($restaurantTips as $restaurantTip) {
if (strpos($restaurantTip->tip, '%') !== false) {
$percent = str_replace('%', '', $restaurantTip->tip);
$tipValue[$restaurantTip->tip] = intToMoneyString(round($tippableAmount*$percent/100));
} else {
$tipValue[intToMoneyString($restaurantTip->tip)] = intToMoneyString($restaurantTip->tip);
}
}
if (array_key_exists('tip', $handler->params)) {
$tip = intToMoneyString(moneyStringToIntIgnoreAfterComma($handler->params['tip']));
} else {
if ($restaurant->default_tip && $restaurant->default_tip != 'custom') {
$defaultTipIsPercentage = strpos($restaurant->default_tip, '%') !== false;
$tip = $tipValue[$defaultTipIsPercentage ? $restaurant->default_tip : intToMoneyString($restaurant->default_tip)];
} else {
$tip = '$0.00';
}
$handler->params['tip'] = $cart->getReadableTipAmount();
}
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/templates4.0
/customer
/cart.php
'variant' => 'outline-secondary',
'shape' => 'circle',
'onclick' => "app.event.emit('hide_cart')",
], EDS\Icon(['icon' => 'close', 'variant' => 'regular']))?>
<? } ?>
</div>
<div>
<? include(CORE_PATH. 'templates4.0/customer/change_location/cart.php'); ?>
<?
if ($closed_msg = isOrderingClosed(CLOSED_MSG_RESTAURANT)) {
$cart->clear();
?>
<div class="error p-3"><?=$closed_msg?></div>
</div>
<?
} else { ?>
<? include(CORE_PATH. 'templates4.0/customer/cartitems.php'); ?>
<? include(CORE_PATH. 'templates4.0/customer/cartordertotal.php'); ?>
</div>
<div class="fixed_submit pwa-pb-md-down">
<div class="p-3"><!-- Not using css calc() here because of lack of support in older devices -->
<?
/** @var bool $showingCartTotals */
if ($showingCartTotals && $account->show_coupon) {
if (!$coupon = $cart->getCoupon()) { ?>
<div>
<a href="#" class="btn btn-outline-secondary btn-lg cart-btn w-100 hidden-md-down" id="btn-add-coupon-code" role="button" data-bs-target="#modal-coupon" data-open-coupon-modal>Add a coupon code</a>
</div>
<? }
} ?>
<? if ($is_checkout_cart) { ?>
<? if ($cart->payment_method == PAYMENT_GOOGLE_PAY) { ?>
<div class="mt-lg-2">
<?=GooglePay::getButtonHtml($restaurant, $handler)?>
</div>
<? } else { ?>
Arguments
"/home/deploy/EHungry-2-joel/Web/templates4.0/customer/cartordertotal.php"
/home
/deploy
/EHungry-2-joel
/Web
/view4.0
/customer
/category.php
data-async-on-event="menu_selected"
data-async-block="this"
data-async-method="get"
data-async-action="<?=htmlentities(getSecureHost() . 'ajax/?form=menu_items')?>"
data-async-then="({ data }) => {
app.event.emit('menu_items_loaded');
if (data.category_id != null) {
app.event.emit('category_selected', { id: data.category_id });
}
}"
>
<?=$menuPageFragment?>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<? include(CORE_PATH. 'templates4.0/customer/cart.php'); ?>
<input type="hidden" id="hid-category-id" value="<?=$category->id?>" />
<div class="hidden" id="upsell-source">
<? include(CORE_PATH. 'templates4.0/customer/cartupsell.php'); ?>
</div>
<?
if (!empty($_REQUEST['item_id'])) {
$item = new MenuItem($_REQUEST['item_id']); ?>
<script>
// load menu item when it's a menu item page url - for `history.pushState()`
$(() => {
$('#add_menu_item').modal('show');
loadMenuItem(<?=$item->id?>, <?=$_REQUEST['price_id'] ?: 'null'?>, null, <?=$menu->id?>, <?=$category->id?>);
});
</script>
<? } ?>
<script>
Arguments
"/home/deploy/EHungry-2-joel/Web/templates4.0/customer/cart.php"
/home
/deploy
/EHungry-2-joel
/Web
/view4.0
/customer
/ordering3.php
<?
switch ($_REQUEST['ordering_level']) {
case OrderingLevel::NONE:
App::debugbarTime($timerLevel = 'ordering3: locationlist');
include(CORE_PATH . 'templates4.0/customer/locationlist.php');
break;
case OrderingLevel::RESTAURANT:
case OrderingLevel::MENU:
App::debugbarTime($timerLevel = 'ordering3: menu');
include(CORE_PATH . 'view4.0/customer/menu.php');
break;
case OrderingLevel::CATEGORY:
App::debugbarTime($timerLevel = 'ordering3: category');
include(CORE_PATH . 'view4.0/customer/category.php');
break;
case OrderingLevel::ITEM:
case OrderingLevel::PRICE:
App::debugbarTime($timerLevel = 'ordering3: menuitem');
include(CORE_PATH . 'view4.0/customer/category.php');
break;
}
if (isset($timerLevel)) {
App::debugbarTime($timerLevel);
}
Arguments
"/home/deploy/EHungry-2-joel/Web/view4.0/customer/category.php"
/home
/deploy
/EHungry-2-joel
/Web
/controllers
/customer.php
if (!in_array($_REQUEST['form'], ['checkout', 'nosuchpage', 'validatecallback', 'viewdeliveryzone'])) {
//TODO: probably need to add one more form here that is called ajax, callback seems to reset when it shouldnt
unset($_SESSION['validation_data']);
}
$locs = $account->getActiveRestaurants('position');
$tab = MainNavigationTab::getAllForAccount($account->getId());
include_once(CORE_PATH.'lib/helpers/customer3.0.php');
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('header');
include_once(getLayoutPartPath('header'));
App::debugbarTime('header');
}
App::debugbarTime("view '{$_REQUEST['form']}'");
$path = CORE_PATH.'view' . ($_REQUEST['_VERSION'] == 4 ? 4 : 3) . '.0/customer/'.$_REQUEST['form'].'.php';
if (is_readable($path)) {
include_once($path);
}
App::debugbarTime("view '{$_REQUEST['form']}'");
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('footer');
include_once(getLayoutPartPath('footer'));
App::debugbarTime('footer');
}
function getLayoutPartPath($part) {
if (isset($_REQUEST['_CORDOVA_APP'])) {
$cart = Cart::getCurrent();
//FIXME: it's technically possible to end up with $template = null
if (!$_REQUEST['contentonly']) {
$template = !isset($_REQUEST["altdoc"])? "app/$part" : "app/alt$part";
}
} else {
$template = !isset($_REQUEST["altdoc"])? "customer/$part" : "customer/alt$part";
}
Arguments
"/home/deploy/EHungry-2-joel/Web/view4.0/customer/ordering3.php"
/home
/deploy
/EHungry-2-joel
/Web
/index.php
App::startTime();
ErrorHandlers::register();
// Global.php is the core setup file for the application
App::debugbarTime('Global.php');
require(dirname(__DIR__) . '/PHP/Global.php');
App::debugbarTime('Global.php');
/** @var string $controller The main controller - defined at /PHP/Global.php */
App::debugbarTime('Sentry - controller');
ErrorHandlers::sentryInit($controller); //doesn't always do much - not every controller has a Sentry project
App::debugbarTime('Sentry - controller');
App::debugbarTime("controller: $controller");
apache_note('AppController', $controller);
if (file_exists(CORE_PATH."lib/helpers/$controller.php")) {
require CORE_PATH."lib/helpers/$controller.php";
}
require CORE_PATH."controllers/$controller.php";
App::debugbarTime("controller: $controller");
Arguments
"/home/deploy/EHungry-2-joel/Web/controllers/customer.php"