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 / additives.php

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

116 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPPIZZA_TEMPLATES_ADDITIVES Class
4 *
5 * @package WPPIZZA
6 * @subpackage WPPizza Additives
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_ADDITIVES
19 *
20 *
21 *
22 * ================================================================================================================================= */
23
24 class WPPIZZA_MARKUP_ADDITIVES{
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
58 /*********************
59 get all allergens
60 *********************/
61 $allergens = wppizza_all_allergens();
62
63 /*********************
64 get all additives
65 *********************/
66 $additives = wppizza_all_additives();
67
68 /*********************
69 set unique id
70 *********************/
71 $id = WPPIZZA_PREFIX.'-additives-'.$unique_id;
72
73 /*********************
74 set/add classes using attributes
75 *********************/
76 $class= array();
77 $class[] = WPPIZZA_PREFIX.'-additives';
78 //add icon class
79 $has_icons = array_filter(wppizza_array_column($allergens, 'icon'));
80 if(!empty($has_icons)){
81 $class[] = WPPIZZA_PREFIX.'-additives-icons';
82 }
83 if(!empty($atts['class'])){
84 $class[] = esc_html($atts['class']);
85 }
86 /*
87 implode for output
88 */
89 $class = trim(implode(' ', $class));
90
91 /*********************
92 ini markup array
93 *********************/
94 $markup = array();
95
96 /*********************
97 get markup
98 *********************/
99 if(file_exists( WPPIZZA_TEMPLATE_DIR . '/markup/global/additives.php')){
100 require(WPPIZZA_TEMPLATE_DIR.'/markup/global/additives.php');
101 }else{
102 require(WPPIZZA_PATH.'templates/markup/global/additives.php');
103 }
104
105 /*********************
106 apply filter if required and implode for output
107 *********************/
108 $markup = apply_filters('wppizza_filter_additives_widget_markup', $markup, $atts, $unique_id, $additives);
109 $markup = trim(implode('', $markup));
110
111
112 return $markup;
113 }
114
115 }
116 ?>