Отрисовка контента
@return string
@uses HTTP::request
320156
function adminRender()
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');
        if (!UserRights($this->access))
        {
            return '';
        }

        if (HTTP::request()->getMethod() == 'POST')
        {
            $this->update();
        }

        $html = $this->renderForm();
        return $html;
    }
468708
function html()
	{
		$params = $this->params();

		if(!empty($params['property']))
			$params['name'] = $params['property'];

		$form = $this->form();

		extract($params);

		$obj = $form->object();
		if(!$obj)
			$obj = $form->call('calling_object');

		$el_params = "";
		foreach(explode(' ', 'size style') as $p)
			if(!empty($$p))
				$el_params .= " $p=\"{$$p}\"";

		if(!empty($xref))
		{
			// Задан класс m2m связей
			if(is_object($xref))
				$xref_obj = $xref;
			else
				$xref_obj = bors_foo($xref);

			$list = $xref_obj->named_list($obj);
			$name = $xref_obj->name($obj, $xref_obj->class_name());
		}

		// http://admin2.aviaport.wrk.ru/newses/256783/form2/
		if(!empty($named_list))
			$list = bors_foo($named_list)->named_list();

		if(!is_array($list))
		{
			if(preg_match("!^(\w+)\->(\w+)$!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]]);
			}
			elseif(preg_match("!^(\w+)\->(\w+)\('(.+)'\)!", $list, $m))
			{
				if($m[1] == 'this')
					$list = call_user_func([$obj, $m[2]], $m[3]);
				else
					$list = call_user_func([bors_foo($m[1]), $m[2]], $m[3]);
			}
			elseif(preg_match("!^\w+$!", $list))
			{
				$list_class = $list;
				$list = new $list_class(@$args);
				$list = $list->get('named_list');
				if(!$list)
					$list = base_list::make($list_class, array(), $params + array('non_empty' => true));
			}
			else
			{
				eval('$list='.$list);
			}
		}

		if(!$current && !empty($list['default']))
			$current = $list['default'];

		if(empty($delim))
			$delim = "<br />";

		$ids = array();

		$values = $value;

		if(empty($values))
		{
			if(empty($get))
				$current = preg_match('!^\w+$!', $name) ? (isset($value)?$value:($obj?$obj->get($name):0)) : 0;
			else
				$current = $obj->$get();

			if(!$current && !empty($list['default']))
				$current = $list['default'];

			if(!is_array($current))
				$current = array($current);
		}
		else
			$current = $values;

		$class = explode(' ', defval($params, 'class'));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$class[] = "error";

		if($class)
			$class = ' class="'.join(' ', $class).'"';
		else
			$class = '';

		$label_css = explode(' ', defval($params, 'label_css', ''));

		if(in_array($name, explode(',', session_var('error_fields'))))
			$label_css[] = "error";

		if(!empty($label_css))
			$label_css = " class=\"".join(" ", $label_css)."\"";
		else
			$label_css = "";

		if($input_data_toggle = defval($params, 'input_data_toggle', ''))
			$input_data_toggle = " data-toggle=\"$input_data_toggle\"";

		$html = '';

		// Если нужно, добавляем заголовок поля
		$html .= $this->label_html();

		// Если отдельный блок, то на всю ширину.
		if($this->label() && empty($style))
			$style = "width: 99%";

		$labels_html = array();

		if($columns)
		{
			$labels_html[] = "<table><tr><td style=\"padding: 0 10px 0 0\">";
			$per_column = ceil(count($list) / $columns);
		}

		$pos = 0;

		foreach($list as $id => $iname)
		{
			if($columns && $pos && $pos % $per_column == 0)
				$labels_html[] = "</td><td>";

			$ids[] = $id;
			$checked = in_array($id, $current);
			$labels_html[] = "<label{$label_css}><input type=\"checkbox\" name=\"".addslashes($name)."[]\" value=\"$id\"".($checked ? " checked=\"checked\"" : "")."$el_params$class$input_data_toggle />".($checked?'<b>':'')."&nbsp;$iname".($checked?'</b>':'')."</label>$delim\n";
			$pos++;

		}

		if($columns)
			$labels_html[] = "</td></tr></table>";

		$labels_html = join("", $labels_html);

		if($container = defval($params, 'label_container'))
			$labels_html = sprintf($container, $labels_html);

		$html .= $labels_html;

		$form->append_attr('checkboxes_list', $name);

		if($form->get('has_form_table'))
			$html .= "</td></tr>\n";

		return $html;
	}
455800
public function getUrl()
    {
        if (empty($this->url)) {
            $url = $this->httpRequest()->getCurrentUrl(true)->getPath();
            // we need to have the trailing slash because of the match inside matchRequest
            // and also when matching the default method, we can do an incorrect match if we don't have the start and end slash
            $this->url = $this->str($url)->trimRight('/')->val() . '/';
        }

        return $this->url;
    }
51362
public function clientRenderContent()
    {
        /** @var TClientUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $request = Eresus_CMS::getLegacyKernel()->request;
        /* Если в URL указано что-либо кроме адреса раздела, отправляет ответ 404 */
        if ($request['file'] || $request['query'] ||
            $page->subpage || $page->topic)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }

        return $page->content;
    }
