XOOPS  2.6.0
Xmf\Metagen Class Reference

Static Public Member Functions

static assignDescription ($description)
 
static assignKeywords ($keywords)
 
static assignTitle ($title)
 
static generateDescription ($body, $wordCount=100)
 
static generateKeywords ($body, $count=20, $minLength=4, $forceKeys=null)
 
static generateMetaTags ($title, $body, $count=20, $minLength=4, $wordCount=100, $forceKeys=null)
 
static generateSeoTitle ($title= '', $extension= '')
 
static getSearchSummary ($haystack, $needles=null, $length=120)
 

Public Attributes

const ELLIPSIS = "…"
 

Static Protected Member Functions

static asPlainText ($rawText)
 
static checkStopWords ($key)
 
static nonEmptyString ($var)
 

Static Private Member Functions

static getNeedlePositions ($haystack, $needles)
 

Detailed Description

Definition at line 27 of file Metagen.php.

Member Function Documentation

static Xmf\Metagen::asPlainText (   $rawText)
staticprotected

asPlainText - clean string to be plain text, without control characters such as newlines, html markup, or leading trailing or repeating spaces.

Parameters
string$rawTexta text string to be cleaned
Returns
string

Definition at line 341 of file Metagen.php.

References $text.

static Xmf\Metagen::assignDescription (   $description)
static

assignDescription set the meta description tag

Parameters
string$descriptionpage description
Returns
void

Definition at line 88 of file Metagen.php.

References $xoopsTpl, and $xoTheme.

static Xmf\Metagen::assignKeywords (   $keywords)
static

assignKeywords set the meta keywords tag

Parameters
array$keywordskeywords for page
Returns
void

Definition at line 64 of file Metagen.php.

References $xoopsTpl, and $xoTheme.

static Xmf\Metagen::assignTitle (   $title)
static

assignTitle set the page title

Parameters
string$titlepage title
Returns
void

Definition at line 43 of file Metagen.php.

References $xoopsTpl, and $xoTheme.

static Xmf\Metagen::checkStopWords (   $key)
staticprotected

checkStopWords - look up a word in a list of stop words and classify it as a significant word or a stop word.

Parameters
string$keythe word to check
Returns
bool True if word is significant, false if it is a stop word

Definition at line 168 of file Metagen.php.

References _XMF_STOPWORDS, and Xmf\Language\load().

Here is the call graph for this function:

static Xmf\Metagen::generateDescription (   $body,
  $wordCount = 100 
)
static

generateDescription - generate a short description from a body of text

Parameters
string$bodybody text
integer$wordCountmaximum word count for description
Returns
string

Definition at line 197 of file Metagen.php.

References $i, and $text.

static Xmf\Metagen::generateKeywords (   $body,
  $count = 20,
  $minLength = 4,
  $forceKeys = null 
)
static

generateKeywords builds a set of keywords from text body

Parameters
string$bodytext to extract keywords from
integer$countnumber of keywords to use
integer$minLengthminimum length of word to consider as a keyword
string[]|null$forceKeys array of keywords to force use, or null for none
Returns
array of keywords

Definition at line 112 of file Metagen.php.

References $count, and $text.

static Xmf\Metagen::generateMetaTags (   $title,
  $body,
  $count = 20,
  $minLength = 4,
  $wordCount = 100,
  $forceKeys = null 
)
static

generateMetaTags - generate and assign all meta tags

Parameters
string$titletitle
string$bodybody text
int$countmaximum keywords to use
int$minLengthminimum length of word to consider as keyword
int$wordCountmaximum word count for description summary
string[]|null$forceKeys associative array of keywords to force use
Returns
void

Definition at line 233 of file Metagen.php.

References $count.

static Xmf\Metagen::generateSeoTitle (   $title = '',
  $extension = '' 
)
static

Create a title for the short_url field of an article

Parameters
string$titletitle of the article
string$extensionextension to add
Returns
string sort_url for the article
Author
psylove

Definition at line 273 of file Metagen.php.

static Xmf\Metagen::getNeedlePositions (   $haystack,
  $needles 
)
staticprivate

getNeedlePositions - Esentially this is a strpos() for an array of needles. Given a haystack and an array of needles, return an array of all initial positions, if any, of those needles in that haystack.

Parameters
string$haystackthe string to summarize
mixed$needlessearch term, array of search terms, or null
Returns
integer[] array of initial positions of substring of haystack

Definition at line 365 of file Metagen.php.

References $i.

static Xmf\Metagen::getSearchSummary (   $haystack,
  $needles = null,
  $length = 120 
)
static

getSearchSummary splits a string into string no larger than a specified length, and centered around the first occurance of any of an array of needles, or starting at the begining of the string if no needles are specified or found.

The string will be broken on spaces and an ellipsis (...) will be added to the string when broken.

Parameters
string$haystackthe string to summarize
mixed$needlessearch term, array of search terms, or null
int$lengthmaxium length for the summary
Returns
string a substring of haystack

Definition at line 302 of file Metagen.php.

References $start, and $temp.

static Xmf\Metagen::nonEmptyString (   $var)
staticprotected

Return true if the string is length > 0

Parameters
string$varto test
Returns
boolean
Author
psylove

Definition at line 258 of file Metagen.php.

References $var.

Member Data Documentation

const Xmf\Metagen::ELLIPSIS = "…"

Unicode horizontal ellipsis U+2026 This will be used to replace omitted text.

Definition at line 34 of file Metagen.php.


The documentation for this class was generated from the following file: