| @@ -76,9 +76,13 @@ | ||
| 76 | 76 | /** |
| 77 | 77 | * Load the license data from the database |
| 78 | 78 | */ |
| 79 | 79 | protected function load() { |
| 80 | - static $defaults = array( | |
| 80 | + if( $this->loaded ) { | |
| 81 | + return; | |
| 82 | + } | |
| 83 | + | |
| 84 | + $defaults = array( | |
| 81 | 85 | 'key' => '', |
| 82 | 86 | 'activation_key' => '', |
| 83 | 87 | 'activated' => false, |
| 84 | 88 | 'expires_at' => '' |
| @@ -83,13 +87,11 @@ | ||
| 83 | 87 | 'activated' => false, |
| 84 | 88 | 'expires_at' => '' |
| 85 | 89 | ); |
| 86 | 90 | |
| 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 | - } | |
| 91 | + $data = (array) get_option( $this->option_key, array() ); | |
| 92 | + $this->data = array_replace( $defaults, $data ); | |
| 93 | + $this->loaded = true; | |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | /** |
| 95 | 97 | * Reload the license data from DB |
| @@ -104,11 +106,13 @@ | ||
| 104 | 106 | * |
| 105 | 107 | * @return License |
| 106 | 108 | */ |
| 107 | 109 | public function save() { |
| 108 | - if( $this->dirty ) { | |
| 109 | - update_option( $this->option_key, $this->data ); | |
| 110 | - $this->dirty = false; | |
| 110 | + if( ! $this->dirty ) { | |
| 111 | + return; | |
| 111 | 112 | } |
| 113 | + | |
| 114 | + update_option( $this->option_key, $this->data ); | |
| 115 | + $this->dirty = false; | |
| 112 | 116 | } |
| 113 | 117 | |
| 114 | -} | |
| 118 | +} | |