17534
protected function getGuzzle()
    {
        $headers = array_merge([
            'Content-Type' => 'application/json',
            'Accept' => 'application/json'
        ], $this->additionalHeaders);

        // Сбрасываем доп. заголовки для последующих запросов
        $this->additionalHeaders = [];

        return new GuzzleClient([
            'headers' => $headers,
            'verify' => false
        ]);
    }
785434
public function getRequest()
    {
        $path = $_SERVER['REQUEST_URI'];
    
        //remove ? url queries
        if (strpos($path, '?') !== false) {
            list($path, $tmp) = explode('?', $path, 2);
        }

        $array = explode('/', $path);
        
        $path = array(
            'string' => $path,
            'array' => $array);
            
        //set the request
        return $this('registry')
            ->set('method', $_SERVER['REQUEST_METHOD'])
            ->set('query', $_SERVER['QUERY_STRING'])
            ->set('body', file_get_contents('php://input'))
            ->set('server', $_SERVER)
            ->set('cookie', $_COOKIE)
            ->set('get', $_GET)
            ->set('post', $_POST)
            ->set('files', $_FILES)
            ->set('path', $path);
    }
486603
protected function getCurrentPort()
    {
        // Сначала проверьте наличие прокси-сервера
        $port = $this->getHeader('X_FORWARDED_PORT');
        if ($port) {
            return (string)$port;
        }

        $protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
        if ($protocol === 'https') {
            return '443';
        }

        return (string)$this->getServerVar('SERVER_PORT');
    }
228887
protected function getRequest()
    {
        $request = new Request();

        $request->setUrl($this->getUrl())
            ->setHeaders($this->getHeaders())
            ->setParams($this->getRequestParams())
            ->setBody($this->getRequestBody())
            ->setUserIp($this->getUserIp());
      
        if (isset($_SERVER)) {
            $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null)
                ->setQueryString(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null);
        }
      
        if (isset($_GET)) {
            $request->setGet($_GET);
        }
        if (isset($_POST)) {
            $request->setPost($_POST);
        }
        
        if ($request->getMethod() === 'PUT') {
            $postData = array();
            parse_str($request->getBody(), $postData);
            $request->setPost($postData);
        }
        
        $extras = $this->getRequestExtras();
        if (!$extras) {
            $extras = array();
        }

        $request->setExtras($extras);
        
        if (isset($_SESSION) && is_array($_SESSION) && count($_SESSION) > 0) {
            $request->setSession($_SESSION);
        }
        return $request;
    }
224842
public function request() {
		if ( 0 === strpos( $this->url, 'http://127.0.0.1:' ) || 0 === strpos( $this->url, 'http://localhost:' ) ) {
			return new \WP_Error(
				'http_request_failed',
				__( 'Requests for local URLs are not supported.', 'inc2734-wp-oembed-blog-card' )
			);
		}

		$this->response = wp_remote_get(
			$this->url,
			[
				'timeout'    => 10,
				'user-agent' => $this->user_agent,
			]
		);

		return $this->response;
	}
