PluginProbe
WPPizza – A Restaurant Plugin / 3.20
WPPizza – A Restaurant Plugin v3.20
trunk 2.16.11.28 3.19 3.19.1 3.19.2 3.19.3 3.19.4 3.19.5 3.19.6 3.19.7 3.19.7.1 3.19.7.2 3.19.7.3 3.19.7.4 3.19.8 3.19.8.1 3.19.8.2 3.19.8.3 3.19.9 3.20 3.20.1
wppizza / classes / markup / totals.php

totals.php in WPPizza – A Restaurant Plugin 3.20, at classes/markup/totals.php

165 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPPIZZA_TEMPLATES_TOTALS Class
4 *
5 * @package WPPIZZA
6 * @subpackage WPPizza Totals (widget/shortcode)
7 * @copyright Copyright (c) 2015, Oliver Bach
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 3.0
10 *
11 */
12 if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/
13
14 /* ================================================================================================================================= *
15 *
16 *
17 *
18 * CLASS - WPPIZZA_TEMPLATES_TOTALS
19 *
20 *
21 *
22 * ================================================================================================================================= */
23
24 class WPPIZZA_MARKUP_TOTALS{
25
26 /******************************************************************************
27 *
28 *
29 * [construct]
30 *
31 *
32 *******************************************************************************/
33 function __construct() {
34 }
35
36 /******************************************************************************
37 *
38 *
39 * [methods]
40 *
41 *
42 *******************************************************************************/
43 /***************************************
44 [apply attributes]
45 ***************************************/
46 function attributes($atts=null){
47 /**get markup**/
48 $markup = $this->get_markup($atts);
49 return $markup;
50 }
51
52 /***************************************
53 [markup]
54 ***************************************/
55 function get_markup($atts){
56 static $unique_id = 0; $unique_id++;
57 global $wppizza_options;
58
59 /*********************
60 set unique id
61 *********************/
62 $id = WPPIZZA_PREFIX.'-totals-'.$unique_id;
63
64 /*********************
65 set classes
66 *********************/
67 $class= array();
68 $class[] = WPPIZZA_PREFIX.'-totals-container' ;
69 $class[] = WPPIZZA_PREFIX.'-totals';
70 if(!empty($atts['class'])){
71 $class[] = esc_html($atts['class']);
72 }
73 $class = trim(implode(' ', $class));
74
75 /*********************
76 set markup components
77 *********************/
78 /**get links to order page*/
79 $orderpage = wppizza_page_links('orderpage');
80 /** checkout button **/
81 if(!empty($atts['checkout']) && !empty($orderpage)){
82 $checkoutbutton = true;
83 $checkoutbutton_class=''.WPPIZZA_PREFIX.'-totals-checkout-button';
84 $checkoutbutton_title=''.$wppizza_options['localization']['place_your_order'].'';
85 }
86
87 /*item count enabled/position**/
88 if(!empty($atts['itemcount'])){
89 if($atts['itemcount']=='left'){
90 $count_left = true;
91 $count_left_class=''.WPPIZZA_PREFIX.'-totals-itemcount';
92 }
93 if($atts['itemcount']=='right'){
94 $count_right = true;
95 $count_right_class=''.WPPIZZA_PREFIX.'-totals-itemcount';
96 }
97 }
98 /**
99 value
100 **/
101 $total = true;
102 $total_class = ( !empty($atts['value']) && $atts['value']=='items' ) ? WPPIZZA_PREFIX.'-totals-items' : WPPIZZA_PREFIX.'-totals-order' ;
103
104 /**
105 allow for view cart button to show cart contents
106 **/
107 if(!empty($atts['viewcart'])){
108 /*create view cart button */
109 $viewcart = true;
110 $viewcart_class = ''.WPPIZZA_PREFIX.'-totals-viewcart';
111 //$viewcart_title = $wppizza_options['localization']['view_cart'];
112
113 /*create hidden cart span */
114 $cart_class = array();
115 $cart_class[] = ''.WPPIZZA_PREFIX.'-totals-cart';
116 if(!empty($atts['cart_view'])){
117 $xCartView = explode(',',$atts['cart_view']);
118 foreach($xCartView as $module){
119 if(strtolower(trim($module)) == 'itemised'){
120 $cart_class[] = ''.WPPIZZA_PREFIX.'-totals-cart-items';
121 }
122 if(strtolower(trim($module)) == 'summary'){
123 $cart_class[] = ''.WPPIZZA_PREFIX.'-totals-cart-summary';
124 }
125 }
126
127 }else{
128 $cart_class[] = ''.WPPIZZA_PREFIX.'-totals-cart-items';
129 $cart_class[] = ''.WPPIZZA_PREFIX.'-totals-cart-summary';
130 }
131
132 $cart= true;
133 $cart_class = implode(' ',$cart_class);
134 }
135
136 /*********************
137 ini markup array
138 *********************/
139 $markup = array();
140
141 /*********************
142 get markup
143 *********************/
144 if(file_exists( WPPIZZA_TEMPLATE_DIR . '/markup/global/totals.php')){
145 require(WPPIZZA_TEMPLATE_DIR.'/markup/global/totals.php');
146 }else{
147 require(WPPIZZA_PATH.'templates/markup/global/totals.php');
148 }
149 /*
150 remove display of
151 price if set by attribute (in case we only want count)
152 */
153 if(!empty($atts['count_only'])){
154 unset($markup['total']);
155 }
156 /*********************
157 apply filter if required and implode for output
158 *********************/
159 $markup = apply_filters('wppizza_filter_totals_widget_markup', $markup, $atts, $unique_id);
160 $markup = trim(implode('', $markup));
161
162 return $markup;
163 }
164 }
165 ?>