AdminSeo
in package
Provide Search Engine Optimisation functionality
The DaveChild library uses deprecated functions (since 8.2). They're not removed in 8.3 but I'd bet on 8.4 (end of 2024).
Table of Contents
Properties
- $content : string
- $dom : DOMDocument|null
- $extra_links : array<string|int, mixed>
- $seo_considerations : array<string|int, mixed>
- $seo_goodresults : array<string|int, mixed>
- $seo_improvements : array<string|int, mixed>
- $seo_problems : array<string|int, mixed>
- $slug : string
- $topic : string
Methods
- addContent() : void
- Add main content for later processing
- addLinks() : void
- Add external links to inject into content analysis
- determineAverageWordScore() : void
- Determine SEO average word score
- determineLinksScore() : void
- Determines SEO links score
- determineReadabilityScore() : void
- Determine SEO readability score
- determineSectionWordScore() : void
- Determine SEO word count per section score
- determineSlugWordsScore() : void
- Determine SEO slug stopwords score
- determineTopicWordsScore() : void
- Determine SEO topic keywords score
- determineWordCountScore() : void
- Determine SEO word count score
- getAnalysis() : string
- Populate SEO view with analysis
- getFleschReadingScore() : int
- Determine Flesch reading score 0 = hard, 100 = easy Thanks to github.com/DaveChild
- getKeywordDensity() : array<string|int, mixed>
- Return list of keyword density
- getListOfLinks() : array<string|int, mixed>
- Return list of all links
- getWordCountPerSection() : int
- Returns the average word count per section
- isStopWord() : bool
- Determine if given word is a stop-word
- processDOM() : void
- Setup content as DOM object
- processString() : array<string|int, mixed>
- Return list of useful keywords from given string
- setSlug() : void
- Set page slug for analysis
- setTopic() : void
- Set topic (focus word) for analysis
Properties
$content
public
static string
$content
= ''
$dom
public
static DOMDocument|null
$dom
= null
$extra_links
public
static array<string|int, mixed>
$extra_links
= []
$seo_considerations
public
static array<string|int, mixed>
$seo_considerations
= []
$seo_goodresults
public
static array<string|int, mixed>
$seo_goodresults
= []
$seo_improvements
public
static array<string|int, mixed>
$seo_improvements
= []
$seo_problems
public
static array<string|int, mixed>
$seo_problems
= []
$slug
public
static string
$slug
= ''
$topic
public
static string
$topic
= ''
Methods
addContent()
Add main content for later processing
public
static addContent(string $str) : void
Parameters
- $str : string
-
HTML
addLinks()
Add external links to inject into content analysis
public
static addLinks(array<string|int, mixed> $links) : void
Parameters
- $links : array<string|int, mixed>
-
[href, text] pairs
determineAverageWordScore()
Determine SEO average word score
public
static determineAverageWordScore() : void
Return values
void —Updates result arrays directly
determineLinksScore()
Determines SEO links score
public
static determineLinksScore() : void
Return values
void —Updates result arrays directly
determineReadabilityScore()
Determine SEO readability score
public
static determineReadabilityScore() : void
Return values
void —Updates result arrays directly
determineSectionWordScore()
Determine SEO word count per section score
public
static determineSectionWordScore() : void
Return values
void —Updates result arrays directly
determineSlugWordsScore()
Determine SEO slug stopwords score
public
static determineSlugWordsScore() : void
Return values
void —Updates result arrays directly
determineTopicWordsScore()
Determine SEO topic keywords score
public
static determineTopicWordsScore() : void
Return values
void —Updates result arrays directly
determineWordCountScore()
Determine SEO word count score
public
static determineWordCountScore() : void
Return values
void —Updates result arrays directly
getAnalysis()
Populate SEO view with analysis
public
static getAnalysis() : string
Return values
string —HTML view
getFleschReadingScore()
Determine Flesch reading score 0 = hard, 100 = easy Thanks to github.com/DaveChild
public
static getFleschReadingScore(string $str[, string $encoding = '' ]) : int
Parameters
- $str : string
-
Text to score
- $encoding : string = ''
-
Encoding of text
Return values
intgetKeywordDensity()
Return list of keyword density
public
static getKeywordDensity([int $limit = 5 ]) : array<string|int, mixed>
Parameters
- $limit : int = 5
-
Number of results. Default of top five words
Return values
array<string|int, mixed> —[word => count] pairs
getListOfLinks()
Return list of all links
public
static getListOfLinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of URLs
getWordCountPerSection()
Returns the average word count per section
public
static getWordCountPerSection() : int
Return values
int —Average words
isStopWord()
Determine if given word is a stop-word
public
static isStopWord(string $word) : bool
Parameters
- $word : string
-
Word to check
Return values
bool —True when is stop-word
processDOM()
Setup content as DOM object
public
static processDOM() : void
Return values
void —Sets class var directly
processString()
Return list of useful keywords from given string
public
static processString([bool $all = false ]) : array<string|int, mixed>
Parameters
- $all : bool = false
-
True to include stop-words. Default of false (remove stop words)
Return values
array<string|int, mixed> —List of words
setSlug()
Set page slug for analysis
public
static setSlug(string $str) : void
Parameters
- $str : string
-
The front-end URL for current edited page
setTopic()
Set topic (focus word) for analysis
public
static setTopic(string $str) : void
Parameters
- $str : string
-
Word or words as the main topic