The set of functions used to replace the glossary terms. More...
Functions | |
_mo_glossary_reference ($glossary, $term, $attr_name) | |
Generate the href URL for an anchor or quote tag. | |
_mo_glossary_get_abbr (&$abbr, &$abbr_objs) | |
Prepare an array of terms & term objects. | |
_mo_glossary_abbr ($matches) | |
Replace the abbreviations with their descriptions. | |
_mo_glossary_find_terms ($matches) | |
Callback to process the text of the page. | |
_mo_glossary_process ($text, $delta, $format) | |
Process the page. |
This file certainly includes the core functionality of the filter. The functions defined here are those that add the <abbr> tag to the abbreviations found in this node.
http://www.m2osw.com/mo_glossary contact@m2osw.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
_mo_glossary_abbr | ( | $ | matches | ) |
This function replaces abbreviations found in your glossary with an abbr or some other choosen tag. The title of the tag is set to the description of the term.
[in] | $matches | The matches, actually only one: the term. |
References _mo_glossary_get_abbr(), and _mo_glossary_reference().
_mo_glossary_find_terms | ( | $ | matches | ) |
The page includes HTML so we have a first replace that sends us only the text between tags. Then here we search for the actual patterns.
[in] | $matches | The matches, actually only one: the text between two tags. |
References _mo_glossary_get_abbr().
_mo_glossary_get_abbr | ( | &$ | abbr, |
&$ | abbr_objs | ||
) |
This function loads all the terms of a taxonomy used as a glossary.
The $abbr parameter is set to a list of terms and synonyms.
The $abbr_objs are the corresponding term objects that include the description to be used to add the <abbr> tags.
[out] | $abbr | The array of terms to search in the text input |
[out] | $abbr_objs | An array of terms indexed by term names and synonyms |
Referenced by _mo_glossary_abbr(), _mo_glossary_find_terms(), and _mo_glossary_process().
_mo_glossary_process | ( | $ | text, |
$ | delta, | ||
$ | format | ||
) |
This function replaces the terms from the specified glossary taxonomy (MO Glossary by default) with an <abbr> tag or an anchor.
[in] | $text | The text to be filtered. |
[in] | $delta | The filter being used, a number from 0 to 4. |
[in] | $format | The format used to filter the text, this number is used to determines the glossary taxonomy. |
References _mo_glossary_get_abbr().
Referenced by mo_glossary_filter().
_mo_glossary_reference | ( | $ | glossary, |
$ | term, | ||
$ | attr_name | ||
) |
This function generates the URL for an anchor or a quote tag.
[in] | $glossary | The glossary we're working on. |
[in] | $term | The term for which a link is being generated. |
[in] | $attr_name | The name of the attribute used for the link (href, cite). |
Referenced by _mo_glossary_abbr().