Skip to content

Commit

Permalink
Merge pull request #56 from paulmassen/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
paulmassen authored Mar 15, 2018
2 parents 6e5a0eb + a803f46 commit b5314b0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private function seoGetimage($imageurl){
return $imagedata;
}
private function cleanMarkdown($text){
$text=strip_tags($text);
$rules = array (
'/{%[\s\S]*?%}[\s\S]*?/' => '', // remove twig include
'/<style(?:.|\n|\r)*?<\/style>/' => '', // remove style tags
Expand All @@ -118,6 +119,7 @@ private function cleanMarkdown($text){
$text=str_replace('"', '', $text);
$text=str_replace('<p', '', $text);
$text=str_replace('</p>', '', $text);

foreach ($rules as $regex => $rep) {
if (is_callable ( $rep)) {
$text = preg_replace_callback ($regex, $rep, $text);
Expand All @@ -126,7 +128,7 @@ private function cleanMarkdown($text){
}
}

//$text=strip_tags($text);

return substr($text,0,320);
// htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}
Expand Down Expand Up @@ -232,6 +234,10 @@ public function onPageInitialized()
$twittershareimg = $page->header()->twittershareimg;
$imagedata = $this->seoGetimage($twittershareimg);
$meta['twitter:image']['content'] = $this->grav['uri']->base() . $imagedata['url'];
} else {
$meta['twitter:image']['name'] = 'twitter:image';
$meta['twitter:image']['property'] = 'twitter:image';
$meta['twitter:image']['content'] = array_shift($this->grav['page']->media()->images())->url();
};
$meta['twitter:url']['name'] = 'twitter:url';
$meta['twitter:url']['property'] = 'twitter:url';
Expand Down Expand Up @@ -502,6 +508,7 @@ public function onPageInitialized()
'legalname' => @$page->header()->orga['legalname'],
'taxid' => @$page->header()->orga['taxid'],
'vatid' => @$page->header()->orga['vatid'],
'areaServed' => @$areaservedarray,
'description' => @$page->header()->orga['description'],

'address' => [
Expand Down

0 comments on commit b5314b0

Please sign in to comment.