Get all icon constants for dropdown list in example
@param bool $html whether to render icon as array value prefix
@return array
499080
public static function getConstants($html = false)
	{
		$result = [];
		foreach ((new \ReflectionClass(get_class()))->getConstants() as $constant) {
			$key = static::$cssPrefix . ' ' . static::$cssPrefix . '-' . $constant;

			$result[$key] = ($html)
				? static::icon($constant) . '&nbsp;&nbsp;' . $constant
				: $constant;
		}

		return $result;
	}
586953
public function get_right_icons_row($rows=array()) {
        global $USER;
        if ($USER->gradeediting[$this->courseid]) {
            $iconsrow = new html_table_row();
            $iconsrow->attributes['class'] = 'controls';

            foreach ($this->gtree->items as $itemid => $unused) {
                // emulate grade element
                $item = $this->gtree->get_item($itemid);

                $eid = $this->gtree->get_item_eid($item);
                $element = $this->gtree->locate_element($eid);
                $itemcell = new html_table_cell();
                $itemcell->attributes['class'] = 'controls icons i'.$itemid;
                $itemcell->text = $this->get_icons($element);
                $iconsrow->cells[] = $itemcell;
            }
            $rows[] = $iconsrow;
        }
        return $rows;
    }
668718
protected function getIconCssClasses(?string $icon = null, bool $animated = false, array $cssClasses = [])
    {
        $cssClasses[] = 'fa';
        $cssClasses[] = $icon ?? $this->getIcon();
        if ($animated === true) {
            if ($this->getIcon() === 'fa-spinner') {
                $cssClasses[] = 'fa-pulse';
            } else if (in_array($this->getIcon(), ['fa-spinner', 'fa-circle-o-notch', 'fa-refresh', 'fa-cog'])) {
                $cssClasses[] = 'fa-spin';
            }
        }
        if ($this->iconColor) {
            $cssClasses[] = 'text-' . $this->iconColor;
        }
        return $cssClasses;
    }
146209
public function get_props() {
		$props = array(
			'id'         => $this->id,
			'name'       => $this->name,
			'controller' => $this->controller,
			'templateId' => $this->template_id,
			'data'       => $this->get_props_data(),
		);

		/**
		 * Filter icon type properties
		 *
		 * @since 0.1.0
		 * @param array            $props Icon type properties.
		 * @param string           $id    Icon type ID.
		 * @param Icon_Picker_Type $type  Icon_Picker_Type object.
		 */
		$props = apply_filters( 'icon_picker_type_props', $props, $this->id, $this );

		/**
		 * Filter icon type properties
		 *
		 * @since 0.1.0
		 * @param array            $props Icon type properties.
		 * @param Icon_Picker_Type $type  Icon_Picker_Type object.
		 */
		$props = apply_filters( "icon_picker_type_props_{$this->id}", $props, $this );

		return $props;
	}
