PluginProbe
WP Coder – Insert & Manage Code Snippets / 3.2.1
WP Coder – Insert & Manage Code Snippets v3.2.1
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
wp-coder / classes / Publisher / Conditions.php

Conditions.php in WP Coder – Insert & Manage Code Snippets 3.2.1, at classes/Publisher/Conditions.php

33 lines 616 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPCoder\Publisher;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class Conditions {
8
9 public static function init( $result ): bool {
10 $param = ! empty( $result->param ) ? maybe_unserialize( $result->param ) : [];
11 $check = [
12 'status' => self::status( $result->status ),
13 'mode' => self::mode( $result->mode ),
14 ];
15
16 if ( in_array( false, $check, true ) ) {
17 return false;
18 }
19
20 return true;
21
22 }
23
24 private static function status( $status ): bool {
25 return empty( $status );
26 }
27
28 private static function mode( $mode ): bool {
29 return empty( $mode ) || current_user_can( 'administrator' );
30 }
31
32
33 }