Enhance website module
This commit is contained in:
parent
f904ff5240
commit
a2f9f72973
@ -562,14 +562,12 @@ function getStructuredData($type, $data = array())
|
|||||||
}
|
}
|
||||||
elseif ($type == 'blogpost')
|
elseif ($type == 'blogpost')
|
||||||
{
|
{
|
||||||
if ($websitepage->fk_user_creat > 0)
|
if (! empty($websitepage->author_alias))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
$tmpuser = new User($db);
|
//$tmpuser = new User($db);
|
||||||
$restmpuser = $tmpuser->fetch($websitepage->fk_user_creat);
|
//$restmpuser = $tmpuser->fetch($websitepage->fk_user_creat);
|
||||||
|
|
||||||
if ($restmpuser > 0)
|
|
||||||
{
|
|
||||||
$pageurl = $websitepage->pageurl;
|
$pageurl = $websitepage->pageurl;
|
||||||
$title = $websitepage->title;
|
$title = $websitepage->title;
|
||||||
$image = $websitepage->image;
|
$image = $websitepage->image;
|
||||||
@ -599,7 +597,7 @@ function getStructuredData($type, $data = array())
|
|||||||
"dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'",
|
"dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'",
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": "'.$tmpuser->getFullName($weblangs).'"
|
"name": "'.dol_escape_json($websitepage->author_alias).'"
|
||||||
},
|
},
|
||||||
"publisher": {
|
"publisher": {
|
||||||
"@type": "Organization",
|
"@type": "Organization",
|
||||||
@ -614,7 +612,6 @@ function getStructuredData($type, $data = array())
|
|||||||
$ret .= '</script>'."\n";
|
$ret .= '</script>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elseif ($type == 'product')
|
elseif ($type == 'product')
|
||||||
{
|
{
|
||||||
$ret = '<!-- Add structured data for blog post -->'."\n";
|
$ret = '<!-- Add structured data for blog post -->'."\n";
|
||||||
|
|||||||
2
scripts/website/blogpost-footer.txt
Normal file
2
scripts/website/blogpost-footer.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<!-- Before this is the imported content -->
|
||||||
|
<?php includeContainer('blogpost-footer'); ?>
|
||||||
4
scripts/website/blogpost-header.txt
Normal file
4
scripts/website/blogpost-header.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?php includeContainer('blogpost-header'); ?>
|
||||||
|
<h1><?php echo $websitepage->title ?></h1>
|
||||||
|
|
||||||
|
<!-- After this is the imported content -->
|
||||||
@ -42,7 +42,7 @@ $websiteref = empty($argv[2])?'':$argv[2];
|
|||||||
$joomlaserverinfo = empty($argv[3])?'':$argv[3];
|
$joomlaserverinfo = empty($argv[3])?'':$argv[3];
|
||||||
$image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png';
|
$image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png';
|
||||||
|
|
||||||
$max = empty($argv[4])?'10':$argv[4];
|
$max = (empty($argv[4]) && $argv[4] !== '0')?'10':$argv[4];
|
||||||
|
|
||||||
if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) {
|
if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) {
|
||||||
print '***** '.$script_file.' *****'."\n";
|
print '***** '.$script_file.' *****'."\n";
|
||||||
@ -95,6 +95,19 @@ if (! $resql) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$blogpostheader = file_get_contents($path.'blogpost-header.txt');
|
||||||
|
if ($blogpostheader === false) {
|
||||||
|
print "Error: Failed to load file content of 'blogpost-header.txt'\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
$blogpostfooter = file_get_contents($path.'blogpost-footer.txt');
|
||||||
|
if ($blogpostfooter === false) {
|
||||||
|
print "Error: Failed to load file content of 'blogpost-footer.txt'\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$i = 0; $nbimported = 0; $nbalreadyexists = 0;
|
$i = 0; $nbimported = 0; $nbalreadyexists = 0;
|
||||||
@ -107,12 +120,17 @@ while ($obj = $dbjoomla->fetch_object($resql)) {
|
|||||||
//$description = dol_string_nohtmltag($obj->introtext);
|
//$description = dol_string_nohtmltag($obj->introtext);
|
||||||
$description = trim(dol_trunc(dol_string_nohtmltag($obj->metadesc), 250));
|
$description = trim(dol_trunc(dol_string_nohtmltag($obj->metadesc), 250));
|
||||||
if (empty($description)) $description = trim(dol_trunc(dol_string_nohtmltag($obj->introtext), 250));
|
if (empty($description)) $description = trim(dol_trunc(dol_string_nohtmltag($obj->introtext), 250));
|
||||||
$htmltext = '<section id="mysectionnews" contenteditable="true">'."\n";
|
|
||||||
|
$htmltext = "";
|
||||||
|
if ($blogpostheader) $htmltext .= $blogpostheader."\n";
|
||||||
|
$htmltext .= '<section id="mysectionnews" contenteditable="true">'."\n";
|
||||||
$htmltext .= $obj->introtext;
|
$htmltext .= $obj->introtext;
|
||||||
if ($obj->fulltext) {
|
if ($obj->fulltext) {
|
||||||
$htmltext .= '<br>'."\n".'<hr>'."\n".'<br>'."\n".$obj->fulltext;
|
$htmltext .= '<br>'."\n".'<hr>'."\n".'<br>'."\n".$obj->fulltext;
|
||||||
}
|
}
|
||||||
$htmltext .= "\n</section>";
|
$htmltext .= "\n</section>";
|
||||||
|
if ($blogpostfooter) $htmltext .= "\n".$blogpostfooter;
|
||||||
|
|
||||||
$language = ($obj->language && $obj->language != '*' ? $obj->language : 'en');
|
$language = ($obj->language && $obj->language != '*' ? $obj->language : 'en');
|
||||||
$keywords = $obj->metakey;
|
$keywords = $obj->metakey;
|
||||||
$author_alias = $obj->username;
|
$author_alias = $obj->username;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user