Builds page navigation links.

@param string $Type Type of link to return: 'more' or 'less'.
@return string HTML page navigation links.
973521
public function ToString($Type = 'more') {
      if ($this->_PropertiesDefined === FALSE)
         trigger_error(ErrorMessage('You must configure the pager with $Pager->Configure() before retrieving the pager.', 'MorePager', 'GetSimple'), E_USER_ERROR);
      
      // Urls with url-encoded characters will break sprintf, so we need to convert them for backwards compatibility.
      $this->Url = str_replace(array('%1$s', '%2$s', '%s'), '{Page}', $this->Url);
      
      if ($this->TotalRecords === FALSE) {
         return $this->ToStringPrevNext($Type);
      }
      
      $this->CssClass = ConcatSep(' ', $this->CssClass, 'NumberedPager');
         
      $PageCount = ceil($this->TotalRecords / $this->Limit);
      $CurrentPage = ceil($this->Offset / $this->Limit) + 1;
      
      // Show $Range pages on either side of current
      $Range = C('Garden.Modules.PagerRange', 3);
      
      // String to represent skipped pages
      $Separator = C('Garden.Modules.PagerSeparator', '&#8230;');
      
      // Show current page plus $Range pages on either side
      $PagesToDisplay = ($Range * 2) + 1;
      if ($PagesToDisplay + 2 >= $PageCount) {
         // Don't display an ellipses if the page count is only a little bigger that the number of pages.
         $PagesToDisplay = $PageCount;
      }

      $Pager = '';
      $PreviousText = T($this->LessCode);
      $NextText = T($this->MoreCode);
      
      // Previous
      if ($CurrentPage == 1) {
         $Pager = '<span class="Previous">'.$PreviousText.'</span>';
      } else {
         $Pager .= Anchor($PreviousText, $this->PageUrl($CurrentPage - 1), 'Previous', array('rel' => 'prev'));
      }
      
      // Build Pager based on number of pages (Examples assume $Range = 3)
      if ($PageCount <= 1) {
         // Don't build anything
         
      } else if ($PageCount <= $PagesToDisplay) {
         // We don't need elipsis (ie. 1 2 3 4 5 6 7)
         for ($i = 1; $i <= $PageCount ; $i++) {
            $Pager .= Anchor($i, $this->PageUrl($i), $this->_GetCssClass($i, $CurrentPage), array('rel' => self::Rel($i, $CurrentPage)));
         }
         
      } else if ($CurrentPage + $Range <= $PagesToDisplay + 1) { // +1 prevents 1 ... 2
         // We're on a page that is before the first elipsis (ex: 1 2 3 4 5 6 7 ... 81)
         for ($i = 1; $i <= $PagesToDisplay; $i++) {
            $PageParam = 'p'.$i;
            $Pager .= Anchor($i, $this->PageUrl($i), $this->_GetCssClass($i, $CurrentPage), array('rel' => self::Rel($i, $CurrentPage)));
         }

         $Pager .= '<span class="Ellipsis">'.$Separator.'</span>';
         $Pager .= Anchor($PageCount, $this->PageUrl($PageCount));
         
      } else if ($CurrentPage + $Range >= $PageCount - 1) { // -1 prevents 80 ... 81
         // We're on a page that is after the last elipsis (ex: 1 ... 75 76 77 78 79 80 81)
         $Pager .= Anchor(1, $this->PageUrl(1));
         $Pager .= '<span class="Ellipsis">'.$Separator.'</span>';
         
         for ($i = $PageCount - ($PagesToDisplay - 1); $i <= $PageCount; $i++) {
            $PageParam = 'p'.$i;
            $Pager .= Anchor($i, $this->PageUrl($i), $this->_GetCssClass($i, $CurrentPage), array('rel' => self::Rel($i, $CurrentPage)));
         }
         
      } else {
         // We're between the two elipsises (ex: 1 ... 4 5 6 7 8 9 10 ... 81)
         $Pager .= Anchor(1, $this->PageUrl(1));
         $Pager .= '<span class="Ellipsis">'.$Separator.'</span>';
         
         for ($i = $CurrentPage - $Range; $i <= $CurrentPage + $Range; $i++) {
            $PageParam = 'p'.$i;
            $Pager .= Anchor($i, $this->PageUrl($i), $this->_GetCssClass($i, $CurrentPage), array('rel' => self::Rel($i, $CurrentPage)));
         }

         $Pager .= '<span class="Ellipsis">'.$Separator.'</span>';
         $Pager .= Anchor($PageCount, $this->PageUrl($PageCount));
      }
      
      // Next
      if ($CurrentPage == $PageCount) {
         $Pager .= '<span class="Next">'.$NextText.'</span>';
      } else {
         $PageParam = 'p'.($CurrentPage + 1);
         $Pager .= Anchor($NextText, $this->PageUrl($CurrentPage + 1), 'Next', array('rel' => 'next')); // extra sprintf parameter in case old url style is set
      }
      if ($PageCount <= 1)
         $Pager = '';

      $ClientID = $this->ClientID;
      $ClientID = $Type == 'more' ? $ClientID.'After' : $ClientID.'Before';

      if ($Pager) {
         if (isset($this->HtmlBefore)) {
            $Pager = $this->HtmlBefore.$Pager;
         }
         if (isset($this->HtmlAfter)) {
            $Pager = ' '.$Pager.$this->HtmlAfter;
         }
      }
      
      return $Pager == '' ? '' : sprintf($this->Wrapper, Attribute(array('id' => $ClientID, 'class' => $this->CssClass)), $Pager);
   }
