Processed the content of the required tag.

@param null|string $tagContent The possible tag content or null.
@throws CodeWarning If there is a mixed type.

@return void
430660
protected function processTagContent(?string $tagContent = null): void
    {
        $returnParts = explode(' ', (string) $tagContent);
        $type = $returnParts[0];

        $this
            ->checkForMixedType($type)
            ->checkForMissingDesc($type, $returnParts);
    }
321971
protected function getReportData(?string $tagContent = null): ?array
    {
        return [
            static::MESSAGE_TAG_CONTENT_FORMAT_INVALID,
            $this->stackPos,
            static::CODE_TAG_CONTENT_FORMAT_INVALID,
            [
                $tagContent,
                $this->getValidPattern()
            ]
        ];
    }
97032
protected void init(I_CmsXmlContentContainer container) throws JspException {

        // check if the tag contains a pageSize, pageIndex and pageNavLength attribute, or none of them
        int pageAttribCount = 0;
        pageAttribCount += CmsStringUtil.isNotEmpty(m_pageSize) ? 1 : 0;
        pageAttribCount += CmsStringUtil.isNotEmpty(m_pageIndex) ? 1 : 0;

        if ((pageAttribCount > 0) && (pageAttribCount < 2)) {
            throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_TAG_CONTENTLOAD_INDEX_SIZE_0));
        }

        I_CmsXmlContentContainer usedContainer;
        if (container == null) {
            // no preloading ancestor has been found
            usedContainer = this;
            if (CmsStringUtil.isEmpty(m_collector)) {
                // check if the tag contains a collector attribute
                throw new CmsIllegalArgumentException(
                    Messages.get().container(Messages.ERR_TAG_CONTENTLOAD_MISSING_COLLECTOR_0));
            }
            if (CmsStringUtil.isEmpty(m_param)) {
                // check if the tag contains a param attribute
                throw new CmsIllegalArgumentException(
                    Messages.get().container(Messages.ERR_TAG_CONTENTLOAD_MISSING_PARAM_0));
            }
        } else {
            // use provided container (preloading ancestor)
            usedContainer = container;
        }

        if (isPreloader()) {
            // always disable direct edit for preload
            m_directEditMode = CmsDirectEditMode.FALSE;
        } else if (m_directEditMode == null) {
            // direct edit mode must not be null
            m_directEditMode = CmsDirectEditMode.FALSE;
        }

        // initialize OpenCms access objects
        m_controller = CmsFlexController.getController(pageContext.getRequest());
        m_cms = m_controller.getCmsObject();

        // get the resource name from the selected container
        String resourcename = getResourceName(m_cms, usedContainer);

        // initialize a string mapper to resolve EL like strings in tag attributes
        CmsMacroResolver resolver = CmsMacroResolver.newInstance().setCmsObject(m_cms).setJspPageContext(
            pageContext).setResourceName(resourcename).setKeepEmptyMacros(true);

        // resolve the collector name
        if (container == null) {
            // no preload parent container, initialize new values
            m_collectorName = resolver.resolveMacros(getCollector());
            // resolve the parameter
            m_collectorParam = resolver.resolveMacros(getParam());
            m_collectorResult = null;
        } else {
            // preload parent content container available, use values from this container
            m_collectorName = usedContainer.getCollectorName();
            m_collectorParam = usedContainer.getCollectorParam();
            m_collectorResult = usedContainer.getCollectorResult();
            if (m_locale == null) {
                // use locale from ancestor if available
                m_locale = usedContainer.getXmlDocumentLocale();
            }
        }

        if (m_locale == null) {
            // no locale set, use locale from users request context
            m_locale = m_cms.getRequestContext().getLocale();
        }

        try {
            // now collect the resources
            I_CmsResourceCollector collector = OpenCms.getResourceManager().getContentCollector(m_collectorName);
            if (collector == null) {
                throw new CmsException(Messages.get().container(Messages.ERR_COLLECTOR_NOT_FOUND_1, m_collectorName));
            }
            // execute the collector if not already done in parent tag
            if (m_collectorResult == null) {
                m_collectorResult = collector.getResults(m_cms, m_collectorName, m_collectorParam);
            }

            m_contentInfoBean = new CmsContentInfoBean();
            m_contentInfoBean.setPageSizeAsString(resolver.resolveMacros(m_pageSize));
            m_contentInfoBean.setPageIndexAsString(resolver.resolveMacros(m_pageIndex));
            m_contentInfoBean.setPageNavLengthAsString(resolver.resolveMacros(m_pageNavLength));
            m_contentInfoBean.setResultSize(m_collectorResult.size());
            m_contentInfoBean.setLocale(m_locale.toString());
            m_contentInfoBean.initResultIndex();

            if (!isPreloader()) {
                // not required when only preloading
                m_collectorResult = CmsJspTagResourceLoad.limitCollectorResult(m_contentInfoBean, m_collectorResult);
                m_contentInfoBean.initPageNavIndexes();

                String createParam = collector.getCreateParam(m_cms, m_collectorName, m_collectorParam);
                if ((createParam != null) && CmsDefaultFileNameGenerator.hasNumberMacro(createParam)) {
                    // use "create link" only if collector supports it and it contains the number macro for new file names
                    m_directEditLinkForNew = CmsEncoder.encode(m_collectorName + "|" + createParam);
                }
            } else if (isScopeVarSet()) {
                // scope variable is set, store content load bean in JSP context
                CmsJspContentLoadBean bean = new CmsJspContentLoadBean(m_cms, m_locale, m_collectorResult);
                storeAttribute(bean);
            }

        } catch (CmsException e) {
            m_controller.setThrowable(e, m_cms.getRequestContext().getUri());
            throw new JspException(e);
        }

        // reset the direct edit options (required because of re-used tags)
        m_directEditOpen = false;
        m_directEditFollowButtons = null;

        // the next loop is the first loop
        m_isFirstLoop = true;
    }
