本文整理汇总了PHP中smarty_block_t函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_block_t函数的具体用法?PHP smarty_block_t怎么用?PHP smarty_block_t使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_block_t函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_time_since
/**
* Smarty size_format modifier plugin.
*
* Type: modifier<br>
* Name: size_format<br>
* Purpose: format sizes directly from DB.
*
* @param integer $size Size of a file.
* @param integer $decimals Number of decimals.
* @return string
*/
function smarty_modifier_time_since($diff_time)
{
if (!is_numeric($diff_time)) {
$diff_time = strtotime(date("Y-m-d H:i:s")) - strtotime($diff_time);
}
if (floor($diff_time / (60 * 60 * 24)) >= 365) {
$value[0] = floor($diff_time / (60 * 60 * 24 * 365));
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("year");
} else {
$value[1] = \Sifo\I18N::getTranslation("years");
}
} elseif (floor($diff_time / (60 * 60 * 24)) >= 30) {
$value[0] = floor($diff_time / (60 * 60 * 24 * 30));
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("month");
} else {
$value[1] = \Sifo\I18N::getTranslation("months");
}
} elseif (floor($diff_time / (60 * 60 * 24)) >= 7) {
$value[0] = floor($diff_time / (60 * 60 * 24 * 7));
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("week");
} else {
$value[1] = \Sifo\I18N::getTranslation("weeks");
}
} elseif (floor($diff_time / (60 * 60)) >= 24) {
$value[0] = floor($diff_time / (60 * 60 * 24));
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("day");
} else {
$value[1] = \Sifo\I18N::getTranslation("days");
}
} elseif (floor($diff_time / 60) >= 60) {
$value[0] = floor($diff_time / (60 * 60));
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("hour");
} else {
$value[1] = \Sifo\I18N::getTranslation("hours");
}
} elseif (floor($diff_time / 60) >= 1) {
$value[0] = floor($diff_time / 60);
if (1 == $value[0]) {
$value[1] = \Sifo\I18N::getTranslation("minute");
} else {
$value[1] = \Sifo\I18N::getTranslation("minutes");
}
} else {
$value[0] = false;
$value[1] = \Sifo\I18N::getTranslation("just some seconds");
}
$value[1] = smarty_block_t(array('count' => $value[0]), $value[1], $this, null);
if ($value[0] > 0) {
$params[1] = $value[0] . ' ' . $value[1];
} else {
$params[1] = $value[1];
}
return smarty_block_t($params, \Sifo\I18N::getTranslation('%1 ago'), $this, null);
}
示例2: smarty_function_email_obfuscator
/**
* Smarty email obfuscator plugin
*
* Type: function.
* Name: email_obfuscator.
* Purpose: email obfuscation for protecting emails.
*
* @author Nino Dafonte <nino.dafonte@gmail.com>.
* @param string Email to obfuscate (received automatically).
* @param string Text to show instead of the email.
* @return string JavaScript to show the obfuscated email.
*/
function smarty_function_email_obfuscator($params, &$smarty)
{
// email address to obfuscate.
$email = isset($params['email']) ? $params['email'] : '';
// optional text to show instead the email
$linktext = isset($params['text']) ? $params['text'] : '';
// style information via class.
$style_class = isset($params['class']) ? ' class=\\"' . $params['class'] . '\\" ' : '';
// style information via id.
$style_id = isset($params['id']) ? ' id=\\"' . $params['id'] . '\\" ' : '';
// Getting the extra params for the case of %1, %2, etc in the linktext. Using ; like separator.
$extra_params = array();
if (isset($params['extra'])) {
$extra_params = explode(';', $params['extra']);
}
// Translating linktext
$textbefore = '';
$textafter = '';
if (!empty($linktext)) {
$temp = smarty_block_t($extra_params, $linktext, $this, null);
// If the email is inside the text string
$email_position = strpos($temp, $email);
if ($email_position) {
// If the email is inside the string we make the link only in the email address
$textbefore = substr($temp, 0, $email_position);
$textafter = substr($temp, strpos($temp, $email) + strlen($email));
$linktext = '';
} else {
// Else the link is all the string
$linktext = $temp;
}
}
$character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
$key = str_shuffle($character_set);
$cipher_text = '';
$id = 'e' . rand(1, 999999999);
for ($i = 0; $i < strlen($email); $i += 1) {
$cipher_text .= $key[strpos($character_set, $email[$i])];
}
$script = 'var namex="' . $linktext . '";var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";';
$script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));var linktext=(namex.length == 0)?linktext=d:linktext=namex;var textbefore="' . $textbefore . '";var textafter="' . $textafter . '";';
$script .= 'document.getElementById("' . $id . '").innerHTML=textbefore+"<a ' . $style_id . $style_class . ' href=\\"mailto:"+d+"\\">"+linktext+"<\\/a>"+textafter';
$script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\\"'), $script) . "\")";
$script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>';
return '<span id="' . $id . '">[javascript protected email address]</span>' . $script;
}
示例3: array
} else {
?>
<li><?php
if (!isset($_tag_stack)) {
$_tag_stack = array();
}
$_tag_stack[] = array();
$_block_repeat = true;
smarty_block_t($_tag_stack[count($_tag_stack) - 1], null, $this, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
No visible boards<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_t($_tag_stack[count($_tag_stack) - 1], $_block_content, $this, $_block_repeat);
}
array_pop($_tag_stack);
?>
</li>
<?php
}
?>
</ul>
<?php
if ((defined("KU_MENUTYPE") ? KU_MENUTYPE : null) == 'normal') {
?>
</div>
<?php
}
示例4: array
/ajax_loader.gif" style="float:left; margin-top:8px;" />
<p style="float:left;margin-left:10px; padding-top:5px;" >
<img src="<?php
echo $this->_tpl_vars['image_url'];
?>
/loading.gif" />
<br/><span style="padding-left:3px;color:#aaaaaa "><?php
$this->_tag_stack[] = array('t', array());
smarty_block_t($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat = true);
while ($_block_repeat) {
ob_start();
?>
Please wait a while ...<?php
$_block_content = ob_get_contents();
ob_end_clean();
echo smarty_block_t($this->_tag_stack[count($this->_tag_stack) - 1][1], $_block_content, $this, $_block_repeat = false);
}
array_pop($this->_tag_stack);
?>
</span></p>
</div>
</div>
</div>
</div>
<?php
echo '
<!--[if gte IE 6]>
<style type="text/css">
#main_loader .loader_box
{
示例5: content_56768d000667d9_02431979
function content_56768d000667d9_02431979($_smarty_tpl)
{
if (!is_callable('smarty_function_locale')) {
require_once '/var/www/wordpress/lamps.lightmaster.cz/www3/smarty/plugins/function.locale.php';
}
if (!is_callable('smarty_block_t')) {
require_once '/var/www/wordpress/lamps.lightmaster.cz/www3/smarty/plugins/block.t.php';
}
?>
<div class="row">
<div class="col-sm-12">
<div class="widget-box">
<div class="widget-header">
<?php
echo smarty_function_locale(array('path' => "locale", 'domain' => "lightmaster_en_US"), $_smarty_tpl);
?>
<h4><?php
$_smarty_tpl->smarty->_cache['tag_stack'][] = array('t', array());
$_block_repeat = true;
echo smarty_block_t(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
COMPANIESTITLE<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_t(array(), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['tag_stack']);
?>
</h4>
</div>
<?php
echo '<script';
?>
>
var lamps = <?php
echo json_encode($_smarty_tpl->tpl_vars['companiesList']->value);
?>
;
<?php
echo '</script';
?>
>
<div class="widget-body">
<div class="widget-main no-padding">
<table class="table table-hover table-bordered table-striped table-condensed">
<thead>
<tr>
<th><?php
$_smarty_tpl->smarty->_cache['tag_stack'][] = array('t', array());
$_block_repeat = true;
echo smarty_block_t(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
COMPANYNAME<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_t(array(), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['tag_stack']);
?>
</th>
<th><?php
$_smarty_tpl->smarty->_cache['tag_stack'][] = array('t', array());
$_block_repeat = true;
echo smarty_block_t(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
COMPANYEDIT<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_t(array(), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['tag_stack']);
?>
</th>
</tr>
</thead>
<?php
$_from = $_smarty_tpl->tpl_vars['companiesList']->value;
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$__foreach_it_0_saved_item = isset($_smarty_tpl->tpl_vars['it']) ? $_smarty_tpl->tpl_vars['it'] : false;
$_smarty_tpl->tpl_vars['it'] = new Smarty_Variable();
$__foreach_it_0_total = $_smarty_tpl->smarty->ext->_foreach->count($_from);
if ($__foreach_it_0_total) {
foreach ($_from as $_smarty_tpl->tpl_vars['it']->value) {
$__foreach_it_0_saved_local_item = $_smarty_tpl->tpl_vars['it'];
?>
<tr id="item<?php
echo $_smarty_tpl->tpl_vars['it']->value['id'];
?>
">
//.........这里部分代码省略.........
开发者ID:hittl,项目名称:LIGHTMASTER_SMARTY,代码行数:101,代码来源:1e69f3f625aa17be4c9d01fd81c9b058ad25409a_0.file.controls-list.tpl.php
示例6: content_567690f88d6f43_17768414
function content_567690f88d6f43_17768414($_smarty_tpl)
{
if (!is_callable('smarty_function_locale')) {
require_once '/var/www/wordpress/lamps.lightmaster.cz/www3/smarty/plugins/function.locale.php';
}
if (!is_callable('smarty_block_t')) {
require_once '/var/www/wordpress/lamps.lightmaster.cz/www3/smarty/plugins/block.t.php';
}
?>
<div class="row">
<div class="col-sm-12">
<div class="widget-box">
<div class="widget-header">
<?php
echo smarty_function_locale(array('path' => "./locale", 'domain' => "lightmaster_en_US"), $_smarty_tpl);
?>
<h4><?php
$_smarty_tpl->smarty->_cache['tag_stack'][] = array('t', array());
$_block_repeat = true;
echo smarty_block_t(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
LAMPSTITLE<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_t(array(), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['tag_stack']);
?>
</h4>
</div>
<?php
echo '<script';
?>
>
var lamps = <?php
echo json_encode($_smarty_tpl->tpl_vars['lampList']->value);
?>
;
<?php
echo '</script';
?>
>
<div class="widget-body">
<div class="widget-main no-padding">
<table class="table table-hover table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Id lampy</th>
<th>Value 1</th>
<th>Value 2</th>
<th>Value 3</th>
<th>Value 4</th>
<th>Value 5</th>
<th>Value 6</th>
</tr>
</thead>
<?php
$_from = $_smarty_tpl->tpl_vars['lampList']->value;
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$__foreach_it_0_saved_item = isset($_smarty_tpl->tpl_vars['it']) ? $_smarty_tpl->tpl_vars['it'] : false;
$_smarty_tpl->tpl_vars['it'] = new Smarty_Variable();
$__foreach_it_0_total = $_smarty_tpl->smarty->ext->_foreach->count($_from);
if ($__foreach_it_0_total) {
foreach ($_from as $_smarty_tpl->tpl_vars['it']->value) {
$__foreach_it_0_saved_local_item = $_smarty_tpl->tpl_vars['it'];
?>
<tr id="item<?php
echo $_smarty_tpl->tpl_vars['it']->value['id'];
?>
">
<td><?php
echo $_smarty_tpl->tpl_vars['it']->value['id'];
?>
</td>
<td><?php
echo $_smarty_tpl->tpl_vars['it']->value['lat'];
?>
</td>
<td><?php
echo $_smarty_tpl->tpl_vars['it']->value['long'];
?>
</td>
<td><?php
echo $_smarty_tpl->tpl_vars['it']->value['isenabled'];
?>
<?php
if ($_smarty_tpl->tpl_vars['it']->value['dealer_company']) {
?>
( <?php
echo $_smarty_tpl->tpl_vars['it']->value['dealer_company'];
?>
)<?php
}
?>
//.........这里部分代码省略.........
开发者ID:hittl,项目名称:LIGHTMASTER_SMARTY,代码行数:101,代码来源:ede474e473ee7b2c9a05a85e91fcc0d26a014487_0.file.lamps-list.tpl.php