7348
public function getMonthlyArchiveLink($type = 'day')
    {
        /** @var DBDatetime $date */
        $date = $this->dbObject('PublishDate');

        if ($type !== 'year') {
            if ($type === 'day') {
                return Controller::join_links(
                    $this->Parent()->Link('archive'),
                    $date->format('Y'),
                    $date->format('M'),
                    $date->format('d')
                );
            }

            return Controller::join_links($this->Parent()->Link('archive'), $date->format('Y'), $date->format('M'));
        }

        return Controller::join_links($this->Parent()->Link('archive'), $date->format('Y'));
    }
1170452
protected static function getMultilingualSectionFromType($type)
    {
        $detector = Core::make('multilingual/detector');
        if ($type == self::MULTILINGUAL_CONTENT_SOURCE_DEFAULT) {
            $ms = Section::getDefaultSection();
        } else {
            $c = \Page::getCurrentPage();
            $ms = Section::getBySectionOfSite($c);
            if (!is_object($ms)) {
                $ms = $detector->getPreferredSection();
            }
        }

        return $ms;
    }
250460
private function getTypeSuffix($type)
    {
        self::$TYP_MAPPING = array_merge(self::$TYP_COMPLEX_MAPPING, self::$TYP_SIMPLE_MAPPING);

        if ($type == '') {
            return '';
        }

        if (!isset(self::$TYP_MAPPING[$this->type])) {
            return '';
        }

        return self::$TYP_MAPPING[$this->type];
    }
1211098
function pathObjectUrl($entity, $type = LinkGeneratorService::TYPE_LINK_DEFAULT, array $parameters = array()) {
        if($entity === null){
            return "";
        }
        return $this->linkGeneratorService->generateOnlyUrl($entity, $type, $parameters);
    }
355795
protected function getPhpType(Type $type): string
    {
        switch ($builtinType = $type->getBuiltinType()) {
            case Type::BUILTIN_TYPE_ARRAY:
            case Type::BUILTIN_TYPE_INT:
            case Type::BUILTIN_TYPE_FLOAT:
            case Type::BUILTIN_TYPE_BOOL:
            case Type::BUILTIN_TYPE_STRING:
                return $builtinType;
            case Type::BUILTIN_TYPE_OBJECT:
                if (null !== ($className = $type->getClassName()) && is_a($className, \DateTimeInterface::class, true)) {
                    return \DateTimeInterface::class;
                }

            // no break
            default:
                return 'string';
        }
    }
