本文整理汇总了PHP中T_函数的典型用法代码示例。如果您正苦于以下问题:PHP T_函数的具体用法?PHP T_怎么用?PHP T_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveSyndicate
/**
* Saves the record from an edit form submit
* @param string The current GET/POST option
*/
function saveSyndicate($option)
{
global $database;
$params = mosGetParam($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$_POST['params'] = mosParameters::textareaHandling($txt);
}
$id = mosGetParam($_POST, 'id', '17');
$row = new mosComponent($database);
$row->load($id);
if (!$row->bind($_POST)) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->check()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
if (!$row->store()) {
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit;
}
$msg = T_('Settings successfully Saved');
mosRedirect('index2.php?option=' . $option, $msg);
}
示例2: createform
function createform($_name, $_type = null)
{
$this->data->extendForm = true;
if (!$this->form) {
$this->twig_macro('form');
$this->form = new \lib\form();
$this->data->form = object();
}
$args = func_get_args();
if (count($args) === 2) {
$submit_value = T_('submit');
if ($_type == 'add') {
$submit_value = T_('submit');
} elseif ($_type == 'edit') {
$submit_value = T_('save');
} elseif ($_type == 'login') {
$submit_value = T_('sing in');
} elseif ($_type == 'register') {
$submit_value = T_('create an account');
} elseif (!empty($_type)) {
$submit_value = $_type;
}
array_push($args, $submit_value);
}
$form = call_user_func_array(array($this->form, 'make'), $args);
if (get_class($form) == 'lib\\form' || preg_match("/cls\\\\form/", get_class($form))) {
preg_match("/^(@[^\\.]+)*\\.(.+)\$/", $_name, $sName);
$this->data->form->{$sName[2]} = $form;
}
// if type of form is edit then fill it with related data
if ($_type == 'edit') {
$this->form_fill($form, $sName[2]);
}
return $form;
}
示例3: case_status_report
/**
* Generate the case status report
*
* @param mixed $questionnaire_id The quesitonnaire, if specified
* @param string $sample_id The sample, if speified
* @param mixed $outcome_id THe outcome id, if specified
*
* @return false if empty otherwise true if table drawn
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2012-10-02
*/
function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false)
{
global $db;
$q = "";
if ($questionnaire_id !== false) {
$q = "AND c.questionnaire_id = {$questionnaire_id}";
}
$s = "";
if ($sample_id !== false) {
$s = "AND s.import_id = '{$sample_id}'";
}
$o = "";
if ($outcome_id !== false) {
$o = "AND c.current_outcome_id = {$outcome_id}";
}
$sql = "SELECT \tCONCAT('<a href=\\'supervisor.php?case_id=', c.case_id, '\\'>', c.case_id, '</a>') as case_id,\r\n\t\t\to.description as outcomes,\r\n\t\t\tsi.description as samples, s.Time_zone_name as timezone, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'" . TIME_FORMAT . "') as time, (SELECT COUNT(*) FROM `call` WHERE `call`.case_id = c.case_id) as nrcalls, (SELECT COUNT(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) as nrattempts, \t\r\n\t\t\tCASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "'\r\n\t\t\t\tWHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "'\r\n\t\t\t\tELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),' " . TQ_("minutes") . "')\r\n\t\t\tEND AS availableinmin,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT('<span class=\\'text-info\\'>', oq.firstName,' ',oq.lastName,'</span>')\r\n\t\t\tEND AS assignedoperator,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('')\r\n\t\t\tELSE CONCAT('   ', cq.sortorder ,' ')\r\n\t\t\tEND AS ordr,\r\n\t\t\tCASE WHEN oq.operator_id IS NULL THEN \r\n\t\t\t\tCONCAT('<span data-toggle=\\'tooltip\\' title=\\'" . TQ_("Not assigned, select to assign") . "\\'><input type=\\'checkbox\\' name=\\'c', c.case_id, '\\' value=\\'', c.case_id, '\\' /></span>')\r\n\t\t\tELSE CONCAT('<a href=\"?questionnaire_id={$questionnaire_id}&sample_import_id={$sample_id}&unassign=', cq.case_queue_id, '\" data-toggle=\\'tooltip\\' title=\\'" . TQ_("Click to unassign") . "\\'><i class=\\'fa fa-trash-o fa-lg text-danger\\'></i></a>')\r\n\t\t\tEND AS flag\t\r\n\t\tFROM `case` as c\r\n\t\tJOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)\r\n\t\tJOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)\r\n\t\tJOIN sample as s ON (s.sample_id = c.sample_id {$s})\r\n\t\tJOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)\r\n\t\tJOIN questionnaire_sample as qs ON (qs.questionnaire_id = {$questionnaire_id} AND qs.sample_import_id = s.import_id)\r\n\t\tLEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)\r\n\t\tLEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)\r\n\t\tLEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)\r\n\t\tLEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)\r\n\t\tLEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)\r\n\t\tWHERE c.current_operator_id IS NULL {$q} {$o}\r\n\t\tAND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )\r\n\t\tAND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)\r\n\t\tGROUP BY c.case_id ORDER BY c.case_id ASC";
print "<form method=\"post\" action=\"?questionnaire_id={$questionnaire_id}&sample_import_id={$sample_id}\">";
$rs2 = $db->GetAll($sql);
translate_array($rs2, array("outcomes"));
$datacol = array('case_id', 'samples', 'timezone', 'time', 'nrattempts', 'nrcalls', 'outcomes', 'availableinmin', 'assignedoperator', 'ordr', 'flag');
$headers = array(T_("Case id"), T_("Sample"), T_("Timezone"), T_("Time NOW"), T_("Call attempts"), T_("Calls"), T_("Outcome"), T_("Available in"), T_("Assigned to"), T_("Order"), "<i class='fa fa-check-square-o fa-lg'></i>");
if (isset($_GET['sample_import_id'])) {
unset($datacol[1]);
unset($headers[1]);
}
xhtml_table($rs2, $datacol, $headers, "tclass", false, false, "bs-table");
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected\r\n\t\tFROM operator\r\n\t\tWHERE enabled = 1";
$rs3 = $db->GetAll($sql);
print "<h4 class='col-sm-offset-5 pull-left text-right control-label'>" . T_("Assign selected cases to") . " " . T_("operator") . " : </h4> ";
display_chooser($rs3, "operator_id", "operator_id", true, false, false, true, false, true, "pull-left");
print " <button class='btn btn-default' type='submit' data-toggle='tooltip' title='" . T_("Assign cases to operator queue") . "'><i class='fa fa-link fa-lg text-primary'></i> " . T_("Assign") . "</button>";
print "</form></br>";
return true;
}
示例4: display_legend
/**
* Display the icon legend
*/
function display_legend()
{
if (empty($this->icons)) {
return;
}
// There are some icons to display:
echo '<div id="icon_legend">' . T_('Legend') . ': ';
// Loop on all map array of filenames for icons to display icons list in the same order:
foreach ($this->icons as $icon) {
$icon_info = get_icon_info($icon);
if (!$icon_info) {
continue;
}
echo '<span class="legend_element">' . get_icon($icon) . ' ';
if (isset($icon_info['legend'])) {
// Icon has a legend:
echo $icon_info['legend'] . ' ';
} else {
// Icon has no legend so we use the alt:
echo $icon_info['alt'] . ' ';
}
echo '</span>';
}
echo '</div>';
}
示例5: filter_email_return
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_email_return(&$Form)
{
global $datestart, $datestop, $email;
$Form->date_input('datestartinput', $datestart, T_('From date'));
$Form->date_input('datestopinput', $datestop, T_('To date'));
$Form->text_input('email', $email, 40, T_('Email'));
}
示例6: post_signup
/**
* signup to system
* @return [type] [description]
*/
public function post_signup()
{
// get parameters and set to local variables
$mymobile = utility::post('mobile', 'filter');
$mypass = utility::post('password', 'hash');
$myperm = $this->option('account');
if (!$myperm) {
$myperm = 'NULL';
}
$user_id = \lib\db\users::signup($mymobile, $mypass, $myperm);
if ($user_id) {
// generate verification code
// save in logs table
// set SESSION verification_mobile
$code = \lib\utility\filter::generate_verification_code($user_id, $mymobile);
if ($code) {
\lib\utility\sms::send($mymobile, 'signup', $code);
debug::true(T_("Register successfully"));
$this->redirector()->set_url('verification?from=signup&mobile=' . $mymobile);
// $this->redirector()->set_url('login?from=signup&cp=1&mobile='.$mymobile);
} else {
debug::error(T_("Please contact to administrator!"));
}
} elseif ($user_id === false) {
debug::error(T_("Mobile number exist!"));
} else {
debug::error(T_("Please contact to administrator!"));
}
}
示例7: uploadimage
function uploadimage($x, $imgname, $tid)
{
global $site_config;
$imagesdir = $site_config["torrent_dir"] . "/images";
$allowed_types =& $site_config["allowed_image_types"];
if (!($_FILES["image{$x}"]["name"] == "")) {
if ($imgname != "") {
$img = "{$imagesdir}/{$imgname}";
$del = unlink($img);
}
$y = $x + 1;
$im = getimagesize($_FILES["image{$x}"]["tmp_name"]);
if (!$im[2]) {
show_error_msg(T_("ERROR"), "Invalid Image {$y}.", 1);
}
if (!array_key_exists($im['mime'], $allowed_types)) {
show_error_msg(T_("ERROR"), T_("INVALID_FILETYPE_IMAGE"), 1);
}
if ($_FILES["image{$x}"]["size"] > $site_config['image_max_filesize']) {
show_error_msg(T_("ERROR"), sprintf(T_("INVAILD_FILE_SIZE_IMAGE"), $y), 1);
}
$uploaddir = "{$imagesdir}/";
$ifilename = $tid . $x . $allowed_types[$im['mime']];
$copy = copy($_FILES["image{$x}"]["tmp_name"], $uploaddir . $ifilename);
if (!$copy) {
show_error_msg(T_("ERROR"), sprintf(T_("ERROR_UPLOADING_IMAGE"), $y), 1);
}
return $ifilename;
}
}
示例8: showBlogLastArticles
function showBlogLastArticles()
{
$content = '';
$feed = new SimplePie();
$feed->set_feed_url(array('http://bilboplanet.com/feed/'));
$feed->set_cache_duration(600);
# $feed->enable_xml_dump(isset($_GET['xmldump']) ? true : false);
$success = $feed->init();
$feed->handle_content_type();
if ($success) {
$content .= '<div class="box-dashboard"><div class="top-box-dashboard">' . T_('BilboPlanet news - Official Website :') . '</div>';
$content .= '<ul>';
$itemlimit = 0;
foreach ($feed->get_items() as $item) {
if ($itemlimit == 4) {
break;
}
$content .= '<li>' . $item->get_date('j/m/y') . ' : ';
$content .= '<a class="tips" rel="' . $item->get_title() . '" href="' . $item->get_permalink() . '" target="_blank">' . $item->get_title() . '</a>';
$content .= '</li>';
$itemlimit = $itemlimit + 1;
}
$content .= '</ul></div>';
}
return $content;
}
示例9: datarow
public function datarow($_table = null, $_id = null, $_metatable = false)
{
if (!$_table) {
$_table = $this->module();
}
// if myid parameter set use it else use url parameter for myid
if (!$_id) {
$_id = $this->childparam();
}
$tmp_result = $this->sql()->table($_table)->where('id', $_id)->select();
if ($tmp_result->num() == 1) {
$tmp_result = $tmp_result->assoc();
// add meta table rows as filed to datarow, can access via meta in datarow
if ($_metatable) {
$metas = $this->sql()->table('options')->where('post_id', $_id)->field('option_key', 'option_value', 'option_meta')->select()->allassoc();
foreach ($metas as $key => $value) {
$myval = $value['option_meta'];
if (substr($myval, 0, 1) === '{') {
$myval = json_decode($myval, true);
}
$mykey = strtok($value['option_key'], '_');
$tmp_result['meta'][$mykey] = $myval;
}
}
return $tmp_result;
} elseif ($tmp_result->num() > 1) {
\lib\error::access(T_("id is found 2 or more times. it's imposible!"));
} else {
\lib\error::access(T_("Url incorrect: id not found"));
return false;
}
return null;
}
示例10: navmenu
function navmenu()
{
?>
<br />
<div class="f-border">
<table cellpadding='0' cellspacing='3' width='100%'>
<tr class="f-title">
<th width='100%' height="32" align='center'>
<?php
print "<a href='account.php'><b>" . T_("YOUR_PROFILE") . "</b></a>";
?>
|
<?php
print "<a href='account.php?action=edit_settings&do=edit'><b>" . T_("YOUR_SETTINGS") . "</b></a>";
?>
|
<?php
print "<a href='account.php?action=changepw'><b>" . T_("CHANGE_PASS") . "</b></a>";
?>
|
<?php
print "<a href='account.php?action=mytorrents'><b>" . T_("YOUR_TORRENTS") . "</b></a>";
?>
|
<?php
print "<a href='mailbox.php'><b>" . T_("YOUR_MESSAGES") . "</b></a>";
?>
</th>
</tr>
</table>
</div>
<br />
<?php
}
示例11: loadSettingsFromFile
private function loadSettingsFromFile($dbSettingsFile)
{
// Check that databaseSettingsFile is valid
if (!is_readable($dbSettingsFile)) {
ErrorHandling::fatalNoDatabaseError(T_("DB Config File isn't a valid file.") . "({$dbSettingsFile})");
}
$settings = file($dbSettingsFile);
foreach ($settings as $setting) {
list($key, $value) = explode(":", $setting);
$value = trim($value);
switch ($key) {
case 'sql_username':
$this->user = $value;
break;
case 'sql_password':
$this->pass = $value;
break;
case 'sql_server':
$this->host = $value;
break;
case 'sql_database':
case 'sql_radmindatabase':
$this->db = $value;
break;
}
}
}
示例12: botSearchContacts
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchContacts($text, $phrase = '', $ordering = '')
{
global $database, $my;
$text = trim($text);
if ($text == '') {
return array();
}
$section = T_('Contact');
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$database->setQuery("SELECT id FROM #__menu WHERE link LIKE 'index.php?option=com_contact%' ORDER BY LENGTH(link)");
$citemid = $database->loadResult();
$query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', '{$section}', b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&Itemid={$citemid}&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid AND b.access <= '{$my->gid}'" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.misc LIKE '%{$text}%'" . "\n OR a.con_position LIKE '%{$text}%'" . "\n OR a.address LIKE '%{$text}%'" . "\n OR a.suburb LIKE '%{$text}%'" . "\n OR a.state LIKE '%{$text}%'" . "\n OR a.country LIKE '%{$text}%'" . "\n OR a.postcode LIKE '%{$text}%'" . "\n OR a.telephone LIKE '%{$text}%'" . "\n OR a.fax LIKE '%{$text}%' )" . "\n AND a.published = '1'" . "\n ORDER BY {$order}";
$database->setQuery($query);
$rows = $database->loadObjectList();
return $rows;
}
示例13: __construct
/**
* __construct
*
* @param FCMS_Error $error
* @param Database $db
* @param int $id
*
* @return void
*/
public function __construct(FCMS_Error $error, Database $db, $id = null)
{
if (!isset($_SESSION['fcms_id']) && is_null($id)) {
$this->displayName = 'unknown-user';
$this->email = 'unknow-email';
$this->tzOffset = '';
$this->access = 10;
return;
} else {
if (isset($_SESSION['fcms_id'])) {
$this->id = (int) $_SESSION['fcms_id'];
}
}
// Passing in an ID, will overwrite the session
// So we can create a user object for a user other than the logged in one
if (!is_null($id)) {
$this->id = (int) $id;
}
$this->error = $error;
$this->db = $db;
// Get User info
$sql = "SELECT u.`fname`, u.`lname`, u.`username`, s.`displayname`, u.`email`, s.`timezone`, u.`access`\n FROM `fcms_users` AS u\n LEFT JOIN `fcms_user_settings` AS s ON u.`id` = s.`user`\n WHERE u.`id` = ?";
$userInfo = $this->db->getRow($sql, $this->id);
if ($userInfo === false) {
$this->error->setMessage(sprintf(T_('Could not get information for user [%s].'), $this->id));
return;
}
$this->displayName = $this->getDisplayNameFromData($userInfo);
$this->email = $userInfo['email'];
$this->tzOffset = $userInfo['timezone'];
$this->access = $userInfo['access'];
return;
}
示例14: cat_line
/**
* Generate category line when it has children
*
* @param Chapter generic category we want to display
* @param int level of the category in the recursive tree
* @return string HTML
*/
function cat_line($Chapter, $level)
{
global $line_class, $result_fadeout, $permission_to_edit, $current_User, $Settings;
global $GenericCategoryCache;
$line_class = $line_class == 'even' ? 'odd' : 'even';
$r = '<tr id="tr-' . $Chapter->ID . '"class="' . $line_class . (isset($result_fadeout[$GenericCategoryCache->dbIDname]) && in_array($Chapter->ID, $result_fadeout[$GenericCategoryCache->dbIDname]) ? ' fadeout-ffff00' : '') . '">
<td class="firstcol shrinkwrap">' . $Chapter->ID . '
</td>';
if ($permission_to_edit) {
// We have permission permission to edit:
$edit_url = regenerate_url('action,' . $Chapter->dbIDname, $Chapter->dbIDname . '=' . $Chapter->ID . '&action=edit');
$r .= '<td>
<strong style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $Chapter->dget('name') . '</a></strong>
</td>';
} else {
$r .= '<td>
<strong style="padding-left: ' . $level . 'em;">' . $Chapter->dget('name') . '</strong>
</td>';
}
$r .= '<td>' . $Chapter->dget('urlname') . '</td>';
$r .= '<td class="lastcol shrinkwrap">';
if ($permission_to_edit) {
// We have permission permission to edit, so display action column:
$r .= action_icon(T_('New...'), 'new', regenerate_url('action,cat_ID,cat_parent_ID', 'cat_parent_ID=' . $Chapter->ID . '&action=new')) . action_icon(T_('Edit...'), 'edit', $edit_url);
if ($Settings->get('allow_moving_chapters')) {
// If moving cats between blogs is allowed:
$r .= action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=move'), T_('Move'));
}
$r .= action_icon(T_('Delete...'), 'delete', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=delete'));
}
$r .= '</td>';
$r .= '</tr>';
return $r;
}
示例15: post_changepass
function post_changepass()
{
$myid = $this->login('id');
$newpass = utility::post('password-new', 'hash');
$oldpass = utility::post('password-old');
$tmp_result = $this->sql()->tableUsers()->where('id', $myid)->and('user_status', 'active')->select();
// if exist
if ($tmp_result->num() == 1) {
$tmp_result = $tmp_result->assoc();
$myhashedPassword = $tmp_result['user_pass'];
// if password is correct. go for login:)
if (isset($myhashedPassword) && utility::hasher($oldpass, $myhashedPassword)) {
$newpass = utility::post('password-new', 'hash');
$qry = $this->sql()->table('users')->where('id', $myid)->set('user_pass', $newpass);
$sql = $qry->update();
$this->commit(function () {
debug::true(T_("change password successfully"));
$this->redirector()->set_domain()->set_url();
// \lib\utility\Sms::send($_mobile, 'changepass');
});
// if a query has error or any error occour in any part of codes, run roolback
$this->rollback(function () {
debug::error(T_("change password failed!"));
});
} else {
debug::error(T_("Password is incorrect"));
}
} elseif ($tmp_result->num() == 0) {
debug::error(T_("user is incorrect"));
} else {
debug::error(T_("Please forward this message to administrator"));
}
sleep(0.1);
}