Seter. Принимаем и обрабатываем глобальный массив $_POST. Используем protected $_data
548375
public function __SET($name, $data){
		if (is_array($data)) {
			foreach ($data as $name => $value) {
				$this->_data[$name] = $this->clearData($value);
			}
		} else {
			$this->_data[$name] = $this->clearData($data);
		}
	}
1346779
function validateData(data){
  /* Создаем промис */
  return new Promise(function(resolve, reject){
    if(
      (data.password == "iddqd")
      &&(data.login == "Carmak")
    ){
      /* Все верно, пользователь авторизирован */
      resolve(data);
    }else{
      /* Ошибка при вводе данных */
      reject(new Error('Ошибка при вводе логина или пароля'));
    }
  });
}
321315
function mf_save_post_data( $post_id ) {
    global $wpdb;

    //@todo hay que ponerle nonce a una de las metaboxes
    /*if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__) ) ) {*/
      //return $post_id;
    /*}*/

    if ( !current_user_can( 'edit_post', $post_id ) )
      return $post_id;

     //just in case if the post_id is a post revision and not the post inself
    if ( $the_post = wp_is_post_revision( $post_id ) ) {
      $post_id = $the_post;
    }

    // Check if the post_type has page attributes
    // if is the case is necessary need save the page_template
    if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != 'page' && isset($_REQUEST['page_template'])) {
      add_post_meta($post_id, '_wp_mf_page_template', $_POST['page_template'], true) or update_post_meta($post_id, '_wp_mf_page_template', $_POST['page_template']);
    }

    if (!empty($_POST['magicfields'])) {

      $customfields = $_POST['magicfields'];

      /** Deleting the old values **/
      $sql_delete = $wpdb->prepare( "DELETE FROM ".MF_TABLE_POST_META." WHERE post_id = %s",$post_id );
      $wpdb->query($sql_delete);

      foreach ( $customfields as $field_name => $field ) {
        delete_post_meta($post_id, $field_name);
      }
      /** / Deleting the old values **/

      //creating the new values
      foreach( $customfields as $field_name => $groups ) {

        $group_count = 1;
        foreach( $groups as $fields ) {
          $field_count = 1;
          foreach( $fields as $value ) {
            //here if the value of the field needs a process before to be saved
            //should be trigger that method here
            //$value =  mf_process_value_by_type($field_name,$value);

            // Adding field value meta data
            add_post_meta($post_id, "{$field_name}", $value);

            $meta_id = $wpdb->insert_id;

            $sql_insert = $wpdb->prepare(
              "INSERT INTO " . MF_TABLE_POST_META .
              " ( meta_id, field_name, field_count, group_count, post_id ) " .
              " VALUES " .
              " (%s,'%s',%s,%s,%s) ",
              $meta_id,
              $field_name,
              $field_count,
              $group_count,
              $post_id
            );

            $wpdb->query($sql_insert);

            $field_count++;
          }
          $group_count++;
        }
      }
    }
  }
57717
function Set(&$row)
	{
	global $ACTIVE_RECORD_SAFETY;

		$db = $this->DB();

		if (!$row) {
			$this->_saved = false;
			return false;
		}

		$this->_saved = true;

		$table = $this->TableInfo();
		if ($ACTIVE_RECORD_SAFETY && sizeof($table->flds) != sizeof($row)) {
			# <AP>
			$bad_size = TRUE;
			if (sizeof($row) == 2 * sizeof($table->flds)) {
				// Only keep string keys
				$keys = array_filter(array_keys($row), 'is_string');
				if (sizeof($keys) == sizeof($table->flds)) {
					$bad_size = FALSE;
				}
			}
			if ($bad_size) {
			$this->Error("Table structure of $this->_table has changed","Load");
			return false;
		}
			# </AP>
		}
		else
			$keys = array_keys($row);

		# <AP>
		reset($keys);
		$this->_original = array();
		foreach($table->flds as $name=>$fld) {
			$value = $row[current($keys)];
			$this->$name = $value;
			$this->_original[] = $value;
			next($keys);
		}

		# </AP>
		return true;
	}
