本文整理汇总了PHP中_函数的典型用法代码示例。如果您正苦于以下问题:PHP _函数的具体用法?PHP _怎么用?PHP _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_check_priv
function sc_check_priv($prob_id, $opened, $user)
{
if (!function_exists('check_priv')) {
require __DIR__ . '/privilege.php';
}
if (isset($_SESSION['user'])) {
if (strcmp($user, $_SESSION['user']) == 0 || check_priv(PRIV_SOURCE)) {
return TRUE;
}
}
require __DIR__ . '/../conf/database.php';
if (!defined('PROB_HAS_TEX')) {
require __DIR__ . '/../lib/problem_flags.php';
}
if ($opened) {
$row = mysqli_fetch_row(mysqli_query($con, "select has_tex from problem where problem_id={$prob_id}"));
if (!$row) {
return _('There\'s no such problem');
}
$prob_flag = $row[0];
if ($prob_flag & PROB_IS_HIDE && !check_priv(PRIV_INSIDER)) {
return _('Looks like you can\'t access this page');
}
if ($prob_flag & PROB_DISABLE_OPENSOURCE) {
return _('This solution is not open-source');
} else {
if ($prob_flag & PROB_SOLVED_OPENSOURCE) {
if (isset($_SESSION['user'])) {
$query = 'select min(result) from solution where user_id=\'' . $_SESSION['user'] . "' and problem_id={$prob_id} group by problem_id";
$user_status = mysqli_query($con, $query);
$row = mysqli_fetch_row($user_status);
if ($row && $row[0] == 0) {
return TRUE;
}
}
return _('You can\'t see me before solving it');
} else {
if (isset($_SESSION['user'])) {
$res = mysqli_query($con, "SELECT contest.contest_id,co.contest_id from contest\n RIGHT JOIN (select contest_id from contest_status where user_id='" . $_SESSION['user'] . "' and leave_time is NULL) as cs on (contest.contest_id=cs.contest_id)\n LEFT JOIN (select contest_id from contest_problem where problem_id={$prob_id}) as cp on (contest.contest_id=cp.contest_id)\n LEFT JOIN (select contest_id from contest_owner where user_id='" . $_SESSION['user'] . "') as co on (contest.contest_id=co.contest_id)\n where NOW()>start_time and NOW()<end_time and contest.hide_source_code");
$num = mysqli_num_rows($res);
if ($num > 0) {
$accessible = false;
while ($row = mysqli_fetch_row($res)) {
if (!is_null($row[1])) {
$accessible = true;
}
}
if ($accessible) {
return TRUE;
} else {
return _('You can\'t see me before the contest ends');
}
}
return TRUE;
}
}
}
}
return _('Looks like you can\'t access this page');
}
示例2: _renderInfo
/**
* Return the rendered information about the Horde_Mime_Part object.
*
* URL parameters used by this function:
* - tgz_contents: (integer) If set, show contents of ZIP file.
*
* @return array See Horde_Mime_Viewer_Driver::render().
*/
protected function _renderInfo()
{
global $injector;
$vars = $injector->getInstance('Horde_Variables');
if (!$this->getConfigParam('show_contents') && !isset($vars->tgz_contents)) {
$status = new IMP_Mime_Status($this->_mimepart, _("This is a compressed file."));
$status->addMimeAction('tgzViewContents', _("Click to display the file contents."));
$status->icon('mime/compressed.png');
return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
}
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/mime'));
$view->addHelper('Text');
$view->downloadclass = 'tgzdownload';
$view->files = array();
$view->tableclass = 'tgzcontents';
$tgzInfo = $this->_getTgzInfo();
foreach ($tgzInfo as $key => $val) {
if (!strlen($val['data'])) {
continue;
}
$file = new stdClass();
$file->download = '';
$file->name = $val['name'];
$file->size = IMP::sizeFormat($val['size']);
if (!empty($val['size'])) {
$file->download = $this->getConfigParam('imp_contents')->linkView($this->_mimepart, 'download_render', '', array('class' => 'iconImg downloadAtc', 'jstext' => _("Download"), 'params' => array('tgz_attachment' => $key)));
}
$view->files[] = $file;
}
return array($this->_mimepart->getMimeId() => array('data' => $view->render('compressed'), 'type' => 'text/html; charset=UTF-8'));
}
示例3: _init
/**
*/
protected function _init()
{
global $injector, $notification, $page_output;
$this->_assertCategory('Ingo_Rule_System_Whitelist', _("Whitelist"));
$ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
$whitelist = $ingo_storage->getSystemRule('Ingo_Rule_System_Whitelist');
/* Token checking & perform requested actions. */
switch ($this->_checkToken(array('rule_update'))) {
case 'rule_update':
try {
$whitelist->addresses = $this->vars->whitelist;
$ingo_storage->updateRule($whitelist);
$notification->push(_("Changes saved."), 'horde.success');
$injector->getInstance('Ingo_Factory_Script')->activateAll();
} catch (Ingo_Exception $e) {
$notification->push($e);
}
break;
}
/* Prepare the view. */
$view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/whitelist'));
$view->addHelper('Horde_Core_View_Helper_Help');
$view->addHelper('Horde_Core_View_Helper_Label');
$view->addHelper('Text');
$view->disabled = $whitelist->disable;
$view->formurl = $this->_addToken(self::url());
$view->whitelist = implode("\n", $whitelist->addresses);
$page_output->addScriptFile('whitelist.js');
$page_output->addInlineJsVars(array('IngoWhitelist.filtersurl' => strval(Ingo_Basic_Filters::url()->setRaw(true))));
$this->title = _("Whitelist Edit");
$this->output = $view->render('whitelist');
}
示例4: translate
function translate($lang, $test = 0)
{
global $LOCALE_PATH;
putenv("LANGUAGE={$lang}");
bindtextdomain("zarafa", "{$LOCALE_PATH}");
if (STORE_SUPPORTS_UNICODE == false) {
bind_textdomain_codeset('zarafa', "windows-1252");
} else {
bind_textdomain_codeset('zarafa', "utf-8");
}
textdomain('zarafa');
setlocale(LC_ALL, $lang);
$trans_array["Sent Items"] = _("Sent Items");
$trans_array["Outbox"] = _("Outbox");
$trans_array["Deleted Items"] = _("Deleted Items");
$trans_array["Inbox"] = _("Inbox");
$trans_array["Calendar"] = _("Calendar");
$trans_array["Contacts"] = _("Contacts");
$trans_array["Drafts"] = _("Drafts");
$trans_array["Journal"] = _("Journal");
$trans_array["Notes"] = _("Notes");
$trans_array["Tasks"] = _("Tasks");
$trans_array["Junk E-mail"] = _("Junk E-mail");
return $trans_array;
}
示例5: preforward
/**
* preprocess before forwarding.
*
* @access public
*/
function preforward()
{
$this->subtitle = _('Select language');
$config = $this->backend->getConfig();
$this->af->setApp('allow_language', $config->get('allow_language'));
$this->af->setApp('cur_lang', current($this->backend->ctl->getLanguage()));
}
示例6: show
/**
* Show the menu
*
* @return void
*/
function show()
{
$cur = common_current_user();
$action = $this->action->trimmed('action');
$this->out->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartSubGroupNav', array($this))) {
$this->out->menuItem(common_local_url('showstream', array('nickname' => $this->user->nickname)), _m('MENU', 'Profile'), empty($profile) ? $this->user->nickname : $profile->getBestName(), $action == 'showstream', 'nav_profile');
$this->out->menuItem(common_local_url('subscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscriptions'), sprintf(_('People %s subscribes to.'), $this->user->nickname), $action == 'subscriptions', 'nav_subscriptions');
$this->out->menuItem(common_local_url('subscribers', array('nickname' => $this->user->nickname)), _m('MENU', 'Subscribers'), sprintf(_('People subscribed to %s.'), $this->user->nickname), $action == 'subscribers', 'nav_subscribers');
if ($cur && $cur->id == $this->user->id) {
// Possibly site admins should be able to get in here too
$pending = $this->countPendingSubs();
if ($pending || $cur->subscribe_policy == User::SUBSCRIBE_POLICY_MODERATE) {
$this->out->menuItem(common_local_url('subqueue', array('nickname' => $this->user->nickname)), sprintf(_m('MENU', 'Pending (%d)'), $pending), sprintf(_('Approve pending subscription requests.'), $this->user->nickname), $action == 'subqueueaction', 'nav_subscribers');
}
}
$this->out->menuItem(common_local_url('usergroups', array('nickname' => $this->user->nickname)), _m('MENU', 'Groups'), sprintf(_('Groups %s is a member of.'), $this->user->nickname), $action == 'usergroups', 'nav_usergroups');
$this->out->menuItem(common_local_url('peopletagsubscriptions', array('nickname' => $this->user->nickname)), _m('MENU', 'Lists'), sprintf(_('List subscriptions by %s.'), $this->user->nickname), in_array($action, array('peopletagsbyuser', 'peopletagsubscriptions', 'peopletagsforuser')), 'nav_timeline_peopletags');
if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
$this->out->menuItem(common_local_url('invite'), _m('MENU', 'Invite'), sprintf(_('Invite friends and colleagues to join you on %s.'), common_config('site', 'name')), $action == 'invite', 'nav_invite');
}
Event::handle('EndSubGroupNav', array($this));
}
$this->out->elementEnd('ul');
}
示例7: render
public function render(\Koch\Pagination\Pagination $pagination)
{
$lastPage = $pagination->getLastPage();
$numberOfPages = $pagination->getNumberOfPages();
$current_page = $pagination->getCurrentPage();
$url = 'URL';
$html = '<nav class="pagination">';
$html .= sprintf('<a href="%s">‹ %s</a>', str_replace('{page}', 1, $url), _('First'));
if ($pagination->hasPreviousPage()) {
$html .= sprintf('<a href="%s"><</a>', str_replace('{page}', $pagination->getPreviousPage(), $url));
}
// render page range around the current page
for ($i = 1; $i <= $numberOfPages; ++$i) {
if ($i === $current_page) {
$html .= sprintf('<li class="active">%s</li>', $i);
} else {
$html .= sprintf('<a href="%s">%s</a>', str_replace('{page}', $i, $url), $i);
}
}
if ($pagination->hasNextPage()) {
$html .= sprintf('<a href="%s">></a>', str_replace('{page}', $pagination->getNextPage(), $url));
}
if ($lastPage) {
$html .= sprintf('<a href="%s"> %s›</a>', str_replace('{page}', $lastPage, $url), _('Last'));
}
$html .= '</nav>';
return $html;
}
示例8: do_credits
function do_credits()
{
global $dblang, $globals;
echo '<br style="clear: both;" />' . "\n";
echo '<div class="credits-strip">' . "\n";
echo '<span class="credits-strip-text">' . "\n";
// IMPORTANT: legal note only for our servers, CHANGE IT!!
if (preg_match('/meneame.net$/', get_server_name())) {
echo '<a href="http://bitassa.com/legal-meneame.php"><strong>' . _('información legal y condiciones de uso') . '</strong></a> | ';
}
// IMPORTANT: read above
echo '<a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php#we">' . _('quiénes somos') . '</a>';
echo '<br />';
echo '<a href="http://meneame.wikispaces.com/" title="wiki meneame">' . _('wiki') . '</a>' . "\n";
echo ' | ' . _('código: ') . ' <a href="' . $globals['base_url'] . 'COPYING">' . _('licencia') . '</a>, <a href="' . $globals['base_url'] . 'archives/meneame-src.tgz">' . _('descargar') . '</a>';
echo ' | <a href="http://creativecommons.org/licenses/by-sa/2.5/">' . _('licencia de los gráficos') . '</a>' . "\n";
echo '</span>' . "\n";
echo '<span class="credits-strip-buttons">' . "\n";
echo '<a href="http://validator.w3.org/check?uri=referer"><img src="' . $globals['base_url'] . 'img/common/valid-xhtml10.png" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>' . "\n";
echo ' ' . "\n";
echo '<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="' . $globals['base_url'] . 'img/common/vcss.png" alt="Valid CSS!" /></a> ' . "\n";
echo '<a href="http://feedvalidator.org/check.cgi?url=http://meneame.net/rss2.php"><img src="' . $globals['base_url'] . 'img/common/valid-rss.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a>' . "\n";
echo '</span>' . "\n";
echo '</div>' . "\n";
echo "<!--ben-tmp-functions:do_credits-->\n";
}
示例9: get_menu
function get_menu($params)
{
$out = '';
extract($params);
$prefix = empty($prefix) ? '' : $prefix;
$suffix = empty($suffix) ? '' : $suffix;
$pre_tag = empty($pre_tag) ? '' : $pre_tag;
$after_tag = empty($after_tag) ? '' : $after_tag;
$out = '';
include_once LIB_ROOT . '/pages/page.class.php';
$out .= $prefix . '<a href="/" class=menu>' . _('Home') . '</a>' . $suffix;
if (!AuthController::getInstance()->isAuthorized() && $show_signup) {
$out .= $prefix . '<a href="/signup.php" class=menu>' . _('Sign Up') . '</a>' . $suffix;
}
if ($show_memberarea) {
$out .= $prefix . '<a href="/user/account.php" class=menu>' . _('Member\'s area') . '</a>' . $suffix;
}
if (Project::getInstance()->getCurUser()->isAdmin()) {
$out .= $prefix . '<small><a href="/includes/inlines/admin/page.php?position=0" target="blank" style="font-size:9px;">(add page here)</a></small>' . $suffix;
}
$result = sql_query('
SELECT *
FROM pages
WHERE lang="' . $_COOKIE['lang'] . '" AND home=0 AND show_in_menu=1
ORDER BY position, id DESC
');
while ($menu_page = mysql_fetch_assoc($result)) {
$out .= $prefix . '<a href="/index.php?page=' . $menu_page['id'] . '" class=menu>' . $menu_page['name'] . '</a>' . $suffix;
if (Project::getInstance()->getCurUser()->isAdmin()) {
$out .= $prefix . '<small><a href="/includes/inlines/admin/page.php?position=' . $menu_page['position'] . '" target="blank" style="font-size:9px;">(add page here)</a></small>' . $suffix;
}
}
$out .= $exclude ? '' : $prefix . '<a href="/contactus.php" class=menu>' . _('Contact Us') . '</a>' . $suffix;
return $pre_tag . $out . $after_tag;
}
示例10: getAlert
/**
* Sets and shows an alert
*
* @param string $message
* @param string $type = "Error"
* @param boolean $URL = NULL
* @return string value
*/
function getAlert($message, $type = "error", $URL = NULL)
{
if (!is_null($URL)) {
$message = a(__(_($message)), encode($URL), TRUE);
}
if ($type === "error") {
return '<div id="alert-message" class="alert alert-error">
<a class="close">×</a>
' . __(_($message)) . '
</div>';
} elseif ($type === "success") {
unset($_POST);
return '<div id="alert-message" class="alert alert-success">
<a class="close">×</a>
' . __(_($message)) . '
</div>';
} elseif ($type === "warning") {
return '<div id="alert-message" class="alert alert-warning">
<a class="close">×</a>
' . __(_($message)) . '
</div>';
} elseif ($type === "notice") {
return '<div id="alert-message" class="alert alert-info">
<a class="close">×</a>
' . __(_($message)) . '
</div>';
}
}
示例11: execute
/**
* Purge old messages in the sent-mail mailbox.
*
* @return boolean Whether any messages were purged from the mailbox.
*/
public function execute()
{
global $prefs, $notification;
/* Get the current UNIX timestamp minus the number of days specified
* in 'purge_sentmail_keep'. If a message has a timestamp prior to
* this value, it will be deleted. */
$del_time = new Horde_Date(time() - $prefs->getValue('purge_sentmail_keep') * 86400);
foreach ($this->_getMboxes() as $mbox) {
/* Open the sent-mail mailbox and get the list of messages older
* than 'purge_sentmail_keep' days. */
$query = new Horde_Imap_Client_Search_Query();
$query->dateSearch($del_time, Horde_Imap_Client_Search_Query::DATE_BEFORE);
$msg_ids = $mbox->runSearchQuery($query);
/* Go through the message list and delete the messages. */
if ($msg_ids->delete(array('nuke' => true))) {
$msgcount = count($msg_ids);
if ($msgcount == 1) {
$notification->push(sprintf(_("Purging 1 message from sent-mail mailbox %s."), $mbox->display), 'horde.message');
} else {
$notification->push(sprintf(_("Purging %d messages from sent-mail mailbox."), $msgcount, $mbox->display), 'horde.message');
}
}
}
return true;
}
示例12: _handle
/**
* Variables required in form input:
* - imple_submit: vcard action. Contains import and source properties
* - mime_id
* - muid
*
* @return boolean True on success.
*/
protected function _handle(Horde_Variables $vars)
{
global $registry, $injector, $notification;
$iCal = new Horde_Icalendar();
try {
$contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
if (!($mime_part = $contents->getMimePart($vars->mime_id))) {
throw new IMP_Exception(_("Cannot retrieve vCard data from message."));
} elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
throw new IMP_Exception(_("Error reading the contact data."));
}
$components = $iCal->getComponents();
} catch (Exception $e) {
$notification->push($e, 'horde.error');
}
$import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false;
$source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false;
if ($import && $source && $registry->hasMethod('contacts/import')) {
$count = 0;
foreach ($components as $c) {
if ($c->getType() == 'vcard') {
try {
$registry->call('contacts/import', array($c, null, $source));
++$count;
} catch (Horde_Exception $e) {
$notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
}
}
}
$notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
}
}
示例13: sidebar
/**
* Add additional items to the sidebar.
*
* @param Horde_View_Sidebar $sidebar The sidebar object.
*/
public function sidebar($sidebar)
{
$perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
if (Sesha::isAdmin(Horde_Perms::READ) || $perms->hasPermission('sesha:addStock', $GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$sidebar->addNewButton(_("_Add Stock"), Horde::url('stock.php')->add('actionId', 'add_stock'));
}
}
示例14: __construct
public function __construct()
{
$this->Name = "agent_readmeoss";
$this->Title = _("ReadMeOSS generation");
$this->AgentName = "readmeoss";
parent::__construct();
}
示例15: html
public function html()
{
global $registry;
$view = $GLOBALS['injector']->createInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
$view->owner = $this->_view->gallery->get('owner');
$view->userfeedurl = Ansel::getUrlFor('rss_user', array('owner' => $view->owner));
$view->slug = $this->_view->gallery->get('slug');
$view->galleryname = $this->_view->gallery->get('name');
$view->galleryfeedurl = Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $view->slug));
$view->title = _("Links");
/* Embed html */
if (empty($this->_view->_params['image_id'])) {
/* Gallery view */
$params = array('count' => 10);
if (!empty($slug)) {
$params['gallery_slug'] = $slug;
} else {
$params['gallery_id'] = $this->_view->gallery->id;
}
} else {
// This is an image view
$params = array('thumbsize' => 'screen', 'images' => $this->_view->_params['image_id'], 'count' => 10);
}
$view->embed = Ansel::embedCode($params);
return $view->render('links');
}