Returns first existing class passed in array.

@param array $possible_pages Possible page classes.

@return string
@throws PageFactoryException When page class is not found.
198293
protected function getExistingPageClass(array $possible_pages)
	{
		foreach ( $possible_pages as $page_class ) {
			if ( class_exists($page_class) ) {
				return $page_class;
			}
		}

		$message = sprintf(
			'None of the possible classes were found: %s',
			implode($possible_pages, ', ')
		);

		throw new PageFactoryException($message, PageFactoryException::TYPE_PAGE_CLASS_NOT_FOUND);
	}
272935
public function getPageOrderInstance()
    {
        if ($this->pageOrder === null) {
            $this->pageOrder = new PageOrderImpl($this);
        }
        return $this->pageOrder;
    }
279578
public function getAdditionalPagePaths()
    {
        $em = \ORM::entityManager();

        return $em->getRepository('\Concrete\Core\Entity\Page\PagePath')->findBy(
            ['cID' => $this->getCollectionID(), 'ppIsCanonical' => false,
        ]);
    }
430245
protected function createPageButtons()
	{
		if(($pageCount=$this->getPageCount())<=1)
			return array();

		list($beginPage,$endPage)=$this->getPageRange();
		$currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
		$buttons=array();

		// first page
		if ($this->firstPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->firstPageLabel,0, $this->firstPageCssClass,$currentPage<=0,false);
		}
		// prev page
		if ($this->prevPageLabel !== false) {
			if(($page=$currentPage-1)<0)
				$page=0;
			$buttons[]=$this->createPageButton($this->prevPageLabel,$page, $this->previousPageCssClass,$currentPage<=0,false);
		}

		// internal pages
		for($i=$beginPage;$i<=$endPage;++$i)
			$buttons[]=$this->createPageButton($i+1,$i, $this->internalPageCssClass,false,$i==$currentPage);

		// next page
		if ($this->nextPageLabel !== false) {
			if(($page=$currentPage+1)>=$pageCount-1)
				$page=$pageCount-1;
			$buttons[]=$this->createPageButton($this->nextPageLabel,$page, $this->nextPageCssClass,$currentPage>=$pageCount-1,false);
		}
		// last page
		if ($this->lastPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1, $this->lastPageCssClass,$currentPage>=$pageCount-1,false);
		}

		return $buttons;
	}
595262
public function allowedChildren() {
        $allowedChildren = array();
        $candidates = $this->stat('allowed_children');
        if($candidates && $candidates != "none") {
            foreach($candidates as $candidate) {
                // If a classname is prefixed by "*", such as "*Page", then only that
                // class is allowed - no subclasses. Otherwise, the class and all its subclasses are allowed.
                if(substr($candidate,0,1) == '*') {
                    $allowedChildren[] = substr($candidate,1);
                } else {
                    $subclasses = ClassInfo::subclassesFor($candidate);
                    foreach($subclasses as $subclass) {
                        $allowedChildren[] = $subclass;
                    }
                }
            }
        }
        
        return $allowedChildren;
    }
821228
public function getPerPage()
	{
		$items_per_page_list = array_keys($this->getItemsPerPageList());

		$per_page = $this->per_page ?: reset($items_per_page_list);

		if (($per_page !== 'all' && !in_array((int) $this->per_page, $items_per_page_list, true))
			|| ($per_page === 'all' && !in_array($this->per_page, $items_per_page_list, true))) {
			$per_page = reset($items_per_page_list);
		}

		return $per_page;
	}
1351841
public function getChildren()
        {
            $hash = key($this->_index);

            if (isset($this->_pages[$hash])) {
                return $this->_pages[$hash];
            }

            return null;
        }
220028
public function PageTypes()
    {
        $classes = SiteTree::page_type_classes();

        $result = new ArrayList();

        foreach ($classes as $class) {
            $instance = SiteTree::singleton($class);
            if ($instance instanceof HiddenClass) {
                continue;
            }

            // skip this type if it is restricted
            $needPermissions = $instance->config()->get('need_permission');
            if ($needPermissions && !$this->can($needPermissions)) {
                continue;
            }

            $result->push(new ArrayData(array(
                'ClassName' => $class,
                'AddAction' => $instance->i18n_singular_name(),
                'Description' => $instance->i18n_classDescription(),
                'IconURL' => $instance->getPageIconURL(),
                'Title' => $instance->i18n_singular_name(),
            )));
        }

        $result = $result->sort('AddAction');

        return $result;
    }
509449
protected function getNextPage()
	{
		$backtrace = debug_backtrace();
		return $this->getNextPageFromList(Utils::getReturnTypes($backtrace[1]['class'], $backtrace[1]['function']), $backtrace[1]['class']);
	}
178450
public function getPagination($className='CPagination')
	{
		if($this->_pagination===null)
		{
			$this->_pagination=new $className;
			if(($id=$this->getId())!='')
				$this->_pagination->pageVar=$id.'_page';
		}
		return $this->_pagination;
	}
456481
public function getClasses()
    {
        $owner = $this->owner;
        $classes = array();
        $classes[] = $owner->ClassName;
        if ($owner->ClassName == 'PlaceablePage') {
            $classes[] = $owner->PageType()->Type;
        }
        $owner->extend('updateClasses', $classes);
        return implode(' ', $classes);
    }
517635
protected function findInitializedPagerId()
    {
        foreach ($this->pagers as $key => $pager) {
            if (isset($pager->totalpages)) {
                return $key;
            }
        }

        return '';
    }
