Transforms html comments to span elements

@param  string|null $content
@return string|null
@throws TransformationFailedException
495890
public function transform($content)
    {
        if (null === $content) {
            return null;
        }

        if (!is_string($content)) {
            throw new TransformationFailedException(sprintf(
                'Expected string, %s given',
                gettype($content)
            ));
        }

        //replace comments with span so that we can add a nice style to the commented section
        $content = StripTagsUtil::replaceCommentWith($content, StripTagsUtil::SPAN_REPLACEMENT);

        return $content;
    }
1062445
protected function encode($content)
    {
        $jsonString = parent::encode($content);

        if ($this->hasValidCallback()) {
            return \sprintf('%s(%s);', $this->getCallback(), $jsonString);
        }

        return $jsonString;
    }
1359691
public function decode($content)
    {
        $result       = null;
        $this->errors = new ErrorCollection();

        $documentAsArray = json_decode($content, true);
        if ($documentAsArray !== null) {
            $result = $this->parseDocument($documentAsArray);

            return $this->errors->count() <= 0 ? $result : null;
        } else {
            return null;
        }
    }
1188951
protected function text_content($content) {
        if (!is_null($this->contenttransformer)) { // Apply content transformation
            $content = $this->contenttransformer->process($content);
        }
        return is_null($content) ? null : $this->xml_safe_text_content($content); // Safe UTF-8 and encode
    }
60438
public function format($content){
		// Add tcy
		$content = $this->tcyiz($content);
		// Add auto indent
		$dom = $this->getDomFromString($content);
		foreach( $dom->getElementsByTagName('p') as $p ){
			if( !$this->need_indent($p->nodeValue) ){
				$this->add_class($p, 'no-indent');
			}
		}
		// Remove all tt, big, acronym, strike, abbr
		$node_to_remove = array();
		foreach( ['tt', 'big', 'acronym', 'abbr', 'strike'] as $tag){
			foreach( $dom->getElementsByTagName($tag) as $elem ) {
				/** @var \DOMElement $elem */
				$new_elem = $dom->createElement( 'span' );
				// Copy all attributes
				if ( $elem->attributes ) {
					foreach ( $elem->attributes as $attr ) {
						$new_elem->setAttribute( $attr->nodeName, $attr->nodeValue );
					}
				}
				// Add original tag name as class
				$this->add_class($new_elem, $tag);
				// Copy all nodes
				foreach ( $elem->childNodes as $child ) {
					$new_elem->appendChild( $elem->removeChild( $child ) );
				}
				$node_to_remove[] = $elem;
				$elem->parentNode->replaceChild( $new_elem, $elem );
			}
		}
		return $this->retrieveBody($dom);
	}
566601
protected function _render($content)
    {
        $this->_textMessage = $this->_htmlMessage = '';

        $content = implode("\n", $content);
        $rendered = $this->_renderTemplates($content);

        $this->_createBoundary();
        $msg = [];

        $contentIds = array_filter((array)Hash::extract($this->_attachments, '{s}.contentId'));
        $hasInlineAttachments = count($contentIds) > 0;
        $hasAttachments = !empty($this->_attachments);
        $hasMultipleTypes = count($rendered) > 1;
        $multiPart = ($hasAttachments || $hasMultipleTypes);

        $boundary = $relBoundary = $textBoundary = $this->_boundary;

        if ($hasInlineAttachments) {
            $msg[] = '--' . $boundary;
            $msg[] = 'Content-Type: multipart/related; boundary="rel-' . $boundary . '"';
            $msg[] = '';
            $relBoundary = $textBoundary = 'rel-' . $boundary;
        }

        if ($hasMultipleTypes && $hasAttachments) {
            $msg[] = '--' . $relBoundary;
            $msg[] = 'Content-Type: multipart/alternative; boundary="alt-' . $boundary . '"';
            $msg[] = '';
            $textBoundary = 'alt-' . $boundary;
        }

        if (isset($rendered['text'])) {
            if ($multiPart) {
                $msg[] = '--' . $textBoundary;
                $msg[] = 'Content-Type: text/plain; charset=' . $this->_getContentTypeCharset();
                $msg[] = 'Content-Transfer-Encoding: ' . $this->_getContentTransferEncoding();
                $msg[] = '';
            }
            $this->_textMessage = $rendered['text'];
            $content = explode("\n", $this->_textMessage);
            $msg = array_merge($msg, $content);
            $msg[] = '';
        }

        if (isset($rendered['html'])) {
            if ($multiPart) {
                $msg[] = '--' . $textBoundary;
                $msg[] = 'Content-Type: text/html; charset=' . $this->_getContentTypeCharset();
                $msg[] = 'Content-Transfer-Encoding: ' . $this->_getContentTransferEncoding();
                $msg[] = '';
            }
            $this->_htmlMessage = $rendered['html'];
            $content = explode("\n", $this->_htmlMessage);
            $msg = array_merge($msg, $content);
            $msg[] = '';
        }

        if ($textBoundary !== $relBoundary) {
            $msg[] = '--' . $textBoundary . '--';
            $msg[] = '';
        }

        if ($hasInlineAttachments) {
            $attachments = $this->_attachInlineFiles($relBoundary);
            $msg = array_merge($msg, $attachments);
            $msg[] = '';
            $msg[] = '--' . $relBoundary . '--';
            $msg[] = '';
        }

        if ($hasAttachments) {
            $attachments = $this->_attachFiles($boundary);
            $msg = array_merge($msg, $attachments);
        }
        if ($hasAttachments || $hasMultipleTypes) {
            $msg[] = '';
            $msg[] = '--' . $boundary . '--';
            $msg[] = '';
        }

        return $msg;
    }