1065211
function unserialize($data)
	{
		$propvals = unserialize($data);

		$ro = new ReflectionObject($this);

		foreach ($ro->getProperties() as $rp )
		{
			$propname = $rp->name;
			if ( array_key_exists($propname,$propvals) )
			{
				if (method_exists($rp,"setAccessible"))
				{
					$rp->setAccessible(true);
					$rp->setValue($this,$propvals[$propname]);
				}
				elseif (!$rp->isPrivate())
				{
					// if < php 5.3 we can't serialize private vars
					$rp->setValue($this,$propvals[$propname]);
				}

			}
		}
	}
124944
function save($table, $data, $primary_key, $stmt_key = null)
    {
        // Update if primary key exists in data set or insert new row
        if (!empty($data[$primary_key])) {
            return $this->update($table, $data, $primary_key . " = ?", $data[$primary_key], $stmt_key);
        } else {
            return $this->insert($table, $data, $stmt_key);
        }
    }
243604
public function save() 
    {
        try {
            $m = self::getByAlias($this->alias);
        } catch (\Exception $e) {}
        
        if ($m && $m->id != $this->id) throw new Exception\CMS('Меню c таким алиасом уже существует.');
        
		self::getDbConnection()->update('menus',
			array(
				'alias' => $this->alias,
				'name'  => $this->name,
				'data'  => serialize($this->data),
			),
			array('id' => $this->id)
		);
  	}
548025
function load_array($object, $where)
	{
		if(!$by_id  = popval($where, 'by_id'))
			$by_id  = popval($where, '*by_id');

		if(!($select = popval($where, '*select')))
			$select = popval($where, 'select');

		$target_info = popval($where, '*join_object');

		$set    = popval($where, '*set');

		$must_be_configured = $object->get('must_be_configured');

		if(is_null($object))
		{
			$db_name = $where['*db'];
			$table_name = $where['*table'];
			unset($where['*db'], $where['*table']);
			$select = array('*');
			$class_name = 'base_object_db';
			$object = new base_object_db(NULL);
			$post_functions = array();
		}
		else
		{
			$db_name = $object->db_name();
			$table_name = $object->table_name();
			$class_name = $object->class_name();
			$class_file = $object->class_file();
			list($select, $where, $post_functions) = self::__query_data_prepare($object, $where);
		}

		if(empty($db_name))
			throw new Exception("Not defined database to load $class_name");

		$dbh = new driver_mysql($db_name);

		// формат: array(..., '*set' => 'MAX(create_time) AS max_create_time, ...')
		if($set)
			foreach(preg_split('/\s*,\s*/', $set) as $s)
				$select[] = $s;

		$datas = $dbh->select_array($table_name, join(',', $select), $where, $class_name);

		$objects = array();

		$num_objects = count($datas);

		if($num_objects > 200 && Cfg::get('debug.profiling'))
			bors_debug::syslog('profiling', "Load {$num_objects} of $class_name");

		foreach($datas as $data)
		{
			$object->set_id(@$data['id']);
			$object->data = $data;

			if($target_info)
			{
				foreach($target_info as $target_class_name => $info)
				{
					$target = new $target_class_name(NULL);
					foreach($info['target_properties'] as $p)
					{
						$value = $data[$p];
						$p = preg_replace('/^\w+\.(.+)$/', '$1', $p);
						if(preg_match('/^(\w+)\|(\w+)$/', $p, $m))
						{
							$p = $m[1];
							$value = $m[2]($value);
						}

						$target_data[$p] = $value;
						unset($data[$p]);
					}

					$target->set_id(@$target_data['id']);
					$target->data = $target_data;
					$object->set_attr($info['property_for_target'], $target);
				}
			}

			if($must_be_configured)
				$object->b2_configure();

			$object->set_is_loaded(true);

			if(!empty($post_functions))
				self::post_functions_do($object, $post_functions);

			if($by_id === true)
				$objects[$object->id()] = $object;
			elseif($by_id)
				$objects[$object->$by_id()] = $object;
			else
				$objects[] = $object;

			if($num_objects <= 100)
				save_cached_object($object);

			$object = new $class_name(NULL);
			$object->set_class_file($class_file);
		}

		return $objects;
	}
