process param parsing

@return void
778085
protected function _process()
    {
        $name = $this->config('field');
        $this->value = $this->_registry->data($name);
        $this->_processed = true;
    }
250016
protected function parseParams()
    {
        if (!isset($this->attrs->server['HTTP_CONTENT_LENGTH'])) {
            $this->attrs->contentLength = 0;
        } else {
            $this->attrs->contentLength = (int)$this->attrs->server['HTTP_CONTENT_LENGTH'];
        }

        if (isset($this->attrs->server['CONTENT_TYPE']) && !isset($this->attrs->server['HTTP_CONTENT_TYPE'])) {
            $this->attrs->server['HTTP_CONTENT_TYPE'] = $this->attrs->server['CONTENT_TYPE'];
        }

        if (isset($this->attrs->server['QUERY_STRING'])) {
            self::parseStr($this->attrs->server['QUERY_STRING'], $this->attrs->get);
        }
        if (isset($this->attrs->server['REQUEST_METHOD'])
            && ($this->attrs->server['REQUEST_METHOD'] === 'POST' || $this->attrs->server['REQUEST_METHOD'] === 'PUT')
            && isset($this->attrs->server['HTTP_CONTENT_TYPE'])
        ) {
            $this->attrs->server['REQUEST_METHOD_POST'] = true;
            self::parseStr($this->attrs->server['HTTP_CONTENT_TYPE'], $this->contype, true);
            $found = false;
            foreach ($this->contype as $k => $v) {
                if (mb_orig_strpos($k, '/') === false) {
                    continue;
                }
                if (!$found) {
                    $found = true;
                } else {
                    unset($this->contype[$k]);
                }
            }

            if (isset($this->contype['multipart/form-data'])
                && (isset($this->contype['boundary']))
            ) {
                $this->attrs->input->setBoundary($this->contype['boundary']);
            }
        } else {
            $this->attrs->server['REQUEST_METHOD_POST'] = false;
        }

        if (isset($this->attrs->server['HTTP_COOKIE'])) {
            self::parseStr($this->attrs->server['HTTP_COOKIE'], $this->attrs->cookie, true);
        }

        if (isset($this->attrs->server['HTTP_AUTHORIZATION'])) {
            $e = explode(' ', $this->attrs->server['HTTP_AUTHORIZATION'], 2);

            if (($e[0] === 'Basic') && isset($e[1])) {
                $e[1] = base64_decode($e[1]);
                $e = explode(':', $e[1], 2);

                if (isset($e[1])) {
                    list($this->attrs->server['PHP_AUTH_USER'], $this->attrs->server['PHP_AUTH_PW']) = $e;
                }
            }
        }

        $this->onParsedParams();
    }
566381
public function postProcess()
    {
        foreach ($this->info as $key => $v) {
            if (count((array) $v) == 1) {
                $this->info[$key] = $v->type;
            } elseif (count((array) $v) == 2 && isset($v->allow_null)) {
                $this->info[$key] = -$v->type;
            }
        }
    }
1108437
protected function process()
    {

        // try to load the appropriate key for the stock status
        if (!$this->hasHeader(ColumnKeys::QUANTITY_AND_STOCK_STATUS)) {
            $this->addHeader(ColumnKeys::QUANTITY_AND_STOCK_STATUS);
        }

        // append/replace the stock status
        $this->setValue(ColumnKeys::QUANTITY_AND_STOCK_STATUS, 1);
    }
858478
protected function parse(): void
    {
        // add the root node
        $this->root = new HtmlNode('root');
        $activeNode = $this->root;
        while ( ! is_null($activeNode)) {
            $str = $this->content->copyUntil('<');
            if ($str == '') {
                $info = $this->parseTag();
                if ( ! $info['status']) {
                    // we are done here
                    $activeNode = null;
                    continue;
                }

                // check if it was a closing tag
                if ($info['closing']) {
                    $foundOpeningTag  = true;
                    $originalNode     = $activeNode;
                    while ($activeNode->getTag()->name() != $info['tag']) {
                        $activeNode = $activeNode->getParent();
                        if (is_null($activeNode)) {
                            // we could not find opening tag
                            $activeNode = $originalNode;
                            $foundOpeningTag = false;
                            break;
                        }
                    }
                    if ($foundOpeningTag) {
                        $activeNode = $activeNode->getParent();
                    }
                    continue;
                }

                if ( ! isset($info['node'])) {
                    continue;
                }

                /** @var AbstractNode $node */
                $node = $info['node'];
                $activeNode->addChild($node);

                // check if node is self closing
                if ( ! $node->getTag()->isSelfClosing()) {
                    $activeNode = $node;
                }
            } else if ($this->options->whitespaceTextNode ||
                trim($str) != ''
            ) {
                // we found text we care about
                $textNode = new TextNode($str, $this->options->removeDoubleSpace);
                $activeNode->addChild($textNode);
            }
        }
    }
743352
private function parseParameterValues()
    {
        $this->filterParameters = $this->parseOperators($this->filterParameters);
        foreach ($this->dataParameters as $key => $input) {
            $this->dataParameters[$key] = $this->parseValue($input);
        }
    }
1234482
public function process()
    {
        switch ($this->inputs['action']) {
            case 'login':
                $this->webLogin();
                break;
            case 'logout':
                $this->webLogout();
                exit($this->showWebLoginForm());
                break;
            case 'getContacts':
                $this->getContacts();
                break;
            case 'updateStatus':
                $this->updateStatus();
                break;
            case 'sendMessage':
                $this->sendMessage();
                break;
            case 'sendBroadcast':
                $this->sendBroadcast();
                break;
            default:
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
                    exit($this->showWebForm());
                }
                exit($this->showWebLoginForm());
                break;
        }
    }
1325806
private function process_parameters($param){
    foreach ($param as $key => $val){
      //$val is an array
      if (\is_array($val)){
        $param[$key] = $this->process_parameters($val);
      }
      else {
        $param[$key] = $this->sanitize($val);
      }
    }
    //Return the processed parameters
    return $param;
  }
301087
final protected function parseRow(): void
    {
        // only parse the next row if only one in buffer
        if (\count($this->bufferedRow) > 1) {
            return;
        }
        if (feof($this->file)) {
            $this->currentRow = null;

            return;
        }

        $this->currentRowEnded = false;
        // read file until row is ended
        while (!$this->currentRowEnded && !feof($this->file)) {
            $data = fread($this->file, 1024);
            xml_parse($this->parser, $data);
        }
    }
362130
public function process()
    {
        parent::process();

        $data = &$this->getForm()->getFormData();

        if (!isset($data[$this->id])) {
            return;
        }

        $this->value = $data[$this->id];
        $length = $this->getValueLength();

        if ($length === 0) {
            $this->value = null;
        }

        if ($this->required && $length === 0) {
            $message = $this->getValidationMessage('required');
            $this->addMessage($message);
        } elseif ($this->maxlength !== null && $length > $this->maxlength) {
            $message = $this->getValidationMessage('too-long');
            $message->primary_content = sprintf(
                $message->primary_content,
                $this->maxlength
            );

            $this->addMessage($message);
        }
    }
351417
public function process()
    {
        parent::process();
        try {
            if (!array_key_exists('config_key', $this->request->args())) {
                $this->config_key = 'config';
            }
            if (!array_key_exists('code', $this->request->args())) {
                $this->code = str_replace(array('-', '.'), array('_', '_'), $this->name);
            }

            $profile = new \stdClass();
            $profile->properties = new \stdClass();
            $profile->properties->modx = new \stdClass();
            $profile->properties->modx->core_path = $this->core_path;
            $profile->properties->modx->config_key = $this->config_key;

            $this->getMODX($profile);

            $profile = array(
                'name' => $this->name,
                'code' => $this->code,
                'properties' => array(
                    'modx' => array(
                        'core_path' => $this->core_path,
                        'config_key' => $this->config_key,
                        'context_mgr_path' => $this->modx->getOption('manager_path', null, MODX_MANAGER_PATH),
                        'context_mgr_url' => $this->modx->getOption('manager_url', null, MODX_MANAGER_URL),
                        'context_connectors_path' => $this->modx->getOption('connectors_path', null, MODX_CONNECTORS_PATH),
                        'context_connectors_url' => $this->modx->getOption('connectors_url', null, MODX_CONNECTORS_URL),
                        'context_web_path' => $this->modx->getOption('base_path', null, MODX_BASE_PATH),
                        'context_web_url' => $this->modx->getOption('base_url', null, MODX_BASE_URL),
                    ),
                ),
            );

            $profileFilename = TELEPORT_BASE_PATH . 'profile' . DIRECTORY_SEPARATOR . $this->code . '.profile.json';
            $written = $this->modx->getCacheManager()->writeFile($profileFilename, $this->modx->toJSON($profile));

            if ($written === false) {
                throw new ActionException($this, "Error writing profile {$profileFilename}");
            }
            $this->request->log("Successfully wrote profile to {$profileFilename}");
            if ($this->target && $this->push) {
                if (!$this->push($profileFilename, $this->target)) {
                    throw new ActionException($this, "Error pushing profile {$profileFilename} to {$this->target}");
                }
                $this->request->log("Successfully pushed profile {$profileFilename} to {$this->target}");
                $this->request->log("{$this->target}", false);
            } else {
                $this->request->log("{$profileFilename}", false);
            }
        } catch (\Exception $e) {
            throw new ActionException($this, "Error generating profile: " . $e->getMessage(), $e);
        }
    }
889737
protected function parseFilter()
    {
        if (! $params = $this->getParams()) {
            return;
        }

        foreach ($params as $key => $value) {
            if ($this->isEloquentBuilder() && Str::contains($key, '~')) {
                $this->filterRelation($key, $value);
            } else {
                $this->filter($key, $value);
            }
        }
    }
