mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Bootstrap3 news and search-menu template fixes.
New thumb.php placeholder feature added. New {GLYPH} shortcode added. Usage: {GLYPH=time}
This commit is contained in:
parent
bbb22c140f
commit
5a4d97ca9a
@ -352,13 +352,19 @@ class news_shortcodes extends e_shortcode
|
|||||||
function sc_newsimage($parm = '')
|
function sc_newsimage($parm = '')
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if(!$this->news_item['news_thumbnail'])
|
if(!$this->news_item['news_thumbnail'])
|
||||||
{
|
{
|
||||||
return '';
|
if($parm == 'placeholder')
|
||||||
|
{
|
||||||
|
$src = $tp->thumbUrl(); // placeholder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
elseif($this->news_item['news_thumbnail'][0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change.
|
||||||
|
|
||||||
if($this->news_item['news_thumbnail'][0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change.
|
|
||||||
{
|
{
|
||||||
$src = $tp->thumbUrl($this->news_item['news_thumbnail']);
|
$src = $tp->thumbUrl($this->news_item['news_thumbnail']);
|
||||||
}
|
}
|
||||||
@ -369,6 +375,8 @@ class news_shortcodes extends e_shortcode
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
switch($parm)
|
switch($parm)
|
||||||
{
|
{
|
||||||
case 'src':
|
case 'src':
|
||||||
@ -381,7 +389,7 @@ class news_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
default:
|
default:
|
||||||
return "<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'><img class='news_image news-image img-rounded' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
|
return "<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'><img class='news_image news-image img-responsive img-rounded' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ class cpage_shortcodes extends e_shortcode
|
|||||||
$size = vartrue($options['size'], "");
|
$size = vartrue($options['size'], "");
|
||||||
$inc = ($size) ? " btn-".$size : "";
|
$inc = ($size) ? " btn-".$size : "";
|
||||||
|
|
||||||
return '<a class="cpage btn btn-default'.$inc.'" href="'.$url.'">'.$text.'</a>';
|
return '<a class="cpage btn btn-primary'.$inc.'" href="'.$url.'">'.$text.'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
8
e107_core/shortcodes/single/glyph.php
Normal file
8
e107_core/shortcodes/single/glyph.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function glyph_shortcode($parm = '')
|
||||||
|
{
|
||||||
|
$file = "icon-".$parm.".glyph";
|
||||||
|
return e107::getParser()->toGlyph($file,false);
|
||||||
|
}
|
@ -9,12 +9,12 @@
|
|||||||
$MENU_TEMPLATE['default']['end'] = '';
|
$MENU_TEMPLATE['default']['end'] = '';
|
||||||
|
|
||||||
$MENU_TEMPLATE['button']['start'] = '<div class="cpage-menu">';
|
$MENU_TEMPLATE['button']['start'] = '<div class="cpage-menu">';
|
||||||
$MENU_TEMPLATE['button']['body'] = '{CMENUBODY}{CPAGEBUTTON}';
|
$MENU_TEMPLATE['button']['body'] = '{CMENUBODY}<br />{CPAGEBUTTON}';
|
||||||
$MENU_TEMPLATE['button']['end'] = '</div>';
|
$MENU_TEMPLATE['button']['end'] = '</div>';
|
||||||
|
|
||||||
### Additional control over image thumbnailing is possible via SETIMAGE e.g. {SETIMAGE: w=200&h=150&crop=1}
|
### Additional control over image thumbnailing is possible via SETIMAGE e.g. {SETIMAGE: w=200&h=150&crop=1}
|
||||||
$MENU_TEMPLATE['buttom-image']['start'] = '<div class="cpage-menu">';
|
$MENU_TEMPLATE['buttom-image']['start'] = '<div class="cpage-menu">';
|
||||||
$MENU_TEMPLATE['buttom-image']['body'] = '{CMENUIMAGE}{CPAGEBUTTON}';
|
$MENU_TEMPLATE['buttom-image']['body'] = '{CMENUIMAGE}<br />{CPAGEBUTTON}';
|
||||||
$MENU_TEMPLATE['buttom-image']['end'] = '</div>';
|
$MENU_TEMPLATE['buttom-image']['end'] = '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
@ -1907,12 +1907,13 @@ class e_parse extends e_parser
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $url
|
* Generate an auto-sized Image URL.
|
||||||
* @param $options ??
|
* @param $url - path to image or leave blank for a placeholder.
|
||||||
|
* @param $options - width and height, but leaving this empty and using $this->thumbWidth() and $this->thumbHeight() is preferred. ie. {SETWIDTH: w=x&y=x}
|
||||||
* @param $raw ??
|
* @param $raw ??
|
||||||
* @param $full
|
* @param $full
|
||||||
*/
|
*/
|
||||||
public function thumbUrl($url, $options = array(), $raw = false, $full = false)
|
public function thumbUrl($url=null, $options = array(), $raw = false, $full = false)
|
||||||
{
|
{
|
||||||
if(substr($url,0,3)=="{e_") // Fix for broken links that use {e_MEDIA} etc.
|
if(substr($url,0,3)=="{e_") // Fix for broken links that use {e_MEDIA} etc.
|
||||||
{
|
{
|
||||||
@ -2669,14 +2670,36 @@ class e_parser
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr($text,-6) == '.glyph') // Bootstrap or Font-Awesome.
|
// Bootstrap 3 Glyph names.
|
||||||
|
$bs3 = array(
|
||||||
|
'adjust','align-center','align-justify','align-left','align-right','arrow-down','arrow-left','arrow-right','arrow-up','asterisk','backward','ban-circle','barcode','bell','bold','book
|
||||||
|
','bookmark','briefcase','bullhorn','calendar','camera','certificate','check','chevron-down','chevron-left','chevron-right','chevron-up','circle-arrow-down','circle-arrow-left','circle-arrow-right
|
||||||
|
','circle-arrow-up','cloud','cloud-download','cloud-upload','cog','collapse-down','collapse-up','comment','compressed','copyright-mark','credit-card','cutlery','dashboard','download','download-alt
|
||||||
|
','earphone','edit','eject','envelope','euro','exclamation-sign','expand','export','eye-close','eye-open','facetime-video','fast-backward','fast-forward','file','film','filter','fire','flag
|
||||||
|
','flash','floppy-disk','floppy-open','floppy-remove','floppy-save','floppy-saved','folder-close','folder-open','font','forward','fullscreen','gbp','gift
|
||||||
|
','glass','globe','hand-down','hand-left','hand-right','hand-up','hd-video','hdd','header','headphones','heart','heart-empty','home','import','inbox','indent-left','indent-right','info-sign','italic','leaf','link','list
|
||||||
|
','list-alt','lock','log-in','log-out','magnet','map-marker','minus','minus-sign','move','music','new-window','off','ok','ok-circle','ok-sign','open','paperclip','pause','pencil','phone','phone-alt','picture
|
||||||
|
','plane','play','play-circle','plus','plus-sign','print','pushpin','qrcode','question-sign','random','record','refresh','registration-mark','remove','remove-circle','remove-sign','repeat','resize-full','resize-horizontal
|
||||||
|
','resize-small','resize-vertical','retweet','road','save','saved','screenshot','sd-video','search','send','share','share-alt','shopping-cart','signal','sort','sort-by-alphabet','sort-by-alphabet-alt
|
||||||
|
','sort-by-attributes','sort-by-attributes-alt','sort-by-order','sort-by-order-alt','sound-5-1','sound-6-1','sound-7-1','sound-dolby','sound-stereo','star','stats','step-backward','step-forward','stop
|
||||||
|
','subtitles','tag','tags','tasks','text-height','text-width','th','th-large','th-list','thumbs-down','thumbs-up','time','tint','tower','transfer','trash','tree-conifer','tree-deciduous','unchecked','upload
|
||||||
|
','usd','user','volume-down','volume-off','volume-up','warning-sign','wrench','zoom-in','zoom-out'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if(substr($text,-6) == '.glyph' || strpos($text,".")==false) // Bootstrap or Font-Awesome.
|
||||||
{
|
{
|
||||||
list($cls,$tmp) = explode('.glyph',$text);
|
list($cls,$tmp) = explode('.glyph',$text);
|
||||||
|
$id = str_replace("icon-","",$cls);
|
||||||
|
|
||||||
if(deftrue('FONTAWESOME') == 4) // Convert FontAwesome 3 to 4.
|
if(deftrue('FONTAWESOME') == 4 && !in_array($id ,$bs3)) // Convert FontAwesome 3 to 4.
|
||||||
{
|
{
|
||||||
$cls = str_replace('icon-', 'fa fa-', $cls);
|
$cls = str_replace('icon-', 'fa fa-', $cls);
|
||||||
}
|
}
|
||||||
|
elseif(defset("BOOTSTRAP")===3)
|
||||||
|
{
|
||||||
|
$cls = str_replace('icon-', 'glyphicon glyphicon-', $cls);
|
||||||
|
}
|
||||||
|
|
||||||
$text = (deftrue('BOOTSTRAP') === 3) ? "<span class='".$cls."'></span>" : "<i class='".$cls."'></i>"; // retain space.
|
$text = (deftrue('BOOTSTRAP') === 3) ? "<span class='".$cls."'></span>" : "<i class='".$cls."'></i>"; // retain space.
|
||||||
$text .= ($space !== false) ? $space : "";
|
$text .= ($space !== false) ? $space : "";
|
||||||
|
@ -26,7 +26,7 @@ class emailprint
|
|||||||
// $look = 0 --->display all icons
|
// $look = 0 --->display all icons
|
||||||
// $look = 1 --->display email icon only
|
// $look = 1 --->display email icon only
|
||||||
// $look = 2 --->display print icon only
|
// $look = 2 --->display print icon only
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$text_emailprint = "";
|
$text_emailprint = "";
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ class emailprint
|
|||||||
|
|
||||||
if(deftrue('BOOTSTRAP'))
|
if(deftrue('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
$genericMail = "<i class='icon-envelope'></i>";
|
$genericMail = $tp->toGlyph('icon-envelope',false); // "<i class='icon-envelope'></i>";
|
||||||
$genericPrint = "<i class='icon-print'></i>";
|
$genericPrint = $tp->toGlyph('icon-print',false); // "<i class='icon-print'></i>";
|
||||||
}
|
}
|
||||||
else // BC
|
else // BC
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ if(false === $cached)
|
|||||||
|
|
||||||
$menu .= "</div>";
|
$menu .= "</div>";
|
||||||
$menu .= "<div class='blogcalendar-archive-link' >
|
$menu .= "<div class='blogcalendar-archive-link' >
|
||||||
<a class='blogcalendar-archive-link btn btn-small btn-s btn-default' href='$prefix/archive.php'>".BLOGCAL_L2."</a>
|
<a class='blogcalendar-archive-link btn btn-small btn-s btn-primary' href='$prefix/archive.php'>".BLOGCAL_L2."</a>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ $NEWS_MENU_TEMPLATE['other']['start'] = "<div id='otherNews' data-interval='fal
|
|||||||
<div class='carousel-inner'>
|
<div class='carousel-inner'>
|
||||||
{SETIMAGE: w=400&h=200&crop=1}"; // set the {NEWSIMAGE} dimensions.
|
{SETIMAGE: w=400&h=200&crop=1}"; // set the {NEWSIMAGE} dimensions.
|
||||||
$NEWS_MENU_TEMPLATE['other']['item'] = '<div class="item {ACTIVE}">
|
$NEWS_MENU_TEMPLATE['other']['item'] = '<div class="item {ACTIVE}">
|
||||||
{NEWSIMAGE}
|
{NEWSIMAGE=placeholder}
|
||||||
<h3>{NEWSTITLE}</h3>
|
<h3>{NEWSTITLE}</h3>
|
||||||
<p>{NEWSSUMMARY}</p>
|
<p>{NEWSSUMMARY}</p>
|
||||||
<p class="text-right"><a class="btn btn-default" href="{NEWSURL}">'.LAN_READ_MORE.' »</a></p>
|
<p class="text-right"><a class="btn btn-primary" href="{NEWSURL}">'.LAN_READ_MORE.' »</a></p>
|
||||||
</div>';
|
</div>';
|
||||||
$NEWS_MENU_TEMPLATE['other']['end'] = "</div></div>";
|
$NEWS_MENU_TEMPLATE['other']['end'] = "</div></div>";
|
||||||
|
|
||||||
@ -80,9 +80,9 @@ $NEWS_MENU_TEMPLATE['other']['end'] = "</div></div>";
|
|||||||
$NEWS_MENU_TEMPLATE['other2']['caption'] = TD_MENU_L2;
|
$NEWS_MENU_TEMPLATE['other2']['caption'] = TD_MENU_L2;
|
||||||
$NEWS_MENU_TEMPLATE['other2']['start'] = "<ul class='media-list unstyled othernews2-block'>{SETIMAGE: w=100&h=100&crop=1}"; // set the {NEWSIMAGE} dimensions.
|
$NEWS_MENU_TEMPLATE['other2']['start'] = "<ul class='media-list unstyled othernews2-block'>{SETIMAGE: w=100&h=100&crop=1}"; // set the {NEWSIMAGE} dimensions.
|
||||||
$NEWS_MENU_TEMPLATE['other2']['item'] = "<li class='media'>
|
$NEWS_MENU_TEMPLATE['other2']['item'] = "<li class='media'>
|
||||||
<span class='media-object pull-left'>{NEWSIMAGE}</span>
|
<span class='media-object pull-left'>{NEWSIMAGE=placeholder}</span>
|
||||||
<div class='media-body'><h4>{NEWSTITLELINK}</h4>
|
<div class='media-body'><h4>{NEWSTITLELINK}</h4>
|
||||||
<p class='text-right'><a class='btn btn-default' href='{NEWSURL}'>".LAN_READ_MORE." »</a></p>
|
<p class='text-right'><a class='btn btn-primary' href='{NEWSURL}'>".LAN_READ_MORE." »</a></p>
|
||||||
</div>
|
</div>
|
||||||
</li>\n";
|
</li>\n";
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ $NEWS_TEMPLATE['list']['item'] = '
|
|||||||
<div class="row row-fluid">
|
<div class="row row-fluid">
|
||||||
<div class="span3 col-md-3">
|
<div class="span3 col-md-3">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
{NEWSIMAGE}
|
{NEWSIMAGE=placeholder}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span9 col-md-9">
|
<div class="span9 col-md-9">
|
||||||
@ -53,6 +53,7 @@ $NEWS_TEMPLATE['list']['item'] = '
|
|||||||
|
|
||||||
// XXX As displayed by news.php (no query) or news.php?list.1.1 (ie. regular view of a particular category)
|
// XXX As displayed by news.php (no query) or news.php?list.1.1 (ie. regular view of a particular category)
|
||||||
//XXX TODO GEt this looking good in the default Bootstrap theme.
|
//XXX TODO GEt this looking good in the default Bootstrap theme.
|
||||||
|
/*
|
||||||
$NEWS_TEMPLATE['default']['item'] = '
|
$NEWS_TEMPLATE['default']['item'] = '
|
||||||
{SETIMAGE: w=400}
|
{SETIMAGE: w=400}
|
||||||
<div class="view-item">
|
<div class="view-item">
|
||||||
@ -71,8 +72,29 @@ $NEWS_TEMPLATE['default']['item'] = '
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
*/
|
||||||
|
|
||||||
|
$NEWS_TEMPLATE['default']['item'] = '
|
||||||
|
{SETIMAGE: w=900&h=300}
|
||||||
|
<h2>{NEWSTITLE}</h2>
|
||||||
|
<p class="lead">by {NEWSAUTHOR}</p>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">{GLYPH=time} Posted on {NEWSDATE=short}</div>
|
||||||
|
<div class="col-md-6 text-right options">{GLYPH=tags} {NEWSTAGS} {GLYPH=comments} {NEWSCOMMENTCOUNT} {EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
{NEWSIMAGE=placeholder}
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<p class="lead">{NEWSSUMMARY}</p>
|
||||||
|
{NEWSBODY}
|
||||||
|
<hr>
|
||||||
|
<div class="options">
|
||||||
|
<span class="category">Category: {NEWSCATEGORY}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,17 +109,25 @@ $NEWS_TEMPLATE['view']['item'] = '
|
|||||||
{SETIMAGE: w=800}
|
{SETIMAGE: w=800}
|
||||||
<div class="view-item">
|
<div class="view-item">
|
||||||
<h2>{NEWSTITLE}</h2>
|
<h2>{NEWSTITLE}</h2>
|
||||||
<small class="muted">
|
<p class="lead">by {NEWSAUTHOR}</p>
|
||||||
<span class="date">{NEWSDATE=short} by <span class="author">{NEWSAUTHOR}</span></span>
|
<hr>
|
||||||
</small>
|
<div class="row">
|
||||||
|
<div class="col-md-6">{GLYPH=time} Posted on {NEWSDATE=short}</div>
|
||||||
|
<div class="col-md-6 text-right">{GLYPH=tags} {NEWSTAGS} {GLYPH=comments} {NEWSCOMMENTCOUNT} {EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
{NEWSIMAGE=placeholder}
|
||||||
|
<hr>
|
||||||
|
<p class="lead">{NEWSSUMMARY}</p>
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
{NEWSIMAGE}
|
|
||||||
{NEWSBODY}
|
{NEWSBODY}
|
||||||
{EXTENDED}
|
{EXTENDED}
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<span class="category">{NEWSCATEGORY}</span> {NEWSTAGS} {NEWSCOMMENTS} {EMAILICON} {PRINTICON} {PDFICON} {ADMINOPTIONS}
|
<span class="category">Category: {NEWSCATEGORY}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
@ -41,12 +41,15 @@ if (strstr(e_PAGE, "news.php")) {
|
|||||||
$page = 99;
|
$page = 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($custom_query[1]) && $custom_query[1] != '') {
|
if (isset($custom_query[1]) && $custom_query[1] != '')
|
||||||
$image_file = ($custom_query[1] != 'default') ? $custom_query[1] : e_PLUGIN_ABS.'search_menu/images/search.png';
|
{
|
||||||
$width = (isset($custom_query[2]) && $custom_query[2]) ? $custom_query[2] : '16';
|
$image_file = ($custom_query[1] != 'default') ? $custom_query[1] : e_PLUGIN_ABS.'search_menu/images/search.png';
|
||||||
$height = (isset($custom_query[3]) && $custom_query[3]) ? $custom_query[3] : '16';
|
$width = (isset($custom_query[2]) && $custom_query[2]) ? $custom_query[2] : '16';
|
||||||
$search_button = "<input type='image' src='".$image_file."' value='".LAN_180."' style='width: ".$width."px; height: ".$height."px; border: 0px; vertical-align: middle' name='s' />";
|
$height = (isset($custom_query[3]) && $custom_query[3]) ? $custom_query[3] : '16';
|
||||||
} else {
|
$search_button = "<input type='image' src='".$image_file."' value='".LAN_180."' style='width: ".$width."px; height: ".$height."px; border: 0px; vertical-align: middle' name='s' />";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$search_button = "<input class='btn button search' type='submit' name='s' value='".LAN_180."' />";
|
$search_button = "<input class='btn button search' type='submit' name='s' value='".LAN_180."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,19 +59,53 @@ if (isset($custom_query[5]) && $custom_query[5]) {
|
|||||||
$value_text = "value=''";
|
$value_text = "value=''";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "<form class='form-inline' method='get' action='".e_HTTP."search.php'>
|
|
||||||
|
|
||||||
|
if(deftrue('BOOTSTRAP'))
|
||||||
|
{
|
||||||
|
$text = '
|
||||||
|
<form class="form-inline" method="get" action="'.e_HTTP.'search.php">
|
||||||
|
<div class="input-group">
|
||||||
|
<input class="form-control search" type="text" name="q" size="20" maxlength="50" '.$value_text.'>
|
||||||
|
<input type="hidden" name="r" value="0" />';
|
||||||
|
|
||||||
|
if (isset($custom_query[4]) && $custom_query[4] != '')
|
||||||
|
{
|
||||||
|
$text .= "<input type='hidden' name='ref' value='".$custom_query[4]."' />";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= '
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-default" type="submit" name="s"><span class="glyphicon glyphicon-search"></span></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>';
|
||||||
|
}
|
||||||
|
else // Legacy v1 code.
|
||||||
|
{
|
||||||
|
$text = "<form class='form-inline' method='get' action='".e_HTTP."search.php'>";
|
||||||
|
|
||||||
|
$text .= "
|
||||||
<div>
|
<div>
|
||||||
<input class='tbox search' type='text' name='q' size='20' ".$value_text." maxlength='50' />
|
<input class='tbox search' type='text' name='q' size='20' ".$value_text." maxlength='50' />
|
||||||
<input type='hidden' name='r' value='0' />";
|
<input type='hidden' name='r' value='0' />";
|
||||||
|
|
||||||
if (isset($custom_query[4]) && $custom_query[4] != '') {
|
|
||||||
|
|
||||||
|
if (isset($custom_query[4]) && $custom_query[4] != '')
|
||||||
|
{
|
||||||
$text .= "<input type='hidden' name='ref' value='".$custom_query[4]."' />";
|
$text .= "<input type='hidden' name='ref' value='".$custom_query[4]."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= $search_button."
|
$text .= $search_button."
|
||||||
</div>
|
</div>
|
||||||
</form>";
|
</form>";
|
||||||
if (isset($searchflat) && $searchflat) {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($searchflat) && $searchflat)
|
||||||
|
{
|
||||||
echo $text;
|
echo $text;
|
||||||
} else {
|
} else {
|
||||||
$ns->tablerender(LAN_180." ".SITENAME, "<div style='text-align:center'>".$text."</div>", 'search');
|
$ns->tablerender(LAN_180." ".SITENAME, "<div style='text-align:center'>".$text."</div>", 'search');
|
||||||
|
@ -9,7 +9,12 @@ body {
|
|||||||
padding-top:20px;
|
padding-top:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.alert { margin-top:20px }
|
.alert {
|
||||||
|
margin-top:20px
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Sign in Page */
|
/* Sign in Page */
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
<custompages>/news</custompages>
|
<custompages>/news</custompages>
|
||||||
<menuPresets>
|
<menuPresets>
|
||||||
<area id='1'>
|
<area id='1'>
|
||||||
|
<menu name='search' />
|
||||||
|
<menu name='news_categories' />
|
||||||
<menu name='other_news' />
|
<menu name='other_news' />
|
||||||
<menu name='other_news2' />
|
<menu name='other_news2' />
|
||||||
<menu name='news_categories' />
|
|
||||||
<menu name='blogcalendar' />
|
<menu name='blogcalendar' />
|
||||||
</area>
|
</area>
|
||||||
</menuPresets>
|
</menuPresets>
|
||||||
|
53
thumb.php
53
thumb.php
@ -68,6 +68,8 @@ class e_thumbpage
|
|||||||
/** Stores watermark prefs
|
/** Stores watermark prefs
|
||||||
*/
|
*/
|
||||||
protected $_watermark = array();
|
protected $_watermark = array();
|
||||||
|
|
||||||
|
private $_placeholder = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor - init paths
|
* Constructor - init paths
|
||||||
@ -163,9 +165,10 @@ class e_thumbpage
|
|||||||
|
|
||||||
function checkSrc()
|
function checkSrc()
|
||||||
{
|
{
|
||||||
if(!vartrue($this->_request['src']))
|
if(!vartrue($this->_request['src'])) // display placeholder when src is missing.
|
||||||
{
|
{
|
||||||
return false;
|
$this->_placeholder = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@ -195,6 +198,11 @@ class e_thumbpage
|
|||||||
$this->_src_path = $path;
|
$this->_src_path = $path;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->_placeholder = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// echo "path=".$path."<br />";
|
// echo "path=".$path."<br />";
|
||||||
return false;
|
return false;
|
||||||
@ -203,6 +211,18 @@ class e_thumbpage
|
|||||||
function sendImage()
|
function sendImage()
|
||||||
{
|
{
|
||||||
//global $bench;
|
//global $bench;
|
||||||
|
|
||||||
|
if($this->_placeholder == true)
|
||||||
|
{
|
||||||
|
$width = ($this->_request['aw']) ? $this->_request['aw'] : $this->_request['w'];
|
||||||
|
$height = ($this->_request['ah']) ? $this->_request['ah'] : $this->_request['h'];
|
||||||
|
|
||||||
|
$parm = array('size' => $width."x".$height);
|
||||||
|
|
||||||
|
$this->placeholder($parm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->_src_path)
|
if(!$this->_src_path)
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
@ -214,6 +234,8 @@ class e_thumbpage
|
|||||||
$cache_str = md5(serialize($options).$this->_src_path);
|
$cache_str = md5(serialize($options).$this->_src_path);
|
||||||
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
|
if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
|
||||||
{
|
{
|
||||||
$thumbnfo['lmodified'] = filemtime(e_CACHE_IMAGE.$fname);
|
$thumbnfo['lmodified'] = filemtime(e_CACHE_IMAGE.$fname);
|
||||||
@ -237,6 +259,7 @@ class e_thumbpage
|
|||||||
|
|
||||||
@readfile(e_CACHE_IMAGE.$fname);
|
@readfile(e_CACHE_IMAGE.$fname);
|
||||||
//$bench->end()->logResult('thumb.php', $_GET['src'].' - retrieve cache');
|
//$bench->end()->logResult('thumb.php', $_GET['src'].' - retrieve cache');
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +290,7 @@ class e_thumbpage
|
|||||||
{
|
{
|
||||||
$thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
|
$thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watermark Option - See admin->MediaManager->prefs for details.
|
// Watermark Option - See admin->MediaManager->prefs for details.
|
||||||
|
|
||||||
if($this->_watermark['activate'] < $options['w']
|
if($this->_watermark['activate'] < $options['w']
|
||||||
@ -282,11 +305,15 @@ class e_thumbpage
|
|||||||
|
|
||||||
$thumb->WatermarkText($this->_watermark);
|
$thumb->WatermarkText($this->_watermark);
|
||||||
}
|
}
|
||||||
|
// echo "hello";
|
||||||
|
|
||||||
|
|
||||||
|
//exit;
|
||||||
|
|
||||||
// set cache
|
// set cache
|
||||||
$thumb->save(e_CACHE_IMAGE.$fname);
|
$thumb->save(e_CACHE_IMAGE.$fname);
|
||||||
|
|
||||||
|
|
||||||
// show thumb
|
// show thumb
|
||||||
$thumb->show();
|
$thumb->show();
|
||||||
}
|
}
|
||||||
@ -333,6 +360,8 @@ class e_thumbpage
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function ctype($ftype)
|
public static function ctype($ftype)
|
||||||
{
|
{
|
||||||
static $known_types = array(
|
static $known_types = array(
|
||||||
@ -350,6 +379,20 @@ class e_thumbpage
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Display a placeholder image.
|
||||||
|
function placeholder($parm)
|
||||||
|
{
|
||||||
|
$getsize = isset($parm['size']) ? $parm['size'] : '100x100';
|
||||||
|
$dimensions = explode('x', $getsize);
|
||||||
|
|
||||||
|
header('location: http://placehold.it/'.$getsize);
|
||||||
|
header('Content-Length: 0');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user