Made to Order Software Corporation Logo

MO Glossary: mo_glossary.page.inc File Reference

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.

Detailed Description

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.

Copyright (c) 2009-2012 Made to Order Software Corp.

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.


Function Documentation

_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.

Note:
Only the first instance is replaced on a per page basis. Having all the abbreviations replace over an entire page would otherwise look as if we were overdoing it.
Parameters:
[in]$matchesThe matches, actually only one: the term.
Returns:
The abbreviation between abbr tags.

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.

Note:
The text received by this function includes the '>' from the previous tag and '<' from the next tag.
Parameters:
[in]$matchesThe matches, actually only one: the text between two tags.
Returns:
The text with the abbreviations added.

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.

Parameters:
[out]$abbrThe array of terms to search in the text input
[out]$abbr_objsAn 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.

Parameters:
[in]$textThe text to be filtered.
[in]$deltaThe filter being used, a number from 0 to 4.
[in]$formatThe format used to filter the text, this number is used to determines the glossary taxonomy.
Returns:
The processed input text

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.

Parameters:
[in]$glossaryThe glossary we're working on.
[in]$termThe term for which a link is being generated.
[in]$attr_nameThe name of the attribute used for the link (href, cite).
Returns:
The URL to the term definition.

Referenced by _mo_glossary_abbr().

Documentation generated by Doxygen on Sat Mar 24 2012 23:03:00