519886
public function getFirstInvalidPage()
    {
        foreach ($this->pages as $id => $page) {
            if (!$this->getSessionContainer()->getValidationStatus($id)) {
                return $page;
            }
        }
        return null;
    }
780619
public function getPagination(string $resourceClass = null, string $operationName = null, array $context = []): array
    {
        $page = $this->getPage($context);
        $limit = $this->getLimit($resourceClass, $operationName, $context);

        if (0 === $limit && 1 < $page) {
            throw new InvalidArgumentException('Page should not be greater than 1 if limit is equal to 0');
        }

        return [$page, $this->getOffset($resourceClass, $operationName, $context), $limit];
    }
572180
protected function get_firstpageid() {
        global $DB;
        if ($this->firstpageid == null) {
            if (!$this->loadedallpages) {
                $firstpageid = $DB->get_field('lesson_pages', 'id', array('lessonid'=>$this->properties->id, 'prevpageid'=>0));
                if (!$firstpageid) {
                    print_error('cannotfindfirstpage', 'lesson');
                }
                $this->firstpageid = $firstpageid;
            } else {
                $firstpage = $this->get_firstpage();
                $this->firstpageid = $firstpage->id;
            }
        }
        return $this->firstpageid;
    }
847864
function () {
            var $pages = this.$pages,
                index = this.state.currentPage - 1,
                next = index + 1,
                prev = index - 1,
                buffer = 20;

            // @TODO: optimize this a bit
            // add/removeClass is expensive, so try using hasClass
            $pages.removeClass(PRESENTATION_CSS_CLASSES);
            if (this.twoPageMode) {
                next = index + 2;
                prev = index - 2;
                $pages.slice(Math.max(prev, 0), index).addClass(CSS_CLASS_PAGE_PREV);
                $pages.slice(next, next + 2).addClass(CSS_CLASS_PAGE_NEXT);
            } else {
                if (prev >= 0) {
                    $pages.eq(prev).addClass(CSS_CLASS_PAGE_PREV);
                }
                if (next < this.numPages) {
                    $pages.eq(next).addClass(CSS_CLASS_PAGE_NEXT);
                }
            }
            $pages.slice(0, index).addClass(CSS_CLASS_PAGE_BEFORE);
            $pages.slice(Math.max(0, index - buffer), index).addClass(CSS_CLASS_PAGE_BEFORE_BUFFER);
            $pages.slice(next).addClass(CSS_CLASS_PAGE_AFTER);
            $pages.slice(next, Math.min(this.numPages, next + buffer)).addClass(CSS_CLASS_PAGE_AFTER_BUFFER);

            /*
            // OPTIMIZATION CODE NOT YET WORKING PROPERLY
            $pages.slice(0, index).each(function () {
                var $p = $(this),
                    i = $p.index(),
                    toAdd = '',
                    toRm = '';
                if (!$p.hasClass(beforeClass.trim())) toAdd += beforeClass;
                if ($p.hasClass(nextClass.trim())) toRm += nextClass;
                if ($p.hasClass(afterClass.trim())) toRm += afterClass;
                if ($p.hasClass(afterBufferClass.trim())) toRm += afterBufferClass;
                if (i >= index - buffer && !$p.hasClass(beforeBufferClass.trim()))
                    toAdd += beforeBufferClass;
                else if ($p.hasClass(beforeBufferClass.trim()))
                    toRm += beforeBufferClass;
                if (i >= prev && !$p.hasClass(prevClass.trim()))
                    toAdd += prevClass;
                else if ($p.hasClass(prevClass.trim()))
                    toRm += prevClass;
                $p.addClass(toAdd).removeClass(toRm);
//                console.log('before', $p.index(), toRm, toAdd);
            });
            $pages.slice(next).each(function () {
                var $p = $(this),
                    i = $p.index(),
                    toAdd = '',
                    toRm = '';
                if (!$p.hasClass(afterClass.trim())) toAdd += afterClass;
                if ($p.hasClass(prevClass.trim())) toRm += prevClass;
                if ($p.hasClass(beforeClass.trim())) toRm += beforeClass;
                if ($p.hasClass(beforeBufferClass.trim())) toRm += beforeBufferClass;
                if (i <= index + buffer && !$p.hasClass(afterBufferClass.trim()))
                    toAdd += afterBufferClass;
                else if ($p.hasClass(afterBufferClass.trim()))
                    toRm += afterBufferClass;
                if (i <= next + 1 && !$p.hasClass(nextClass.trim()))
                    toAdd += nextClass;
                else if ($p.hasClass(nextClass.trim()))
                    toRm += nextClass;
                $p.addClass(toAdd).removeClass(toRm);
//                console.log('after', $p.index(), toRm, toAdd);
            });*/
        }
685899
public function footerClass($classes = [])
    {
        $classes = !is_array($classes) ? explode(' ', $classes) : $classes;
        $classes[] = 'footer-area';

        $i = 0;
        if (is_active_sidebar('footer-one')) $i++;
        if (is_active_sidebar('footer-two')) $i++;
        if (is_active_sidebar('footer-three')) $i++;
        if (is_active_sidebar('footer-four')) $i++;

        switch ($i) {
            case 1:
                $classes[] = 'col-sm-12';
                break;
            case 2:
                $classes[] = 'col-sm-6';
                break;
            case 3:
                $classes[] = 'col-sm-4';
                break;
            case 4:
                $classes[] = 'col-sm-6 col-md-3';
                break;
            default:
                break;
        }

        $classes = apply_filters('novusopress_view_footer_classes', $classes);
        $output = sprintf('class="%s"', implode(' ', $classes));

        return apply_filters('novusopress_view_footer_class_output', $output);
    }