1170046
public function store($key, $code, $tag = null, $php = true) {
		$content = "";
		if ($php)
			$content = self::PHP_TAG;
		$content .= $code . "\n";
		$this->storeContent ( $key, $content, $tag );
	}
121330
public void addClassContentTree(Content contentTree, Content classContentTree) {
        if (configuration.allowTag(HtmlTag.MAIN)) {
            mainTree.addContent(classContentTree);
            contentTree.addContent(mainTree);
        } else {
            contentTree.addContent(classContentTree);
        }
    }
893076
protected function processBlocks(string &$content): void
    {
        $pattern = $this->getTagPattern('block\s+([_a-zA-Z][_a-zA-Z0-9]*)' . preg_quote($this->endTag, '/') . '\s*(.+?)\s*' . preg_quote($this->startTag . '/block', '/'));
        $blockCodes = [];
        $content = preg_replace_callback($pattern, function ($match) use (&$blockCodes) {
            $blockCodes[$match[1]] = $match[2];
            return '';
        }, $content);
        $displayPattern = $this->getTagPattern('display_block\s+([_a-zA-Z][_a-zA-Z0-9]*)');
        $content = preg_replace_callback($displayPattern, function ($match) use ($blockCodes) {
            if (isset($blockCodes[$match[1]])) {
                return $blockCodes[$match[1]];
            }
            return '';
        }, $content);
    }
1207705
public static function executeAttributePreprocessors(Tag $tag, array $tagConfig)
	{
		if (empty($tagConfig['attributePreprocessors']))
		{
			return;
		}

		foreach ($tagConfig['attributePreprocessors'] as list($attrName, $regexp, $map))
		{
			if ($tag->hasAttribute($attrName))
			{
				self::executeAttributePreprocessor($tag, $attrName, $regexp, $map);
			}
		}
	}
1261695
public function setContent( Content $content )
    {
        foreach ( $this->handlers as $handler )
        {
            if ( $handler instanceof ContentAwareHandlerInterface )
            {
                $handler->setContent( $content );
            }
        }
    }
1164045
public void doTag()
            throws JspException
    {
        // report any errors...
        if (hasErrors()) {
            reportErrors();
            return;
        }

        // calculate the output value...
        String text;
        if (_value != null) {
            text = _value.toString();
        }
        else {
            if (_defaultValue != null) {
                text = _defaultValue;
            }
            else {
                logger.warn(Bundle.getString("Tags_ContentExpressionNull", _value));
                text = DEFAULT_NULL_TEXT;
            }
        }

        write(text);
    }
967221
public function sendContent()
    {
        if (!is_null($this->contentCallback)) {
            $callback = new Callback($this->contentCallback);
            $callback->execute();
        }
        echo $this->content;
    }
653027
protected function checkContent()
    {
        if (is_array($this->content) && count($this->content)) {
            foreach ($this->content as $name => $value) {
                switch ($name) {
                    case 'category':
                    case 'mainMessage':
                    case 'buttonMessage':
                    case 'language':
                        $this->addContentOption($name, $value);
                        break;
                    case 'mainParams':
                    case 'buttonParams':
                        $this->addParamsOption($name, $value);
                        break;
                }
            }
        }
    }
