Builds Span Link of Paging Button.
@access		protected
@param		string		$text			Text or HTML of Paging Button Span
@param		string		$class			Additive Style Class of Paging Button Span
@return		string
177269
protected function buildSpan( $text, $class = NULL )
	{
		$class 	= $class ? $this->getOption( 'class_span' )." ".$class : $this->getOption( 'class_span' );
		$span	= UI_HTML_Tag::create( "span", $text, array( 'class' => $class ) );
		return $span;
	}
271786
public function getHtml(string $text) : string
    {
        $textAsHtml = htmlspecialchars($text, ENT_QUOTES);
        $textWithNewLines = nl2br($textAsHtml);

        $tokenized = $this->tokenizer->tokenize($textWithNewLines);
        $html = $this->bbCode->format($tokenized);

        return $html;
    }
575029
public function twitter($what, $text=null, $class=null) {
		if (is_null($text)) {
			$text = $what;
		}

		$attributes = $this->getHtmlAttributes(array('class'=>$class));

		if (substr($what,0,1)=='@') {
			$link = "https://www.twitter.com/" . ltrim($what, '@');
		} elseif (substr($what,0,1)=='#') {
			$parts = explode(' ', $what);
			if (count($parts)>1) {
				$link = "https://twitter.com/search?q=" . urlencode($what);
			} else {
				$link = "https://www.twitter.com/hashtag/" . ltrim($what, '#');
			}
		}

		return "<a href='$link'$attributes>$text</a>";
	}
984753
public function addElementsClass($class) {
		foreach ($this->getElements() as $element) {
			if ($element instanceof Tag) {
				$element->addClass($class);
			}
		}
		
		return $this;
	}
429096
public static function panel($text, $id)
	{
		$content = '';
		if (self::$open)
		{
			$content .= '</div></div>';
		}
		else
		{
			self::$open = true;
		}
		$content .= '<h3 class="pane-toggler title" id="' . $id . '"><a href="#' . $id . '"><span>' . $text . '</span></a></h3><div class="panel"><div class="pane-slider content">';

		return $content;
	}
1304928
public static function button(
        $name = NULL,
        $class = NULL,
        $id = NULL,
        $text = NULL,
        $attrs = array()
    )
    {
        $ret = NULL;
        
           if($name)
            $attrs['name'] = $name;
        
        $ret .= self::tag('button', $text, $class, $id, $attrs);
        return $ret;
    }
731136
public function link(string $url, string $text)
    {
        return $this->add(Link::to($url, $text));
    }
1305050
public static function parseExternalLinks( $text ) {
		static $urlProtocols = false;
		static $counter = 0;
		// @codeCoverageIgnoreStart
		if ( !$urlProtocols ) {
			if ( function_exists( 'wfUrlProtocols' ) ) {
				// Allow custom protocols
				$urlProtocols = wfUrlProtocols();
			} else {
				$urlProtocols = 'https?:\/\/|ftp:\/\/';
			}
		}
		// @codeCoverageIgnoreEnd

		$extLinkBracketedRegex = '/(?:(<[^>]*)|' .
			'\[(((?i)' . $urlProtocols . ')' .
				self::EXT_LINK_URL_CLASS .
				'+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]|' .
			'(((?i)' . $urlProtocols . ')' .
				self::EXT_LINK_URL_CLASS .
				'+))/Su';

		return preg_replace_callback(
			$extLinkBracketedRegex,
			function ( array $bits ) use ( &$counter ) {
				// @codeCoverageIgnoreStart
				if ( $bits[1] != '' ) {
					return $bits[1];
				}
				// @codeCoverageIgnoreEnd

				if ( isset( $bits[4] ) && $bits[4] != '' ) {
					return '<a href="' . $bits[2] . '">' . $bits[4] . '</a>';
				} elseif ( isset( $bits[5] ) ) {
					return '<a href="' . $bits[5] . '">' . $bits[5] . '</a>';
				} else {
					return '<a href="' . $bits[2] . '">[' . ++$counter . ']</a>';
				}
			},
			$text
		);
	}