1240414
private function create()
    {
        $sections = $this->menuBranch();
        array_unshift($sections[0], 'ВСЕ РАЗДЕЛЫ');
        array_unshift($sections[1], 'all');
        $form = array(
            'name' => 'formCreate',
            'caption' => 'Добавить баннер',
            'width' => '600px',
            'fields' => array(
                array('type' => 'hidden', 'name' => 'action', 'value' => 'insert'),
                array('type' => 'edit', 'name' => 'caption', 'label' => '<b>Заголовок</b>',
                    'width' => '100%', 'maxlength' => '255', 'pattern' => '/.+/',
                    'errormsg' => 'Заголовок не может быть пустым!'),
                array('type' => 'listbox', 'name' => 'section', 'label' => '<b>Разделы</b>', 'height' => 5,
                    'items' => $sections[0], 'values' => $sections[1]),
                array('type' => 'edit', 'name' => 'block', 'label' => '<b>Блок баннера</b>',
                    'width' => '100px', 'maxlength' => 31,
                    'comment' => 'Для вставки баннера используйте макрос <b>$(Banners:имя_блока)</b>',
                    'pattern' => '/.+/', 'errormsg' => 'Не указан блок баннера!'),
                array('type' => 'edit', 'name' => 'priority', 'label' => 'Приоритет', 'width' => '20px',
                    'comment' => 'Если для одного раздела и одного блока задано несколько баннеров, будет ' .
                        'показан с большим приоритетом',
                    'default' => 0, 'pattern' => '/\d+/', 'errormsg' => 'Приоритет задается только цифрами!'),
                array('type' => 'edit', 'name' => 'showFrom', 'label' => 'Начало показов',
                    'width' => '100px', 'comment' => 'ГГГГ-ММ-ДД', 'default' => gettime('Y-m-d'),
                    'pattern' => '/[12]\d{3,3}-[01]\d-[0-3]\d/', 'errormsg' => 'Неправильный формат даты!'),
                array('type' => 'edit', 'name' => 'showTill', 'label' => 'Конец показов',
                    'width' => '100px', 'comment' => 'ГГГГ-ММ-ДД; Пустое - без ограничений',
                    'pattern' => '/([12]\d{3,3}-[01]\d-[0-3]\d)|(^$)/',
                    'errormsg' => 'Неправильный формат даты!'),
                array('type' => 'edit', 'name' => 'showCount', 'label' => 'Макс. кол-во показов',
                    'width' => '100px', 'comment' => '0 - без ограничений', 'default' => 0,
                    'pattern' => '/(\d+)|(^$)/', 'errormsg' => 'Кол-во показов задается только цифрами!'),
                /*array ('type' => 'edit', 'name' => 'mail', 'label' => 'e-mail владельца',
                    'width' => '200px', 'maxlength' => '63'),*/
                array('type' => 'checkbox', 'name' => 'active', 'label' => 'Активировать',
                    'default' => true),
                array('type' => 'header', 'value' => 'Свойства баннера'),
                array('type' => 'file', 'name' => 'image', 'label' => 'Картинка или Flash', 'width' => '50'),
                array('type' => 'edit', 'name' => 'width', 'label' => 'Ширина', 'width' => '100px',
                    'comment' => 'только для Flash'),
                array('type' => 'edit', 'name' => 'height', 'label' => 'Высота', 'width' => '100px',
                    'comment' => 'только для Flash'),
                array('type' => 'edit', 'name' => 'url', 'label' => 'URL для ссылки', 'width' => '100%',
                    'maxlength' => '255'),
                array('type' => 'select', 'name' => 'target', 'label' => 'Открывать',
                    'items' => array('в новом окне', 'в том же окне')),
                array('type' => 'header', 'value' => 'HTML-код баннера'),
                array('type' => 'memo', 'name' => 'html',
                    'label' => 'HTML-код (Если задан HTML-код, то предыдущие свойства игнорируются и могут ' .
                        'не заполняться)',
                    'height' => '4'),
            ),
            'buttons' => array('ok', 'cancel'),
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form);
        return $result;
    }
227340
function execute(O $o) {
		$c = df_customer($o['customer']); /** @var Customer $c */
		$s = df_customer_session(); /** @var Session $s */
		if ($s->getDfSsoId()) {
			$c[Schema::fIdC($s->getDfSsoProvider())] = $s->getDfSsoId();
			/**
			 * 2016-12-04
			 * Нельзя использовать здесь @see df_eav_update(),
			 * потому что наше поле не является атрибутом EAV,
			 * а является просто полем таблицы customer_entity.
			 */
			$c->save();
		}
		$s->unsDfSsoId()->unsDfSsoProvider()->unsDfSsoRegistrationData();
		$s->setDfNeedConfirm(df_customer_is_need_confirm($c));
	}
