1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Hero cleanup for Bootstrap5. Switched to placeholder images. Admin-ui type 'image' now loads remote URLs correctly.

This commit is contained in:
Cameron 2021-02-26 10:13:07 -08:00
parent d5a4ef57d1
commit cb95b4b243
16 changed files with 80 additions and 53 deletions

View File

@ -4171,7 +4171,7 @@ class e_parse
return null;
}
if(!empty($file))
if(!empty($file) && (strpos($file, 'http') === false))
{
$srcset = null;
$path = null;

View File

@ -5537,8 +5537,9 @@ var_dump($select_options);*/
}
$fileOnly = basename($value);
// Not an image but a file. (media manager)
if(!preg_match("/\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP)$/", $fileOnly) && strpos($fileOnly,'.') !== false)
if(!preg_match("/\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP)/", $fileOnly) && strpos($fileOnly,'.') !== false)
{
$icon = '{e_IMAGE}filemanager/zip_32.png';
$src = $tp->replaceConstants(vartrue($parms['pre']).$icon, 'abs');

View File

@ -39,7 +39,7 @@ class e_media
'application' => array('zip','doc','gz'),
'audio' => array('mp3','wav'),
'image' => array('jpeg','jpg','png','gif', 'svg', 'webp'),
'video' => array('mp4', 'youtube','youtubepl'),
'video' => array('mp4', 'youtube','youtubepl', 'mov'),
'other' => array(),
// 'glyph' => array('glyph')
);
@ -1188,6 +1188,11 @@ class e_media
return $key;
}
if(strpos($mediaURL, 'via.placeholder') !== false)
{
return 'image';
}
return null;
}
@ -1222,7 +1227,7 @@ class e_media
break;
case "image":
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'crop'=>$crop, 'class'=>'image-selector img-responsive img-fluid', 'legacy'=>varset($options['legacyPath'])));
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'crop'=>$crop, 'class'=> varset($options['class'],'image-selector img-responsive img-fluid'), 'legacy'=>varset($options['legacyPath'])));
// $previewURL = $tp->thumbUrl($default, array('w'=>800));
break;

View File

