PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 4.1
Bubble Menu – Floating Button Menu with Sticky Navigation v4.1
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 / Conditions.php

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

49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Conditions
5 *
6 * Provides methods to check conditions for displaying item
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 namespace BubbleMenu\Publish;
16
17 use BubbleMenu\WOWP_Plugin;
18 use BubbleMenu\WOWP_Public;
19
20 defined( 'ABSPATH' ) || exit;
21
22 class Conditions {
23
24 public static function init( $result ): bool {
25 $param = ! empty( $result->param ) ? maybe_unserialize( $result->param ) : [];
26
27 $check = [
28 'status' => self::status( $result->status ),
29 'mode' => self::mode( $result->mode ),
30 ];
31
32 $check = apply_filters( WOWP_Plugin::PREFIX . '_conditions', $check );
33
34 if ( in_array( false, $check, true ) ) {
35 return false;
36 }
37
38 return true;
39
40 }
41
42 private static function status( $status ): bool {
43 return empty( $status );
44 }
45
46 private static function mode( $mode ): bool {
47 return empty( $mode ) || current_user_can( 'manage_options' );
48 }
49 }