RitaHelper::pageDescription()

@param string $text
@return
182538
public function pageDescription($text = '')
    {
        $text = $this->_View->fetch('description', $text);
        
        return $this->Html->meta('description', $text);
    }
1291230
public function text($text = '')
    {
        $msg = array(
            'ToUserName'   => $this->getRevFrom(),
            'FromUserName' => $this->getRevTo(),
            'MsgType'      => self::MSGTYPE_TEXT,
            'Content'      => $this->_auto_text_filter($text),
            'CreateTime'   => time(),
        );
        $this->Message($msg);
        return $this;
    }
1085048
public function process($text)
    {
        $iterations = $this->maxIterations === null ? 1 : $this->maxIterations;
        $context = new ProcessorContext();
        $context->processor = $this;

        while ($iterations--) {
            $context->iterationNumber++;
            $newText = $this->processIteration($text, $context, null);
            if ($newText === $text) {
                break;
            }
            $text = $newText;
            $iterations += $this->maxIterations === null ? 1 : 0;
        }

        return $text;
    }
893828
protected function _processText($text)
    {
        $matches = array();

        preg_match_all("/(href|src)=\"(?!http|ftp|https|mailto|data)([^\"]*)\"/", $text, $matches, PREG_SET_ORDER);

        foreach ($matches as $match)
        {
            $route = $this->getObject('lib:dispatcher.router.route', array(
                'url'    => $match[2],
                'escape' => false
            ));

            //Add the host and the schema
            $route->scheme = $this->getUrl()->scheme;
            $route->host   = $this->getUrl()->host;

            $text = str_replace($match[0], $match[1].'="'.$route.'"', $text);
        }

        return $text;
    }
925955
public function read(&$text)
    {
        $text = str_replace(
            array_keys($this->_alias_read),
            array_values($this->_alias_read),
            $text);

        return $this;
    }
1103170
protected function getPreviousButton($text = "&laquo;")
    {

        if ($this->currentPage() <= 1) {
            return $this->getDisabledTextWrapper($text);
        }

        $url = $this->url(
            $this->currentPage() - 1
        );

        return $this->getPageLinkWrapper($url, $text);
    }
855888
public function label($text)
    {
        $label = self::createElement('label');

        if (isset($this->attributeList['id'])) {
            $label->refer($this->attributeList['id']);
        }

        return $label->text($this)
            ->text($text);
    }
711619
static function parse($text)
    {
        $parser = new \Parsedown();

        $text = static::cleanLeadingSpace($text);

        return $parser->text($text);
    }
751942
public static function translateFromEditMode($text)
    {
        $app = Application::getFacadeApplication();
        $entityManager = $app->make(EntityManagerInterface::class);
        $resolver = $app->make(ResolverManagerInterface::class);
        $appUrl = Application::getApplicationURL();

        $text = preg_replace(
            [
                '/{CCM:BASE_URL}/i',
            ],
            [
                $appUrl,
            ],
            $text
        );

        //page links...
        $text = preg_replace(
            '/{CCM:CID_([0-9]+)}/i',
            $appUrl . '/' . DISPATCHER_FILENAME . '?cID=\\1',
            $text
        );

        //images...
        $dom = new HtmlDomParser();
        $r = $dom->str_get_html($text, true, true, DEFAULT_TARGET_CHARSET, false);
        if (is_object($r)) {
            foreach ($r->find('concrete-picture') as $picture) {
                $fID = $picture->fid;

                $attrString = "";
                foreach ($picture->attr as $attr => $val) {
                    if (!in_array($attr, self::$blackListImgAttributes)) {
                        $attrString .= "$attr=\"$val\" ";
                    }
                }

                $picture->outertext = '<img src="' . $resolver->resolve([
                        '/download_file',
                        'view_inline',
                        $fID
                    ]) . '" ' . $attrString . '/>';
            }

            $text = (string) $r->restore_noise($r);
        }

        // now we add in support for the links
        $text = static::replacePlaceholder(
            $text,
            '{CCM:FID_([0-9]+)}',
            function ($fID) use ($resolver) {
                if ($fID > 0) {
                    return $resolver->resolve(['/download_file', 'view_inline', $fID]);
                }
            }
        );

        //file downloads...
        $text = static::replacePlaceholder(
            $text,
            '{CCM:FID_DL_([0-9]+)}',
            function ($fID) use ($resolver) {
                if ($fID > 0) {
                    return $resolver->resolve(['/download_file', 'view', $fID]);
                }
            }
        );

        return $text;
    }
