PluginProbe
Migrate to WordPress.com / trunk
Migrate to WordPress.com vtrunk
6.72 6.65 trunk 5.72 5.81 5.88
wpcom-migration / wp_settings.php

wp_settings.php in Migrate to WordPress.com trunk, at wp_settings.php

92 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('WPCOMWPSettings')) :
5 class WPCOMWPSettings {
6 public function getOption($key) {
7 $res = false;
8 if (function_exists('get_site_option')) {
9 $res = get_site_option($key, false);
10 }
11 if ($res === false) {
12 $res = get_option($key, false);
13 }
14 return $res;
15 }
16
17 public function deleteOption($key) {
18 if (function_exists('delete_site_option')) {
19 return delete_site_option($key);
20 } else {
21 return delete_option($key);
22 }
23 }
24
25 public function updateOption($key, $value) {
26 if (function_exists('update_site_option')) {
27 return update_site_option($key, $value);
28 } else {
29 return update_option($key, $value);
30 }
31 }
32
33 public function getOptions($options = array()) {
34 $result = array();
35
36 foreach ($options as $option)
37 $result[$option] = $this->getOption($option);
38
39 return $result;
40 }
41
42 public function updateOptions($args) {
43 $result = array();
44
45 foreach ($args as $option => $value) {
46 $this->updateOption($option, $value);
47 $result[$option] = $this->getOption($option);
48 }
49
50 return $result;
51 }
52
53 public function deleteOptions($options) {
54 $result = array();
55
56 foreach ($options as $option) {
57 $this->deleteOption($option);
58 $result[$option] = !$this->getOption($option);
59 }
60
61 return $result;
62 }
63
64 public function setTransient($name, $value, $time) {
65 if (function_exists('set_site_transient')) {
66 return set_site_transient($name, $value, $time);
67 }
68 return false;
69 }
70
71 public function deleteTransient($name) {
72 if (function_exists('delete_site_transient')) {
73 return delete_site_transient($name);
74 }
75 return false;
76 }
77
78 public function getTransient($name) {
79 if (function_exists('get_site_transient')) {
80 return get_site_transient($name);
81 }
82 return false;
83 }
84
85 public function deleteMetaData($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
86 if (function_exists('delete_metadata')) {
87 return delete_metadata($meta_type, $object_id, $meta_key, $meta_value, $delete_all);
88 }
89 return false;
90 }
91 }
92 endif;