Parse the custom toolbar setting.
@param string $customtoolbar
@return array csv toolbar lines
494539
public static function parse_toolbar_setting($customtoolbar) {
        $result = array();
        $customtoolbar = trim($customtoolbar);
        if ($customtoolbar === '') {
            return $result;
        }
        $customtoolbar = str_replace("\r", "\n", $customtoolbar);
        $customtoolbar = strtolower($customtoolbar);
        $i = 0;
        foreach (explode("\n", $customtoolbar) as $line) {
            $line = preg_replace('/[^a-z0-9_,\|\-]/', ',', $line);
            $line = str_replace('|', ',|,', $line);
            $line = preg_replace('/,,+/', ',', $line);
            $line = trim($line, ',|');
            if ($line === '') {
                continue;
            }
            if ($i == 10) {
                // Maximum is ten lines, merge the rest to the last line.
                $result[9] = $result[9].','.$line;
            } else {
                $result[] = $line;
                $i++;
            }
        }
        return $result;
    }
482508
public function setToolbars(array $toolbars)
    {
        $this->_toolbars = array();
        foreach($toolbars as $toolbar) {
            $this->setToolbar($toolbar);
        }

        return $this;
    }
154901
protected function parseTitle()
    {
        if (($registeredName = array_search($this->className, $this->defaultContextSettings)) !== false) {
            return $registeredName;
        } elseif (preg_match('/\\\\([^\\\\]*)Helper$/', $this->className, $matches)) {
            return $matches[1];
        }

        return $this->className;
    }
922995
public function parse_value($value) {
        global $COURSE;

        if (strpos($value, '$ToolProxyBinding.custom.url') !== false) {
            if ($COURSE->format == 'site') {
                $this->params['context_type'] = 'Group';
            } else {
                $this->params['context_type'] = 'CourseSection';
            }
            $this->params['context_id'] = $COURSE->id;
            $this->params['vendor_code'] = $this->get_service()->get_tool_proxy()->vendorcode;
            $this->params['product_code'] = $this->get_service()->get_tool_proxy()->guid;
            $value = str_replace('$ToolProxyBinding.custom.url', parent::get_endpoint(), $value);
        }
        return $value;

    }
805237
public function customDictionariesEdit($customDictionary)
    {
        if (!count($customDictionary) ||
            empty($customDictionary['code']) ||
            empty($customDictionary['elements'])
        ) {
            throw new \InvalidArgumentException(
                'Parameter `dictionary` must contain a data & fields `code` & `elemets` must be set'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/custom-fields/dictionaries/{$customDictionary['code']}/edit",
            "POST",
            ['customDictionary' => json_encode($customDictionary)]
        );
    }
406488
protected function getBlocks()
    {
        $blocks = [];

        foreach ($this->blocks as $key => $value) {
            $blocks[$key] = 'Caouecs\\Sirtrevorjs\\Converter\\'.$value.'Converter';
        }

        if (!empty($this->customBlocks)) {
            $blocks = array_merge($blocks, $this->customBlocks);
        }

        if (isset($this->config['customBlocks']) && !empty($this->config['customBlocks'])) {
            $blocks = array_merge($blocks, $this->config['customBlocks']);
        }

        return $blocks;
    }
646931
private function parseCustomElementMarkup(CustomInteraction $customElement){
        
        $xincludes = array();
        $xml = new DOMDocument();
        $xml->formatOutput = true;
        $loadSuccess = $xml->loadXML($customElement->getMarkup());
        $node = $xml->documentElement;
        
        if($loadSuccess && !is_null($node)){
            $parser = new ParserFactory($xml);
            $xincludesNodes = $parser->queryXPath(".//*[name(.)='include']");
            foreach($xincludesNodes as $xincludeNode){
                $href = $xincludeNode->getAttribute('href');
                $asset = $this->resolver->resolve($href);
                $filePath = $asset->getMediaSource()->download($asset->getMediaIdentifier());
                if(file_exists($filePath)){
                    $fileContent = file_get_contents($filePath);
                    $xmlInclude = new DOMDocument();
                    $xmlInclude->formatOutput = true;
                    $xmlInclude->loadXML($fileContent);
                    foreach($xmlInclude->documentElement->childNodes as $node){
                        $importNode = $xml->importNode($node, true);
                        $xincludeNode->parentNode->insertBefore($importNode, $xincludeNode);
                    }
                }else{
                    throw new XIncludeException('The file referenced by href does not exist : '.$href, $xincludeNode);
                }
                $xincludeNode->parentNode->removeChild($xincludeNode);
                $xincludes[] = $href;
            }
        }else{
            throw new ParsingException('cannot parse pci markup');
        }

        $customElement->setMarkup($xml->saveXML(null, LIBXML_NOEMPTYTAG));
        
        return $xincludes;
    }
343129
protected function getCustomMessageFromTranslator( $customKey )
	{
		if ( ( $message = $this->translator->trans( $customKey ) ) !== $customKey )
		{
			return $message;
		}

		$shortKey = preg_replace( '/^validation\.custom\./', '', $customKey );

		$customMessages = Arr::dot( (array) $this->translator->trans( 'validation.custom' ) );

		foreach ( $customMessages as $key => $message )
		{
			if ( Str::contains( $key, ['*'] ) && Str::is( $key, $shortKey ) )
			{
				return $message;
			}
		}

		return $customKey;
	}
936147
public void setToolBar(JToolBar newToolBar) {
        JToolBar oldToolBar = getToolBar();
        if (oldToolBar == newToolBar) {
            return;
        }
        if (oldToolBar != null) {
            headerPanel.remove(oldToolBar);
        }
        if (newToolBar != null) {
            newToolBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
            headerPanel.add(newToolBar, BorderLayout.EAST);
        }
        updateHeader();
        firePropertyChange("toolBar", oldToolBar, newToolBar);
    }
1195505
public function renderToolbar($event = null)
    {
        if (!$this->checkAccess() || Yii::$app->getRequest()->getIsAjax()) {
            return;
        }

        $baseDebugUrl = Url::toRoute(['/' . $this->id . '/default/toolbar']);
        $baseDebugUrl = Html::encode($baseDebugUrl);
        $currentTag = $this->logTarget->tag;
        echo "<div id='yii-debug-toolbar' data-url='$baseDebugUrl' style='display:none' class='yii-debug-toolbar-bottom'></div>";
        echo "<script type='text/javascript'>window.yii2debugBaseDebugUrl = '$baseDebugUrl';window.yii2debugCurrentTag = '$currentTag';</script>";

        if ($this->includeAssets) {
            /* @var $view View */
            $view = isset($event->sender) ? $event->sender : new View();
            echo '<style>' . $view->renderPhpFile(__DIR__ . '/assets/toolbar.css') . '</style>';
            echo '<style>' . $view->renderPhpFile(__DIR__ . '/assets/toolbar-custom.css') . '</style>';
            echo '<script>' . $view->renderPhpFile(__DIR__ . '/assets/toolbar.js') . '</script>';
        }
    }
943392
public function getToolbarHtml()
    {
        $url = Url::toRoute([
            '/' . $this->id . '/default/toolbar',
            'tag' => $this->logTarget->tag,
        ]);
        return '<div id="yii-debug-toolbar" data-url="' . Html::encode($url) . '" style="display:none" class="yii-debug-toolbar-bottom"></div>';
    }
1290905
public function getConfigurationRaw($configData, array $customAttributes=[])
    {

        $getConfig = new \SimpleXMLElement(
            "<get-configuration>".
                "{$configData}".
            "</get-configuration>"

        );

        foreach ($customAttributes as $attrName => $attrValue) {

            $getConfig->addAttribute($attrName, $attrValue);

        }

        return $this->netConf()->sendRPC($getConfig->asXML());

    }
1276029
protected function render_tool_customlang_menu(\tool_customlang_menu $menu) {
        $output = '';
        foreach ($menu->get_items() as $item) {
            $output .= $this->single_button($item->url, $item->title, $item->method);
        }
        return $this->box($output, 'menu');
    }
1011993
protected function addToolbar()
	{
		$title = JFactory::getApplication()->input->get('title');

		if (empty($title)) {
			$title = 'Symfony';
		}

		JToolbarHelper::title($title);
	}
1254069
public function buttonToolbar(array $buttonGroups, array $options = array()) {
        $options += [
            'templateVars' => []
        ];
        return $this->formatTemplate('buttonToolbar', [
            'content' => implode('', $buttonGroups),
            'attrs' => $this->templater()->formatAttributes($options, ['vertical']),
            'templateVars' => $options['templateVars']
        ]);
    }
576612
private function parse_fields() {
		$fields = Kirki::$fields;
		foreach ( $fields as $field ) {
			if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) {
				// Get the control ID and properly format it for the tooltips.
				$id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) );
				// Add the tooltips content.
				$this->tooltips_content[ $id ] = [
					'id'      => $id,
					'content' => $field['tooltip'],
				];
			}
		}
	}
