opengraph image tag

This commit is contained in:
fredtempez 2018-10-24 15:50:07 +02:00
parent d464394218
commit 096eabdf32
10 changed files with 82 additions and 10 deletions

View File

@ -4,4 +4,25 @@ SetEnv SESSION_USE_TRANS_SID 0
# Bloque l'accès à la liste des fichiers
Options -Indexes
# Attention, surtout ne rien modifier ci-dessous !
# Attention, surtout ne rien modifier ci-dessous !
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteBase /ZwiiCMS-dev/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</ifModule>
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteBase /ZwiiCMS-dev/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</ifModule>
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteBase /ZwiiCMS-dev/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</ifModule>

View File

@ -5,7 +5,7 @@
* Modifications :
- Footer dans 3 blocs contenant dans l'ordre : Texte, Réseaux sociaux, Copyright
- Pagination variable du nombres d'articles par page (news, blog et form)
- Position du module Galerie dans une page ; haut ; bas ou libre avec les doubles crochets insérés dans l'article [] (PeterRabbit)
- Position des modules Galerie et Form dans une page ; haut ; bas ou libre avec les doubles crochets insérés dans l'article [] (PeterRabbit)
- Prise en compte des balises OpenGraph title , description et type
* Correction :
- Accès aux pages désactivées par le sitemap

View File

@ -1984,12 +1984,19 @@ class layout extends common {
}
/**
* Affiche le type
* Affiche le meta type
*/
public function showMetaType() {
echo '<meta property="og:type" content="website" />';
}
/**
* Affiche la meta image (site screenshot)
*/
public function showMetaImage() {
echo '<meta property="og:image" content="' . helper::baseUrl() .'site/screenshot.png" />';
}
/**
* Affiche la notification

View File

@ -7,6 +7,7 @@
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>
<?php $layout->showMetaType(); ?>
<?php $layout->showMetaImage(); ?>
<?php $layout->showFavicon(); ?>
<?php $layout->showVendor(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">

View File

@ -7,6 +7,7 @@
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>
<?php $layout->showMetaType(); ?>
<?php $layout->showMetaImage(); ?>
<?php $layout->showFavicon(); ?>
<?php $layout->showVendor(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">

View File

@ -6,7 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php $layout->showMetaTitle(); ?>
<?php $layout->showMetaDescription(); ?>
<?php $layout->showMetaType(); ?>
<?php $layout->showMetaType(); ?>
<?php $layout->showMetaImage(); ?>
<?php $layout->showFavicon(); ?>
<?php $layout->showVendor(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">

View File

@ -146,6 +146,7 @@ class config extends common {
* Sauvegarde des données
*/
public function backup() {
// Creation du ZIP
$fileName = date('Y-m-d-h-i-s', time()) . '.zip';
$zip = new ZipArchive();
@ -166,6 +167,31 @@ class config extends common {
]);
}
/**
* Réalise une copie d'écran
* https://www.codexworld.com/capture-screenshot-website-url-php-google-api/
*/
public function metaimage() {
// fonction désactivée pour un site local
if ( strpos(helper::baseUrl(false),'localhost') === 0 OR strpos(helper::baseUrl(false),'127.0.0.1') === 0)
{
$googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. helper::baseUrl(false) .'&screenshot=true&key=AIzaSyA_JOJidlWFgEiyxTlSGi2_fORgYsCZFtA');
$googlePagespeedData = json_decode($googlePagespeedData, true);
$screenshot = $googlePagespeedData['screenshot']['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
$data = 'data:image/jpeg;base64,'.$screenshot;
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
file_put_contents( helper::baseUrl(false) . '/site/file/source/screenshot.png',$data);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Image tag réinitialisée',
'redirect' => helper::baseUrl() . 'config',
'state' => true
]);
}
}
/**
* Configuration
*/

View File