50741
protected function _getListOptionsForElem() {
		$cachePath = 'DefaultOptions_Form_' . $this->_currUIlang;
		$cached = Cache::read($cachePath, CAKE_THEME_CACHE_KEY_HELPERS);
		if (!empty($cached)) {
			return $cached;
		}

		$result = [];
		$result['select'] = [
			'extraOpt' => [
				'actions-box',
				'container',
				'count-selected-text',
				'deselect-all-text',
				'dropdown-align-right',
				'dropup-auto',
				'header',
				'hide-disabled',
				'icon-base',
				'live-search',
				'live-search-normalize',
				'live-search-placeholder',
				'live-search-style',
				'max-options',
				'max-options-text',
				'mobile',
				'multiple-separator',
				'none-selected-text',
				'select-all-text',
				'selected-text-format',
				'select-on-tab',
				'show-content',
				'show-icon',
				'show-subtext',
				'show-tick',
				'size',
				'style',
				'tick-icon',
				'width',
				'window-padding',
			]
		];
		$result['dateTime'] = [
			'defaultOpt' => [
				'label' => false,
				'data-toggle' => 'datetimepicker'
			],
			'extraOpt' => [
				'date-format',
				'date-locale',
				'icon-type',
				'widget-position-horizontal',
				'widget-position-vertical'
			]
		];
		$result['spin'] = [
			'defaultOpt' => [
				'data-toggle' => 'spin',
				'data-spin-verticalbuttons' => 'true',
				'label' => false,
			],
			'extraOpt' => [
				'min',
				'max',
				'step',
				'decimals',
				'maxboostedstep',
				'verticalbuttons',
				'prefix',
				'prefix_extraclass',
				'postfix',
				'postfix_extraclass',
			]
		];
		$result['flag'] = [
			'defaultOpt' => [
				'type' => 'select'
			],
			'extraOpt' => [
				'country-url',
			],
			'divOpt' => [
				'data-toggle' => 'flag-select',
				'data-button-type' => 'btn-default form-control',
			]
		];
		$result['autocomplete'] = [
			'defaultOpt' => [
				'data-toggle' => 'autocomplete',
				'label' => false,
			],
			'extraOpt' => [
				'type',
				'plugin',
				'url',
				'local',
				'min-length'
			]
		];
		$result['createUploadForm'] = [
			'type' => 'file',
			'default' => false,
			'url' => false
		];
		$result['upload'] = [
			'btnTitle' => $this->Html->tag('span', __d('view_extension', 'Select file...')),
			'inputOpt' => [
				'type' => 'file',
				'secure' => false,
				'label' => false,
				'div' => false,
				'data-toggle' => 'fileupload',
				'name' => 'files',
				'data-fileupload-btntext-upload' => __d('view_extension', 'Upload'),
				'data-fileupload-btntext-abort' => __d('view_extension', 'Abort'),
				'data-fileupload-msgtext-processing' => __d('view_extension', 'Processing...'),
				'data-fileupload-msgtext-error' => __d('view_extension', 'File upload failed'),
			]
		];
		$result['createFormTabs'] = [
			'tabListOpt' => [
				'class' => 'nav nav-pills nav-stacked col-xs-4 col-sm-4 col-md-4 col-lg-4'
			],
			'tabContentClass' => 'tab-content col-xs-8 col-lg-8 col-sm-8 col-md-8 col-lg-8',
			'submitBtn' => [
				'title' => __d('view_extension', 'Save'),
				'options' => [
					'class' => 'btn btn-success btn-md',
					'div' => 'form-group text-center'
				]
			]
		];
		Cache::write($cachePath, $result, CAKE_THEME_CACHE_KEY_HELPERS);

		return $result;
	}
244160
private function parseAttributes(string $html): string
    {
        $remainingHtml = \mb_substr($html, mb_strlen($this->name) + 1);
        while (\mb_strpos($remainingHtml, '>') !== false && preg_match("/^\s*[\/]?>/", $remainingHtml) === 0) {
            $remainingHtml = $this->parseAttribute($remainingHtml);
        }

        return $remainingHtml;
    }
515505
public function getAttributesHTML($attributes = null)
    {
        // Initialise:
        
        $remove = [];
        
        // Detect Excluded Attributes:
        
        if (is_string($attributes)) {
            $remove = func_get_args();
        }
        
        // Detect Passed Attributes:
        
        if (!$attributes || is_string($attributes)) {
            $attributes = $this->getAttributes();
        }
        
        // Ensure Array Data Type:
        
        $attributes = (array) $attributes;
        
        // Remove Excluded Attributes:
        
        if (!empty($remove)) {
            $attributes = array_diff_key($attributes, array_flip($remove));
        }
        
        // Answer Markup:
        
        return ViewTools::singleton()->getAttributesHTML($attributes);
    }
