Skip to content
GitLab
Erkunden
Anmelden
Registrieren
Primärnavigation
Suchen oder aufrufen …
Projekt
QUIQQER Smarty v3
Verwalten
Aktivität
Mitglieder
Labels
Planen
Wiki
Code
Merge Requests
0
Repository
Branch
Commits
Tags
Repository-Diagramm
Revisionen vergleichen
Build
Pipelines
Aufgaben
Pipeline-Zeitpläne
Artefakte
Bereitstellung
Releases
Betreiben
Umgebungen
Analysieren
Wertschöpfungskettenanalyse
Mitwirkenden-Analyse
CI/CD-Analyse
Repository-Analysen
Hilfe
Hilfe
Support
GitLab-Dokumentation
GitLab-Pläne vergleichen
Community-Forum
Zu GitLab beitragen
Feedback geben
Tastenkürzel
?
Code-Schnipsel
Gruppen
Projekte
Show more breadcrumbs
QUIQQER
QUIQQER Smarty v3
Commits
20a9e22c
Commit
20a9e22c
erstellt
vor 1 Jahr
von
Henning Leutz
Dateien durchsuchen
Optionen
Downloads
Patches
Einfaches Diff
feat: support of new video quiqqer class
Übergeordneter
08163142
No related branches found
Branches enthält Commit
No related tags found
Tags enthält Commit
2 Merge Requests
!7
Next
,
!6
Dev
Pipeline
#5180
fehlgeschlagen mit Phase
Phase:
in 12 Sekunden
Änderungen
2
Pipelines
1
Leerzeichenänderungen ausblenden
Inline
Nebeneinander
2 geänderte Dateien
Quiqqer/Engine/plugins_qui/function.image.php
+46
-32
46 Ergänzungen, 32 Löschungen
Quiqqer/Engine/plugins_qui/function.image.php
composer.json
+1
-1
1 Ergänzung, 1 Löschung
composer.json
werden angezeigt
mit
47 Ergänzungen
und
33 Löschungen
Quiqqer/Engine/plugins_qui/function.image.php
+
46
−
32
Zeige Datei @
20a9e22c
<?php
/**
* Smarty plugin
*
* @package com.pcsg.pms.smarty
* @subpackage plugins
*/
use
QUI\Projects\Media\Image
;
use
QUI\Projects\Media\Video
;
/**
* Smarty {image} function plugin
*
...
...
@@ -7,17 +17,19 @@
* Name: image<br>
*
* @param array $params
* @param Smarty $smarty
* @param Smarty
_Internal_Template
$smarty
*
* @return string
*
* @throws Exception
*
* @event onSmartyImageBegin [array &$params]
* @event onSmartyImageEnd [string &$imageString]
* @event onSmartyImageBeforeSource [string &$src]
* @author www.pcsg.de (Henning Leutz)
*
* @author www.pcsg.de (Henning Leutz)
*/
function
smarty_function_image
(
$params
,
$smarty
)
function
smarty_function_image
(
array
$params
,
Smarty_Internal_Template
$smarty
):
string
{
// defaults
if
(
!
isset
(
$params
[
'type'
]))
{
...
...
@@ -70,8 +82,12 @@ function smarty_function_image($params, $smarty)
// Image Params
if
(
strpos
(
$params
[
'src'
],
'image.php'
)
===
false
)
{
if
((
isset
(
$params
[
'onlyicon'
])
||
!
isset
(
$params
[
'onlyicon'
])
&&
!
isset
(
$params
[
'onlysrc'
])
||
isset
(
$params
[
'onlysrc'
])
&&
!
$params
[
'onlysrc'
])
$onlySrcCheck
=
(
isset
(
$params
[
'onlyicon'
])
||
!
isset
(
$params
[
'onlyicon'
])
&&
!
isset
(
$params
[
'onlysrc'
])
||
isset
(
$params
[
'onlysrc'
])
&&
!
$params
[
'onlysrc'
]);
if
(
$onlySrcCheck
&&
QUI\Icons\Handler
::
getInstance
()
->
isIcon
(
$params
[
'src'
])
)
{
return
smarty_plugin_image_assign
(
...
...
@@ -90,7 +106,7 @@ function smarty_function_image($params, $smarty)
QUI\System\Log
::
LEVEL_WARNING
,
[
'smarty'
=>
'{image}'
,
'image'
=>
$params
[
'src'
]
'image'
=>
$params
[
'src'
]
]
);
...
...
@@ -101,7 +117,7 @@ function smarty_function_image($params, $smarty)
return
smarty_plugin_image_assign
(
$params
,
''
,
$smarty
);
}
$src
=
str_replace
(
'&'
,
'&'
,
$params
[
'src'
]);
$src
=
str_replace
(
'&'
,
'&'
,
$params
[
'src'
]);
$attributes
=
QUI\Utils\StringHelper
::
getUrlAttributes
(
$src
);
if
(
!
isset
(
$attributes
[
'id'
])
||
!
isset
(
$attributes
[
'project'
]))
{
...
...
@@ -118,9 +134,9 @@ function smarty_function_image($params, $smarty)
try
{
$Project
=
QUI
::
getProject
(
$attributes
[
'project'
]);
$Media
=
$Project
->
getMedia
();
$Media
=
$Project
->
getMedia
();
/* @param $Image
\QUI\Projects\Media\
Image */
/* @param $Image Image */
$Image
=
$Media
->
get
((
int
)
$attributes
[
'id'
]);
}
catch
(
Exception
$Exception
)
{
QUI\System\Log
::
addNotice
(
...
...
@@ -155,8 +171,7 @@ function smarty_function_image($params, $smarty)
return
smarty_plugin_image_assign
(
$params
,
''
,
$smarty
);
}
/* @var $Image \QUI\Projects\Media\Image */
/* @var $Image Image */
// Falls das Objekt gewünscht ist
if
(
isset
(
$params
[
'assign'
])
&&
isset
(
$params
[
'object'
]))
{
$smarty
->
assign
(
$params
[
'assign'
],
$Image
);
...
...
@@ -164,18 +179,17 @@ function smarty_function_image($params, $smarty)
return
''
;
}
if
(
$Image
->
getType
()
!=
'QUI\Projects\Media\Image'
)
{
// @todo video type einführen
if
(
$Image
->
getType
()
!==
Image
::
class
||
$Image
->
getType
()
===
Video
::
class
)
{
$mimeType
=
$Image
->
getAttribute
(
'mime_type'
);
$html
=
''
;
$html
=
''
;
if
(
strpos
(
$mimeType
,
'video/'
)
===
0
)
{
$width
=
''
;
$height
=
''
;
$controls
=
''
;
$autoplay
=
''
;
$loop
=
''
;
$muted
=
''
;
$width
=
''
;
$height
=
''
;
$controls
=
''
;
$autoplay
=
''
;
$loop
=
''
;
$muted
=
''
;
$playsinline
=
''
;
$style
=
''
;
...
...
@@ -208,10 +222,10 @@ function smarty_function_image($params, $smarty)
}
if
(
!
empty
(
$params
[
'style'
]))
{
$style
=
'style="'
.
$params
[
'style'
]
.
'"'
;
$style
=
'style="'
.
$params
[
'style'
]
.
'"'
;
}
$src
=
$Image
->
getUrl
(
true
);
$src
=
$Image
->
getUrl
(
true
);
$type
=
''
;
if
(
strpos
(
$src
,
'.mp4'
))
{
...
...
@@ -223,8 +237,8 @@ function smarty_function_image($params, $smarty)
}
$html
=
'
<video width="'
.
$width
.
'" height="'
.
$height
.
'" '
.
$controls
.
' '
.
$autoplay
.
' '
.
$loop
.
' '
.
$muted
.
' '
.
$playsinline
.
' '
.
$style
.
' >
<source src="'
.
$src
.
'" type="'
.
$type
.
'" />
<video width="'
.
$width
.
'" height="'
.
$height
.
'" '
.
$controls
.
' '
.
$autoplay
.
' '
.
$loop
.
' '
.
$muted
.
' '
.
$playsinline
.
' '
.
$style
.
' >
<source src="'
.
$src
.
'" type="'
.
$type
.
'" />
Your browser does not support the video tag.
</video>
'
;
...
...
@@ -241,12 +255,12 @@ function smarty_function_image($params, $smarty)
$params
[
'width'
]
=
false
;
}
$maxWidth
=
''
;
$maxWidth
=
''
;
$maxHeight
=
''
;
$ratio
=
false
;
try
{
$maxWidth
=
$Image
->
getWidth
();
$maxWidth
=
$Image
->
getWidth
();
$maxHeight
=
$Image
->
getHeight
();
if
(
$maxWidth
&&
$maxHeight
)
{
...
...
@@ -279,7 +293,7 @@ function smarty_function_image($params, $smarty)
default
:
case
'resize'
:
try
{
$src
=
$Image
->
createResizeCache
(
$params
[
'width'
],
$params
[
'height'
]);
$src
=
$Image
->
createResizeCache
(
$params
[
'width'
],
$params
[
'height'
]);
$resizeData
=
$Image
->
getResizeSize
(
$params
[
'width'
],
$params
[
'height'
]);
if
(
$resizeData
[
'width'
]
<
$params
[
'width'
])
{
...
...
@@ -355,12 +369,12 @@ function smarty_function_image($params, $smarty)
return
smarty_plugin_image_assign
(
$params
,
$src
,
$smarty
);
}
$src
=
str_replace
(
CMS_DIR
,
URL_DIR
,
$src
);
$src
=
str_replace
(
CMS_DIR
,
URL_DIR
,
$src
);
$host
=
false
;
if
(
isset
(
$params
[
'host'
])
&&
$params
[
'host'
]
==
1
)
{
$host
=
$Image
->
getMedia
()
->
getProject
()
->
getVHost
(
true
,
true
);
$src
=
$host
.
$src
;
$src
=
$host
.
$src
;
}
if
(
isset
(
$params
[
'onlysrc'
]))
{
...
...
@@ -379,7 +393,7 @@ function smarty_function_image($params, $smarty)
}
$attributes
=
[];
$filter
=
\
array_flip
([
$filter
=
array_flip
([
'src'
,
'type'
,
'reflection'
,
...
...
@@ -425,11 +439,11 @@ function smarty_function_image($params, $smarty)
*
* @param array $params
* @param string $str
* @param Smarty $smarty
* @param Smarty
_Internal_Template
$smarty
*
* @return string
*/
function
smarty_plugin_image_assign
(
$params
,
$str
,
$smarty
)
function
smarty_plugin_image_assign
(
array
$params
,
string
$str
,
Smarty_Internal_Template
$smarty
):
string
{
if
(
!
isset
(
$params
[
'assign'
]))
{
return
$str
;
...
...
This diff is collapsed.
Zum Erweitern klicken.
composer.json
+
1
−
1
Zeige Datei @
20a9e22c
...
...
@@ -16,7 +16,7 @@
"require"
:
{
"php"
:
"5.*|7.*|8.*"
,
"smarty\/smarty"
:
"3.*"
,
"quiqqer\/quiqqer"
:
"^1.
4.3
|dev-master|dev-dev"
,
"quiqqer\/quiqqer"
:
"^1.
9
|dev-master|dev-dev"
,
"quiqqer\/utils"
:
"^1.4|dev-master|dev-dev"
,
"quiqqer\/bricks"
:
"^1.3|*@dev"
},
...
...
This diff is collapsed.
Zum Erweitern klicken.
Vorschau
0%
Wiederholen
oder
Neue Datei anhängen
.
Abbrechen
You are about to add
0
people
to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Kommentar speichern
Abbrechen
Bitte
registrieren
oder
Anmelden
zum Kommentieren