Format query for export url.

@param int  $scope
@param null $args

@return array
433764
public static function formatExportQuery($scope = '', $args = null)
    {
        $query = '';

        if ($scope === static::SCOPE_ALL) {
            $query = 'all';
        }

        if ($scope === static::SCOPE_CURRENT_PAGE) {
            $query = "page:$args";
        }

        if ($scope === static::SCOPE_SELECTED_ROWS) {
            $query = "selected:$args";
        }

        return [static::$queryName => $query];
    }
710553
private function formatScopes(array $scopes)
    {
        if (empty($scopes)) {
            return [null]; //use at least 1 null scope
        }

        array_walk(
            $scopes,
            function (&$scope) {
                if (is_array($scope)) {
                    $scope = implode(' ', $scope);
                }
            }
        );

        return $scopes;
    }
38518
public function afterFetch(Array &$args) {
        $model = $args[0];
        $results = $args[1];
        $table = $model->getName();
        $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');

        if (!$results instanceof Garp_Db_Table_Rowset) {
            $results = array($results);
        }

        $url = $this->_url;
        $params = (array)$this->_params;
        // set sensible defaults
        if (!$url) {
            // non-intelligent route existence check:
            if (strpos(file_get_contents(APPLICATION_PATH.'/configs/routes.ini'),
                       '/'.$model->getName().'/:slug')
               ) {
                $url = '/'.$model->getName().'/%s';
                $params = array('slug');
            } else {
                throw new Garp_Model_Behavior_Exception('Route discovery failed. Please add "/'.$model->getName().'/:slug" to'.
                                    ' routes.ini or give a proper URL configuration to the behavior.');
            }
        }

        foreach ($results as $row) {
            if (!$row) {
                continue;
            }
            // Maps parameters to column values. $params should contain column names.
            $columnToValue = function($column) use ($row) {
                try {
                    return $row->{$column};
                } catch (Exception $e) {
                    return '';
                }
            };

            $values = array_map($columnToValue, $params);
            array_unshift($values, $url);
            $theUrl = call_user_func_array('sprintf', $values);
            $theUrl = $view->fullUrl($theUrl);

            $row->setVirtual(
                self::VIRTUAL_COLUMN_NAME,
                $theUrl
            );
        }

        // return the pointer to 0
        if ($results instanceof Garp_Db_Table_Rowset) {
            $results->rewind();
        } else {
        // also, return results to the original format if it was no Rowset to begin with.
            $results = $results[0];
        }
    }
87204
public function getLoginUrl($scope = array(), $version = null)
        {
            $scope = $this->getScope($scope);

            return $this->getFacebookHelper()->getLoginUrl($scope, $version);
        }
177118
public function createAuthUrl($scope) {
    $params = array(
        'response_type=code',
        'redirect_uri=' . urlencode($this->redirectUri),
        'client_id=' . urlencode($this->clientId),
        'scope=' . urlencode($scope),
        'access_type=' . urlencode($this->accessType),
        'approval_prompt=' . urlencode($this->approvalPrompt)
    );

    if (isset($this->state)) {
      $params[] = 'state=' . urlencode($this->state);
    }
    $params = implode('&', $params);
    return self::OAUTH2_AUTH_URL . "?$params";
  }
1314902
public function parse_query_args( $args ) {
		$query_args = [
			'frontend' => $args,
			'backend'  => $args,
		];

		if ( isset( $args['frontend'] ) || isset( $args['backend'] ) ) {
			foreach ( [ 'frontend', 'backend' ] as $query_type ) {
				$query_args[ $query_type ] = isset( $args[ $query_type ] )
					? $args[ $query_type ]
					: [];
			}
		}

		return $query_args;
	}
175086
public function getLoginUrl(
        array $scope = [Scope::READ_BASIC_PROFILE, Scope::READ_EMAIL_ADDRESS]
    ) {
        $params = [
            'response_type' => self::OAUTH2_RESPONSE_TYPE,
            'client_id' => $this->getClientId(),
            'redirect_uri' => $this->getRedirectUrl(),
            'state' => $this->getState(),
            'scope' => implode(' ', $scope),
        ];
        $uri = $this->buildUrl('authorization', $params);
        return $uri;
    }
347279
final protected function createUrl($controller, array $args = array(), $index = 0)
    {
        if (ArrayUtils::isAssoc($args)) {
            return $this->urlBuilder->createQueryUrl($controller, $args, $index);
        } else {
            return $this->urlBuilder->createUrl($controller, $args, $index);
        }
    }
1130912
public function map($scope, $path, $url = null)
    {
        return $this->parent->map($this->translate($scope), $path, $url);
    }
30010
public function parse($arguments = null)
    {
        $this->_options = [];
        $this->_values = [];

        if ($arguments === null) {
            if (isset($GLOBALS['argv'][1]) && $GLOBALS['argv'][1][0] === '/') {
                $arguments = [$GLOBALS['argv'][1]];
            } else {
                /** @noinspection CallableParameterUseCaseInTypeContextInspection */
                $arguments = array_slice($GLOBALS['argv'], 3);
            }
        }

        if (count($arguments) === 1 && $arguments[0][0] === '/') {
            $query = parse_url($arguments[0], PHP_URL_QUERY);
            parse_str($query, $this->_options);
            if (($fragment = parse_url($arguments[0], PHP_URL_FRAGMENT)) !== null) {
                $this->_values[] = $fragment;
            }
        } else {
            $this->_parse($arguments);
        }

        return $this;
    }
