PluginProbe
Boxzilla – WordPress Popup Builder / 3.2.21
Boxzilla – WordPress Popup Builder v3.2.21
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/licensing/class-license.php +21 -17 3.1.14 → 3.2.21 View file →
@@ -15,8 +15,9 @@
15 15 * @package Boxzilla\Licensing
16 16 */
17 17 class License {
18 18
19 +
19 20 /**
20 21 * @var string The name of the option that holds the License data
21 22 */
22 23 protected $option_key = '';
@@ -46,12 +47,12 @@
46 47 /**
47 48 * @param string $name
48 49 * @param mixed $value
49 50 */
50 - public function __set($name, $value) {
51 + public function __set( $name, $value ) {
51 52 $this->load();
52 53 $this->data[ $name ] = $value;
53 - $this->dirty = true;
54 + $this->dirty = true;
54 55 }
55 56
56 57 /**
57 58 * @param string $name
@@ -57,9 +58,9 @@
57 58 * @param string $name
58 59 *
59 60 * @return mixed
60 61 */
61 - public function __get($name) {
62 + public function __get( $name ) {
62 63 $this->load();
63 64 return $this->data[ $name ];
64 65 }
65 66
@@ -76,20 +77,22 @@
76 77 /**
77 78 * Load the license data from the database
78 79 */
79 80 protected function load() {
80 - static $defaults = array(
81 - 'key' => '',
81 + if ( $this->loaded ) {
82 + return;
83 + }
84 +
85 + $defaults = array(
86 + 'key' => '',
82 87 'activation_key' => '',
83 - 'activated' => false,
84 - 'expires_at' => ''
88 + 'activated' => false,
89 + 'expires_at' => '',
85 90 );
86 91
87 - if( ! $this->loaded ) {
88 - $data = (array) get_option( $this->option_key, array() );
89 - $this->data = array_replace( $defaults, $data );
90 - $this->loaded = true;
91 - }
92 + $data = (array) get_option( $this->option_key, array() );
93 + $this->data = array_replace( $defaults, $data );
94 + $this->loaded = true;
92 95 }
93 96
94 97 /**
95 98 * Reload the license data from DB
@@ -104,11 +107,12 @@
104 107 *
105 108 * @return License
106 109 */
107 110 public function save() {
108 - if( $this->dirty ) {
109 - update_option( $this->option_key, $this->data );
110 - $this->dirty = false;
111 + if ( ! $this->dirty ) {
112 + return;
111 113 }
114 +
115 + update_option( $this->option_key, $this->data );
116 + $this->dirty = false;
112 117 }
113 -
114 -}
118 +}