update Helper

This commit is contained in:
Jean-Christian Denis 2023-03-26 21:51:23 +02:00
parent 21212c2ec1
commit 740c674b0f
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -15,12 +15,12 @@ declare(strict_types=1);
namespace Dotclear\Plugin\entryPhotoExifWidget; namespace Dotclear\Plugin\entryPhotoExifWidget;
use dcCore; use dcCore;
use Dotclear\Helper\File\Path;
use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsElement; use Dotclear\Plugin\widgets\WidgetsElement;
use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsStack;
use dt; use dt;
use html;
use imageMeta; use imageMeta;
use path;
class Widgets class Widgets
{ {
@ -34,7 +34,7 @@ class Widgets
$categories_combo = ['-' => '', __('Uncategorized') => 'null']; $categories_combo = ['-' => '', __('Uncategorized') => 'null'];
$categories = dcCore::app()->blog->getCategories(); $categories = dcCore::app()->blog->getCategories();
while ($categories->fetch()) { while ($categories->fetch()) {
$cat_title = html::escapeHTML($categories->cat_title); $cat_title = Html::escapeHTML($categories->cat_title);
$categories_combo[$cat_title] = $categories->cat_id; $categories_combo[$cat_title] = $categories->cat_id;
} }
@ -236,7 +236,7 @@ class Widgets
(bool) $w->content_only, (bool) $w->content_only,
'photoExifWidget ' . $w->class, 'photoExifWidget ' . $w->class,
'', '',
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
sprintf(self::$widget_content, $contents) sprintf(self::$widget_content, $contents)
); );
} }
@ -263,7 +263,7 @@ class Widgets
# Loop through images # Loop through images
foreach ($m[1] as $i => $img) { foreach ($m[1] as $i => $img) {
$src = $thb = $alt = false; $src = $thb = $alt = false;
$info = path::info($img); $info = Path::info($img);
$base = $info['base']; $base = $info['base'];
$ext = $info['extension']; $ext = $info['extension'];
@ -365,25 +365,25 @@ class Widgets
# Title # Title
if (!empty($m['Title'])) { if (!empty($m['Title'])) {
$metas['Title'][1] = html::escapeHTML($m['Title']); $metas['Title'][1] = Html::escapeHTML($m['Title']);
} }
# Description # Description
if (!empty($m['Description'])) { if (!empty($m['Description'])) {
if (!empty($m['Title']) && $m['Title'] != $m['Description']) { if (!empty($m['Title']) && $m['Title'] != $m['Description']) {
$metas['Description'][1] = html::escapeHTML($m['Description']); $metas['Description'][1] = Html::escapeHTML($m['Description']);
} }
} }
# Location # Location
if (!empty($m['City'])) { if (!empty($m['City'])) {
$metas['Location'][1] .= html::escapeHTML($m['City']); $metas['Location'][1] .= Html::escapeHTML($m['City']);
} }
if (!empty($m['City']) && !empty($m['country'])) { if (!empty($m['City']) && !empty($m['country'])) {
$metas['Location'][1] .= ', '; $metas['Location'][1] .= ', ';
} }
if (!empty($m['country'])) { if (!empty($m['country'])) {
$metas['Location'][1] .= html::escapeHTML($m['Country']); $metas['Location'][1] .= Html::escapeHTML($m['Country']);
} }
# DateTimeOriginal # DateTimeOriginal
@ -395,17 +395,17 @@ class Widgets
# Make # Make
if (isset($m['Make'])) { if (isset($m['Make'])) {
$metas['Make'][1] = html::escapeHTML($m['Make']); $metas['Make'][1] = Html::escapeHTML($m['Make']);
} }
# Model # Model
if (isset($m['Model'])) { if (isset($m['Model'])) {
$metas['Model'][1] = html::escapeHTML($m['Model']); $metas['Model'][1] = Html::escapeHTML($m['Model']);
} }
# Lens # Lens
if (isset($m['Lens'])) { if (isset($m['Lens'])) {
$metas['Lens'][1] = html::escapeHTML($m['Lens']); $metas['Lens'][1] = Html::escapeHTML($m['Lens']);
} }
# ExposureProgram # ExposureProgram