1316962
protected function normalizeArgs(array $args)
    {
        $args += [
            'resultsPerPage' => null,
            'allowedDownloadFormats' => null,
        ];
        $normalized = [];
        $error = $this->app->make('helper/validation/error');
        /* @var \Concrete\Core\Error\ErrorList\ErrorList $error */
        $valn = $this->app->make('helper/validation/numbers');
        /* @var \Concrete\Core\Utility\Service\Validation\Numbers $valn */
        if ($valn->integer($args['resultsPerPage'], 1)) {
            $normalized['resultsPerPage'] = (int) $args['resultsPerPage'];
        } else {
            $error->add(t('Please specify the number of search results per page.'));
        }
        $allowedDownloadFormats = [];
        if (is_array($args['allowedDownloadFormats'])) {
            $tcProvider = $this->app->make(TranslationsConverterProvider::class);
            foreach (array_unique($args['allowedDownloadFormats']) as $adf) {
                if ($tcProvider->isRegistered($adf) === false) {
                    $error->add(t('Invalid format identifier received'));
                } else {
                    $allowedDownloadFormats[] = $adf;
                }
            }
        }
        $normalized['allowedDownloadFormats'] = implode(',', $allowedDownloadFormats);
        $normalized['allowedDownloadFor'] = (isset($args['allowedDownloadFor']) && is_string($args['allowedDownloadFor'])) ? $args['allowedDownloadFor'] : '';
        if (!array_key_exists($normalized['allowedDownloadFor'], $this->getDownloadAccessLevels())) {
            $error->add(t('Please specify who can download the translations'));
        }
        if (!$error->has()) {
            if ($normalized['allowedDownloadFor'] !== static::ALLOWDOWNLOADFOR_NOBODY && $normalized['allowedDownloadFormats'] === '') {
                $error->add(t('If you specify that some user can download the translations, you should specify the allowed download formats'));
            }
        }

        return $error->has() ? $error : $normalized;
    }
227880
public function mapUrl($controller, array $args = array(), $index = 0)
    {
        return $this->urlBuilder->createUrl($controller, $args, $index);
    }
432765
public function _list($args=null) 
    {
      $data = Ensure::Input($args);
      $data = $data->get();
      if (isset($data[0])) {
        $data = $data[0];
      }
      if (!(isset($data["size"]))) {
        $data["size"] = DEFAULTS::SIZE;			
      }
      if (!(isset($data["page"]))) {
        $data["page"] = DEFAULTS::PAGE;
      }
      $url = URIResource::Make($this->path);
      $class = get_class($this) . "Collection";

      return new $class(new DataPacketCollection($this->client->get($url, $data)));
    }
1144623
public function query($url = '', $argsOrParams = array(), $params = array())
    {
        if (strpos($url, '%s') === false) {
            $argsOrParams = $argsOrParams + $this->request->getQueries();
        } else {
            $params += $this->request->getQueries();
        }
        return $this->__invoke($url, $argsOrParams, $params);
    }
858819
public function get($args = [], $scheme = false)
    {
        if (is_string($args)) {
            $url = $args;
            if ($url === '') {
                return $this->router->createUrl($url, $scheme);
            } elseif ($url[0] === '/') {
                $url = $this->alias->get('@web') . $url;
                if (!$scheme) {
                    return $url;
                }
            } elseif (parse_url($url, PHP_URL_SCHEME)) {
                return $url;
            } else {
                return $this->router->createUrl($url, $scheme);
            }
            $anchor = null;
            $args = '';
        } else {
            $url = $args[0];
            if ($url === '') {
                return $this->router->createUrl($args, $scheme);
            } elseif ($url[0] === '/') {
                $url = $this->alias->get('@web') . $url;
            } elseif (parse_url($url, PHP_URL_SCHEME)) {
                null;
            } else {
                return $this->router->createUrl($args, $scheme);
            }

            $anchor = isset($args['#']) ? $args['#'] : null;
            unset($args[0], $args['#']);
        }

        if ($args) {
            $url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($args);
        }

        if ($anchor !== null) {
            $url .= '#' . $anchor;
        }

        if ($scheme) {
            if ($scheme === true) {
                $scheme = $this->request->getScheme();
            }
            return ($scheme === '//' ? $scheme : "$scheme://") . $this->request->getServer('HTTP_HOST') . $url;
        } else {
            return $url;
        }
    }
375859
function formatToArrayDataTables($route = null,array $parameters = array()) {
        $results = $this->getCurrentPageResults()->getArrayCopy();
        $data = array(
            'draw' => $this->draw,
            'recordsTotal' => $this->getNbResults(),
            'recordsFiltered' => $this->getNbResults(),
            'data' => $results,
            '_links' => $this->getLinks($route,$parameters),
        );
        return $data;
    }
1297636
public function getContentByScope($scopeName, $textQuery, array $parameters = [])
    {
        if ($scope = $this->getScope($scopeName)) {
            $this->parser->setQuery($textQuery);
            $this->parser->setParameters($parameters);
            $this->parser->setScope($scope);

            return $this->parser->fetch();
        }

        return null;
    }