PluginProbe
Search & Replace Everything – Quick and Easy Way to Find and Replace Text, Links / trunk
Search & Replace Everything – Quick and Easy Way to Find and Replace Text, Links vtrunk
1.5.2 1.5.0 1.5.1 1.4.7 1.4.6 1.4.4 1.4.5 1.4.3 trunk 1.0.2 1.0.3 1.0.4 1.0.4.1 1.1 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.2 1.2.3 1.2.4 1.2.5 All 34 releases
update-urls / lite / includes / Option.php

Option.php in Search & Replace Everything – Quick and Easy Way to Find and Replace Text, Links trunk, at lite/includes/Option.php

99 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace KaizenCoders\UpdateURLS;
4
5 class Option {
6 /**
7 * @var string
8 *
9 * @since 1.2
10 */
11 static $prefix = 'kc_uu_';
12
13 /**
14 * Get option
15 *
16 * @param string $option
17 * @param string $default
18 *
19 * @return bool|mixed|void|null
20 *
21 * @since 1.2
22 */
23 public static function get( $option = '', $default = '' ) {
24
25 if ( empty( $option ) ) {
26 return null;
27 }
28
29 $option = self::$prefix . $option;
30
31 return get_option( $option, $default );
32
33 }
34
35 /**
36 * Set Option
37 *
38 * @param string $option
39 * @param string $value
40 *
41 * @return bool|null
42 *
43 * @since 1.2
44 */
45 public static function set( $option = '', $value = '', $autoload = false ) {
46
47 if ( empty( $option ) ) {
48 return null;
49 }
50
51 $option = self::$prefix . $option;
52
53 return update_option( $option, $value, $autoload );
54
55 }
56
57 /**
58 * Add Option
59 *
60 * @param string $option
61 * @param string $value
62 *
63 * @return bool|null
64 *
65 * @since 1.2
66 */
67 public static function add( $option = '', $value = '', $autoload = false ) {
68
69 if ( empty( $option ) ) {
70 return null;
71 }
72
73 $option = self::$prefix . $option;
74
75 return add_option( $option, $value, '', $autoload );
76
77 }
78
79 /**
80 * Delete option
81 *
82 * @param string $option
83 *
84 * @return bool|null
85 *
86 * @since 1.2
87 */
88 public static function delete( $option = null ) {
89
90 if ( empty( $option ) ) {
91 return null;
92 }
93
94 $option = self::$prefix . $option;
95
96 return delete_option( $option );
97 }
98
99 }