本文整理汇总了PHP中gt函数的典型用法代码示例。如果您正苦于以下问题:PHP gt函数的具体用法?PHP gt怎么用?PHP gt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_attribution
/**
* Smarty {attribution} function plugin
*
* Type: function<br>
* Name: attribution<br>
* Purpose: create an attribution phrase
*
* @param $params
* @param \Smarty $smarty
*/
function smarty_function_attribution($params, &$smarty)
{
if (isset($params['user_id'])) {
$u = user::getUserById($params['user_id']);
} elseif (isset($params['user'])) {
$u = $params['user'];
}
if (!empty($u->id)) {
$str = "";
$display = isset($params['display']) ? $params['display'] : DISPLAY_ATTRIBUTION;
switch ($display) {
case "firstlast":
$str = $u->firstname . " " . $u->lastname;
break;
case "lastfirst":
$str = $u->lastname . ", " . $u->firstname;
break;
case "first":
$str = $u->firstname;
break;
case "username":
default:
$str = $u->username;
break;
}
echo $str;
} else {
echo gt('Anonymous User');
}
}
示例2: update
function update()
{
global $db;
//$db->delete('modstate');
$aMods = $db->selectObjects('modstate', 1);
foreach ($aMods as $key => $value) {
if (!empty($this->params['mods']) && array_key_exists($value->module, $this->params['mods'])) {
$aMods[$key]->active = $this->params['mods'][$value->module];
$db->updateObject($aMods[$key], 'modstate', "module='" . $value->module . "'");
} else {
$aMods[$key]->active = 0;
$db->updateObject($aMods[$key], 'modstate', "module='" . $value->module . "'");
}
unset($this->params['mods'][$value->module]);
}
if (!empty($this->params['mods'])) {
foreach ($this->params['mods'] as $key => $value) {
$aMod->module = $key;
$aMod->active = $value;
$db->insertObject($aMod, 'modstate');
}
}
flash("message", gt("Active Modules have been updated."));
expHistory::returnTo('editable');
}
示例3: smarty_function_optiondisplayer
/**
* Smarty {optiondisplayer} function plugin
*
* Type: function<br>
* Name: optiondisplayer<br>
* Purpose: display option dropdown list
*
* @param $params
* @param \Smarty $smarty
* @return bool
*/
function smarty_function_optiondisplayer($params, &$smarty)
{
global $db;
$groupname = $params['options'];
$product = $params['product'];
$display_price_as = isset($params['display_price_as']) ? $params['display_price_as'] : 'diff';
// get the option group
$og = new optiongroup();
//$group = $og->find('bytitle', $groupname);
$group = $og->find('first', 'product_id=' . $product->id . ' AND title="' . $groupname . '"');
//grab the options configured for this product
$options = $product->optionDropdown($group->title, $display_price_as);
// if there are no options we can return now
if (empty($options)) {
return false;
}
// find the default option if there is one.
$default = $db->selectValue('option', 'id', 'optiongroup_id=' . $group->id . ' AND is_default=1');
$view = $params['view'];
//if((isset() || $og->required == false) $includeblank = $params['includeblank'] ;
//elseif((isset($params['includeblank']) && $params['includeblank'] == false) || $og->required == true) $includeblank = false;
$includeblank = $og->required == false && !isset($params['includeblank']) ? gt('-- Please Select an Option --') : $params['includeblank'];
$template = get_common_template($view, $smarty->getTemplateVars('__loc'), 'options');
$template->assign('product', $product);
$template->assign('options', $options);
$template->assign('group', $group);
$template->assign('params', $params);
$template->assign('default', $default);
$template->assign('includeblank', $includeblank);
$template->assign('required', $params['required']);
$template->assign('selected', $params['selected']);
echo $template->render();
}
示例4: move
/**
* @role update
*/
public function move()
{
$page = StaticPage::getInstanceById((int) $this->request->get('id'), StaticPage::LOAD_DATA);
// update parent
if ($this->request->get('parent')) {
$parent = StaticPage::getInstanceById((int) $this->request->get('parent'), StaticPage::LOAD_DATA);
} else {
$parent = null;
}
$page->parent->set($parent);
$page->save();
// update order
$f = new ARUpdateFilter();
if ($parent) {
$f->setCondition(eq(f('StaticPage.parentID'), $parent->getID()));
} else {
$f->setCondition(new IsNullCond(f('StaticPage.parentID')));
}
$f->addModifier('StaticPage.position', new ARExpressionHandle('position+2'));
if ($this->request->get('previous')) {
$previous = StaticPage::getInstanceById((int) $this->request->get('previous'), StaticPage::LOAD_DATA);
$position = $previous->position->get();
$f->mergeCondition(gt(f('StaticPage.position'), $position));
$page->position->set($position + 1);
} else {
$previous = null;
$page->position->set(1);
}
ActiveRecordModel::updateRecordSet('StaticPage', $f);
$page->save();
return new JSONResponse(array(), 'success', $this->translate('_pages_were_successfully_reordered'));
}
示例5: smarty_block_script
/**
* Smarty {script} block plugin
*
* Type: block<br>
* Name: script<br>
* Purpose: Set up a script block
*
* @param $params
* @param $content
* @param \Smarty $smarty
* @param $repeat
*/
function smarty_block_script($params, $content, &$smarty, &$repeat)
{
if ($content) {
global $userjsfiles;
if (empty($params['unique'])) {
die("<strong style='color:red'>" . gt("The 'unique' parameter is required for the {script} plugin.") . "</strong>");
}
if ((isset($params['yui2mods']) || isset($params['yuimodules'])) && !strstr($content, "YUI(")) {
$params['yui3mods'] = 1;
$yui2mods = $params['yui2mods'] ? $params['yui2mods'] : $params['yuimodules'];
$toreplace = array('"', "'", " ");
$stripmodquotes = str_replace($toreplace, "", $yui2mods);
$splitmods = explode(",", $stripmodquotes);
$y3wrap = "YUI(EXPONENT.YUI3_CONFIG).use(";
$y3wrap .= "'yui2-yahoo-dom-event', ";
foreach ($splitmods as $key => $mod) {
if ($mod == "menu") {
$y3wrap .= "'yui2-container', ";
}
$y3wrap .= "'yui2-" . $mod . "', ";
}
$y3wrap .= "function(Y) {\r\n";
$y3wrap .= "var YAHOO=Y.YUI2;";
$y3wrap .= $content;
$y3wrap .= "});";
$content = $y3wrap;
}
expJavascript::pushToFoot(array("unique" => $params['unique'], "yui3mods" => $params['yui3mods'], "content" => $content, "src" => $params['src']));
}
}
示例6: attributeLabels
public function attributeLabels()
{
$labels = array('tid' => gT('Token ID'), 'partcipant' => gt('Participant ID'), 'firstname' => gT('First name'), 'lastname' => gT('Last name'), 'email' => gT('Email address'), 'emailstatus' => gT('Email status'), 'token' => gT('Token'), 'language' => gT('Language code'), 'blacklisted' => gT('Blacklisted'), 'sent' => gT('Invitation sent date'), 'remindersent' => gT('Last reminder sent date'), 'remindercount' => gT('Total numbers of sent reminders'), 'completed' => gT('Completed'), 'usesleft' => gT('Uses left'), 'validfrom' => gT('Valid from'), 'validuntil' => gT('Valid until'));
foreach (decodeTokenAttributes($this->survey->attributedescriptions) as $key => $info) {
$labels[$key] = $info['description'];
}
return $labels;
}
示例7: echoFailure
function echoFailure($msg = "")
{
echo '<span class="failed">' . gt('Failed') . '</span>';
if ($msg != "") {
echo ' : ' . $msg;
}
echo '</td></tr>';
}
示例8: doSort
/**
* Sorts the array of comparable objects.
*/
protected function doSort()
{
for ($i = 1; $i < $this->n; ++$i) {
for ($j = $i; $j > 0 && gt($this->array[$j - 1], $this->array[$j]); --$j) {
$this->swap($j, $j - 1);
}
}
}
示例9: update
function update()
{
$timestamp = mktime(0, 0, 0, $this->params['month'], 1);
$endday = expDateTime::endOfMonthDay($timestamp);
if ($this->params['day'] > $endday) {
expValidator::failAndReturnToForm(gt('There are only') . ' ' . $endday . ' ' . gt('days in') . ' ' . $this->motd->months[$this->params['month']], $this->params);
}
parent::update();
}
示例10: smarty_function_getchromemenu
/**
* Smarty {getchromemenu} function plugin
*
* Type: function<br>
* Name: getchromemenu<br>
* Purpose: display the chrome menu
*
* @param $params
* @param \Smarty $smarty
* @return bool
*/
function smarty_function_getchromemenu($params, &$smarty)
{
global $router, $user;
$cloc = $smarty->getTemplateVars('__loc');
$module = $params['module'];
$list = '<ul class="container-menu">';
$list .= '<li class="container-info">' . $module->action . ' / ' . str_replace($module->action . '_', '', $module->view) . '</li>';
if (!empty($params['rank']) && expPermissions::check('order_modules', $cloc)) {
$uplink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 2, 'b' => $params['rank'] - 1));
$downlink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 1, 'b' => $params['rank']));
if ($params['rank'] != 1) {
//dont show this up arrow if it's the first module in a container
$list .= '<li><a href="' . $uplink . '" class="mod-up">' . gt("Move Module Up") . '</a></li>';
}
if (!$params['last']) {
//if this is the last module in a container don't show down arrow.
$list .= '<li><a href="' . $downlink . '" class="mod-down">' . gt("Move Module Down") . '</a></li>';
}
}
$rerank = $params['rerank'];
if ($rerank == 'false') {
$rerank = 0;
} else {
$rerank = 1;
}
if ($user->isAdmin()) {
$userlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'userperms', '_common' => 1));
$grouplink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'groupperms', '_common' => 1));
$list .= '<li><a href="' . $userlink . '" class="user">' . gt("User Permissions") . '</a></li>';
$list .= '<li><a href="' . $grouplink . '" class="group">' . gt("Group Permissions") . '</a></li>';
}
if (!empty($module->id) && expPermissions::check('edit_module', $cloc) && $module->permissions['administrate'] == 1) {
$editlink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'edit', 'src' => $module->info['source']));
$list .= '<li><a href="' . $editlink . '" class="config-view">' . gt("Configure Action") . " & " . gt("View") . '</a></li>';
}
if ($module->permissions['configure'] == 1) {
if (expModules::controllerExists($module->info['class'])) {
$configlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'configure', 'hcview' => $module->view));
$list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>';
} elseif ($module->info['hasConfig']) {
$configlink = $router->makeLink(array('module' => $module->info['class'], 'src' => $module->info['source'], 'action' => 'configure', '_common' => 1));
$list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>';
}
}
if (!empty($module->id) && expPermissions::check('delete_module', $cloc)) {
$deletelink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'delete', 'rerank' => $rerank));
$list .= '<li><a href="' . $deletelink . '" class="delete" onclick="alert(\'' . gt("This content is being sent to the Recycle Bin to be recovered later if you wish.") . '\')">' . gt("Remove Module") . '</a></li>';
}
if (HELP_ACTIVE) {
$helplink = help::makeHelpLink(expModules::getControllerName($module->info['class']));
$list .= '<li><a href="' . $helplink . '" class="helplink" target="_blank">' . gt("Get Help") . '</a></li>';
}
$list .= '</ul>';
expCSS::pushToHead(array("unique" => "container-chrome", "link" => PATH_RELATIVE . "framework/modules/container/assets/css/admin-container.css"));
expJavascript::pushToFoot(array("unique" => 'container-chrome', "yui3mods" => 'node', "src" => PATH_RELATIVE . "framework/core/assets/js/exp-container.js"));
echo $list;
}
示例11: addToCart
function addToCart($params)
{
global $order;
expSession::set('params', $params);
//get the configuration
$cfg->mod = "ecomconfig";
$cfg->src = "@globalstoresettings";
$cfg->int = "";
$config = new expConfig($cfg);
$this->config = empty($catConfig->config) || @$catConfig->config['use_global'] == 1 ? $config->config : $catConfig->config;
$min_amount = $this->config['minimum_gift_card_purchase'];
$custom_message_product = $this->config['custom_message_product'];
if (empty($params['product_id'])) {
flash('error', gt("Please specify the style of the gift card you want to purchase."));
expHistory::back();
}
if (empty($params['card_amount']) && empty($params['card_amount_txt'])) {
flash('error', gt("You need to specify the card amount for the gift card."));
expHistory::back();
} else {
// eDebug($params, true);
$item = new orderitem($params);
$sm = $order->getCurrentShippingMethod();
$item->shippingmethods_id = $sm->id;
if (isset($params['card_amount_txt'])) {
$params['card_amount_txt'] = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']);
}
if (!empty($params['card_amount_txt']) && $params['card_amount_txt'] > 0) {
$item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount_txt']);
} else {
$item->products_price = preg_replace("/[^0-9.]/", "", $params['card_amount']);
}
if ($item->products_price < $min_amount) {
flash('error', gt("The minimum amount of gift card is") . " " . $min_amount);
expHistory::back();
}
$item->products_name = expCore::getCurrencySymbol() . $params['card_amount'] . ' ' . $this->title . " Style Gift Card";
if (!empty($params['toname'])) {
$ed['To'] = isset($params['toname']) ? $params['toname'] : '';
}
if (!empty($params['fromname'])) {
$ed['From'] = isset($params['fromname']) ? $params['fromname'] : '';
}
if (!empty($params['msg'])) {
$ed['Message'] = isset($params['msg']) ? $params['msg'] : '';
$item->products_price += $custom_message_product;
$item->products_name = $item->products_name . " (with message)";
}
$item->extra_data = serialize($ed);
// we need to unset the orderitem's ID to force a new entry..other wise we will overwrite any
// other giftcards in the cart already
$item->id = null;
$item->quantity = $this->getDefaultQuantity();
$item->save();
return true;
}
}
示例12: smarty_block_css
/**
* Smarty {css} block plugin
*
* Type: block<br>
* Name: css<br>
* Purpose: Set up a css block
*
* @param $params
* @param $content
* @param \Smarty $smarty
* @param $repeat
*/
function smarty_block_css($params, $content, &$smarty, &$repeat)
{
if ($content) {
if (empty($params['unique'])) {
die("<strong style='color:red'>" . gt("The 'unique' parameter is required for the {css} plugin.") . "</strong>");
}
expCSS::pushToHead(array("unique" => $params['unique'], "css" => $content, "link" => $params['link'], "corecss" => $params['corecss']));
}
}
示例13: userFormUpdate
function userFormUpdate($params)
{
global $order;
if ($order->grand_total > $params["cash_amount"]) {
expValidator::failAndReturnToForm(gt("The total amount of your order is greater than what the amount you have input.") . "<br />" . gt("Please enter exact or greater amount of your total."));
}
$this->opts = null;
$this->opts->cash_amount = $params["cash_amount"];
return $this->opts;
}
示例14: doSort
/**
* Sorts the array of comparable objects.
*/
protected function doSort()
{
for ($i = $this->n; $i > 1; --$i) {
for ($j = 0; $j < $i - 1; ++$j) {
if (gt($this->array[$j], $this->array[$j + 1])) {
$this->swap($j, $j + 1);
}
}
}
}
示例15: form
function form($object)
{
$form = new form();
if (!isset($object->html)) {
$object->html = "";
}
$form->register("html", '', new htmleditorcontrol($object->html));
$form->register("submit", "", new buttongroupcontrol(gt('Save'), '', gt('Cancel'), "", 'editable'));
return $form;
}