Habari\Options::__set PHP Метод

__set() публичный Метод

Applies the option value to the options table
public __set ( string $name, mixed $value )
$name string Name of the option to set
$value mixed Value to set
    public function __set($name, $value)
    {
        if (!isset($this->options)) {
            $this->get_all_options();
        }
        // if the option already exists and has the same value, there is nothing to update and we shouldn't waste a db hit
        // i can't think of any negative implications of this, but that's no guarantee
        if (isset($this->options[$name]) && $this->options[$name] == $value) {
            return;
        }
        $value = Plugins::filter('option_set_value', $value, $name, isset($this->options[$name]) ? $this->options[$name] : null);
        $this->options[$name] = $value;
        // we now serialize everything, not just arrays and objects
        $result = DB::update(DB::table('options'), array('name' => $name, 'value' => serialize($value), 'type' => 1), array('name' => $name));
        if (Error::is_error($result)) {
            $result->out();
            die;
        }
    }