328823
public function render ($content = null)
		{
			// Custom error output.
			$errors = $this->model->getErrors($this->attribute);

			if (count($errors) == 0)
				$this->parts[ '{error}' ] = '';
			else
			{
				$class = isset($this->errorOptions[ 'class' ]) ? ' class="' . $this->errorOptions[ 'class' ] . '"' : '';
				$this->parts[ '{error}' ] = '<div' . $class . '><ul class="list-unstyled">';
				foreach ($errors as $e)
				{
					$this->parts[ '{error}' ] .= '<li>' . $e . '</li>';
				}
				$this->parts[ '{error}' ] .= '</ul></div>';
			}

			return parent::render($content);
		}
890145
public static function unicodeToShortcode($content)
    {
        $replacement = '';
        $encoding = mb_detect_encoding($content);
        $codepoints = array_flip(self::getShortcodes());

        /* Break content along codepoint boundaries */
        $parts = preg_split(
            self::MB_REGEX,
            $content,
            -1,
            PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
        );

        /* Reconstruct content using shortcodes */
        $sequence = [];
        foreach ($parts as $offset => $part) {
            if (preg_match(self::MB_REGEX, $part)) {
                $part = mb_convert_encoding($part, 'UTF-32', $encoding);
                $words = unpack('N*', $part);
                $codepoint = sprintf('%X', reset($words));

                $sequence[] = $codepoint;

                if (isset($codepoints[$codepoint])) {
                    $replacement .= ":$codepoints[$codepoint]:";
                    $sequence = [];
                } else {
                    /* Check multi-codepoint sequence */
                    $multi = implode('-', $sequence);

                    if (isset($codepoints[$multi])) {
                        $replacement .= ":$codepoints[$multi]:";
                        $sequence = [];
                    }
                }
            } else {
                $replacement .= $part;
            }
        }

        return $replacement;
    }
467959
public function render($content) {
        $form = $this->getElement();
        if (!$form instanceof \Zend_Form) {
            return $content;
        }

        $this->_recurseForm($form);

        return $content;
    }
1180348
public static function escapeAndMarkdownLight(?string $content): string
    {
        return $content ? C::getMarkdown()->textLight(Html::escape($content)) : (string) $content;
    }
875955
protected function renderElement($content = null)
    {
        // Get element parts
        $element    = $this->getElement();
        $attributes = $this->getAttributesAsString();

        // Create html
        $html = '<' . $element;
        if ($attributes) {
            $html .= $attributes;
        }

        // Create closing tag
        if (is_string($content)) {
            $html .= '>' . $content . '</' . $element;
        }
        $html .= $this->getClosingBracket();

        return $html;
    }
580604
public function getControl($content = NULL)
	{
		$btn = Html::el('button', [
			'type' => 'button',
			'name' => $this->getHtmlName(),
		]);
		$btn->setHtml($content === NULL ? $this->caption : $content);
		$this->addBtnClass($btn);

		return $btn;
	}
972816
public static function th(
        string $content = null, 
        array $attributes = []
    ) : string 
    {
        return self::tag("th", $content, $attributes);
    }
427645
protected function renderTag($content = null)
    {
        $attributes = $this->renderAttributes();

        if ($this->isVoid) {
            return sprintf(
                '<%1$s%2$s%3$s>',
                $this->tag,
                $attributes,
                $this->isXhtml ? ' /' : ''
            );
        }

        return sprintf(
            '<%1$s%2$s>%3$s</%1$s>',
            $this->tag,
            $attributes,
            $content
        );
    }
920896
public function compile($content)
    {
        if( ! $this->count()) return $content;

        $pattern = $this->getRegex();

        return preg_replace_callback("/{$pattern}/s", [&$this, 'render'], $content);
    }
1178896
private static function GetUpperContentGroup(Content $content)
    {
        if ($content->GetPageContent())
        {
            return self::FindPageGroup($content->GetPageContent()->GetPage());
        }
        else if ($content->GetLayoutContent())
        {
            return $content->GetLayoutContent()->
                        GetArea()->GetLayout()->GetUserGroup();
        }
        else if ($content->GetContainerContent())
        {
            return $content->GetContainerContent()->
                        GetContainer()->GetUserGroup();
        }
        return null;
    }
1260616
public function parse($content)
    {
        $set = null;
        if (strpos($content, '@ORM') === false) {
            return $set;
        }

        if (preg_match(self::PATTERN, $content, $matches)) {
            $set[] = [$matches[1], $matches[2]];
        }



        return $set;
    }