PluginProbe
QuadMenu – Mega Menu / 3.3.7
QuadMenu – Mega Menu v3.3.7
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / jetpack_vendor / automattic / jetpack-constants / README.md

README.md in QuadMenu – Mega Menu 3.3.7, at jetpack_vendor/automattic/jetpack-constants/README.md

68 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 # Jetpack Constants
2
3 A simple constant manager for Jetpack.
4
5 Testing constants is hard. Once you define a constant in PHP, it's defined. Constants Manager is an abstraction layer so that unit tests can set constants for tests.
6
7 ### Usage
8
9 Retrieve the value of a constant `CONSTANT_NAME` (returns `null` if it's not defined):
10
11 ```php
12 use Automattic\Jetpack\Constants;
13
14 $constant_value = Constants::get_constant( 'CONSTANT_NAME' );
15 ```
16
17 Set the value of a constant `CONSTANT_NAME` to a particular value:
18
19 ```php
20 use Automattic\Jetpack\Constants;
21
22 $value = 'some value';
23 Constants::set_constant( 'CONSTANT_NAME', $value );
24 ```
25
26 Check whether a constant `CONSTANT_NAME` is defined:
27
28 ```php
29 use Automattic\Jetpack\Constants;
30
31 $defined = Constants::is_defined( 'CONSTANT_NAME' );
32 ```
33
34 Check whether a constant `CONSTANT_NAME` is truthy:
35
36 ```php
37 use Automattic\Jetpack\Constants;
38
39 $is_truthy = Constants::is_true( 'CONSTANT_NAME' );
40 ```
41
42 Delete the `CONSTANT_NAME` constant:
43
44 ```php
45 use Automattic\Jetpack\Constants;
46
47 Constants::clear_single_constant( 'CONSTANT_NAME' );
48 ```
49
50 Delete all known constants:
51
52 ```php
53 use Automattic\Jetpack\Constants;
54
55 Constants::clear_constants();
56 ```
57 ## Using this package in your WordPress plugin
58
59 If you plan on using this package in your WordPress plugin, we would recommend that you use [](https://packagist.org/packages/automattic/jetpack-autoloaderJetpack Autoloader](https://packagist.org/packages/automattic/jetpack-autoloader](https://packagist.org/packages/automattic/jetpack-autoloader) as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.
60
61 ## Security
62
63 Need to report a security vulnerability? Go to [](https://automattic.com/security/https://automattic.com/security/](https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [](https://hackerone.com/automattichttps://hackerone.com/automattic](https://hackerone.com/automattic](https://hackerone.com/automattic).
64
65 ## License
66
67 jetpack-constants is licensed under [](./LICENSE.txtGNU General Public License v2 (or later)](./LICENSE.txt](./LICENSE.txt)
68