fix PSR CS
This commit is contained in:
parent
93880688ae
commit
c60ffd8b5a
4 changed files with 118 additions and 158 deletions
|
@ -1,18 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contibutors
|
* @author Jean-Christian Denis and contibutors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once dirname(__FILE__) . '/_widgets.php';
|
||||||
|
|
19
_define.php
19
_define.php
|
@ -1,16 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contibutors
|
* @author Jean-Christian Denis and contibutors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -21,11 +20,11 @@ $this->registerModule(
|
||||||
'Jean-Christian Denis and contibutors',
|
'Jean-Christian Denis and contibutors',
|
||||||
'1.0.4',
|
'1.0.4',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.19']],
|
'requires' => [['core', '2.19']],
|
||||||
'permissions' => 'admin',
|
'permissions' => 'admin',
|
||||||
'type'=> 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/entryPhotoExifWidget',
|
'support' => 'https://github.com/JcDenis/entryPhotoExifWidget',
|
||||||
'details' => 'https://plugins.dotaddict.org/dc2/details/entryPhotoExifWidget',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/entryPhotoExifWidget',
|
||||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/entryPhotoExifWidget/master/dcstore.xml'
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/entryPhotoExifWidget/master/dcstore.xml'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contibutors
|
* @author Jean-Christian Denis and contibutors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/_widgets.php';
|
require_once dirname(__FILE__) . '/_widgets.php';
|
||||||
|
|
239
_widgets.php
239
_widgets.php
|
@ -1,16 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
* @brief entryPhotoExifWidget, a plugin for Dotclear 2
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @package Dotclear
|
||||||
* @subpackage Plugin
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis and contibutors
|
* @author Jean-Christian Denis and contibutors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -19,35 +18,34 @@ $core->addBehavior('initWidgets', ['entryPhotoExifWidget', 'setWidget']);
|
||||||
|
|
||||||
class entryPhotoExifWidget
|
class entryPhotoExifWidget
|
||||||
{
|
{
|
||||||
public static $supported_post_type = array('post', 'page', 'gal', 'galitem');
|
public static $supported_post_type = ['post', 'page', 'gal', 'galitem'];
|
||||||
public static $widget_content = '<ul>%s</ul>';
|
public static $widget_content = '<ul>%s</ul>';
|
||||||
public static $widget_text = '<li class="epew-%s"><strong>%s</strong> %s</li>';
|
public static $widget_text = '<li class="epew-%s"><strong>%s</strong> %s</li>';
|
||||||
public static $widget_thumb = '<li><img class="img-thumbnail" alt="%s" src="%s" /></li>';
|
public static $widget_thumb = '<li><img class="img-thumbnail" alt="%s" src="%s" /></li>';
|
||||||
|
|
||||||
public static function setWidget($w)
|
public static function setWidget($w)
|
||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
|
||||||
$categories_combo = array('-' => '', __('Uncategorized') => 'null');
|
$categories_combo = ['-' => '', __('Uncategorized') => 'null'];
|
||||||
$categories = $core->blog->getCategories();
|
$categories = $core->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$thumbnail_combo = array(
|
$thumbnail_combo = [
|
||||||
__('None') => '',
|
__('None') => '',
|
||||||
__('square') => 'sq',
|
__('square') => 'sq',
|
||||||
__('thumbnail') => 't',
|
__('thumbnail') => 't',
|
||||||
__('small') => 's',
|
__('small') => 's',
|
||||||
__('medium') => 'm'
|
__('medium') => 'm'
|
||||||
);
|
];
|
||||||
|
|
||||||
$w->create(
|
$w->create(
|
||||||
'epew',
|
'epew',
|
||||||
__('Entry Photo Exif'),
|
__('Entry Photo Exif'),
|
||||||
array('entryPhotoExifWidget', 'getWidget'),
|
['entryPhotoExifWidget', 'getWidget'],
|
||||||
null,
|
null,
|
||||||
__('Show images exif of an entry')
|
__('Show images exif of an entry')
|
||||||
);
|
);
|
||||||
|
@ -186,27 +184,23 @@ class entryPhotoExifWidget
|
||||||
global $core, $_ctx;
|
global $core, $_ctx;
|
||||||
|
|
||||||
# Widget is offline
|
# Widget is offline
|
||||||
if ($w->offline)
|
if ($w->offline) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Not in post context
|
# Not in post context
|
||||||
if (!$_ctx->exists('posts') || !$_ctx->posts->post_id)
|
if (!$_ctx->exists('posts') || !$_ctx->posts->post_id) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Not supported post type
|
# Not supported post type
|
||||||
if (!in_array($_ctx->posts->post_type, self::$supported_post_type))
|
if (!in_array($_ctx->posts->post_type, self::$supported_post_type)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Category limit
|
# Category limit
|
||||||
if ($w->category == 'null' && $_ctx->posts->cat_id !== null
|
if ($w->category == 'null' && $_ctx->posts->cat_id !== null
|
||||||
|| $w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id)
|
|| $w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,48 +211,41 @@ class entryPhotoExifWidget
|
||||||
$images = self::getImageSource($core, $text, $w->thumbsize);
|
$images = self::getImageSource($core, $text, $w->thumbsize);
|
||||||
|
|
||||||
# No images
|
# No images
|
||||||
if (empty($images))
|
if (empty($images)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = '';
|
$contents = '';
|
||||||
|
|
||||||
# Loop through images
|
# Loop through images
|
||||||
foreach($images as $img)
|
foreach ($images as $img) {
|
||||||
{
|
|
||||||
# List metas
|
# List metas
|
||||||
$metas = self::getImageMeta($core, $img['source']);
|
$metas = self::getImageMeta($core, $img['source']);
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
foreach($metas as $k => $v)
|
foreach ($metas as $k => $v) {
|
||||||
{
|
|
||||||
# Don't show unwanted metadata or empty metadata
|
# Don't show unwanted metadata or empty metadata
|
||||||
if (!$w->__get('showmeta_' . $k) || !$w->showmeta && empty($v[1]))
|
if (!$w->__get('showmeta_' . $k) || !$w->showmeta && empty($v[1])) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$content .= sprintf(self::$widget_text, $k, $v[0], $v[1]);
|
$content .= sprintf(self::$widget_text, $k, $v[0], $v[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
# No meta
|
# No meta
|
||||||
if (empty($content))
|
if (empty($content)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Thumbnail
|
# Thumbnail
|
||||||
if ($img['thumb'])
|
if ($img['thumb']) {
|
||||||
{
|
$content = sprintf(self::$widget_thumb, $img['title'], $img['thumb']) .
|
||||||
$content = sprintf(self::$widget_thumb, $img['title'], $img['thumb']).
|
|
||||||
$content;
|
$content;
|
||||||
}
|
}
|
||||||
$contents .= $content;
|
$contents .= $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Nothing found
|
# Nothing found
|
||||||
if (empty($contents))
|
if (empty($contents)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,42 +254,39 @@ class entryPhotoExifWidget
|
||||||
$w->content_only,
|
$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)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImageSource($core, $subject, $size='')
|
public static function getImageSource($core, $subject, $size = '')
|
||||||
{
|
{
|
||||||
# Path and url
|
# Path and url
|
||||||
$p_url = $core->blog->settings->system->public_url;
|
$p_url = $core->blog->settings->system->public_url;
|
||||||
$p_site = preg_replace('#^(.+?//.+?)/(.*)$#', '$1', $core->blog->url);
|
$p_site = preg_replace('#^(.+?//.+?)/(.*)$#', '$1', $core->blog->url);
|
||||||
$p_root = $core->blog->public_path;
|
$p_root = $core->blog->public_path;
|
||||||
|
|
||||||
# Image pattern
|
# Image pattern
|
||||||
$pattern = '(?:' . preg_quote($p_site,'/') . ')?' . preg_quote($p_url, '/');
|
$pattern = '(?:' . preg_quote($p_site, '/') . ')?' . preg_quote($p_url, '/');
|
||||||
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|jpeg|png|gif))"[^>]+/msu', $pattern);
|
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|jpeg|png|gif))"[^>]+/msu', $pattern);
|
||||||
|
|
||||||
# No image
|
# No image
|
||||||
if (!preg_match_all($pattern, $subject, $m))
|
if (!preg_match_all($pattern, $subject, $m)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $duplicate = array();
|
$res = $duplicate = [];
|
||||||
$allowed_ext = array('.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.gif', '.GIF');
|
$allowed_ext = ['.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.gif', '.GIF'];
|
||||||
|
|
||||||
# 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'];
|
||||||
|
|
||||||
# Not original
|
# Not original
|
||||||
if (preg_match('/^\.(.+)_(sq|t|s|m)$/', $base, $mbase))
|
if (preg_match('/^\.(.+)_(sq|t|s|m)$/', $base, $mbase)) {
|
||||||
{
|
|
||||||
$base = $mbase[1];
|
$base = $mbase[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,18 +294,16 @@ class entryPhotoExifWidget
|
||||||
$f = $p_root . '/' . $info['dirname'] . '/' . $base;
|
$f = $p_root . '/' . $info['dirname'] . '/' . $base;
|
||||||
|
|
||||||
# Find extension
|
# Find extension
|
||||||
foreach($allowed_ext as $end)
|
foreach ($allowed_ext as $end) {
|
||||||
{
|
if (file_exists($f . $end)) {
|
||||||
if (file_exists($f . $end))
|
|
||||||
{
|
|
||||||
$src = $f . $end;
|
$src = $f . $end;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# No file
|
# No file
|
||||||
if (!$src || in_array($src, $duplicate))
|
if (!$src || in_array($src, $duplicate)) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,26 +311,23 @@ class entryPhotoExifWidget
|
||||||
$duplicate[] = $src;
|
$duplicate[] = $src;
|
||||||
|
|
||||||
# Find thumbnail
|
# Find thumbnail
|
||||||
if (!empty($size))
|
if (!empty($size)) {
|
||||||
{
|
|
||||||
$t = $p_root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.jpg';
|
$t = $p_root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.jpg';
|
||||||
if (file_exists($t))
|
if (file_exists($t)) {
|
||||||
{
|
|
||||||
$thb = $p_url . (dirname($img) != '/' ? dirname($img) : '') . '/.' . $base . '_' . $size . '.jpg';
|
$thb = $p_url . (dirname($img) != '/' ? dirname($img) : '') . '/.' . $base . '_' . $size . '.jpg';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find image description
|
# Find image description
|
||||||
if (preg_match('/alt="([^"]+)"/', $m[0][$i], $malt))
|
if (preg_match('/alt="([^"]+)"/', $m[0][$i], $malt)) {
|
||||||
{
|
|
||||||
$alt = $malt[1];
|
$alt = $malt[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$res[] = array(
|
$res[] = [
|
||||||
'source' => $src,
|
'source' => $src,
|
||||||
'thumb' => $thb,
|
'thumb' => $thb,
|
||||||
'title' => $alt
|
'title' => $alt
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
|
@ -356,24 +335,24 @@ class entryPhotoExifWidget
|
||||||
|
|
||||||
public static function getImageMeta($core, $src)
|
public static function getImageMeta($core, $src)
|
||||||
{
|
{
|
||||||
$metas = array(
|
$metas = [
|
||||||
'Title' => array(__('Title:'), ''),
|
'Title' => [__('Title:'), ''],
|
||||||
'Description' => array(__('Description:'), ''),
|
'Description' => [__('Description:'), ''],
|
||||||
'Location' => array(__('Location:'), ''),
|
'Location' => [__('Location:'), ''],
|
||||||
'DateTimeOriginal' => array(__('Date:'), ''),
|
'DateTimeOriginal' => [__('Date:'), ''],
|
||||||
'Make' => array(__('Manufacturer:'), ''),
|
'Make' => [__('Manufacturer:'), ''],
|
||||||
'Model' => array(__('Model:'), ''),
|
'Model' => [__('Model:'), ''],
|
||||||
'Lens' => array(__('Lens:'), ''),
|
'Lens' => [__('Lens:'), ''],
|
||||||
'ExposureProgram' => array(__('Program:'), ''),
|
'ExposureProgram' => [__('Program:'), ''],
|
||||||
'Exposure' => array(__('Speed:'), ''),
|
'Exposure' => [__('Speed:'), ''],
|
||||||
'FNumber' => array(__('Aperture:'), ''),
|
'FNumber' => [__('Aperture:'), ''],
|
||||||
'ISOSpeedRatings' => array(__('ISO:'), ''),
|
'ISOSpeedRatings' => [__('ISO:'), ''],
|
||||||
'FocalLength' => array(__('Focal:'), ''),
|
'FocalLength' => [__('Focal:'), ''],
|
||||||
'ExposureBiasValue' => array(__('Exposure Bias:'), ''),
|
'ExposureBiasValue' => [__('Exposure Bias:'), ''],
|
||||||
'MeteringMode' => array(__('Metering mode:'), '')
|
'MeteringMode' => [__('Metering mode:'), '']
|
||||||
);
|
];
|
||||||
|
|
||||||
$exp_prog = array(
|
$exp_prog = [
|
||||||
0 => __('Not defined'),
|
0 => __('Not defined'),
|
||||||
1 => __('Manual'),
|
1 => __('Manual'),
|
||||||
2 => __('Normal program'),
|
2 => __('Normal program'),
|
||||||
|
@ -383,9 +362,9 @@ class entryPhotoExifWidget
|
||||||
6 => __('Action program'),
|
6 => __('Action program'),
|
||||||
7 => __('Portait mode'),
|
7 => __('Portait mode'),
|
||||||
8 => __('Landscape mode')
|
8 => __('Landscape mode')
|
||||||
);
|
];
|
||||||
|
|
||||||
$met_mod = array(
|
$met_mod = [
|
||||||
0 => __('Unknow'),
|
0 => __('Unknow'),
|
||||||
1 => __('Average'),
|
1 => __('Average'),
|
||||||
2 => __('Center-weighted average'),
|
2 => __('Center-weighted average'),
|
||||||
|
@ -394,113 +373,97 @@ class entryPhotoExifWidget
|
||||||
5 => __('Pattern'),
|
5 => __('Pattern'),
|
||||||
6 => __('Partial'),
|
6 => __('Partial'),
|
||||||
7 => __('Other')
|
7 => __('Other')
|
||||||
);
|
];
|
||||||
|
|
||||||
if (!$src || !file_exists($src)) return $metas;
|
if (!$src || !file_exists($src)) {
|
||||||
|
return $metas;
|
||||||
|
}
|
||||||
|
|
||||||
$m = imageMeta::readMeta($src);
|
$m = imageMeta::readMeta($src);
|
||||||
|
|
||||||
# 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::escpeHTML($m['Description']);
|
$metas['Description'][1] = html::escpeHTML($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
|
||||||
if (!empty($m['DateTimeOriginal']))
|
if (!empty($m['DateTimeOriginal'])) {
|
||||||
{
|
$dt_ft = $core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format;
|
||||||
$dt_ft = $core->blog->settings->system->date_format . ', ' . $core->blog->settings->system->time_format;
|
$dt_tz = $core->blog->settings->system->blog_timezone;
|
||||||
$dt_tz = $core->blog->settings->system->blog_timezone;
|
|
||||||
$metas['DateTimeOriginal'][1] = dt::dt2str($dt_ft, $m['DateTimeOriginal'], $dt_tz);
|
$metas['DateTimeOriginal'][1] = dt::dt2str($dt_ft, $m['DateTimeOriginal'], $dt_tz);
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
|
||||||
if (isset($m['ExposureProgram']))
|
if (isset($m['ExposureProgram'])) {
|
||||||
{
|
$metas['ExposureProgram'][1] = $exp_prog[$m['ExposureProgram']] ?? $m['ExposureProgram'];
|
||||||
$metas['ExposureProgram'][1] = isset($exp_prog[$m['ExposureProgram']]) ?
|
|
||||||
$exp_prog[$m['ExposureProgram']] : $m['ExposureProgram'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exposure
|
# Exposure
|
||||||
if (!empty($m['Exposure']))
|
if (!empty($m['Exposure'])) {
|
||||||
{
|
|
||||||
$metas['Exposure'][1] = $m['Exposure'] . 's';
|
$metas['Exposure'][1] = $m['Exposure'] . 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
# FNumber
|
# FNumber
|
||||||
if (!empty($m['FNumber']))
|
if (!empty($m['FNumber'])) {
|
||||||
{
|
$ap = sscanf($m['FNumber'], '%d/%d');
|
||||||
$ap = sscanf($m['FNumber'], '%d/%d');
|
$metas['FNumber'][1] = $ap ? 'f/' . ($ap[0] / $ap[1]) : $m['FNumber'];
|
||||||
$metas['FNumber'][1] = $ap ? 'f/' . ( $ap[0] / $ap[1]) : $m['FNumber'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ISOSpeedRatings
|
# ISOSpeedRatings
|
||||||
if (!empty($m['ISOSpeedRatings']))
|
if (!empty($m['ISOSpeedRatings'])) {
|
||||||
{
|
|
||||||
$metas['ISOSpeedRatings'][1] = $m['ISOSpeedRatings'];
|
$metas['ISOSpeedRatings'][1] = $m['ISOSpeedRatings'];
|
||||||
}
|
}
|
||||||
|
|
||||||
# FocalLength
|
# FocalLength
|
||||||
if (!empty($m['FocalLength']))
|
if (!empty($m['FocalLength'])) {
|
||||||
{
|
$fl = sscanf($m['FocalLength'], '%d/%d');
|
||||||
$fl = sscanf($m['FocalLength'], '%d/%d');
|
$metas['FocalLength'][1] = $fl ? $fl[0] / $fl[1] . 'mm' : $m['FocalLength'];
|
||||||
$metas['FocalLength'][1] = $fl ? $fl[0]/$fl[1] . 'mm' : $m['FocalLength'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ExposureBiasValue
|
# ExposureBiasValue
|
||||||
if (isset($m['ExposureBiasValue']))
|
if (isset($m['ExposureBiasValue'])) {
|
||||||
{
|
|
||||||
$metas['ExposureBiasValue'][1] = $m['ExposureBiasValue'];
|
$metas['ExposureBiasValue'][1] = $m['ExposureBiasValue'];
|
||||||
}
|
}
|
||||||
|
|
||||||
# MeteringMode
|
# MeteringMode
|
||||||
if (isset($m['MeteringMode']))
|
if (isset($m['MeteringMode'])) {
|
||||||
{
|
|
||||||
$metas['MeteringMode'][1] = isset($met_mod[$m['MeteringMode']]) ?
|
$metas['MeteringMode'][1] = isset($met_mod[$m['MeteringMode']]) ?
|
||||||
$exp_prog[$m['MeteringMode']] : $m['MeteringMode'];
|
$exp_prog[$m['MeteringMode']] : $m['MeteringMode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $metas;
|
return $metas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue