本文整理汇总了PHP中__t函数的典型用法代码示例。如果您正苦于以下问题:PHP __t函数的具体用法?PHP __t怎么用?PHP __t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_new_user_notification
function wp_new_user_notification($user_id, $plaintext_pass = '')
{
//pyboxlog('called wp_n_u_n', 1);
$user = new WP_User($user_id);
$body = __t('An account has been created for you on the Computer Science Circles website, with a randomly generated password.
User name: %username%
Current random password: %password%
Please visit
%loginurl%
and change your password to something you will remember.
Press "%upprof%" once you are done.
Thanks from the Computer Science Circles team!
%siteurl%');
//pyboxlog('locale:' . pll_current_language('locale'), 1);
if (class_exists('PLL_Base')) {
update_user_meta($user_id, 'user_lang', pll_current_language('locale'));
}
$subject = __t('Computer Science Circles: New account');
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$find = array('/%username%/i', '/%password%/i', '/%blogname%/i', '/%siteurl%/i', '/%loginurl%/i', '/%useremail%/i', '/%upprof%/i');
$replace = array($user_login, $plaintext_pass, get_option('blogname'), get_option('siteurl'), get_option('siteurl') . '/wp-login.php', $user_email, __t('Update Profile'));
$body = preg_replace($find, $replace, $body);
$body = preg_replace("/%.*%/", "", $body);
pb_mail('"' . get_option('blogname') . '" <' . CSCIRCLES_BOUNCE_EMAIL . '>', '<' . $user_email . '>', $subject, $body);
}
示例2: _addOption
function _addOption()
{
$this->autoRender = false;
$this->autoLayout = false;
$response = array();
$option = $this->data['FieldOption']['text'] = Sanitize::getString($this->data, 'text');
$value = $this->data['FieldOption']['value'] = Sanitize::stripAll($this->data, 'text');
$fieldid = $this->data['FieldOption']['fieldid'] = Sanitize::getInt($this->data, 'field_id');
$fieldName = Sanitize::getString($this->data, 'name');
// Begin validation
if ($value == '') {
$validation = __t("The field is empty.", true);
$response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\"> " . $validation . "</span>');";
return $this->ajaxResponse($response);
}
// Save
$result = $this->FieldOption->save($this->data);
switch ($result) {
case 'success':
// Begin update display
$option = $this->data['FieldOption']['text'];
$value = $this->data['FieldOption']['value'];
$response = "\n jQuery('#{$fieldName}').addOption('{$value}','" . addslashes($option) . "');\n jQuery('#jr_fieldOption{$fieldid}').val(''); \n jQuery('#submitButton{$fieldid}').removeAttr('disabled');\n ";
return $this->ajaxResponse($response);
case 'duplicate':
$validation = sprintf(__t("%s already exists", true), $value);
break;
case 'db_error':
$validation = s2Messages::submitErrorGeneric();
break;
}
$response[] = "jQuery('#{$fieldName}').selectOptions('" . addslashes($option) . "');";
$response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\"> " . $validation . "</span>');";
return $this->ajaxResponse($response);
}
示例3: logoutAction
public function logoutAction($key = 'user')
{
Session::remove($key);
Session::destroy();
Session::setFlash(__t('you_logout'));
$this->redirect("/");
}
示例4: __construct
function __construct()
{
parent::__construct();
switch ($this->integrationMode) {
case 'groups':
// The primary key for categories
switch (getCmsVersion()) {
case CMS_JOOMLA10:
case CMS_MAMBO46:
$this->categoryPrimaryKey = 'group_id';
break;
case CMS_JOOMLA15:
$this->categoryPrimaryKey = 'id';
break;
}
$this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
$this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
break;
case 'fields':
$this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`');
$this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
$this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
break;
}
$this->tag = __t("COMMUNITY_BUILDER_TAG", true);
// Used in MyReviews page to differentiate from other component reviews
$this->fields[] = "'{$this->tag}' AS `Listing.tag`";
}
示例5: __construct
function __construct()
{
parent::__construct();
$cms_version = getCmsVersion();
switch ($this->integrationMode) {
case 'groups':
$this->fields['Category.title'] = 'Category.title AS `Category.title`';
$this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
$this->group[] = 'Listing.id';
$this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
if ($cms_version == CMS_JOOMLA15) {
unset($this->group);
$this->fields['Category.title'] = 'Category.name AS `Category.title`';
$this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'Category' => "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
$this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
}
break;
case 'fields':
$this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.title' => 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`');
$this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
$this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
break;
}
$this->tag = __t("COMMUNITY_BUILDER_TAG", true);
// Used in MyReviews page to differentiate from other component reviews
$this->fields[] = "'{$this->tag}' AS `Listing.tag`";
# Use name or username based on JReviews config
$Config = Configure::read('JreviewsSystem.Config');
if ($Config->name_choice == 'realname') {
$this->fields['Listing.title'] = 'Listing.name AS `Listing.title`';
}
unset($Config);
}
示例6: random
/**
* Generate a "random" alpha-numeric string.
*
* From Laravel
* @param int $length
* @return string
*/
public static function random($length = 16)
{
$length = (int) $length;
if ($length <= 0) {
throw new \InvalidArgumentException(__t('random_length_must_be_greater_then_zero'));
}
if (function_exists('random_bytes')) {
try {
$random = random_bytes($length);
} catch (\Exception $e) {
$random = static::randomString($length);
}
} else {
if (function_exists('openssl_random_pseudo_bytes')) {
$string = '';
while (($len = strlen($string)) < $length) {
$size = $length - $len;
$bytes = openssl_random_pseudo_bytes($size);
$string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
}
$random = $string;
} else {
$random = static::randomString($length);
}
}
return $random;
}
示例7: preDispatch
/**
* Pass a closure to this function in order to modify the output data
* before it is json_encoded and sent to the client. The callable should
* accept an array parameter, and return the modified array.
* @param callable $callable
* @return null
*/
public static function preDispatch($callable)
{
if (!is_callable($callable)) {
throw new \InvalidArgumentException(__t('predispatch_callable_must_be_callable'));
}
self::$preDispatch = $callable;
}
示例8: dbProblemHistory
function dbProblemHistory($limit, $sortname, $sortorder, $req = NULL)
{
global $db_query_info;
$db_query_info = array();
if ($req == NULL) {
$req = $_REQUEST;
}
$db_query_info['type'] = 'problem-history';
$problemname = getSoft($req, "p", "");
//which problem?
$user = getSoft($req, "user", "");
if ($problemname == "") {
return __t("You must enter a non-empty problem name.");
}
$db_query_info['problem'] = $problemname;
$resultdesc = array('y' => __t('Did not crash.'), 'Y' => __t('Correct!'), 'N' => __t('Incorrect.'), 'E' => __t('Internal error.'), 'S' => __t('Saved.'), 's' => __t('Saved.'));
if (!is_user_logged_in()) {
return __t("You must log in to view past submissions.");
}
if ((userIsAdmin() || userIsAssistant()) && $user != "") {
$u = get_userdata($user);
if ($u === false) {
return sprintf(__t("User number %s not found."), $u);
}
$db_query_info['viewuser'] = $user;
} else {
$u = wp_get_current_user();
}
$uid = $u->ID;
$uname = $u->user_login;
global $wpdb;
$table_name = $wpdb->prefix . "pb_submissions";
$counts = $wpdb->get_results($wpdb->prepare("SELECT COUNT(1), COUNT(userinput) from {$table_name}\nWHERE userid = %d AND problem = %s", $uid, $problemname), ARRAY_N);
$count = $counts[0][0];
$showInputColumn = $counts[0][1] > 0;
if ($count == 0) {
return sprintf(__t('We do not have record of any submissions from user %1$s for problem %2$s.'), $uname . ' (#' . $uid . ')', $problemname);
}
$knownFields = array(__t("time & ID") => "beginstamp", __t("user code") => "usercode", __t("user input") => "userinput", __t("result") => "result");
if (array_key_exists($sortname, $knownFields)) {
$sortString = $knownFields[$sortname] . " " . $sortorder . ", ";
} else {
$sortString = "";
}
$prep = $wpdb->prepare("SELECT ID, beginstamp, usercode, userinput, result from {$table_name}\nWHERE userid = %d AND problem = %s ORDER BY {$sortString} ID DESC" . $limit, $uid, $problemname);
$flexirows = array();
foreach ($wpdb->get_results($prep, ARRAY_A) as $r) {
$cell = array();
$cell[__t('user code')] = preBox($r['usercode'], -1, -1);
if ($showInputColumn) {
$cell[__t('user input')] = $r['userinput'] === NULL ? '<i>' . __t('n/a') . '</i>' : preBox($r['userinput'], -1, 100000);
}
if ($problemname != "visualizer") {
$cell[__t('result')] = getSoft($resultdesc, $r['result'], $r['result']);
}
$cell[__t('time & ID')] = str_replace(' ', '<br/>', $r['beginstamp']) . '<br/>#' . $r['ID'];
$flexirows[] = array('id' => $r['ID'], 'cell' => $cell);
}
return array('total' => $count, 'rows' => $flexirows);
}
示例9: fetchInfo
/**
* Fetch Video information
* @param $videoID
* @return array
*/
protected function fetchInfo($videoID)
{
$info = [];
$info['title'] = __t('unable_to_retrieve_x_title', ['service' => 'Vimeo']);
$info['size'] = 0;
$info['width'] = 560;
$info['height'] = 540;
// Get Data
$url = 'http://vimeo.com/api/v2/video/' . $videoID . '.json';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
$content = curl_exec($ch);
curl_close($ch);
$array = json_decode($content, true);
if (!$array) {
return $info;
}
$result = $array[0];
$info['title'] = $result['title'];
$info['caption'] = strip_tags($result['description']);
$info['size'] = $result['duration'];
$info['height'] = $result['height'];
$info['width'] = $result['width'];
$info['tags'] = $result['tags'];
$info['data'] = $this->getThumbnail($result['thumbnail_large']);
return $info;
}
示例10: parseID
/**
* Parse an embed ID
* @param $embedID
* @return array
*/
public function parseID($embedID)
{
$defaultInfo = ['embed_id' => $embedID, 'title' => __t('x_type_x', ['service' => $this->getName(), 'type' => $this->getProviderType()]) . ': ' . $embedID, 'size' => 0, 'name' => $this->getName() . '_' . $embedID . '.jpg', 'type' => $this->getType()];
$info = array_merge($defaultInfo, $this->fetchInfo($embedID));
$info['html'] = $this->getCode($info);
return $info;
}
示例11: findChildOptions
function findChildOptions()
{
$response = array();
$childField = Sanitize::getString($this->data, 'childField');
$childSelected = Sanitize::getString($this->data, 'childSelected');
$parentValue = Sanitize::getString($this->data, 'parentValue');
$module_id = Sanitize::getInt($this->data, 'module_id');
if ($parentValue == '') {
$ret = '<option value="">' . __t("Select", true, true) . '</option>';
$response[] = "jQuery(\"#{$childField}{$module_id}\").html('{$ret}').attr('disabled','disabled');";
return implode(' ', $response);
}
$query = " \r\n SELECT \r\n FieldOption.optionid, FieldOption.text, FieldOption.value\r\n FROM #__jreviews_fieldoptions AS FieldOption\r\n INNER JOIN #__jreviews_fields AS Field ON FieldOption.fieldid = Field.fieldid AND Field.name = '" . $childField . "'\r\n WHERE FieldOption.value LIKE '" . $parentValue . "-%'\r\n ";
$this->_db->setQuery($query);
$options = $this->_db->loadAssocList();
$ret = '<option value="">' . __t("Select", true, true) . '</option>';
foreach ($options as $option) {
if ($childSelected != '' && $option['value'] == $childSelected) {
$ret .= '<option selected="selected" value="' . $option['value'] . '">' . $option['text'] . '</option>';
} else {
$ret .= '<option value="' . $option['value'] . '">' . $option['text'] . '</option>';
}
}
$response[] = "jQuery(\"#{$childField}{$module_id}\").html('{$ret}').removeAttr('disabled');";
return implode(' ', $response);
}
示例12: __construct
function __construct()
{
parent::__construct();
$this->tag = __t("K2_TAG", true);
// Used in MyReviews page to differentiate from other component reviews
// $this->fields[] = "'{$this->tag }' AS `Listing.tag`";
}
示例13: send
public static function send($viewPath, $data, $callback)
{
$config = Bootstrap::get('config');
$mailer = Bootstrap::get('mailer');
if (!$mailer) {
throw new InvalidArgumentException(__t('mail_configuration_no_defined'));
}
$DirectusSettingsTableGateway = new \Zend\Db\TableGateway\TableGateway('directus_settings', Bootstrap::get('zendDb'));
$rowSet = $DirectusSettingsTableGateway->select();
$settings = [];
foreach ($rowSet as $setting) {
$settings[$setting['collection']][$setting['name']] = $setting['value'];
}
$instance = new static($mailer, $settings);
$message = Swift_Message::newInstance();
// default mail from address
$mailConfig = $config['mail'];
$message->setFrom($mailConfig['from']);
call_user_func($callback, $message);
if ($message->getBody() == null) {
// Slim Extras View twig act weird on this version
$viewContent = $instance->getViewContent($viewPath, $data);
$message->setBody($viewContent, 'text/html');
}
$instance->sendMessage($message);
}
示例14: validate
public function validate($data)
{
parent::validate($data);
$step = install_get_step(3);
if ($this->isStrictMode($step)) {
throw new \RuntimeException(__t('mysql_strict_mode_warning'));
}
}
示例15: __construct
function __construct()
{
parent::__construct();
$this->tag = __t("SOBI2_TAG", true);
// Used in MyReviews page to differentiate from other component reviews
$this->fields[] = "'{$this->tag}' AS `Listing.tag`";
// Comment this line to hide the tag from the output
}