@ -16,6 +16,12 @@
<div class="col6">
<div class="block">
<h4>Informations générales</h4>
<?php echo template::select('configHomePageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Page d\'accueil',
'selected' => $this->getData(['config', 'homePageId'])
]); ?>
<?php echo template::text('configTitle', [
'label' => 'Titre du site',
'value' => $this->getData(['config', 'title'])
@ -24,10 +30,19 @@
'label' => 'Description du site',
'value' => $this->getData(['config', 'metaDescription'])
]); ?>
<?php echo template::select('configHomePageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Page d\'accueil',
'selected' => $this->getData(['config', 'homePageId'])
]); ?>
<div class="row">
<div class="col6">
<?php echo template::button('configmetaImage', [
'href' => helper::baseUrl() . 'config/metaimage',
'value' => 'Rafraîchir la capture <br /> d\'écran du site'
]); ?>
</div>
<div class="col6">
<p><img src='<?php echo helper::baseUrl(false) . 'site/file/source/screenshot.png';?>' />
</div>
</div>
</div>
<div class="block">
<h4>Options avancées</h4>

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
/*e44d0419e3c5edabe35ea9374ea4638f*/@import url("https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Oswald");body{background-color:rgba(236,239,241,1);font-family:"Open Sans",sans-serif}a{color:rgba(74,105,189,1)}a:hover{color:rgba(59,90,174,1)}body,.row > div{font-size:14px}body,.block h4,input[type='email'],input[type='text'],input[type='password'],.inputFile,select,textarea,.inputFile,.button.buttonGrey,.button.buttonGrey:hover{color:rgba(33, 34, 35, 1)}.container{max-width:1170px}#site{background-color:rgba(255, 255, 255, 1);border-radius:0;box-shadow:0 #212223}.speechBubble,.button,.button:hover,button[type='submit'],.pagination a,.pagination a:hover,input[type='checkbox']:checked + label:before,input[type='radio']:checked + label:before,.helpContent{background-color:rgba(74,105,189,1);color:white}.helpButton span{color:rgba(74,105,189,1)}input[type='text']:hover,input[type='password']:hover,.inputFile:hover,select:hover,textarea:hover{border-color:rgba(74,105,189,1)}.speechBubble:before{border-color:rgba(74,105,189,1) transparent transparent transparent}.button:hover,button[type='submit']:hover,.pagination a:hover,input[type='checkbox']:not(:active):checked:hover + label:before,input[type='checkbox']:active + label:before,input[type='radio']:checked:hover + label:before,input[type='radio']:not(:checked):active + label:before{background-color:rgba(59,90,174,1)}.helpButton span:hover{color:rgba(59,90,174,1)}.button:active,button[type='submit']:active,.pagination a:active{background-color:rgba(54,85,169,1)}h1,h2,h3,h4,h5,h6{color:rgba(74,105,189,1);font-family:"Oswald",sans-serif;font-weight:normal;text-transform:none}header{background-size:auto}header{background-color:rgba(255,255,255,1);height:150px;line-height:150px;text-align:center}@media (max-width: 767px) {header{height:75px;line-height:75px;}}header span{color:rgba(33,34,35,1);font-family:"Oswald",sans-serif;font-weight:normal;font-size:2em;text-transform:none}nav,nav a{background-color:rgba(74,105,189,1)}nav a,#toggle span,nav a:hover{color:rgba(255, 255, 255, 1)}nav a:hover{background-color:rgba(59,90,174,1)}nav a.active{background-color:rgba(54,85,169,1)}#menu{text-align:left}#toggle span,#menu a{padding:15px 10px;font-weight:normal;font-size:1em;text-transform:none}footer{background-color:rgba(255,255,255,1);color:rgba(33, 34, 35, 1)}footer a{color:rgba(33, 34, 35, 1)}footer .container > div{margin:10px 0}#footerSocials{text-align:center}#footerText{text-align:center}#footerCopyright{text-align:center}
/*eb112aa9a53e26e991af5d7ef6788311*/@import url("https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Oswald");body{background-color:rgba(25,58,81,1);font-family:"Open Sans",sans-serif}a{color:rgba(74,105,189,1)}a:hover{color:rgba(59,90,174,1)}body,.row > div{font-size:14px}body,.block h4,input[type='email'],input[type='text'],input[type='password'],.inputFile,select,textarea,.inputFile,.button.buttonGrey,.button.buttonGrey:hover{color:rgba(33, 34, 35, 1)}.container{max-width:1170px}#site{background-color:rgba(255, 255, 255, 1);border-radius:0;box-shadow:0 #212223}.speechBubble,.button,.button:hover,button[type='submit'],.pagination a,.pagination a:hover,input[type='checkbox']:checked + label:before,input[type='radio']:checked + label:before,.helpContent{background-color:rgba(74,105,189,1);color:white}.helpButton span{color:rgba(74,105,189,1)}input[type='text']:hover,input[type='password']:hover,.inputFile:hover,select:hover,textarea:hover{border-color:rgba(74,105,189,1)}.speechBubble:before{border-color:rgba(74,105,189,1) transparent transparent transparent}.button:hover,button[type='submit']:hover,.pagination a:hover,input[type='checkbox']:not(:active):checked:hover + label:before,input[type='checkbox']:active + label:before,input[type='radio']:checked:hover + label:before,input[type='radio']:not(:checked):active + label:before{background-color:rgba(59,90,174,1)}.helpButton span:hover{color:rgba(59,90,174,1)}.button:active,button[type='submit']:active,.pagination a:active{background-color:rgba(54,85,169,1)}h1,h2,h3,h4,h5,h6{color:rgba(74,105,189,1);font-family:"Oswald",sans-serif;font-weight:normal;text-transform:none}header{background-size:auto}header{background-color:rgba(255,255,255,1);height:150px;line-height:150px;text-align:center}@media (max-width: 767px) {header{height:75px;line-height:75px;}}header span{color:rgba(33,34,35,1);font-family:"Oswald",sans-serif;font-weight:normal;font-size:2em;text-transform:none}nav,nav a{background-color:rgba(74,105,189,1)}nav a,#toggle span,nav a:hover{color:rgba(255, 255, 255, 1)}nav a:hover{background-color:rgba(59,90,174,1)}nav a.active{background-color:rgba(54,85,169,1)}#menu{text-align:left}#toggle span,#menu a{padding:15px 10px;font-weight:normal;font-size:1em;text-transform:none}footer{background-color:rgba(255,255,255,1);color:rgba(33, 34, 35, 1)}footer a{color:rgba(33, 34, 35, 1)}footer .container > div{margin:10px 0}#footerSocials{text-align:center}#footerText{text-align:center}#footerCopyright{text-align:center}