@ -110,12 +110,19 @@ class hero_ui extends e_admin_ui
public function init()
{
// Set drop-down values (if any).
$tp = e107::getParser();
$r = range(1000,10000,1000);
$opts = array();
$opts = array(
'false' => LAN_DISABLED
);
foreach($r as $v)
{
$opts[$v] = str_replace('000', '', $v).' '.LAN_HERO_ADMIN_016;
$x = str_replace('000', '', $v);
$opts[$v] = $tp->lanVars(LAN_HERO_ADMIN_016, $x);
}
$this->prefs['slide_interval']['writeParms']['optArray'] = $opts;

View File

@ -87,11 +87,11 @@ li .hero-list-text {
#carousel-hero.carousel .carousel-indicators li {
vertical-align: top;
display: inline-block;
background-color: #78909c;
background-color: rgba(255,255,255,0.5);
border: none;
border: 0;
height: 3px;
width: 14px;
width: 20px;
margin: 2px;
margin-top: 10px;
border-radius: 2px;
@ -151,7 +151,8 @@ li .hero-list-text {
}
#carousel-hero.carousel .carousel-inner {
overflow: visible
overflow: visible;
height:600px;
}
#carousel-hero.carousel .carousel-inner .item .carousel-caption {
@ -160,7 +161,7 @@ li .hero-list-text {
}
#carousel-hero.carousel .carousel-inner .item {
background-color: #eee;
background-color: rgb(127,127,127);
background-size: cover;
}
@ -184,6 +185,7 @@ li .hero-list-text {
#carousel-hero h2 { font-size: 1.2em}
/* CAROUSEL FADE */
/*
#carousel-hero.carousel-fade .carousel-inner .item {
-webkit-transition-property: opacity;
transition-property: opacity; }
@ -208,6 +210,7 @@ li .hero-list-text {
#carousel-hero.carousel-fade .carousel-control {
z-index: 2; }
*/
/* ANIMATION */
.animation-delay-1 {

View File

@ -13,15 +13,8 @@
if (!defined('e107_INIT')) { exit; }
e107::lan('hero',true, true);
// e107::lan('hero','menu', true);
$text = e107::getParser()->parseTemplate("{HERO}");
e107::getRender()->tablerender(null, $text, 'hero-menu');
if(deftrue('e_FRONTPAGE'))
{
$text = e107::getParser()->parseTemplate("{HERO}", true);
e107::getRender()->tablerender(null, $text, 'hero-menu');
}
elseif(ADMIN)
{
$text = "<div class='alert alert-danger'>".LAN_HERO_MENU_001."</div>";
e107::getRender()->tablerender(null, $text,'hero-menu');
}

View File

@ -34,6 +34,8 @@ class plugin_hero_hero_shortcodes extends e_shortcode
$parm['h'] = e107::getParser()->thumbHeight();
}
return e107::getMedia()->previewTag($this->var['hero_media'], $parm);
// return e107::getParser()->replaceConstants($this->var['hero_media'], 'full');
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

View File

@ -16,12 +16,12 @@ define("LAN_HERO_ADMIN_003", "Background");
define("LAN_HERO_ADMIN_004", "Image/Video");
define("LAN_HERO_ADMIN_005", "Media");
define("LAN_HERO_ADMIN_006", "Label");
define("LAN_HERO_ADMIN_007", "Be sure to enable the hero menu on your home page using the Menu Manager.");
define("LAN_HERO_ADMIN_007", "Be sure to enable the hero menu on your home page using the [Menu Manager].");
define("LAN_HERO_ADMIN_009", "Icon pack");
define("LAN_HERO_ADMIN_010", "Icon-style");
define("LAN_HERO_ADMIN_011", "Slide interval");
define("LAN_HERO_ADMIN_011", "Automated slide interval");
define("LAN_HERO_ADMIN_012", "Text");
define("LAN_HERO_ADMIN_013", "Animation");
define("LAN_HERO_ADMIN_014", "Delay (sec)");
define("LAN_HERO_ADMIN_015", "Button");
define("LAN_HERO_ADMIN_016", "second(s)");
define("LAN_HERO_ADMIN_016", "[x] second(s)");

View File

@ -12,4 +12,4 @@
define("LAN_PLUGIN_HERO_NAME", "Hero");
define("LAN_PLUGIN_HERO_SUMMARY", "Home page 'Hero' area management");
define("LAN_PLUGIN_HERO_DESCRIPTION", "Image and text slider, animated bullet points for the hero area of your home page.");
define("LAN_PLUGIN_HERO_DESCRIPTION", "An image and text slider with animated bullet points for the hero area of your home page.");

View File

@ -1,12 +0,0 @@
<?php
/*
+----------------------------------------------------------------------+
| e107 website content management system Hungarian Language File
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
| Last Modified: 2021/02/21 11:15:44
|
| $Author: Yesszus $
+----------------------------------------------------------------------+
*/
define("LAN_HERO_MENU_001", "Hero only runs on the frontpage of your site.");

View File

@ -9,23 +9,23 @@ if (!defined('e107_INIT')) { exit; }
$HERO_TEMPLATE['default']['header'] = '<!-- Hero Menu: header -->{SETIMAGE: w=400&h=400}
<div id="carousel-hero" class="carousel carousel-fade slide" data-bs-ride="carousel" data-ride="carousel" data-interval="{HERO_SLIDE_INTERVAL}" data-bs-interval="{HERO_SLIDE_INTERVAL}">
<div class="carousel-inner" role="listbox">';
<div class="carousel-inner d-flex" role="listbox">';
$HERO_TEMPLATE['default']['footer'] = '</div><div class="carousel-controls">
<!-- Controls -->
<a class="left carousel-left carousel-control animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="prev" data-bs-slide="prev">
<i class="fa fa-chevron-left fa-fw"></i>
<span class="sr-only">Previous</span>
<span class="sr-only">{LAN=PREVIOUS}</span>
</a>
<a class="right carousel-right carousel-control animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="next" data-bs-slide="next">
<i class="fa fa-chevron-right fa-fw"></i>
<span class="sr-only">Next</span>
<span class="sr-only">{LAN=NEXT}</span>
</a>
<!-- Indicators -->
{HERO_CAROUSEL_INDICATORS: target=carousel-hero&class=animated fadeInUpBig}
</ol>
</div>
</div>';
@ -47,7 +47,7 @@ $HERO_TEMPLATE['default']['end'] = '</ul>
</div>
<div class="col-md-6 ">
<div class="pull-right animated fadeInRight animation-delay-10">
{HERO_MEDIA}
{HERO_MEDIA: class=img-responsive img-fluid d-block w-100}
</div>
</div>
</div>

View File

@ -44,10 +44,10 @@
}
]</field>
<field name="hero_button1">{
"icon": "fa-",
"label": "",
"icon": "fa-arrow-circle-o-down",
"label": "Button",
"url": "",
"class": ""
"class": "primary"
}</field>
<field name="hero_button2">{
"icon": "fa-",
@ -56,8 +56,8 @@
"class": ""
}</field>
<field name="hero_order">0</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide1.jpg</field>
<field name="hero_media">https://via.placeholder.com/800x300.jpg?text=Image+1</field>
<field name="hero_bg"></field>
</item>
<item>
<field name="hero_id">2</field>
@ -113,8 +113,8 @@
"class": ""
}</field>
<field name="hero_order">1</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide2.jpg</field>
<field name="hero_media">https://via.placeholder.com/800x300.jpg?text=Image+2</field>
<field name="hero_bg"></field>
</item>
<item>
<field name="hero_id">3</field>
@ -170,8 +170,8 @@
"class": ""
}</field>
<field name="hero_order">2</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide3.jpg</field>
<field name="hero_media">https://via.placeholder.com/800x300.jpg?text=Image+3</field>
<field name="hero_bg"></field>
</item>
</dbTable>
</database>

View File

@ -340,12 +340,40 @@
{
}
*/
public function testDetectType()
{
$tests = array(
0 => array(
'input' => 'gallery/images/butterfly.jpg',
'expected' => 'image'
),
1 => array(
'input' => 'myfile.mov',
'expected' => 'video'
),
2 => array(
'input' => 'myfile.mp4',
'expected' => 'video'
),
3 => array(
'input' => 'https://via.placeholder.com/728x90.png?text=Label',
'expected' => 'image'
),
);
foreach($tests as $index => $var)
{
$result = $this->md->detectType($var['input']);
$this->assertSame($var['expected'], $result, 'Failed on index #'.$index. ': '.$var['input']);
}
}
/*
public function testGetVideos()
{