402595
protected function getRequestMethod()
    {
        if (isset($this->server['REQUEST_METHOD'])) {
            // check for X-HTTP-Method-Override
            if (isset($this->server['HTTP_X_HTTP_METHOD_OVERRIDE']) && in_array($this->server['HTTP_X_HTTP_METHOD_OVERRIDE'], ['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH'])) {
                return $this->server['HTTP_X_HTTP_METHOD_OVERRIDE'];
            } else {
                return $this->server['REQUEST_METHOD'];
            }
        } else {
            return 'GET';
        }
    }
120108
public function actionName() {
        $request = $this->stack->getCurrentRequest();
        if ($request instanceof Request) {
            $pattern = "#::([a-zA-Z]*)Action#";
            $matches = array();
            preg_match($pattern, $request->get('_controller'), $matches);
            if (isset($matches[1])) {
                return strtolower($matches[1]);
            }

            return '';
        }

        return '';
    }
910086
protected function getRequestUrl()
    {
        $isTest = !array_key_exists('test', $this->getConfig()) || ((bool) $this->getConfig()['test']);

        return ($isTest ? $this->testEendpoint : $this->endpoint)."/{$this->getConfig()['id']}";
    }
924269
public function actionChangePassword()
    {
        $model = $this->model;

        $modelForm = new PasswordChangeForm([
            'user' => $model,
        ]);

        $rr = new RequestResponse();

        if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
            return $rr->ajaxValidateForm($modelForm);
        }


        if ($modelForm->load(\Yii::$app->request->post()) && $modelForm->changePassword()) {
            \Yii::$app->getSession()->setFlash('success', 'Успешно сохранено');
        } else {
            if (\Yii::$app->request->isPost) {
                \Yii::$app->getSession()->setFlash('error', 'Не удалось изменить пароль');
            }
        }

        return $this->render($this->action->id, [
            'model' => $modelForm,
        ]);
    }
789059
public function getLink()
    {
        if ( ! $this->has())
        {
            throw new NotFoundException('Не удалось найти запрошенный ресурс.');
        }

        $response = $this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources/download')
                                                              ->withQuery(http_build_query([
                                                                  'path'       => (string) $this->getPath()
                                                              ], null, '&')), 'GET'));

        if ($response->getStatusCode() == 200)
        {
            $response = json_decode($response->getBody(), true);

            if (isset($response['href']))
            {
                return $response['href'];
            }
        }

        throw new \UnexpectedValueException('Не удалось запросить разрешение на скачивание, повторите заново');
    }
1347604
public function request(){        
        //Cargo el modulo correspondiente en base al tipo de requerimiento
        if(ENOLA_MODE == 'HTTP'){
            //Cargo el modulo Http
            $this->loadHttpModule();
        }else{
            //Cargo el modulo Cron
            $this->loadCronModule();
        }        
        //Luego de la carga de todos los modulos creo una instancia de Support\View
        $this->view= new Support\View();
        //Cargo la configuracion del usuario
        $this->loadUserConfig();
        //Analizo si estoy en modo HTTP o CLI
        if(ENOLA_MODE == 'HTTP'){
            //Ejecuto el controlador correspondiente
            $this->httpCore->executeHttpRequest();
        }else{
            //Ejecuta el cron controller
            $this->cronCore->executeCronController();
        }        
    }
274262
public function toString()
    {
        $status = sprintf('HTTP/%s %d %s', $this->getVersion(), $this->getStatusCode(), $this->getStatusMessage());

        $str  = trim($status) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }
438653
public function getRequestUri()
    {
        if (isset($this->env['REQUEST_URI'])) {
            $uri = $this->env['REQUEST_URI'];
        } else {
            $uri = "/";
        }
        if (strstr($uri, "?")) {
            $uri = strstr($uri, "?", true);
        }
        return $uri;
    }