1186130
function (textContent) {
            // String cast
            if (textContent !== null) {
                textContent = '' + textContent;
            } else {
                textContent = '';
            }
            var dom = this.getDom();
            if (dom) {
                var stringUtils = ariaUtilsString;
                this.textContent = textContent;

                dom.style.display = "inline-block";
                dom.style.overflow = "hidden";
                dom.style.whiteSpace = "nowrap";
                dom.style.verticalAlign = "top";

                var textWidth, ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                if (!ellipsisElement) {
                    dom.innerHTML = '<span class="createdEllipisElement">' + stringUtils.escapeHTML(this.textContent)
                            + '</span>';
                    ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                }
                if (this._cfg.width > 0) {
                    textWidth = this._cfg.width;
                    dom.style.width = this._cfg.width + "px";

                    this._ellipsis = new ariaUtilsEllipsis(ellipsisElement, textWidth, this._cfg.ellipsisLocation, this._cfg.ellipsis, this._context, this._cfg.ellipsisEndStyle);

                    if (!this._ellipsis.ellipsesNeeded) {
                        // No ellipsis was done so remove the <span> and put the full text into the text widget itself
                        dom.removeChild(ellipsisElement);
                        dom.innerHTML = stringUtils.escapeHTML(textContent);
                    }
                }

            }

        }
137005
public synchronized void addHttpContent(HttpContent httpContent) {
        contentObservable.notifyAddListener(httpContent);
        if (messageFuture != null) {
            if (ioException != null) {
                blockingEntityCollector.addHttpContent(new DefaultLastHttpContent());
                messageFuture.notifyMessageListener(blockingEntityCollector.getHttpContent());
                removeMessageFuture();
                throw new RuntimeException(this.getIoException());
            }
            contentObservable.notifyGetListener(httpContent);
            blockingEntityCollector.addHttpContent(httpContent);
            if (messageFuture.isMessageListenerSet()) {
                messageFuture.notifyMessageListener(blockingEntityCollector.getHttpContent());
            }
            // We remove the feature as the message has reached it life time. If there is a need
            // for using the same message again, we need to set the future again and restart
            // the life-cycle.
            if (httpContent instanceof LastHttpContent) {
                removeMessageFuture();
            }
        } else {
            if (ioException != null) {
                blockingEntityCollector.addHttpContent(new DefaultLastHttpContent());
                throw new RuntimeException(this.getIoException());
            } else {
                blockingEntityCollector.addHttpContent(httpContent);
            }
        }
    }
257805
public static function parseXmlContent ($xmlContent)
    {
        $xml    = new \SimpleXMLElement($xmlContent);
        $report = \json_decode(json_encode($xml));
        unset($xml);

        // Adjust to array unconditionally
        if (is_array($report->record)) {
            $report->records = $report->record;
        } else {
            $report->records = array($report->record);
        }
        unset($report->record);

        // Fix empty objects - convert them to empty strings
        foreach ($report->records as $recordId => $record) {
            if (isset($record->auth_results->dkim->domain)) {
                if (is_object($record->auth_results->dkim->domain)) {
                    $record->auth_results->dkim->domain = '';
                }
            }
        }

        return $report;
    }
129679
protected function isBlock($componentContent = NULL) {
    return $componentContent instanceof \Psc\HTML\Tag &&
      $componentContent->getTag() === 'div' ||
      $componentContent->getTag() === 'fieldset'
    ;
  }
1280360
public function onContentLoaded(&$rawContent)
    {
        $this->rawContent = &$rawContent;

        $this->triggerEvent(self::API_VERSION_0_9, 'after_load_content', array(&$this->requestFile, &$rawContent));
    }