1028779
public static function get_icon( $meta ) {
		$icon = '';

		// Icon type is not set.
		if ( empty( $meta['type'] ) ) {
			return $icon;
		}

		// Icon is not set.
		if ( empty( $meta['icon'] ) ) {
			return $icon;
		}

		// Icon type is not registered/enabled.
		if ( ! isset( self::$icon_types[ $meta['type'] ] ) ) {
			return $icon;
		}

		$type = self::$icon_types[ $meta['type'] ];

		$callbacks = array(
			array( $type, 'get_icon' ),
			array( __CLASS__, "get_{$type->id}_icon" ),
			array( __CLASS__, "get_{$type->template_id}_icon" ),
		);

		foreach ( $callbacks as $callback ) {
			if ( is_callable( $callback ) ) {
				$icon = call_user_func( $callback, $meta );
				break;
			}
		}

		return $icon;
	}
1310746
protected function get_icons($element) {
        global $CFG, $USER, $OUTPUT;

        if (!$USER->gradeediting[$this->courseid]) {
            return '<div class="grade_icons" />';
        }

        // Init all icons
        $editicon = '';

        $editable = true;

        if ($element['type'] == 'grade') {
            $item = $element['object']->grade_item;
            if ($item->is_course_item() or $item->is_category_item()) {
                $editable = $this->overridecat;
            }
        }

        if ($element['type'] != 'categoryitem' && $element['type'] != 'courseitem' && $editable) {
            $editicon = $this->gtree->get_edit_icon($element, $this->gpr);
        }

        $editcalculationicon = '';
        $showhideicon        = '';
        $lockunlockicon      = '';

        if (has_capability('moodle/grade:manage', $this->context)) {
            if ($this->get_pref('showcalculations')) {
                $editcalculationicon = $this->gtree->get_calculation_icon($element, $this->gpr);
            }

            if ($this->get_pref('showeyecons')) {
                $showhideicon = $this->gtree->get_hiding_icon($element, $this->gpr);
            }

            if ($this->get_pref('showlocks')) {
                $lockunlockicon = $this->gtree->get_locking_icon($element, $this->gpr);
            }

        }

        $gradeanalysisicon   = '';
        if ($this->get_pref('showanalysisicon') && $element['type'] == 'grade') {
            $gradeanalysisicon .= $this->gtree->get_grade_analysis_icon($element['object']);
        }

        return $OUTPUT->container($editicon.$editcalculationicon.$showhideicon.$lockunlockicon.$gradeanalysisicon, 'grade_icons');
    }
1361094
public static function icon($icon, $size = 0, $tag = 'i')
    {
        $icon = preg_replace('/(")(.*?)(")/', '$2', $icon);

        $icon_array = explode(',', $icon, 2);
        $icon = array_get($icon_array, 0);
        if (array_has($icon_array, 1)) {
            $attributes = explode(',', array_get($icon_array, 1, ''));
        }

        if (substr($icon, 1, 1) == ' ') {
            $type = substr($icon, 0, 1);
            $icon = substr($icon, 2);
        } else {
            $type = config('html.icon.default.type', 'l');
        }
        $icon = ($icon[0] === '-') ? substr($icon, 1) : 'fa-'.$icon;
        $size = ($size > 0) ? ' fa-'.$size : '';
        $fa = self::$tag()->addClass('fa'.$type.' fa-fw '.$icon.$size)->aria('hidden', 'true');

        if (isset($attributes) && is_array($attributes)) {
            foreach ($attributes as $attr) {
                list($attr_name, $attr_value) = explode('=', $attr);
                switch ($attr_name) {
                    case 'transform':
                        $fa->data('fa-'.$attr_name, $attr_value);
                        break;
                    default:
                        $fa->attr($attr_name, $attr_value);
                        break;
                }
            }
        }

        return $fa;
    }
859827
protected function getHtmlFrag($html)
    {
        if (!($html = (string) $html)) {
            return []; // Nothing to do.
        }
        if (preg_match('/(?P<all>(?P<open_tag>\<html(?:\s+[^>]*?)?\>)(?P<contents>.*?)(?P<closing_tag>\<\/html\>))/uis', $html, $html_frag)) {
            return $this->removeNumericKeysDeep($html_frag);
        }
        return [];
    }