501043
protected function setData($data = [])
    {
        if (!isset($data[self::RS_KEY_CODE])) {
            $data[self::RS_KEY_CODE] = 0;
        }
        if (!isset($data[self::RS_KEY_MSG])) {
            $data[self::RS_KEY_MSG] = 'Success';
        }
        if (!isset($data[self::RS_KEY_TYPE])) {
            $data[self::RS_KEY_TYPE] = self::RESPONSE_XHTML;
        }

        if (!isset($data[self::RS_KEY_DATA])) {
            $data[self::RS_KEY_DATA] = new \stdClass();
        } else {
            if (!$data instanceof \stdClass) {
                $data[self::RS_KEY_DATA] = new \stdClass();
            }
        }
        $this->data = $data;
    }
817820
function ssetMeta($name = '', $content = '', $type = 'name', $newline = "\n\t")
	{
		// Since we allow the data to be passes as a string, a simple array
		// or a multidimensional one, we need to do a little prepping.
		if ( ! is_array($name))
		{
			$name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
		}
		elseif (isset($name['name']))
		{
			// Turn single array into multidimensional
			$name = array($name);
		}

		$str = '';
		foreach ($name as $meta)
		{
			$type		= ( ! isset($meta['type']) OR $meta['type'] === 'name') ? 'name' : 'http-equiv';
			$name		= isset($meta['name'])					? $meta['name'] : '';
			$content	= isset($meta['content'])				? $meta['content'] : '';
			$newline	= isset($meta['newline'])				? $meta['newline'] : "\n";

			$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
		}

		$this->_metadata .= $str;
	}
1152064
private function postData()
    {
        $data = array_filter($this->post, function ($v) {
            if (is_array($v)) {
                return array_filter($v, 'strlen');
            }

            return strlen($v);
        });

        return json_encode($data);
    }
643608
public function setData()
    {
        $args = func_get_args();
        if (count($args) === 1 && is_array($args[0])) {
            $this->data->replace($args[0]);
        } elseif (count($args) === 2) {
            // Ensure original behavior is maintained. DO NOT invoke stored Closures.
            if (is_object($args[1]) && method_exists($args[1], '__invoke')) {
                $this->data->set($args[0], $this->data->protect($args[1]));
            } else {
                $this->data->set($args[0], $args[1]);
            }
        } else {
            throw new \InvalidArgumentException('Cannot set View data with provided arguments. Usage: `View::setData( $key, $value );` or `View::setData([ key => value, ... ]);`');
        }
    }
105857
private function postData()
    {
        if (strtolower($this->env->get('REQUEST_METHOD')) == 'put' || strtolower($this->env->get('REQUEST_METHOD')) == 'delete') {
            //put方法
            $body = file_get_contents('php://input');
            $bodys = [];
            parse_str($body, $bodys);
            $_POST = array_merge($bodys, $_POST);
        }
        $data = $_POST;
        $this->body = new Set($data);
        return $this;
    }
84351
public function set($meta, $value = null)
	{
		if ( ! is_array($meta))
		{
			if ( ! is_scalar($meta))
			{
				throw new \InvalidArgumentException('Индекс метаинформации должен быть простого типа.');
			}

			$meta = [(string) $meta => $value];
		}

		if (empty($meta))
		{
			throw new \OutOfBoundsException('Не было передано ни одного значения для добавления метаинформации.');
		}

		/*if (mb_strlen(json_encode($meta, JSON_UNESCAPED_UNICODE), 'UTF-8') > 1024)
		{
			throw new \LengthException('Максимальный допустимый размер объекта метаинформации составляет 1024 байт.');
		}*/

		$request = (new Request($this->uri->withPath($this->uri->getPath().'resources')
			->withQuery(http_build_query(['path' => $this->getPath()], null, '&')), 'PATCH'));

		$request->getBody()
			->write(json_encode(['custom_properties' => $meta]));

		$response = $this->client->send($request);

		if ($response->getStatusCode() == 200)
		{
			$this->setContents(json_decode($response->getBody(), true));
			$this->store['docviewer'] = $this->createDocViewerUrl();
		}

		return $this;
	}
1016504
public function setInput(&$post, &$cookie, &$files, &$put, &$delete, &$data)
    {

        $this->post = $post;
        $this->cookie = $cookie;
        $this->files = $files;
        $this->put = $put;
        $this->delete = $delete;
        $this->data = $data;
    }