1081787
public static function parseLink($text): string
    {
        $text = preg_replace('/&apos;/', '&#39;', $text); // IE does not handle &apos; entity!

        $sectionHtmlPattern = '%            # Rev:20100913_0900 github.com/jmrware/LinkifyURL
                                            # Section text into HTML <A> tags  and everything else.
             (                              # $1: Everything not HTML <A> tag.
               [^<]+(?:(?!<a\b)<[^<]*)*     # non A tag stuff starting with non-"<".
               | (?:(?!<a\b)<[^<]*)+        # non A tag stuff starting with "<".
             )                              # End $1.
             | (                            # $2: HTML <A...>...</A> tag.
                 <a\b[^>]*>                 # <A...> opening tag.
                 [^<]*(?:(?!</a\b)<[^<]*)*  # A tag contents.
                 </a\s*>                    # </A> closing tag.
             )                              # End $2:
             %ix';

        return preg_replace_callback($sectionHtmlPattern, [__CLASS__, 'linkifyCallback'], $text);
    }
787126
public function page_doc_link($text = null) {
        if ($text === null) {
            $text = get_string('moodledocslink');
        }
        $path = page_get_doc_link_path($this->page);
        if (!$path) {
            return '';
        }
        return $this->doc_link($path, $text);
    }
1001733
public function seeLink($text, $url = null, $negate = false)
    {
        return $this->assertInPage(new HasLink($text, $url), $negate);
    }
1220163
protected function getLinkHtml($text, $page, $css)
    {
        $html = $this->buttonHtmlPattern;

        $html = str_replace('{href}', $this->getLinkHref($page), $html);
        $html = str_replace('{text}', $text, $html);
        $html = str_replace('{page}', $page, $html);
        $html = str_replace('{class}', $css, $html);

        if ($css == '') {
            $html = str_replace(' class=""', '', $html);
        }

        return $html;
    }
