PluginProbe
PhastPress / trunk
PhastPress vtrunk
3.12 3.11 1.75 1.76 1.77 1.78 1.79 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.90 1.91 1.92 1.93 1.94 1.95 1.96 1.97 All 119 releases
phastpress / classes / KeyValueStoreImplementation.php

KeyValueStoreImplementation.php in PhastPress trunk, at classes/KeyValueStoreImplementation.php

32 lines 770 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Kibo\PhastPlugins\PhastPress;
4
5 use Kibo\PhastPlugins\SDK\Configuration\KeyValueStore;
6
7 class KeyValueStoreImplementation implements KeyValueStore {
8
9 public function get($key) {
10 if (($value = get_option($this->prefixKey($key))) !== false) {
11 return $value;
12 }
13 if (($value = get_option($this->prefixLegacyKey($key))) !== false) {
14 return json_encode($value);
15 }
16 }
17
18 public function set($key, $value) {
19 update_option($this->prefixKey($key), $value);
20 delete_option($this->prefixLegacyKey($key));
21 }
22
23 private function prefixKey($key) {
24 return 'phastpress2-' . $key;
25 }
26
27 private function prefixLegacyKey($key) {
28 return 'phastpress-' . $key;
29 }
30
31 }
32