本文整理汇总了PHP中eHelper::scDualParams方法的典型用法代码示例。如果您正苦于以下问题:PHP eHelper::scDualParams方法的具体用法?PHP eHelper::scDualParams怎么用?PHP eHelper::scDualParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eHelper
的用法示例。
在下文中一共展示了eHelper::scDualParams方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_faq_question
function sc_faq_question($parm = '')
{
$tp = e107::getParser();
$parm = eHelper::scDualParams($parm);
$param = $parm[1];
$params = $parm[2];
$new = e107::pref('faqs', 'new', 3);
$newDate = strtotime($new . " days ago");
$faqNew = $this->var['faq_datestamp'] > $newDate ? " faq-new" : "";
if ($param == 'expand' && !empty($this->var['faq_answer'])) {
$id = "faq_" . $this->var['faq_id'];
$url = e107::url('faqs', 'item', $this->var, 'full');
$question = $tp->toHTML($this->var['faq_question'], true, 'TITLE');
$hide = $this->item != $this->var['faq_id'] ? 'e-hideme' : '';
$text = "\n\t\t\t<a class='e-expandit faq-question{$faqNew}' href='#{$id}'>" . $question . "</a>\n\t\t\t<div id='{$id}' class='" . $hide . " faq-answer faq_answer clearfix {$faqNew}'>";
$text .= $tp->toHTML($this->var['faq_answer'], true, 'BODY');
$text .= "<div class='faq-extras'>";
if (vartrue($params['tags']) && $this->var['faq_tags']) {
$text .= "<div class='faq-tags'>" . LAN_FAQS_TAGS . ": " . $this->sc_faq_tags() . "</div>";
}
if ($this->datestamp == true) {
$text .= "<div class='faq-datestamp'>" . $tp->toDate($this->var['faq_datestamp']) . "</div>";
}
if ($this->share == true) {
$text .= "<div class='faq-share'>" . $tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=" . $url . "&title=" . $question . "&tags=" . $this->var['faq_tags'] . "}", true) . "</div>";
}
$text .= "</div></div>\n\t\t\t";
} else {
$text = $tp->toHTML($this->var['faq_question'], true, 'BODY');
}
return $text;
}
示例2: url_shortcode
/**
* Example usage (valid news data + option for full URL)
* {URL=news/view/item|news_id=1&news_sef=sef-string&category_id=1&category_sef=category-sef&options[full]=1}
*/
function url_shortcode($parm)
{
list($route, $parms) = eHelper::scDualParams($parm);
if (empty($route)) {
return '';
}
$options = array();
if (isset($parms['options'])) {
$options = $parms['options'];
unset($parms['options']);
}
return e107::getUrl()->create($route, $parms, $options);
}
示例3: toHTML
/**
* Translate to <h*> tag
*/
function toHTML($code_text, $parm)
{
$code_text = trim($code_text);
if (empty($code_text)) {
return '';
}
$bparms = eHelper::scDualParams($parm);
$h = 'h' . ($bparms[1] ? intval($bparms[1]) : 2);
$parms = $bparms[2];
unset($bparms);
$class = " " . e107::getBB()->getClass('h2');
// consistent classes across all themes.
$id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
$style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
return "<{$h}{$id}{$class}{$style}>" . $code_text . "</{$h}>";
}
示例4: sc_newsthumbnail
/**
* Auto-thumbnailing now allowed.
* New sc parameter standards
* Exampes:
* - {NEWSTHUMBNAIL=link|w=200} render link with thumbnail max width 200px
* - {NEWSTHUMBNAIL=|w=200} same as above
* - {NEWSTHUMBNAIL=src|aw=200&ah=200} return thumb link only, size forced to 200px X 200px (smart thumbnailing close to how Facebook is doing it)
*
* First parameter values: link|src|tag
* Second parameter format: aw|w=xxx&ah|ah=xxx
*
* @see eHelper::scDualParams()
* @see eHelper::scParams()
* XXX Also returns Video thumbnails.
*/
function sc_newsthumbnail($parm = '')
{
$tmp = $this->handleMultiple($parm, 'all');
$newsThumb = $tmp['file'];
$class = 'news-thumbnail-' . $tmp['count'];
if (!$newsThumb && $parm != 'placeholder') {
return '';
}
if ($vThumb = e107::getParser()->toVideo($newsThumb, array('thumb' => 'src'))) {
$src = $vThumb;
$_src = '#';
} else {
$parms = eHelper::scDualParams($parm);
if (empty($parms[2])) {
$parms[2] = array('aw' => e107::getParser()->thumbWidth(), 'ah' => e107::getParser()->thumbHeight());
}
if (isset($parms[2]['legacy']) && $parms[2]['legacy'] == true) {
if ($newsThumb[0] != '{') {
$newsThumb = '{e_IMAGE}newspost_images/' . $newsThumb;
}
$tmp = str_replace('newspost_images/thumb_', 'newspost_images/', $newsThumb);
// swap out thumb for image.
if (is_readable(e_IMAGE . $tmp)) {
$newsThumb = $tmp;
}
unset($parms[2]);
}
// We store SC path in DB now + BC
$_src = $src = $newsThumb[0] == '{' || $parms[1] == 'placeholder' ? e107::getParser()->replaceConstants($newsThumb, 'abs') : e_IMAGE_ABS . "newspost_images/" . $newsThumb;
if ($parms[2] || $parms[1] == 'placeholder') {
$src = e107::getParser()->thumbUrl($src, $parms[2]);
}
}
switch ($parms[1]) {
case 'src':
return $src;
break;
case 'tag':
return "<img class='news_image " . $class . "' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' />";
break;
case 'img':
return "<a href='" . $_src . "' rel='external image'><img class='news_image " . $class . "' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' /></a>";
break;
default:
return "<a href='" . e107::getUrl()->create('news/view/item', $this->news_item) . "'><img class='news_image img-responsive img-rounded " . $class . "' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' /></a>";
break;
}
}
示例5: sc_cpagethumbnail
/**
* Auto-thumbnailing now allowed.
* New sc parameter standards
* Exampes:
* - {CPAGETHUMBNAIL=e_MEDIA/images/someimage.jpg|type=tag&w=200} render link with thumbnail max width 200px
* - {CPAGETHUMBNAIL=images/someimage.jpg|w=200} same as above
* - {CPAGETHUMBNAIL=images/someimage.jpg|type=src&aw=200&ah=200} return thumb link only, size forced to 200px X 200px (smart thumbnailing close to how Facebook is doing it)
*
* @see eHelper::scDualParams()
* @see eHelper::scParams()
*/
function sc_cpagethumbnail($parm = '')
{
$parms = eHelper::scDualParams($parm);
if (empty($parms[1])) {
return '';
}
$tp = e107::getParser();
$path = rawurldecode($parms[1]);
if (substr($path, 0, 2) === 'e_') {
$path = str_replace($tp->getUrlConstants('raw'), $tp->getUrlConstants('sc'), $path);
} elseif ($path[0] !== '{') {
$path = '{e_MEDIA}' . $path;
}
$thumb = $tp->thumbUrl($path);
$type = varset($parms[2]['type'], 'tag');
switch ($type) {
case 'src':
return $thumb;
break;
case 'link':
return '<a href="' . $tp->replaceConstants($path, 'abs') . '" class="cpage-image" rel="external image"><img class="cpage-image" src="' . $src . '" alt="' . varset($parms[1]['alt']) . '" /></a>';
break;
case 'tag':
default:
return '<img class="cpage-image" src="' . $thumb . '" alt="' . varset($parms[1]['alt']) . '" />';
break;
}
}
示例6: sc_gallery_slides
/**
* All possible parameters
* {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM}
* first parameter is always number of slides, default is 3
* limit - (optional) total limit of pcitures to be shown
* template - (optional) template - name of template to be used for parsing the slideshow item
*/
function sc_gallery_slides($parm)
{
$tp = e107::getParser();
$this->slideMode = TRUE;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3;
// vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (int) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit);
$tmpl = e107::getTemplate('gallery', 'gallery');
$tmpl = array_change_key_case($tmpl);
// change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
$item_template = $tmpl[$tmpl_key];
// e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
$catList = e107::getMedia()->getCategories('gallery');
$cat = $catList['gallery_' . $this->sliderCat];
$count = 1;
foreach ($list as $row) {
$this->setVars($row)->addVars($cat);
$inner .= $count == 1 ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : "";
$inner .= "\n\t" . $tp->parseTemplate($item_template, TRUE) . "\n";
$inner .= $count == $amount ? "\n</div>\n\n" : "";
if ($count == $amount) {
$count = 1;
$this->slideCount++;
} else {
$count++;
}
}
$inner .= $count != 1 ? "</div><!-- END SLIDES -->" : "";
return $inner;
}
示例7: sc_newsthumbnail
/**
* Auto-thumbnailing now allowed.
* New sc parameter standards
* Exampes:
* - {NEWSTHUMBNAIL=link|w=200} render link with thumbnail max width 200px
* - {NEWSTHUMBNAIL=|w=200} same as above
* - {NEWSTHUMBNAIL=src|aw=200&ah=200} return thumb link only, size forced to 200px X 200px (smart thumbnailing close to how Facebook is doing it)
*
* First parameter values: link|src|tag
* Second parameter format: aw|w=xxx&ah|ah=xxx
*
* @see eHelper::scDualParams()
* @see eHelper::scParams()
*/
function sc_newsthumbnail($parm = '')
{
if (!$this->news_item['news_thumbnail']) {
return '';
}
$parms = eHelper::scDualParams($parm);
// We store SC path in DB now + BC
$_src = $src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS . "newspost_images/" . $this->news_item['news_thumbnail'];
if ($parms[2]) {
$src = e107::getParser()->thumbUrl($src, $parms[2]);
}
switch ($parms[1]) {
case 'src':
return $src;
break;
case 'tag':
return "<img class='news_image' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' />";
break;
case 'img':
return "<a href='" . $_src . "' rel='external image'><img class='news_image' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' /></a>";
break;
default:
return "<a href='" . $this->e107->url->create('news/view/item', $this->news_item) . "'><img class='news_image' src='" . $src . "' alt='' style='" . $this->param['thumbnail'] . "' /></a>";
break;
}
}