692610
public function read(&$text)
    {
        if (preg_match_all('#@template\(\'(.*)\'#siU', $text, $matches)) {
            foreach ($matches[1] as $key => $match) {
                if (is_string($match) && strpos($match, '.') === false) {
                    $path =  dirname($this->getTemplate()->getPath()).DS.$match.'.php';
                    $text = str_replace($matches[0][$key], '$this->loadFile('."'".$path."'", $text);
                }
            }
        }

        return $this;
    }
488820
private function parseLinks($text)
    {
        $offset = 0;
        $matches = array();
        // Extract all links from the text of the passage (if they exist)
        while (preg_match($this->links_pattern, $text, $matches, 0, $offset)) {
            switch ($matches[2]) {
                case '->':
                    $this->links[] = array('text' => trim($matches[1]), 'link' => trim($matches[3]));
                    $this->raw_links[] = $matches[0];
                    break;
                case '<-':
                case '|':
                    $this->links[] = array('text' => trim($matches[3]), 'link' => trim($matches[1]));
                    $this->raw_links[] = $matches[0];
                    break;
                default:
                    throw new \RuntimeException("Something that looked like a link could not be parsed.");
            }
            $offset = mb_stripos($text, $matches[0]) + mb_strlen($matches[0]);
        }
    }
800133
public function getPageDescription()
    {
        if (!$this->parser) {
            return;
        }

        $node = $this->parser->find('meta[name=description]', 0);

        if ($node) {
            return $node->getAttribute('content');
        }
    }
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);
    }
541092
public function purge($text)
    {
        foreach ($this->parsers as $parser) {
            $text = $parser->purge($text);
        }

        return $text;
    }
969929
protected function getNextButton($text = '&raquo;')
    {
        if (!$this->hasMore) {
            return $this->getDisabledTextWrapper($text);
        }

        $url = $this->url($this->currentPage() + 1);

        return $this->getPageLinkWrapper($url, $text);
    }
866405
static function strtolower( $text )
    {
        //We need to detect our internal charset
        if ( self::$charset === null )
        {
            self::$charset = eZTextCodec::internalCharset();
        }

        //First try to use mbstring
        if ( extension_loaded( 'mbstring' ) )
        {
            return mb_strtolower( $text, self::$charset );
        }
        else
        {
            // Fall back if mbstring is not available
            $char = eZCharTransform::instance();
            return $char->transformByGroup( $text, 'lowercase' );
        }
    }
544415
public function replaceMacros($text)
    {
        $section = $this->section;
        if (siteTitleReverse)
        {
            $section = array_reverse($section);
        }
        $section = strip_tags(implode($section, option('siteTitleDivider')));

        $result = str_replace(
            array(
                '$(httpHost)',
                '$(httpPath)',
                '$(httpRoot)',
                '$(styleRoot)',
                '$(dataRoot)',

                '$(siteName)',
                '$(siteTitle)',
                '$(siteKeywords)',
                '$(siteDescription)',

                '$(pageId)',
                '$(pageName)',
                '$(pageTitle)',
                '$(pageCaption)',
                '$(pageHint)',
                '$(pageDescription)',
                '$(pageKeywords)',
                '$(pageAccessLevel)',
                '$(pageAccessName)',

                '$(sectionTitle)',
            ),
            array(
                httpHost,
                httpPath,
                httpRoot,
                styleRoot,
                dataRoot,

                siteName,
                siteTitle,
                siteKeywords,
                siteDescription,

                $this->id,
                $this->name,
                $this->title,
                $this->caption,
                $this->hint,
                $this->description,
                $this->keywords,
                $this->access,
                constant('ACCESSLEVEL'.$this->access),
                $section,
            ),
            $text
        );
        $result = preg_replace_callback('/\$\(const:(.*?)\)/i', '__macroConst', $result);
        $result = preg_replace_callback('/\$\(var:(([\w]*)(\[.*?\]){0,1})\)/i', '__macroVar', $result);
        $result = preg_replace('/\$\(\w+(:.*?)*?\)/', '', $result);
        return $result;
    }