1129477
protected function process_group_tag($tagcontents) {
        global $DB, $CFG;

        // Get configs.
        $truncatecoursecodes    = $this->get_config('truncatecoursecodes');
        $createnewcourses       = $this->get_config('createnewcourses');
        $updatecourses          = $this->get_config('updatecourses');

        if ($createnewcourses) {
            require_once("$CFG->dirroot/course/lib.php");
        }

        // Process tag contents.
        $group = new stdClass();
        if (preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)) {
            $group->coursecode = trim($matches[1]);
        }

        $matches = array();
        if (preg_match('{<description>.*?<long>(.*?)</long>.*?</description>}is', $tagcontents, $matches)) {
            $group->long = trim($matches[1]);
        }

        $matches = array();
        if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
            $group->short = trim($matches[1]);
        }

        $matches = array();
        if (preg_match('{<description>.*?<full>(.*?)</full>.*?</description>}is', $tagcontents, $matches)) {
            $group->full = trim($matches[1]);
        }

        if (preg_match('{<org>(.*?)</org>}is', $tagcontents, $matchesorg)) {
            if (preg_match_all('{<orgunit>(.*?)</orgunit>}is', $matchesorg[1], $matchesorgunit)) {
                $group->categories = array_map('trim', $matchesorgunit[1]);
            }
        }

        $recstatus = ($this->get_recstatus($tagcontents, 'group'));

        if (empty($group->coursecode)) {
            $this->log_line('Error: Unable to find course code in \'group\' element.');
        } else {
            // First, truncate the course code if desired.
            if (intval($truncatecoursecodes) > 0) {
                $group->coursecode = ($truncatecoursecodes > 0)
                    ? substr($group->coursecode, 0, intval($truncatecoursecodes))
                    : $group->coursecode;
            }

            // For compatibility with the (currently inactive) course aliasing, we need this to be an array.
            $group->coursecode = array($group->coursecode);

            // Third, check if the course(s) exist.
            foreach ($group->coursecode as $coursecode) {
                $coursecode = trim($coursecode);
                $dbcourse = $DB->get_record('course', array('idnumber' => $coursecode));
                if (!$dbcourse) {
                    if (!$createnewcourses) {
                        $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
                    } else {

                        // Create the (hidden) course(s) if not found.
                        $courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults.

                        // New course.
                        $course = new stdClass();
                        foreach ($this->coursemappings as $courseattr => $imsname) {

                            if ($imsname == 'ignore') {
                                continue;
                            }

                            // Check if the IMS file contains the mapped tag, otherwise fallback on coursecode.
                            if ($imsname == 'coursecode') {
                                $course->{$courseattr} = $coursecode;
                            } else if (!empty($group->{$imsname})) {
                                $course->{$courseattr} = $group->{$imsname};
                            } else {
                                $this->log_line('No ' . $imsname . ' description tag found for '
                                    .$coursecode . ' coursecode, using ' . $coursecode . ' instead');
                                $course->{$courseattr} = $coursecode;
                            }
                        }

                        $course->idnumber = $coursecode;
                        $course->format = $courseconfig->format;
                        $course->visible = $courseconfig->visible;
                        $course->newsitems = $courseconfig->newsitems;
                        $course->showgrades = $courseconfig->showgrades;
                        $course->showreports = $courseconfig->showreports;
                        $course->maxbytes = $courseconfig->maxbytes;
                        $course->groupmode = $courseconfig->groupmode;
                        $course->groupmodeforce = $courseconfig->groupmodeforce;
                        $course->enablecompletion = $courseconfig->enablecompletion;
                        // Insert default names for teachers/students, from the current language.

                        // Handle course categorisation (taken from the group.org.orgunit or group.org.id fields if present).
                        $course->category = $this->get_category_from_group($group->categories);

                        $course->startdate = time();
                        // Choose a sort order that puts us at the start of the list!
                        $course->sortorder = 0;

                        $course = create_course($course);

                        $this->log_line("Created course $coursecode in Moodle (Moodle ID is $course->id)");
                    }
                } else if (($recstatus == self::IMSENTERPRISE_UPDATE) && $dbcourse) {
                    if ($updatecourses) {
                        // Update course. Allowed fields to be updated are:
                        // Short Name, and Full Name.
                        $hasupdates = false;
                        if (!empty($group->short)) {
                            if ($group->short != $dbcourse->shortname) {
                                $dbcourse->shortname = $group->short;
                                $hasupdates = true;
                            }
                        }
                        if (!empty($group->full)) {
                            if ($group->full != $dbcourse->fullname) {
                                $dbcourse->fullname = $group->full;
                                $hasupdates = true;
                            }
                        }
                        if ($hasupdates) {
                            update_course($dbcourse);
                            $courseid = $dbcourse->id;
                            $this->log_line("Updated course $coursecode in Moodle (Moodle ID is $courseid)");
                        }
                    } else {
                        // Update courses option is not enabled. Ignore.
                        $this->log_line("Ignoring update to course $coursecode");
                    }
                } else if (($recstatus == self::IMSENTERPRISE_DELETE) && $dbcourse) {
                    // If course does exist, but recstatus==3 (delete), then set the course as hidden.
                    $courseid = $dbcourse->id;
                    $show = false;
                    course_change_visibility($courseid, $show);
                    $this->log_line("Updated (set to hidden) course $coursecode in Moodle (Moodle ID is $courseid)");
                }
            }
        }
    }