|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
| enum TEXTFILTER_DISABLED |
The states a filter can be in, stored in the filter_active table.
Definition at line 36 of file filterlib.php.
Define one exclusive separator that we'll use in the temp saved tags keys. It must be something rare enough to avoid having matches with filterobjects. MDL-18165
Definition at line 43 of file filterlib.php.
| enum TEXTFILTER_INHERIT |
The states a filter can be in, stored in the filter_active table.
Definition at line 32 of file filterlib.php.
| enum TEXTFILTER_OFF |
The states a filter can be in, stored in the filter_active table.
Definition at line 34 of file filterlib.php.
| enum TEXTFILTER_ON |
The states a filter can be in, stored in the filter_active table.
Definition at line 30 of file filterlib.php.
| filter_add_javascript | ( | $ | text | ) |
Add missing openpopup javascript to HTML files.
| string | $text |
Definition at line 1421 of file filterlib.php.

| filter_context_may_have_filter_settings | ( | $ | context | ) |
Certain types of context (block and user) may not have local filter settings. the function checks a context to see whether it may have local config.
| object | $context | a context. |
Definition at line 1118 of file filterlib.php.
| filter_delete_all_for_context | ( | $ | contextid | ) |
Delete all the data in the database relating to a context, used when contexts are deleted.
| integer | $contextid | The id of the context being deleted. |
Definition at line 1079 of file filterlib.php.

| filter_delete_all_for_filter | ( | $ | filter | ) |
Delete all the data in the database relating to a filter, prior to deleting it.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
Definition at line 1065 of file filterlib.php.


| filter_get_active_in_context | ( | $ | context | ) |
Get the list of active filters, in the order that they should be used for a particular context, along with any local configuration variables.
object
| object | $context | a context |
Definition at line 829 of file filterlib.php.

Get the names of all the filters installed in this Moodle.
object
Definition at line 513 of file filterlib.php.


| filter_get_all_local_settings | ( | $ | contextid | ) |
This function is for use by backup. Gets all the filter information specific to one context.
object
| int | $contextid |
Definition at line 807 of file filterlib.php.


| filter_get_available_in_context | ( | $ | context | ) |
List all of the filters that are available in this context, and what the local and inherited states of that filter are.
object
| object | $context | a context that is not the system context. |
Definition at line 1015 of file filterlib.php.

This function is for use by the filter administration page.
object
Definition at line 1053 of file filterlib.php.


Return a list of all the filters that may be in use somewhere.
array $enabledfilters
Definition at line 638 of file filterlib.php.


| filter_get_local_config | ( | $ | filter, |
| $ | contextid | ||
| ) |
Get local config variables for a filter in a context. Normally (when your filter is running) you don't need to call this, becuase the config is fetched for you automatically. You only need this, for example, when you are getting the config so you can show the user an editing from.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| integer | $contextid | The ID of the context to get the local config for. |
Definition at line 791 of file filterlib.php.

| filter_get_name | ( | $ | filter | ) |
Look up the name of this filter in the most appropriate location. If $filterlocation = 'mod' then does get_string('filtername', $filter); else if $filterlocation = 'filter' then does get_string('filtername', 'filter_' . $filter); with a fallback to get_string('filtername', $filter) for backwards compatibility. These are the only two options supported at the moment.
| string | $filter | the folder name where the filter lives. |
Definition at line 480 of file filterlib.php.

Return the names of the filters that should also be applied to strings (when they are enabled).
object
Definition at line 659 of file filterlib.php.

| filter_has_global_settings | ( | $ | filter | ) |
Does this filter have a global settings page in the admin tree? (The settings page for a filter must be called, for example, filtersettingfiltertex or filtersettingmodglossay.)
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
Definition at line 1093 of file filterlib.php.

| filter_has_local_settings | ( | $ | filter | ) |
Does this filter have local (per-context) settings?
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
Definition at line 1105 of file filterlib.php.
| filter_is_enabled | ( | $ | filter | ) |
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
Definition at line 628 of file filterlib.php.


