PluginProbe
Float menu – awesome floating side menu / 7.2.5
Float menu – awesome floating side menu v7.2.5
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
float-menu / classes / Publish / Conditions.php

Conditions.php in Float menu – awesome floating side menu 7.2.5, at classes/Publish/Conditions.php

51 lines 1.1 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 WowPlugin
9 * @subpackage Publish
10 * @author Dmytro Lobov <dev@wow-company.com>, Wow-Company
11 * @copyright 2024 Dmytro Lobov
12 * @license GPL-2.0+
13 */
14
15 namespace FloatMenuLite\Publish;
16
17 use FloatMenuLite\WOWP_Plugin;
18 use FloatMenuLite\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, $param ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
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
50 }
51