731609
public function getPaginationHtml($url, $style = 0, $cssClass = null, $replaceClass = false)
    {
	    if($this->total == null) {
            return null;
        }

        if($cssClass == null) {
            $ul_class = 'pagination';
            $li_class = ['details', '', 'active'];
            $a_class = '';
        }
        else {
            if(isset($cssClass['ul']) && trim($cssClass['ul']) != '') {
                $ul_class = $replaceClass ? $cssClass['ul'] : $ul_class.' '.$cssClass['ul'];
            }
            if(isset($cssClass['li']) && is_array($cssClass['li'])) {
                foreach($cssClass['li'] as $i => $li) {
                    if(isset($li) && trim($li) != '') {
                        $li_class[$i] = $replaceClass ? $li : $li_class[$i].' '.$li;
                    }
                }
            }
            if(isset($cssClass['a']) && trim($cssClass['a']) != '') {
                $a_class = $replaceClass ? $cssClass['a'] : $a_class.' '.$cssClass['a'];
            }
        }

        $adjacents = "2";
    	
	    $page = ($this->page == 0 ? 1 : $this->page);  
        $start = ($page - 1) * $this->limit;
	
        $prev = $page - 1;							
        $next = $page + 1;
        $lastpage = ceil($this->total / $this->limit);
        $lpm1 = $lastpage - 1;

        $pagination = "";
        if($lastpage >= 1) {	
		    $pagination .= "<ul class=\"$ul_class\">\n";
            if($style == 0) {
                $pagination .= "\t<li class=\"$li_class[0]\"><a class=\"$a_class\">$page/$lastpage</a></li>\n";
            }

		    if($lastpage < 2 + ($adjacents * 2)) { // $lastpage < 6
			    for($counter = 1; $counter <= $lastpage; $counter++) {
				    if ($counter == $page) {
					    $pagination.= "\t<li class=\"$li_class[2]\"><a class=\"$a_class\">$counter</a></li>\n";
                    }
    			    else {
    				    $pagination.= "\t<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=$counter'>$counter</a></li>\n";
                    }
    		    }
    	    }
            elseif($lastpage > 2 + ($adjacents * 2)) { // $lastpage > 6
			    if($page < 0 + ($adjacents * 2)) { // $page < 4
				    for($counter = 1; $counter < 2 + ($adjacents * 2); $counter++) {
					    if($counter == $page) {
    					    $pagination.= "<li class=\"$li_class[2]\"><a class=\"$a_class\">$counter</a></li>";
                        }
    				    else {
    					    $pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=$counter'>$counter</a></li>";
                        }
    			    }
				    $pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=$lastpage'>&raquo;</a></li>";
    		    }
                elseif($lastpage - ($adjacents * 1) > $page && $page > ($adjacents * 1)) { // $lastpage - 2 > $page && $page > 3
    			    $pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=1'>&laquo;</a></li>";
    			    for($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
    				    if($counter == $page) {
    					    $pagination.= "<li class=\"$li_class[2]\"><a class=\"$a_class\">$counter</a></li>";
                        }
    				    else {
    					    $pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=$counter'>$counter</a></li>";
                        }
    			    }
    			    $pagination.= "<li class=\"$li_class[1]\"><a href='{$url}page=$lastpage'>&raquo;</a></li>";	
    		    }
                else {
    			$pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=1'>&laquo;</a></li>";
    			    for($counter = $lastpage - ($adjacents * 2); $counter <= $lastpage; $counter++) {
					    if($counter == $page) {
    					    $pagination.= "<li class=\"$li_class[2]\"><a class=\"$a_class\">$counter</a></li>";
                        }
    				    else {
    					    $pagination.= "<li class=\"$li_class[1]\"><a class=\"$a_class\" href='{$url}page=$counter'>$counter</a></li>";
                        }
    			    }
    		    }
    	    }
            else {
    		    if($page < 1 + ($adjacents * 2)) {
				    for($counter = 1; $counter < 2 + ($adjacents * 2); $counter++) {
					    if($counter == $page) {
    					    $pagination.= "<li class='active'><a>$counter</a></li>";
                        }
    				    else {
    					    $pagination.= "<li><a href='{$url}page=$counter'>$counter</a></li>";
                        }
				    }
				    $pagination.= "<li><a href='{$url}page=$lastpage'>&raquo;</a></li>";
			    }
		    }
		    $pagination.= "</ul>\n";		
	    }
	    return $pagination;
    }
216625
function highlight($text) {
		$out='';
		$pre=FALSE;
		$text=trim($text);
		if (!preg_match('/^<\?php/',$text)) {
			$text='<?php '.$text;
			$pre=TRUE;
		}
		foreach (token_get_all($text) as $token)
			if ($pre)
				$pre=FALSE;
			else
				$out.='<span'.
					(is_array($token)?
						(' class="'.
							substr(strtolower(token_name($token[0])),2).'">'.
							$this->encode($token[1]).''):
						('>'.$this->encode($token))).
					'</span>';
		return $out?('<code>'.$out.'</code>'):$text;
	}
152344
public function getBtn($class)
    {
        $buttons = null;
        $xPath = new DOMXPath($this->getDomXml());
        $nodeList = $xPath->query("//TAB[@cl='$class']/../BTN");
        if ($nodeList->length) {
            $buttons = new stdClass();
            foreach ($nodeList as $node) {
                $btnId = $node->getAttribute('id');
                $buttons->$btnId = 1;
            }
        }

        return $buttons;
    }
451916
function appendClass( $class, $version = false )
    {
        if ( $class instanceof eZContentClass )
        {
            $classID = $class->attribute( 'id' );
            $version = $class->attribute( 'version' );
        }
        else
        {
            $classID = $class;
        }
        $classGroupLink = eZContentClassClassGroup::create( $classID,
                                                            $version,
                                                            $this->attribute( 'id' ),
                                                            $this->attribute( 'name' ) );
        $classGroupLink->store();
        return $classGroupLink;
    }
976332
protected function buildItem( $text, $class = NULL )
	{
		$list	= array();
		if( $class )
			$list[]	= $class;
		$item	= UI_HTML_Elements::ListItem( $text, 0, array( 'class' => $class ) );
		return $item;
	}