Methods |
public
static
|
assignTitle(string $title): void
assignTitle set the page title
assignTitle set the page title
Parameters
|
#
|
public
static
|
assignKeywords(string[] $keywords): void
assignKeywords set the meta keywords tag
assignKeywords set the meta keywords tag
Parameters
|
#
|
public
static
|
assignDescription(string $description): void
assignDescription set the meta description tag
assignDescription set the meta description tag
Parameters
$description |
page description
|
|
#
|
protected
static
|
assignThemeMeta(string $name, string $value)
assign meta variables in template engine
assign meta variables in template engine
Parameters
$name |
meta name (keywords, description)
|
$value |
meta value
|
|
#
|
protected
static
|
assignTemplateVar(string $name, string $value)
assign meta variables in template engine
assign meta variables in template engine
Parameters
$name |
variable name (i.e. xoops_pagtitle)
|
$value |
meta value
|
|
#
|
public
static
|
generateKeywords(string $body, integer $count = 20, integer $minLength = 4, string[]|null $forceKeys = null): array
generateKeywords builds a set of keywords from text body
generateKeywords builds a set of keywords from text body
Parameters
$body |
text to extract keywords from
|
$count |
number of keywords to use
|
$minLength |
minimum length of word to consider as a keyword
|
$forceKeys |
array of keywords to force use, or null for none
|
Returns
|
#
|
public
static
|
generateDescription(string $body, integer $wordCount = 100): string
generateDescription - generate a short description from a body of text
generateDescription - generate a short description from a body of text
Parameters
$body |
body text
|
$wordCount |
maximum word count for description
|
|
#
|
public
static
|
generateMetaTags(
string $title,
string $body,
int $count = 20,
int $minLength = 4,
int $wordCount = 100,
string[]|null $forceKeys = null,
): void
generateMetaTags - generate and assign all meta tags
generateMetaTags - generate and assign all meta tags
Parameters
$title |
title
|
$body |
body text
|
$count |
maximum keywords to use
|
$minLength |
minimum length of word to consider as keyword
|
$wordCount |
maximum word count for description summary
|
$forceKeys |
associative array of keywords to force use
|
|
#
|
protected
static
|
nonEmptyString(string $var): boolean
Return true if the string is length > 0
Return true if the string is length > 0
Parameters
|
#
|
public
static
|
generateSeoTitle(string $title = '', string $extension = ''): string
Create a title for the short_url field of an article
Create a title for the short_url field of an article
Parameters
$title |
title of the article
|
$extension |
extension to add
|
Returns
|
#
|
public
static
|
getSearchSummary(string $haystack, mixed $needles = null, int $length = 120): string
getSearchSummary splits a string into string no larger than a
specified length, and centered around the first…
getSearchSummary splits a string into string no larger than a
specified length, and centered around the first occurrence
of any of an array of needles, or starting at the beginning
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
$haystack |
the string to summarize
|
$needles |
search term, array of search terms, or null
|
$length |
maximum character length for the summary
|
Returns
|
#
|
protected
static
|
asPlainText(string $rawText): string
asPlainText - clean string to be plain text, without control characters
such as newlines, html markup, or leading…
asPlainText - clean string to be plain text, without control characters
such as newlines, html markup, or leading trailing or repeating spaces.
Parameters
$rawText |
a text string to be cleaned
|
|
#
|
protected
static
|
getNeedlePositions(string $haystack, mixed $needles): integer[]
getNeedlePositions - Essentially this is a strpos() for an array of needles.
Given a haystack and an array of needles,…
getNeedlePositions - Essentially 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
$haystack |
the string to summarize
|
$needles |
search term, array of search terms, or null
|
Returns
array of initial positions of substring of haystack
|
#
|
protected
static
|
purifyText(string $text, boolean $keyword = false): string
purifyText
Parameters
$text |
text to clean
|
$keyword |
replace some punctuation with white space
|
Returns
|
#
|
protected
static
|
html2text(string $document): string
html2text
This will remove HTML tags, javascript sections and white space. It will also
convert some common HTML…
html2text
This will remove HTML tags, javascript sections and white space. It will also
convert some common HTML entities to their text equivalent. Credits to newbb2
Parameters
$document |
HTML to be converted
|
Returns
Text version of $document parameter
|
#
|
public
static
|
checkStopWords(string $key): bool
checkStopWords - look up a word in a list of stop words and
classify it as a significant word or a stop word.
checkStopWords - look up a word in a list of stop words and
classify it as a significant word or a stop word.
Deprecated
since v1.2.0 - use Xmf\StopWords::check()
Parameters
Returns
True if word is significant, false if it is a stop word
|
#
|
protected
static
|
stopWordsObject(): StopWords
Get a StopWords object
|
#
|