752748
public static function get_contextlevel_customdata($contextlevel) {

        $persistent = \tool_dataprivacy\contextlevel::get_record_by_contextlevel($contextlevel, false);
        if (!$persistent) {
            $persistent = new \tool_dataprivacy\contextlevel();
            $persistent->set('contextlevel', $contextlevel);
        }

        $includeinherit = true;
        if ($contextlevel == CONTEXT_SYSTEM) {
            // Nothing to inherit from Site level.
            $includeinherit = false;
        }
        $includenotset = true;
        if ($contextlevel == CONTEXT_SYSTEM || $contextlevel == CONTEXT_USER) {
            // No 'not set' value for system and user because we do not have defaults for them.
            $includenotset = false;
        }
        $purposeoptions = \tool_dataprivacy\output\data_registry_page::purpose_options(
            api::get_purposes(), $includenotset, $includeinherit);
        $categoryoptions = \tool_dataprivacy\output\data_registry_page::category_options(
            api::get_categories(), $includenotset, $includeinherit);

        $customdata = [
            'contextlevel' => $contextlevel,
            'contextlevelname' => get_string('contextlevelname' . $contextlevel, 'tool_dataprivacy'),
            'persistent' => $persistent,
            'purposes' => $purposeoptions,
            'categories' => $categoryoptions,
        ];

        $effectivepurpose = api::get_effective_contextlevel_purpose($contextlevel);
        if ($effectivepurpose) {

            $customdata['currentretentionperiod'] = self::get_retention_display_text($effectivepurpose, $contextlevel,
                \context_system::instance());

            $customdata['purposeretentionperiods'] = [];
            foreach ($purposeoptions as $optionvalue => $unused) {

                // Get the effective purpose if $optionvalue would be the selected value.
                list($purposeid, $unused) = data_registry::get_effective_default_contextlevel_purpose_and_category($contextlevel,
                    $optionvalue);
                $purpose = new \tool_dataprivacy\purpose($purposeid);

                $retentionperiod = self::get_retention_display_text(
                    $purpose,
                    $contextlevel,
                    \context_system::instance()
                );
                $customdata['purposeretentionperiods'][$optionvalue] = $retentionperiod;
            }
        }

        return $customdata;
    }