Fixed some issue

* Fixed PHP Warning when the wiki page is not created
  * Fixed the author and description method
This commit is contained in:
Giuseppe Di Terlizzi 2015-03-30 10:32:15 +02:00
parent 4cc8b6a330
commit 95f02e1bff
2 changed files with 19 additions and 9 deletions

View file

@ -28,7 +28,7 @@ class action_plugin_semantic extends DokuWiki_Action_Plugin {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'json_ld'); $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'json_ld');
} }
if ($this->getConf('useDescription')) { if ($this->getConf('useMetaDescription')) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'meta_description'); $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'meta_description');
} }
@ -64,7 +64,7 @@ class action_plugin_semantic extends DokuWiki_Action_Plugin {
return false; return false;
} }
if (isset($meta['date'])) { if (isset($meta['date']) && $meta['date'] !== '') {
$type = ((isset($meta['semantic']['schema.org']['type'])) $type = ((isset($meta['semantic']['schema.org']['type']))
? $meta['semantic']['schema.org']['type'] ? $meta['semantic']['schema.org']['type']
@ -161,7 +161,11 @@ class action_plugin_semantic extends DokuWiki_Action_Plugin {
$meta = $INFO['meta']; $meta = $INFO['meta'];
if ($meta['date'] && $meta['semantic']['enabled']) { if (isset($meta['semantic']['enabled']) && ! $meta['semantic']['enabled']) {
return false;
}
if (isset($meta['date']) && $meta['date'] !== '') {
$description = str_replace("\n", ' ', trim(ltrim($meta['description']['abstract'], $meta['title']))); $description = str_replace("\n", ' ', trim(ltrim($meta['description']['abstract'], $meta['title'])));
@ -186,9 +190,15 @@ class action_plugin_semantic extends DokuWiki_Action_Plugin {
return false; return false;
} }
if ($this->getConf('useMetaAuthor') && $INFO['perm'] > 0) { if ($INFO['perm'] > 0) {
if ($meta['date'] && $meta['semantic']['enabled']) { $meta = $INFO['meta'];
if (isset($meta['semantic']['enabled']) && ! $meta['semantic']['enabled']) {
return false;
}
if ((isset($meta['date']) && $meta['date'] !== '')) {
$meta = $INFO['meta']; $meta = $INFO['meta'];

View file

@ -1,7 +1,7 @@
base semantic base semantic
author Giuseppe Di Terlizzi author Giuseppe Di Terlizzi
email giuseppe.diterlizzi@gmail.com email giuseppe.diterlizzi@gmail.com
date 2015-03-26 date 2015-03-30
name Semantic Plugin name Semantic Plugin
desc Add Semantic Data in Dokuwiki desc Add Semantic Data in Dokuwiki
url http://www.dokuwiki.org/plugin:semantic url http://www.dokuwiki.org/plugin:semantic