| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | use function get_current_user_id; |
| 10 | 10 | |
| 11 | 11 | class Options extends Base { |
| 12 | 12 | /** |
| 13 | - * Current User Id | |
| 13 | + * Currest User Id | |
| 14 | 14 | * @var integer |
| 15 | 15 | */ |
| 16 | 16 | private $current_user = 0; |
| 17 | 17 | |
| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | */ |
| 22 | 22 | private $has_api = false; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Automatically invoked and set up the properties. | |
| 25 | + * Autometically invoked and setup the properties. | |
| 26 | 26 | */ |
| 27 | 27 | public function __construct(){ |
| 28 | 28 | $this->current_user = get_current_user_id(); |
| 29 | 29 | $this->has_api = ! empty( $this->get( 'api_key', '', $this->current_user ) ); |
| @@ -124,17 +124,12 @@ | ||
| 124 | 124 | * @param string $key |
| 125 | 125 | * @param mixed $value |
| 126 | 126 | * @return boolean |
| 127 | 127 | */ |
| 128 | - public function set( $key, $value, $user_id = null ){ | |
| 128 | + public function set( $key, $value ){ | |
| 129 | 129 | $key = '_templately_' . $key; |
| 130 | + $updated = update_user_meta( $this->user_id(), $key, $value ); | |
| 130 | 131 | |
| 131 | - if( $user_id === null ) { | |
| 132 | - $user_id = $this->user_id(); | |
| 133 | - } | |
| 134 | - | |
| 135 | - $updated = update_user_meta( $user_id, $key, $value ); | |
| 136 | - | |
| 137 | 132 | if( $key === '_templately_api_key' && $updated ) { |
| 138 | 133 | $this->has_api = true; |
| 139 | 134 | } |
| 140 | 135 | |
| @@ -166,35 +161,6 @@ | ||
| 166 | 161 | $this->has_api = false; |
| 167 | 162 | } |
| 168 | 163 | |
| 169 | 164 | return $this; |
| 170 | - } | |
| 171 | - | |
| 172 | - /** | |
| 173 | - * Get option data | |
| 174 | - * | |
| 175 | - * @since 2.0.1 | |
| 176 | - * | |
| 177 | - * @param string $key | |
| 178 | - * @param mixed $default | |
| 179 | - * | |
| 180 | - * @return mixed | |
| 181 | - */ | |
| 182 | - public function get_option( $key, $default = false ){ | |
| 183 | - return get_option( $key, $default ); | |
| 184 | - } | |
| 185 | - | |
| 186 | - /** | |
| 187 | - * Update option data | |
| 188 | - * | |
| 189 | - * @since 2.0.1 | |
| 190 | - * | |
| 191 | - * @param string $key | |
| 192 | - * @param mixed $value | |
| 193 | - * @param string $autoload | |
| 194 | - * | |
| 195 | - * @return bool | |
| 196 | - */ | |
| 197 | - public function update_option( $key, $value, $autoload = 'no' ){ | |
| 198 | - return update_option( $key, $value, $autoload ); | |
| 199 | 165 | } |
| 200 | 166 | } |