PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / helpers / libraries / menu / shape.php
vikappointments / site / helpers / libraries / menu Last commit date
horizontal 3 days ago leftboard 3 days ago abstractlist.php 3 days ago custom.php 3 days ago factory.php 3 days ago index.html 3 days ago item.php 3 days ago separator.php 3 days ago shape.php 3 days ago
shape.php
87 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Class used to represent the shape of a generic menu.
16 *
17 * @since 1.5
18 *
19 * @see MenuAbstractList
20 * @see SeparatorItemShape
21 * @see CustomShape
22 */
23 abstract class MenuShape extends MenuAbstractList
24 {
25 /**
26 * Builds and returns the html structure of the menu and its children.
27 *
28 * @return string The html structure.
29 *
30 * @uses buildHtml()
31 * @uses SeparatorItemShape::build()
32 * @uses CustomShape::buildHtml()
33 */
34 public function build()
35 {
36 $html = "";
37
38 // get the HTML structure from each child of the menu
39 foreach ($this->menu as $separator)
40 {
41 if ($separator instanceof SeparatorItemShape)
42 {
43 // get the HTML if the child is a separator
44 $html .= $separator->build();
45 }
46 else if ($separator instanceof CustomShape)
47 {
48 // get the HTML if the child is a custom shape
49 $html .= $separator->buildHtml();
50 }
51 }
52
53 // build the structure of the menu, which will contain the evaluated $html
54 return $this->buildHtml($html);
55 }
56
57 /**
58 * Builds and returns the html structure of the menu that wraps the children.
59 * This method must be implemented to define a specific graphic of the menu.
60 *
61 * @param string $html The full structure of the children of the menu.
62 *
63 * @return string The html of the menu.
64 */
65 abstract protected function buildHtml($html);
66
67 /**
68 * Builds and returns the html opening that will wrap the body contents.
69 * This html will be displayed after the menu.
70 *
71 * @return string The body opening html.
72 *
73 * @since 1.6.3
74 */
75 abstract public function openBody();
76
77 /**
78 * Builds and returns the html closing that will wrap the body contents.
79 * This html will be displayed after the menu and the body opening.
80 *
81 * @return string The body closing html.
82 *
83 * @since 1.6.3
84 */
85 abstract public function closeBody();
86 }
87