651861
private function extractMetas(DOMDocument $html)
    {
        foreach ($html->getElementsByTagName('meta') as $meta) {
            $value = $meta->getAttribute('content');

            if (empty($value)) {
                continue;
            }

            if ($meta->hasAttribute('name')) {
                $name = trim(strtolower($meta->getAttribute('name')));

                switch ($name) {
                    case 'msapplication-tileimage':
                        $this->bag->add('icons', $value);
                        continue 2;

                    default:
                        $this->bag->set($name, $value);
                        continue 2;
                }
            }

            if ($meta->hasAttribute('itemprop')) {
                $this->bag->set($meta->getAttribute('itemprop'), $value);
            }

            if ($meta->hasAttribute('http-equiv')) {
                $this->bag->set($meta->getAttribute('http-equiv'), $value);
            }

            if ($meta->hasAttribute('property')) {
                $this->bag->set($meta->getAttribute('property'), $value);
            }
        }
    }
891120
protected function htmlOptionsExtraButton()
    {
        return array_merge(
                ['type' => 'button'],
                !empty($this->extraButtonOptions) && is_array($this->extraButtonOptions) ? $this->extraButtonOptions : []
            );
    }
392123
public function getListItemButtons()
    {
        $buttons = ArrayList::create();
        
        foreach ($this->owner->getListItemButtonsConfig() as $name => $spec) {
            
            if ($spec) {
                
                foreach ($spec as $item => $value) {
                    
                    $args = [];
                    
                    if (is_array($value)) {
                        $args  = $value;
                        $value = array_shift($args);
                    }
                    
                    $spec[$item] = $this->processListItemValue($value, $args);
                    
                }
                
                if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
                    continue;
                }
                
                $href = isset($spec['href']) ? $spec['href'] : null;
                
                $type  = null;
                $extra = null;
                
                if ($renderer = $this->owner->getRenderer()) {
                    $type  = $renderer->ButtonTypeStyle;
                    $extra = $renderer->ButtonExtraClass;
                }
                
                if ($href) {
                    
                    $buttons->push(
                        ArrayData::create([
                            'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
                            'Type' => isset($spec['type']) ? $spec['type'] : $type,
                            'HREF' => isset($spec['href']) ? $spec['href'] : null,
                            'Text' => isset($spec['text']) ? $spec['text'] : null,
                            'ExtraClass' => isset($spec['extraClass']) ? $spec['extraClass'] : $extra
                        ])
                    );
                    
                }
                
            }
            
        }
        
        return $buttons;
    }
996053
public static function closeOpenTags($html)
    {
        preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result);
        $openedTags = $result[1];
        preg_match_all("#</([a-z]+)>#iU", $html, $result);
        $closedTags = $result[1];
        $lenOpened = count($openedTags);

        if (count($closedTags) == $lenOpened) {
            return $html;
        }

        $openedTags = array_reverse($openedTags);
        for ($i = 0; $i < $lenOpened; $i++) {
            if (!in_array($openedTags[$i], $closedTags)) {
                $html .= '</' . $openedTags[$i] . '>';
            } else {
                unset($closedTags[array_search($openedTags[$i], $closedTags)]);
            }
        }

        return $html;
    }
801081
static String getDropDownButtonHtml(FontIcon icon) {

        return "<div tabindex=\"0\" role=\"button\" class=\"v-button v-widget borderless v-button-borderless "
            + OpenCmsTheme.TOOLBAR_BUTTON
            + " v-button-"
            + OpenCmsTheme.TOOLBAR_BUTTON
            + "\"><span class=\"v-button-wrap\">"
            + icon.getHtml()
            + "</span></div>";
    }
695456
public static function filterRSS($html) {
        $config = array(
            'anti_link_spam' => ['`.`', ''],
            'comment' => 1,
            'cdata' => 3,
            'css_expression' => 1,
            'deny_attribute' => 'on*,style,class',
            'elements' => '*-applet-form-input-textarea-iframe-script-style-object-embed-comment-link-listing-meta-noscript-plaintext-xmp',
            'keep_bad' => 0,
            'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class
            'valid_xhtml' => 1,
            'balance' => 1
        );
        $spec = static::$defaultSpec;

        $result = static::filter($html, $config, $spec);

        return $result;
    }