PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 4.0.2
Bubble Menu – Floating Button Menu with Sticky Navigation v4.0.2
trunk 1.3 2.0 2.2 2.2.1 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.1 4.1.1
bubble-menu / classes / Publish / Display.php

Display.php in Bubble Menu – Floating Button Menu with Sticky Navigation 4.0.2, at classes/Publish/Display.php

68 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Display
5 *
6 * This class is responsible for displaying the item based on specific conditions.
7 *
8 * @package BubbleMenu
9 * @subpackage Publish
10 * @author Dmytro Lobov <hey@wow-company.com>, Wow-Company
11 * @copyright 2024 Dmytro Lobov
12 * @license GPL-2.0+
13 *
14 */
15
16 namespace BubbleMenu\Publish;
17
18 defined( 'ABSPATH' ) || exit;
19
20 class Display {
21
22
23 public static function init( $id, $param ): bool {
24 if ( self::can_abort_early( $id, $param ) ) {
25 return false;
26 }
27
28 return self::check_shows( $param['show'], $param );
29 }
30
31 private static function can_abort_early( $id, $param ): bool {
32 return empty( $param ) || ! is_array( $param ) || empty( absint( $id ) );
33 }
34
35 private static function check_shows( $showParams, $param ): bool {
36
37 foreach ( $showParams as $i => $show ) {
38
39 if ( self::is_match( $show, $i, $param ) ) {
40 return true;
41 }
42 }
43
44 return false;
45 }
46
47 private static function is_match( $show, $i, $param ): bool {
48
49 $cases = [
50 'everywhere' => 'check_everywhere',
51 ];
52
53 if ( ! isset( $cases[ $show ] ) ) {
54 return false;
55 }
56
57 $function = $cases[ $show ];
58
59 return self::$function( $i, $param );
60
61 }
62
63 private static function check_everywhere(): bool {
64 return true;
65 }
66
67 }
68