/** * Set specific property. * * @since 1.0.0 * * @param string $property The name of a property to associate. * @param mixed $value The value of a property. */ public function __set($property, $value) { if (property_exists($this, $property)) { switch ($property) { case 'currency': if (array_key_exists($value, self::get_currencies())) { $this->{$property} = $value; } break; case 'invoice_sender_name': $this->{$property} = sanitize_text_field($value); break; case 'plugin_enabled': case 'initial_setup': case 'is_first_membership': case 'hide_admin_bar': $this->{$property} = lib2()->is_true($value); break; default: $this->{$property} = $value; break; } } else { switch ($property) { case 'protection_type': if (MS_Rule_Media_Model::is_valid_protection_type($value)) { $this->downloads['protection_type'] = $value; } break; case 'masked_url': $this->downloads['masked_url'] = sanitize_text_field($value); break; } } }