| filter_phrases | ( | $ | text, |
| &$ | link_array, | ||
| $ | ignoretagsopen = NULL, |
||
| $ | ignoretagsclose = NULL, |
||
| $ | overridedefaultignore = false |
||
| ) |
Process phrases intelligently found within a HTML text (such as adding links)
array $usedpharses
| string | $text | the text that we are filtering |
| array | $link_array | an array of filterobjects |
| array | $ignoretagsopen | an array of opening tags that we should ignore while filtering |
| array | $ignoretagsclose | an array of corresponding closing tags |
| bool | $overridedefaultignore | True to only use tags provided by arguments |
Invalid prefixes and suffixes for the fullmatch searches Every "word" character, but the underscore, is a invalid suffix or prefix. (nice to use this because it includes national characters (accents...) as word characters.
Remove tags from $text
Time to cycle through each phrase to be linked
Set some defaults if certain properties are missing Properties may be missing if the filterobject class has not been used to construct the object
Avoid integers < 1000 to be linked. See bug 1446.
All this work has to be done ONLY it it hasn't been done before
Double up chars to protect true duplicates be cleared up before returning to the user.
Strip tags out of the phrase
Double up chars that might cause a false match -- the duplicates will be cleared up before returning to the user.
Set the replacement phrase properly
Strip tags
Quote any regular expression characters and the delimiter in the work phrase to be searched
Work calculated
If $CFG->filtermatchoneperpage, avoid previously (request) linked phrases
Regular expression modifiers
Do we need to do a fullmatch? If yes then go through and remove any non full matching entries
Finally we do our highlighting
If the text has changed we have to look for links again
Set $text to $resulttext
Remove everything enclosed by the ignore tags from $text
Remove tags from $text
If $CFG->filtermatchoneperpage, save linked phrases to request
Replace the not full matches before cycling to next link object
Rebuild the text with all the excluded areas
Reversed so "progressive" str_replace() will solve some nesting problems.
Add missing javascript for popus
Definition at line 1133 of file filterlib.php.


| filter_preload_activities | ( | course_modinfo $ | modinfo | ) |
Preloads the list of active filters for all activities (modules) on the course using two database queries.
| course_modinfo | $modinfo | Course object from get_fast_modinfo |
Definition at line 881 of file filterlib.php.


| filter_remove_duplicates | ( | $ | linkarray | ) |
| array | $linkarray |
Definition at line 1339 of file filterlib.php.


| filter_save_ignore_tags | ( | &$ | text, |
| $ | filterignoretagsopen, | ||
| $ | filterignoretagsclose, | ||
| &$ | ignoretags | ||
| ) |
Extract open/lose tags and their contents to avoid being processed by filters. Useful to extract pieces of code like ... tags. It returns the text converted with some <#xTEXTFILTER_EXCL_SEPARATORx#> codes replacing the extracted text. Such extracted texts are returned in the ignoretags array (as values), with codes as keys.
| string | $text | the text that we are filtering (in/out) |
| array | $filterignoretagsopen | an array of open tags to start searching |
| array | $filterignoretagsclose | an array of close tags to end searching |
| array | $ignoretags | an array of saved strings useful to rebuild the original text (in/out) |
Remove everything enclosed by the ignore tags from $text
form regular expression
Definition at line 1374 of file filterlib.php.

| filter_save_tags | ( | &$ | text, |
| &$ | tags | ||
| ) |
Extract tags (any text enclosed by < and > to avoid being processed by filters. It returns the text converted with some <xTEXTFILTER_EXCL_SEPARATORx%> codes replacing the extracted text. Such extracted texts are returned in the tags array (as values), with codes as keys.
| string | $text | the text that we are filtering (in/out) |
| array | $tags | an array of saved strings useful to rebuild the original text (in/out) |
Definition at line 1403 of file filterlib.php.

| filter_set_applies_to_strings | ( | $ | filter, |
| $ | applytostrings | ||
| ) |
Sets whether a particular active filter should be applied to all strings by format_string, or just used by format_text.
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| boolean | $applytostrings | if true, this filter will apply to format_string and format_text, when it is enabled. |
Definition at line 677 of file filterlib.php.


| filter_set_global_state | ( | $ | filter, |
| $ | state, | ||
| $ | sortorder = false |
||
| ) |
Set the global activated state for a text filter.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| integer | $state | One of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_DISABLED. |
| integer | $sortorder | (optional) a position in the sortorder to place this filter. If not given defaults to: No change in order if we are updating an existing record, and not changing to or from TEXTFILTER_DISABLED. Just after the last currently active filter when adding an unknown filter in state TEXTFILTER_ON or TEXTFILTER_OFF, or enabling/disabling an existing filter. Just after the very last filter when adding an unknown filter in state TEXTFILTER_DISABLED |
Definition at line 550 of file filterlib.php.


| filter_set_local_config | ( | $ | filter, |
| $ | contextid, | ||
| $ | name, | ||
| $ | value | ||
| ) |
Set a particular local config variable for a filter in a context.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| integer | $contextid | The id of the context to get the local config for. |
| string | $name | the setting name. |
| string | $value | the corresponding value. |
Definition at line 746 of file filterlib.php.

| filter_set_local_state | ( | $ | filter, |
| $ | contextid, | ||
| $ | state | ||
| ) |
Set the local activated state for a text filter.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| integer | $contextid | The id of the context to get the local config for. |
| integer | $state | One of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_INHERIT. |
Definition at line 700 of file filterlib.php.


| filter_unset_local_config | ( | $ | filter, |
| $ | contextid, | ||
| $ | name | ||
| ) |
Remove a particular local config variable for a filter in a context.
object
| string | $filter | The filter name, for example 'filter/tex' or 'mod/glossary'. |
| integer | $contextid | The id of the context to get the local config for. |
| string | $name | the setting name. |
Definition at line 775 of file filterlib.php.
