本文整理汇总了PHP中_N函数的典型用法代码示例。如果您正苦于以下问题:PHP _N函数的具体用法?PHP _N怎么用?PHP _N使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_N函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdfForItem
static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
{
global $DB, $CFG_GLPIG;
if (!Session::haveRight("contract", "r")) {
return false;
}
$type = $item->getType();
$ID = $item->getField('id');
$con = new Contract();
$query = "SELECT *\n FROM `glpi_contracts_items`\n WHERE `glpi_contracts_items`.`items_id` = '" . $ID . "'\n AND `glpi_contracts_items`.`itemtype` = '" . $type . "'";
$result = $DB->query($query);
$number = $DB->numrows($result);
$i = $j = 0;
$pdf->setColumnsSize(100);
if ($number > 0) {
$pdf->displayTitle('<b>' . _N('Associated contract', 'Associated contracts', 2) . '</b>');
$pdf->setColumnsSize(19, 19, 19, 16, 11, 16);
$pdf->displayTitle(__('Name'), _x('phone', 'Number'), __('Contract type'), __('Supplier'), __('Start date'), __('Initial contract period'));
$i++;
while ($j < $number) {
$cID = $DB->result($result, $j, "contracts_id");
$assocID = $DB->result($result, $j, "id");
if ($con->getFromDB($cID)) {
$pdf->displayLine(empty($con->fields["name"]) ? "(" . $con->fields["id"] . ")" : $con->fields["name"], $con->fields["num"], Html::clean(Dropdown::getDropdownName("glpi_contracttypes", $con->fields["contracttypes_id"])), str_replace("<br>", " ", $con->getSuppliersNames()), Html::convDate($con->fields["begin_date"]), sprintf(_n('%d month', '%d months', $con->fields["duration"]), $con->fields["duration"]));
}
$j++;
}
} else {
$pdf->displayTitle("<b>" . __('No item found') . "</b>");
}
$pdf->displaySpace();
}
示例2: sprintf
</h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="enable-confirm">
<?php
echo sprintf(__('Are you sure you want to <b>enable</b> %s?'), _N('selected site page', 'selected site pages', 2));
?>
</p>
<p class="confirm-action" style="display:none;" id="disable-confirm">
<?php
echo sprintf(__('Are you sure you want to <b>disable</b> %s?'), _N('selected site page', 'selected site pages', 2));
?>
</p>
<p class="confirm-action" style="display:none;" id="delete-confirm">
<font color="red"><strong><?php
echo sprintf(__('Are you sure you want to DELETE %s?'), _N('selected site page', 'selected site pages', 2));
?>
</strong></font>
<br><br><?php
echo __('Deleted data CANNOT be recovered.');
?>
</p>
<div><?php
echo __('Please confirm to continue.');
?>
</div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="No, Cancel" class="close">
</span>
示例3: sprintf
</h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="enable-confirm">
<?php
echo sprintf(__('Are you sure you want to <b>enable</b> %s?'), _N('selected canned response', 'selected canned responses', 2));
?>
</p>
<p class="confirm-action" style="display:none;" id="disable-confirm">
<?php
echo sprintf(__('Are you sure you want to <b>disable</b> %s?'), _N('selected canned response', 'selected canned responses', 2));
?>
</p>
<p class="confirm-action" style="display:none;" id="delete-confirm">
<font color="red"><strong><?php
echo sprintf(__('Are you sure you want to DELETE %s?'), _N('selected canned response', 'selected canned responses', 2));
?>
</strong></font>
<br><br><?php
echo __('Deleted data CANNOT be recovered, including any associated attachments.');
?>
</p>
<div><?php
echo __('Please confirm to continue.');
?>
</div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="<?php
echo __('No, Cancel');
示例4: __
<div style="display:none;" class="dialog" id="confirm-action">
<h3><?php echo __('Please Confirm');?></h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="make_public-confirm">
<?php echo sprintf(__('Are you sure you want to make %s <b>public</b>?'),
_N('selected department', 'selected departments', 2));?>
</p>
<p class="confirm-action" style="display:none;" id="make_private-confirm">
<?php echo sprintf(__('Are you sure you want to make %s <b>private</b> (internal)?'),
_N('selected department', 'selected departments', 2));?>
</p>
<p class="confirm-action" style="display:none;" id="delete-confirm">
<font color="red"><strong><?php echo sprintf(__('Are you sure you want to DELETE %s?'),
_N('selected department', 'selected departments', 2));?></strong></font>
<br><br><?php echo __('Deleted data CANNOT be recovered.'); ?>
</p>
<div><?php echo __('Please confirm to continue.');?></div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="<?php echo __('No, Cancel');?>" class="close">
</span>
<span class="buttons pull-right">
<input type="button" value="<?php echo __('Yes, Do it!');?>" class="confirm">
</span>
</p>
<div class="clear"></div>
</div>
示例5: __
echo __('Delete');
?>
">
</p>
</form>
<div style="display:none;" class="dialog" id="confirm-action">
<h3><?php
echo __('Please Confirm');
?>
</h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="delete-confirm">
<font color="red"><strong><?php
echo sprintf(__('Are you sure you want to DELETE %s?'), _N('selected custom list', 'selected custom lists', 2));
?>
</strong></font>
<br><br><?php
echo __('Deleted data CANNOT be recovered.');
?>
</p>
<div><?php
echo __('Please confirm to continue.');
?>
</div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="No, Cancel" class="close">
</span>
示例6: count
} else {
$count = count($_POST['ids']);
switch (strtolower($_POST['a'])) {
case 'delete':
$i = 0;
foreach ($_POST['ids'] as $k => $v) {
if (($t = DynamicForm::lookup($v)) && $t->delete()) {
$i++;
}
}
if ($i && $i == $count) {
$msg = sprintf(__('Successfully deleted %s'), _N('selected custom form', 'selected custom forms', $count));
} elseif ($i > 0) {
$warn = sprintf(__('%1$d of %1$d %3$s deleted'), $i, $count, _N('selected custom form', 'selected custom forms', $count));
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to delete %s'), _N('selected custom form', 'selected custom forms', $count));
}
break;
}
}
break;
}
if ($form) {
for ($i = 0; isset($_POST["sort-new-{$i}"]); $i++) {
if (!$_POST["label-new-{$i}"]) {
continue;
}
$field = DynamicFormField::create(array('sort' => $_POST["sort-new-{$i}"] ? $_POST["sort-new-{$i}"] : ++$max_sort, 'label' => $_POST["label-new-{$i}"], 'type' => $_POST["type-new-{$i}"], 'name' => trim($_POST["name-new-{$i}"])));
$field->setRequirementMode($_POST["visibility-new-{$i}"]);
$field->setForm($form);
if (in_array($field->get('name'), $names)) {
示例7: sprintf
echo sprintf(__('Are you sure you want to DELETE %s?'), _N('selected plugin', 'selected plugins', 2));
?>
</strong></font>
<br><br><?php
echo __('Configuration for deleted plugins CANNOT be recovered.');
?>
</p>
<p class="confirm-action" style="display:none;" id="enable-confirm">
<font color="green"><?php
echo sprintf(__('Are you sure you want to <b>enable</b> %s?'), _N('selected plugin', 'selected plugins', 2));
?>
</font>
</p>
<p class="confirm-action" style="display:none;" id="disable-confirm">
<font color="red"><?php
echo sprintf(__('Are you sure you want to <b>disable</b> %s?'), _N('selected plugin', 'selected plugins', 2));
?>
</font>
</p>
<div><?php
echo __('Please confirm to continue.');
?>
</div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="<?php
echo __('No, Cancel');
?>
" class="close">
</span>
示例8: __
echo '<div> '.__('Page').':'.$pageNav->getPageLinks().' </div>';
?>
<p class="centered" id="actions">
<input class="button" type="submit" name="delete" value="<?php echo __('Delete'); ?>">
</p>
</form>
<div style="display:none;" class="dialog" id="confirm-action">
<h3><?php echo __('Please Confirm'); ?></h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="delete-confirm">
<font color="red"><strong><?php echo sprintf(
__('Are you sure you want to DELETE %s?'),
_N('selected custom list', 'selected custom lists', 2)); ?></strong></font>
<br><br><?php echo __('Deleted data CANNOT be recovered.'); ?>
</p>
<div><?php echo __('Please confirm to continue.'); ?></div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="No, Cancel" class="close">
</span>
<span class="buttons pull-right">
<input type="button" value="Yes, Do it!" class="confirm">
</span>
</p>
<div class="clear"></div>
</div>
示例9: sprintf
}
?>
</table>
<div class="clear"></div>
<hr>
<form method="post" class="user"
action="#users/<?php echo $user->getId(); ?>/delete">
<input type="hidden" name="id" value="<?php echo $user->getId(); ?>" />
<?php
if (($num=$user->tickets->count())) {
echo '<div><input type="checkbox" name="deletetickets" value="1" > <strong>'
.sprintf(__('Delete %1$s %2$s %3$s and any associated attachments and data.'),
sprintf('<a href="tickets.php?a=search&uid=%d" target="_blank">',
$user->getId()),
sprintf(_N('one ticket', '%d tickets', $num), $num),
'</a>'
)
.'</strong></div><hr>';
}
?>
<p class="full-width">
<span class="buttons pull-left">
<input type="reset" value="<?php echo __('Reset'); ?>">
<input type="button" name="cancel" class="close"
value="<?php echo __('No, Cancel'); ?>">
</span>
<span class="buttons pull-right">
<input type="submit" value="<?php echo __('Yes, Delete User'); ?>">
</span>
</p>
示例10: switch
switch(strtolower($_POST['a'])) {
case 'delete':
$i=0;
foreach($_POST['ids'] as $k=>$v) {
if(($t=DynamicList::lookup($v)) && $t->delete())
$i++;
}
if ($i && $i==$count)
$msg = sprintf(__('Successfully deleted %s'),
_N('selected custom list', 'selected custom lists', $count));
elseif ($i > 0)
$warn = sprintf(__('%1$d of %2$d %3$s deleted'), $i, $count,
_N('selected custom list', 'selected custom lists', $count));
elseif (!$errors['err'])
$errors['err'] = sprintf(__('Unable to delete %s — they may be in use on a custom form'),
_N('selected custom list', 'selected custom lists', $count));
break;
}
}
break;
}
if ($list && $list->allowAdd()) {
for ($i=0; isset($_POST["sort-new-$i"]); $i++) {
if (!$_POST["value-new-$i"])
continue;
$list->addItem(array(
'value' => $_POST["value-new-$i"],
'abbrev' =>$_POST["abbrev-new-$i"],
'sort' => $_POST["sort-new-$i"] ?: ++$max_isort,
示例11: sprintf
} else {
$errors['err'] = sprintf(__('Unable to disable %s'), _N('selected team', 'selected teams', $count));
}
break;
case 'delete':
foreach ($_POST['ids'] as $k => $v) {
if (($t = Team::lookup($v)) && $t->delete()) {
$i++;
}
}
if ($i && $i == $count) {
$msg = sprintf(__('Successfully deleted %s'), _N('selected team', 'selected teams', $count));
} elseif ($i > 0) {
$warn = sprintf(__('%1$d of %2$d %3$s deleted'), $i, $count, _N('selected team', 'selected teams', $count));
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to delete %s'), _N('selected team', 'selected teams', $count));
}
break;
default:
$errors['err'] = __('Unknown action - get technical help.');
}
}
break;
default:
$errors['err'] = __('Unknown action');
break;
}
}
$page = 'teams.inc.php';
$tip_namespace = 'staff.team';
if ($team || $_REQUEST['a'] && !strcasecmp($_REQUEST['a'], 'add')) {
示例12: switch
switch(strtolower($_POST['a'])) {
case 'delete':
$i=0;
foreach($_POST['ids'] as $k=>$v) {
if(($t=DynamicForm::lookup($v)) && $t->delete())
$i++;
}
if ($i && $i==$count)
$msg = sprintf(__('Successfully deleted %s'),
_N('selected custom form', 'selected custom forms', $count));
elseif ($i > 0)
$warn = sprintf(__('%1$d of %1$d %3$s deleted'), $i, $count,
_N('selected custom form', 'selected custom forms', $count));
elseif (!$errors['err'])
$errors['err'] = sprintf(__('Unable to delete %s'),
_N('selected custom form', 'selected custom forms', $count));
break;
}
}
break;
}
if ($form) {
for ($i=0; isset($_POST["sort-new-$i"]); $i++) {
if (!$_POST["label-new-$i"])
continue;
$field = DynamicFormField::create(array(
'sort'=>$_POST["sort-new-$i"] ? $_POST["sort-new-$i"] : ++$max_sort,
'label'=>$_POST["label-new-$i"],
'type'=>$_POST["type-new-$i"],
'name'=>trim($_POST["name-new-$i"]),
示例13: __
?>
</form>
<?php
}
?>
<div style="display:none;" class="dialog" id="confirm-action">
<h3><?php
echo __('Please Confirm');
?>
</h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<p class="confirm-action" style="display:none;" id="remove-users-confirm">
<?php
echo sprintf(__('Are you sure you want to <b>REMOVE</b> %1$s from <strong>%2$s</strong>?'), _N('selected user', 'selected users', 2), $org->getName());
?>
</p>
<div><?php
echo __('Please confirm to continue.');
?>
</div>
<hr style="margin-top:1em"/>
<p class="full-width">
<span class="buttons pull-left">
<input type="button" value="<?php
echo __('No, Cancel');
?>
" class="close">
</span>
<span class="buttons pull-right">
示例14: __
</thead>
<tbody>
<tr>
<th colspan="2">
<em><b><?php echo __('Agent Authentication Settings'); ?></b></em>
</th>
</tr>
<tr><td><?php echo __('Password Expiration Policy'); ?>:</th>
<td>
<select name="passwd_reset_period">
<option value="0"> — <?php echo __('No expiration'); ?> —</option>
<?php
for ($i = 1; $i <= 12; $i++) {
echo sprintf('<option value="%d" %s>%s</option>',
$i,(($config['passwd_reset_period']==$i)?'selected="selected"':''),
sprintf(_N('Monthly', 'Every %d months', $i), $i));
}
?>
</select>
<font class="error"><?php echo $errors['passwd_reset_period']; ?></font>
<i class="help-tip icon-question-sign" href="#password_expiration_policy"></i>
</td>
</tr>
<tr><td><?php echo __('Allow Password Resets'); ?>:</th>
<td>
<input type="checkbox" name="allow_pw_reset" <?php echo $config['allow_pw_reset']?'checked="checked"':''; ?>>
<i class="help-tip icon-question-sign" href="#allow_password_resets"></i>
</td>
</tr>
<tr><td><?php echo __('Reset Token Expiration'); ?>:</th>
<td>
示例15: authstrike
function authstrike($credentials)
{
global $ost;
$cfg = $ost->getConfig();
$authsession =& $_SESSION['_auth']['staff'];
$username = $credentials['username'];
$authsession['strikes'] += 1;
if ($authsession['strikes'] > $cfg->getStaffMaxLogins()) {
$authsession['laststrike'] = time();
$timeout = $cfg->getStaffLoginTimeout() / 60;
$alert = _S('Excessive login attempts by an agent?') . "\n" . _S('Username') . ": {$username}\n" . _S('IP') . ": {$_SERVER['REMOTE_ADDR']}\n" . _S('Time') . ": " . date('M j, Y, g:i a T') . "\n\n" . _S('Attempts') . ": {$authsession['strikes']}\n" . _S('Timeout') . ": " . sprintf(_N('%d minute', '%d minutes', $timeout), $timeout) . "\n\n";
$ost->logWarning(sprintf(_S('Excessive login attempts (%s)'), $username), $alert, $cfg->alertONLoginError());
return new AccessDenied(__('Forgot your login info? Contact Admin.'));
//Log every other third failed login attempt as a warning.
} elseif ($authsession['strikes'] % 3 == 0) {
$alert = _S('Username') . ": {$username}\n" . _S('IP') . ": {$_SERVER['REMOTE_ADDR']}\n" . _S('Time') . ": " . date('M j, Y, g:i a T') . "\n\n" . _S('Attempts') . ": {$authsession['strikes']}";
$ost->logWarning(sprintf(_S('Failed agent login attempt (%s)'), $username), $alert, false);
}
}