Get all the filters that apply to a given context for calls to format_text.

@param context $context
@return moodle_text_filter[] A text filter
493079
protected function get_text_filters($context) {
        if (!isset($this->textfilters[$context->id])) {
            $this->load_filters($context);
        }
        return $this->textfilters[$context->id];
    }
1157430
public function get_contextvisibility($context) {
        global $USER;

        if ($context->contextlevel == CONTEXT_COURSE) {
            return $this->_options['enablecourseinstances'];
        }

        if ($context->contextlevel == CONTEXT_USER) {
            return $this->_options['enableuserinstances'];
        }

        //the context is SITE
        return true;
    }
731116
private function parseTagBlock(string $tags, Types\Context $context): array
    {
        $tags = $this->filterTagBlock($tags);
        if (!$tags) {
            return [];
        }

        $result = $this->splitTagBlockIntoTagLines($tags);
        foreach ($result as $key => $tagLine) {
            $result[$key] = $this->tagFactory->create(trim($tagLine), $context);
        }

        return $result;
    }
235966
public function loadContext($context) {
        global $DB;

        if (!empty($context->getRecordId())) {
            $params = ['id' => $context->getRecordId()];
        } else {
            $params = [
                'consumerid' => $context->getConsumer()->getRecordId(),
                'lticontextkey' => $context->ltiContextId
            ];
        }
        if ($row = $DB->get_record($this->contexttable, $params)) {
            $context->setRecordId($row->id);
            $context->setConsumerId($row->consumerid);
            $context->ltiContextId = $row->lticontextkey;
            $context->type = $row->type;
            $settings = unserialize($row->settings);
            if (!is_array($settings)) {
                $settings = array();
            }
            $context->setSettings($settings);
            $context->created = $row->created;
            $context->updated = $row->updated;
            return true;
        }

        return false;
    }
393654
public function render($context)
    {
        if (count($this->class) > 0) {
            foreach ($this->class as $class) {
                $this->getRow()->addClass($class);
            }
        }
        return $context;
    }
1089999
public function format($text, $filters = [])
    {
        $formatted = $text;

        foreach ($this->parseChain($filters) as $name => $data) {
            $parameters = $data['parameters'];
            array_unshift($parameters, $formatted);

            $formatted = $this->__call($name, $parameters);
        }

        return $formatted;
    }
1158320
private function getParameterFromContext(array $context, string $parameterName, $default = null)
    {
        $filters = $context['filters'] ?? [];

        return \array_key_exists($parameterName, $filters) ? $filters[$parameterName] : $default;
    }
739675
public function getIgnores()
    {
        $configFile = $this->directory.'/.moodle-plugin-ci.yml';

        if (!is_file($configFile)) {
            return [];
        }

        $config = Yaml::parse(file_get_contents($configFile));

        // Search for context (AKA command) specific filter first.
        if (!empty($this->context) && array_key_exists('filter-'.$this->context, $config)) {
            return $config['filter-'.$this->context];
        }

        return array_key_exists('filter', $config) ? $config['filter'] : [];
    }
1288498
protected function applyFilters(EventContext $context)
    {
        foreach($this->filters as $filter)
        {
            $e = $context->getEvent();
            if ($filter->match($e)){
                $filter->processEvent($context);
                $e->consume();
            }
        }
    }
375755
public function order($order, $context) {
		if (!$order) {
			return [];
		}
		if (is_string($order)) {
			return [$order => 1];
		}
		if (!is_array($order)) {
			return [];
		}
		foreach ($order as $key => $value) {
			if (!is_string($key)) {
				unset($order[$key]);
				$order[$value] = 1;
				continue;
			}
			if (is_string($value)) {
				$order[$key] = strtolower($value) === 'asc' ? 1 : -1;
			}
		}
		return $order;
	}
989158
public static function get_editor_options($context) {
        global $CFG;

        $editoroptions = [
                'subdirs'  => 0,
                'context'  => $context,
                'maxfiles' => EDITOR_UNLIMITED_FILES,
                'maxbytes' => $CFG->maxbytes,
                'noclean' => 0,
                'trusttext' => 0,
                'autosave' => false
        ];

        return $editoroptions;
    }
125404
public function getFilterFormats() {
    $options = [];
    $formats = filter_formats($this->currentUser);
    foreach ($formats as $format) {
      $options[$format->id()] = $format->label();
    }
    return $options;
  }
1329197
public function getSeoPageContext($context)
    {
        if (isset($this->seoPagesContext[$context])) {
            return $this->seoPagesContext[$context];
        }
        $contextTemplate = $this->findOneBy(['context' => $context]);

        if ($contextTemplate) {
            $this->seoPagesContext[$context] = $contextTemplate;

            return $this->seoPagesContext[$context];
        }

        return null;
    }
1295868
protected function mergeContextHeaders($context)
    {
        $headers = $this->headers->asArray();
        
        if($context === null ) {
            return $headers;
        }
        
        $cookieUpdates = $context->cookies()->updates();
        if(empty($cookieUpdates)) {
            return $headers;
        }
        
        $cookieHeaders = array();
        foreach($cookieUpdates as $update) {
            $cookieHeaders[] = $update->asHeader();
        }
        
        foreach($headers as $name => $value) {
            if(strtolower($name) === 'set-cookie') {
                foreach($cookieHeaders as $header) {
                    $headers[$name][] = $header;
                }
                return $headers;
            }
        }
        
        $headers['Set-Cookie'] = $cookieHeaders;
        return $headers;
    }
339057
public function getActions($context = 'bottom')
    {
        $returnValue = array();

		if(isset($this->actions[$context])){
			$returnValue = $this->actions[$context];
		}

        return (array) $returnValue;
    }
1149594
private function collectNodeIdList(Context $context, $filter = [])
    {
        if (empty($filter)) {
            return [];
        }

        $layout = $context->getCurrentLayout();
        if (!$layout) {
            return;
        }

        foreach ($layout->getAllRegions() as $name => $region) {
            if (isset($filter[$name])) {
                foreach ($region as $item) {
                    /* @var $item Item */
                    $this->nidList[] = $item->getNodeId();
                }
            }
        }

        return $this->nidList;
    }
146027
private function getContext(): array
    {
        $context = [$this->name];
        if ($this instanceof AliasInterface) {
            $context = array_unique(array_merge($context, $this->getAlias()));
        }

        return $context;
    }