Skip to content

Commit

Permalink
added treshold to score system and translations
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertusanton committed Sep 15, 2015
1 parent b3fec6b commit a5f860e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
16 changes: 10 additions & 6 deletions code/SeoObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,26 @@ public function updateCMSFields(FieldList $fields) {

/**
* getHTMLStars.
* Get html of stars rating in CMS
* Get html of stars rating in CMS, maximum score is 12
* threshold 2
*
* @param none
* @return String $html
*/
public function getHTMLStars() {

$num_stars = intval(ceil($this->seo_score) / 2);
$treshold_score = $this->seo_score - 2 < 0 ? 0 : $this->seo_score - 2;

$num_stars = intval(ceil($treshold_score) / 2);

$num_nostars = 5 - $num_stars;

$html = '<div id="fivestar-widget">';

for ($i = 1; $i <= $num_stars; $i++) {
$html .= '<div class="star on"></div>';
}
if ($this->seo_score % 2) {
if ($treshold_score % 2) {
$html .= '<div class="star on-half"></div>';
$num_nostars--;
}
Expand Down Expand Up @@ -230,10 +234,10 @@ public function getHTMLSimplePageSubjectTest() {

/**
* getSEOScoreCalculation.
* Do SEO score calculation and set class Array score_criteria 10 corresponding assoc values
* Also set class Integer seo_score with score 0-10 based on values which are true in score_criteria array
* Do SEO score calculation and set class Array score_criteria 12 corresponding assoc values
* Also set class Integer seo_score with score 0-12 based on values which are true in score_criteria array
* Do SEO score calculation and set class Array score_criteria 11 corresponding assoc values
* Also set class Integer seo_score with score 0-11 based on values which are true in score_criteria array
* Also set class Integer seo_score with score 0-12 based on values which are true in score_criteria array
*
* @param none
* @return none, set class array score_criteria tips boolean
Expand Down
4 changes: 3 additions & 1 deletion lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ en:
SEOSubjectCheckPageContent: 'Page content:'
SEOSubjectCheckPageURL: 'Page URL:'
SEOSubjectCheckPageMetaDescription: 'Page meta description:'
SEOSubjectCheckIntro: 'Your page subject is found in:'
SEOGoogleWebmasterMetaTag: 'Google webmaster meta tag'
SEOGoogleWebmasterMetaTagRightTitle: 'Full Google webmaster meta tag For example &lt;meta name="google-site-verification" content="hjhjhJHG12736JHGdfsdf" &gt;'
SEOGoogleWebmasterMetaTagRightTitle: 'Full Google webmaster meta tag For example &lt;meta name="google-site-verification" content="hjhjhJHG12736JHGdfsdf" &gt;'
SEOScoreTipImagesHaveTitleTags: 'All images on this page do not have title tags'
3 changes: 2 additions & 1 deletion lang/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ nl:
SEOSubjectCheckPageMetaDescription: 'Pagina meta omschrijving:'
SEOSubjectCheckIntro: 'Je pagina onderwerp is gevonden in:'
SEOGoogleWebmasterMetaTag: 'Google webmaster meta tag'
SEOGoogleWebmasterMetaTagRightTitle: 'Full Google webmaster meta tag. Bijvoorbeeld &lt;meta name="google-site-verification" content="hjhjhJHG12736JHGdfsdf" &gt;'
SEOGoogleWebmasterMetaTagRightTitle: 'Full Google webmaster meta tag. Bijvoorbeeld &lt;meta name="google-site-verification" content="hjhjhJHG12736JHGdfsdf" &gt;'
SEOScoreTipImagesHaveTitleTags: 'Alle afbeeldingen op deze pagina hebben geen title tags'

0 comments on commit a5f860e

Please sign in to comment.