886923
private function getReferenceType($type)
    {
        switch ($type) {
            case 'absolute':
                return UrlGeneratorInterface::ABSOLUTE_PATH;
            case 'url':
                return UrlGeneratorInterface::ABSOLUTE_URL;
            case 'relative':
                return UrlGeneratorInterface::RELATIVE_PATH;
            case 'network':
                return UrlGeneratorInterface::NETWORK_PATH;
            default:
                return UrlGeneratorInterface::ABSOLUTE_PATH;
        }
    }
624774
public function get_add_page_type_links($previd) {
        global $OUTPUT;

        $links = array();

        foreach ($this->types as $key=>$type) {
            if ($link = $type->add_page_link($previd)) {
                $links[$key] = $link;
            }
        }

        return $links;
    }
1063302
protected function buildBreadcrumbs($type)
    {
        /** @var Breadcrumbs $breadcrumbs */
        $breadcrumbs = $this->get('white_october_breadcrumbs');
        $breadcrumbs->addItem('navigation.home', $this->get('router')->generate('clastic_backoffice_dashboard'));

        /** @var NodeModuleInterface $module */
        $module = $this->get('clastic.module_manager')->getModule($type);
        if ($module) {
            $breadcrumbs->addItem($module->getName(), $this->get('router')->generate('clastic_node_list', array(
                'type' => $type,
            )));
        }

        return $breadcrumbs;
    }
563591
public static function getTypeDescription(?string $type): ?string
    {
        $descriptions = self::typeDescriptions();
        if (isset($descriptions[$type])) {
            return $descriptions[$type];
        }

        return $type;
    }
84872
public function cssClass($type)
    {
        $framework = $this->getFramework();
        $classes = $this->getClasses($framework);

        if (property_exists($classes, $type)) {
            return $classes->$type;
        }

        return '';
    }
1161620
public static function route($type = '')
    {
        if ($type == '') {
            // No type provided, so assume we are on the main "add content"
            // page.
            return static::$URL;

        } else {
            // A special case for panel pages, which have an extra step in the "create node" process.
            // @todo: at the moment, the panel name is hardcoded which might not be ideal.
            if ($type == 'panel') {
                return 'node/add/panel/flexible';
            }

            $type = parent::route($type);
            return static::$URL . '/' . $type;
        }
    }
345210
public function getFromGateway($type) {
        $mapper = $this->config->getCcTypesMapper();
        $type   = strtolower($type);

        if( array_key_exists($type, $mapper) ) {
            return $mapper[$type];
        }

        return 'OT';
    }
734175
protected function _createDefaultVoters($type)
    {
        switch ($type) {
            case static::MATCH_FUZZY_ROUTE:
                return [
                    new FuzzyRouteVoter($this->getView()->getRequest())
                ];
            case static::MATCH_URL:
                return [
                    new UrlVoter($this->getView()->getRequest())
                ];
            case static::MATCH_URL_WITH_QUERY_STRING:
                return [
                    new UrlVoter($this->getView()->getRequest(), [
                        'ignoreQueryString' => false
                    ])
                ];
        }

        return false;
    }
941740
protected static function getConnection($type) {
    $mapper = self::getMapper($type);
    $conn = $mapper->getConnection();
    return $conn;
  }
35317
protected function getLink($type = true) {
        static $links = [];
        $this->config = C('sql');
        $name         = serialize($this->config);
        if (isset($links[$name])) {
            return $this->link = $links[$name];
        }
        try {
            $dns          = $this->getDns();
            $links[$name] = new PDO($dns, $this->config['user'], $this->config['password'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"]);
            $links[$name]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $this->execute("SET sql_mode = ''");
            return $this->link = $links[$name];
        } catch (Exception $e) {
            ERRORCODE($e);
        }
    }
935903
public function get_type_info($type){
		$path_base_dir = __DIR__.'/../templates/';
		if( !is_dir( $path_base_dir.'form_elms/'.urlencode($type).'/' ) ){
			$type = 'text';
		}
		$rtn = array();
		$rtn['type'] = $type;
		$rtn['templates'] = array();
		$rtn['templates']['input'] = 'form_elms/'.urlencode($type).'/input.html';
		$rtn['templates']['preview'] = 'form_elms/'.urlencode($type).'/preview.html';
		$rtn['validate'] = include($path_base_dir.'form_elms/'.urlencode($type).'/validate.php');
		return $rtn;
	}