733548
public function process()
	{
		$view = $this->getView();
		$session = $this->_getContext()->getSession();

		if( ( $languageId = $view->param( 'loc-languageid' ) ) !== null ) {
			$session->set( 'arcavias/locale/languageid', $languageId );
		}

		if( ( $currencyId = $view->param( 'loc-currencyid' ) ) !== null ) {
			$session->set( 'arcavias/locale/currencyId', $currencyId );
		}

		parent::process();
	}
1235923
private function processRequest()
        {
            $this->request['resource'] = (isset($_GET['RESTurl']) && !empty($_GET['RESTurl'])) ? $_GET['RESTurl'] : 'index';
            unset($_GET['RESTurl']);
            $this->request['method'] = Inflector::lower($_SERVER['REQUEST_METHOD']);
            $this->request['headers'] = $this->getHeaders();
            $this->request['format'] = isset($_GET['format']) ? trim($_GET['format']) : null;
            switch($this->request['method']) {
                case 'get':
                    $this->request['params'] = $_GET;
                    break;
                case 'post':
                    $this->request['params'] = array_merge($_POST, $_GET);
                    break;
                case 'put':
                    parse_str(fgc('php://input'), $this->request['params']);
                    break;
                case 'delete':
                    $this->request['params'] = $_GET;
                    break;
                default:
                    break;
            }
            $this->request['content-type'] = $this->getResponseFormat($this->request['format']);
            if(!function_exists('trim_value')) {
                function trim_value(&$value)
                {
                    $value = trim($value);
                }
            }
            array_walk_recursive($this->request, 'trim_value');
        }
912541
public function viewAction()
    {
        if ($this->viewSnippets) {
            $params = $this->_processParameters($this->viewParameters);

            $this->addSnippets($this->viewSnippets, $params);
        }
    }
578025
public function process()
        {
            if ($this->_isXhtml === null) {
                $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
            }

            $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']);
            $this->_placeholders = array();

            // replace SCRIPTs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/(\\s*)(<script\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/i'
                    , array($this, '_removeScriptCB')
                    , $this->_html);

            // replace STYLEs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<style\\b[^>]*?>)([\\s\\S]*?)<\\/style>\\s*/i'
                    , array($this, '_removeStyleCB')
                    , $this->_html);

            // remove HTML comments (not containing IE conditional comments).
            $this->_html = preg_replace_callback(
                    '/<!--([\\s\\S]*?)-->/'
                    , array($this, '_commentCB')
                    , $this->_html);

            // replace PREs with placeholders
            $this->_html = preg_replace_callback('/\\s*(<pre\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/i'
                    , array($this, '_removePreCB')
                    , $this->_html);

            // replace TEXTAREAs with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<textarea\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/i'
                    , array($this, '_removeTextareaCB')
                    , $this->_html);

            // trim each line.
            // @todo take into account attribute values that span multiple lines.
            $this->_html = preg_replace('/^\\s+|\\s+$/m', '', $this->_html);

            // remove ws around block/undisplayed elements
            $this->_html = preg_replace('/\\s+(<\\/?(?:area|base(?:font)?|blockquote|body'
                    . '|caption|center|cite|col(?:group)?|dd|dir|div|dl|dt|fieldset|form'
                    . '|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta'
                    . '|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)'
                    . '|ul)\\b[^>]*>)/i', '$1', $this->_html);

            // remove ws outside of all elements
            $this->_html = preg_replace_callback(
                    '/>([^<]+)</'
                    , array($this, '_outsideTagCB')
                    , $this->_html);

            // use newlines before 1st attribute in open tags (to limit line lengths)
            $this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $this->_html);

            // fill placeholders
            $this->_html = str_replace(
                    array_keys($this->_placeholders)
                    , array_values($this->_placeholders)
                    , $this->_html
            );

            return $this->_html;
        }
558577
public function process()
    {
        parent::process();

        // if nothing was submitted by the user, shortcut return
        if (!$this->hasRawValue()) {
            $this->value = null;
            return;
        }

        $this->value = $this->getRawValue();

        if ($this->auto_trim) {
            $this->value = trim($this->value);
            if ($this->value === '') {
                $this->value = null;
            }
        }

        $len = $this->value === null ? 0 : mb_strlen($this->value);

        if (!$this->required && $this->value === null) {
            return;
        } elseif ($this->value === null) {
            $this->addMessage($this->getValidationMessage('required'));
        } elseif ($this->maxlength !== null && $len > $this->maxlength) {
            $message = $this->getValidationMessage('too-long');
            $message->primary_content = sprintf(
                $message->primary_content,
                $this->maxlength
            );

            $this->addMessage($message);
        } elseif ($this->minlength !== null && $len < $this->minlength) {
            $message = $this->getValidationMessage('too-short');
            $message->primary_content = sprintf(
                $message->primary_content,
                $this->minlength
            );

            $this->addMessage($message);
        }
    }