本文整理汇总了PHP中C::t方法的典型用法代码示例。如果您正苦于以下问题:PHP C::t方法的具体用法?PHP C::t怎么用?PHP C::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_cache_fields_connect_register
function build_cache_fields_connect_register()
{
global $_G;
$data = array();
$fields = array();
if ($_G['setting']['connect']['register_gender']) {
$fields[] = 'gender';
}
if ($_G['setting']['connect']['register_birthday']) {
$fields[] = 'birthyear';
$fields[] = 'birthmonth';
$fields[] = 'birthday';
}
if ($fields) {
foreach (C::t('common_member_profile_setting')->fetch_all($fields) as $field) {
$choices = array();
if ($field['selective']) {
foreach (explode("\n", $field['choices']) as $item) {
list($index, $choice) = explode('=', $item);
$choices[trim($index)] = trim($choice);
}
$field['choices'] = $choices;
} else {
unset($field['choices']);
}
$field['showinregister'] = 1;
$field['available'] = 1;
$data['field_' . $field['fieldid']] = $field;
}
}
savecache('fields_connect_register', $data);
}
示例2: build_cache_stamps
function build_cache_stamps()
{
$data = array();
$fillarray = range(0, 99);
$count = 0;
$repeats = $stampicon = array();
foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
if (isset($fillarray[$stamp['displayorder']])) {
unset($fillarray[$stamp['displayorder']]);
} else {
$repeats[] = $stamp['id'];
}
$count++;
}
foreach ($repeats as $id) {
reset($fillarray);
$displayorder = current($fillarray);
unset($fillarray[$displayorder]);
C::t('common_smiley')->update($id, array('displayorder' => $displayorder));
}
foreach (C::t('common_smiley')->fetch_all_by_type('stamplist') as $stamp) {
if ($stamp['typeid'] < 1) {
continue;
}
$row = C::t('common_smiley')->fetch_by_id_type($stamp['typeid'], 'stamp');
$stampicon[$row['displayorder']] = $stamp['displayorder'];
}
foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
$icon = $stamp['type'] == 'stamp' ? isset($stampicon[$stamp['displayorder']]) ? $stampicon[$stamp['displayorder']] : 0 : ($stamp['type'] == 'stamplist' && !in_array($stamp['displayorder'], $stampicon) ? 1 : 0);
$data[$stamp['displayorder']] = array('url' => $stamp['url'], 'text' => $stamp['code'], 'type' => $stamp['type'], 'icon' => $icon);
}
savecache('stamps', $data);
}
示例3: fetch_by_picid
public function fetch_by_picid($picid, $havecount = false)
{
//返回一条数据同时加载附件表数据
global $_G;
$picid = intval($picid);
$image = $attachment = array();
$image = self::fetch($picid);
if ($image['aid']) {
$attachment = C::t('attachment')->fetch($image['aid']);
}
$data = array_merge($attachment, $image);
$data['title'] = $data['filename'];
//$data['url']=getAttachUrl($data,true);
//if($data['thumb']) $data['icon']=getimgthumbname($_G['setting']['attachurl'].$data['attachment']);
//else $data['icon']=$data['url'];
/*if($data['thumb']>1){
$data['url']=getimgthumbname($data['url'].'.1440x900');
}*/
$data['ext'] = $data['filetype'];
$data['size'] = $data['filesize'];
if ($havecount) {
$count = C::t('count')->fetch_by_type($picid, 'image');
$data['viewnum'] = intval($count['viewnum']);
$data['replynum'] = intval($count['replynum']);
$data['downnum'] = intval($count['downnum']);
$data['star'] = intval($count['star']);
$data['starnum'] = intval($count['starnum']);
}
return $data;
}
示例4: csc
function csc($task = array())
{
global $_G;
$taskvars = array('num' => 0);
$num = 0;
foreach (C::t('common_taskvar')->fetch_all_by_taskid($task['taskid']) as $taskvar) {
if ($taskvar['value']) {
$taskvars[$taskvar['variable']] = $taskvar['value'];
}
}
$taskvars['time'] = floatval($taskvars['time']);
if ($taskvars['act'] == 'favorite') {
$favorite = C::t('forum_spacecache')->fetch($_G['uid'], 'favorite' . $task['taskid']);
$favorite = $favorite['value'];
$num = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], 'tid') - $favorite;
} elseif ($taskvars['act'] == 'magic') {
$maxtime = $taskvars['time'] ? $task['applytime'] + 3600 * $taskvars['time'] : 0;
$num = C::t('common_magiclog')->count_by_action_uid_dateline(2, $_G['uid'], $task['applytime'], $maxtime);
} elseif ($taskvars['act'] == 'userapp') {
$userapp = C::t('forum_spacecache')->fetch($_G['uid'], 'userapp' . $task['taskid']);
$userapp = $userapp['value'];
$num = C::t('home_userapp')->count_by_uid($_G['uid']) - $userapp;
}
if ($num && $num >= $taskvars['num']) {
if ($taskvars['act'] == 'favorite' || $taskvars['act'] == 'userapp') {
C::t('forum_spacecache')->delete($_G['uid'], $taskvars['act'] . $task['taskid']);
}
return TRUE;
} elseif ($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
return FALSE;
} else {
return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
}
}
示例5: build_cache_usergroups_single
function build_cache_usergroups_single()
{
$pluginvalue = pluginsettingvalue('groups');
$allowthreadplugin = C::t('common_setting')->fetch('allowthreadplugin', true);
$data_uf = C::t('common_usergroup_field')->range();
$data_ag = C::t('common_admingroup')->range();
foreach (C::t('common_usergroup')->range() as $gid => $data) {
$data = array_merge($data, (array) $data_uf[$gid], (array) $data_ag[$gid]);
$ratearray = array();
if ($data['raterange']) {
foreach (explode("\n", $data['raterange']) as $rating) {
$rating = explode("\t", $rating);
$ratearray[$rating[0]] = array('isself' => $rating[1], 'min' => $rating[2], 'max' => $rating[3], 'mrpd' => $rating[4]);
}
}
$data['raterange'] = $ratearray;
$data['grouptitle'] = $data['color'] ? '<font color="' . $data['color'] . '">' . $data['grouptitle'] . '</font>' : $data['grouptitle'];
$data['grouptype'] = $data['type'];
$data['grouppublic'] = $data['system'] != 'private';
$data['groupcreditshigher'] = $data['creditshigher'];
$data['groupcreditslower'] = $data['creditslower'];
$data['maxspacesize'] = intval($data['maxspacesize']) * 1024 * 1024;
$data['allowthreadplugin'] = !empty($allowthreadplugin[$data['groupid']]) ? $allowthreadplugin[$data['groupid']] : array();
$data['plugin'] = $pluginvalue[$data['groupid']];
unset($data['type'], $data['system'], $data['creditshigher'], $data['creditslower'], $data['groupavatar'], $data['admingid']);
savecache('usergroup_' . $data['groupid'], $data);
}
}
示例6: check
public function check()
{
$forumlist = C::t('forum_forum')->fetch_all_by_recyclebin();
if (empty($forumlist)) {
$return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_recyclebin_no_need'));
} else {
$forumdesc = '';
$adminfile = defined(ADMINSCRIPT) ? ADMINSCRIPT : 'admin.php';
$k = 1;
foreach ($forumlist as $forum) {
$forumdesc .= '<p class="recyclebinforumlist" ' . ($k > 2 ? 'style="display:none;"' : '') . '><a href="' . $adminfile . '"?action=forums&operation=edit&fid=' . $forum['fid'] . ' target="_blank">' . $forum['name'] . '</a></p>';
if ($k == 3) {
$forumdesc .= '<p id="recyclebinmore"><a href="javascript:;" onclick="showlistmore(\\\'recyclebinmore\\\',\\\'recyclebinforumlist\\\');">' . lang('admincp', 'more') . '</a></p>';
}
$k++;
}
$extraurl = '';
if (count($forumlist) == 1) {
$extraurl = '&optimizefid=' . $forum['fid'];
$forumdesc = '';
}
$return = array('status' => 1, 'type' => 'view', 'lang' => lang('optimizer', 'optimizer_recyclebin_need', array('forumdesc' => $forumdesc)), 'extraurl' => $extraurl);
}
return $return;
}
示例7: fetch_all
public function fetch_all($uids, $force_from_db = false, $fetch_archive = 1)
{
$data = array();
if (!empty($uids)) {
if ($force_from_db || ($data = $this->fetch_cache($uids)) === false || count($uids) != count($data)) {
if (is_array($data) && !empty($data)) {
$uids = array_diff($uids, array_keys($data));
}
if ($data === false) {
$data = array();
}
if (!empty($uids)) {
$query = DB::query('SELECT ' . implode(',', $this->_fields) . ' FROM ' . DB::table($this->_table) . ' WHERE ' . DB::field($this->_pk, $uids));
while ($value = DB::fetch($query)) {
$data[$value[$this->_pk]] = $value;
$this->store_cache($value[$this->_pk], $value);
}
}
}
if (isset($this->membersplit) && $fetch_archive && count($data) != count($uids)) {
$data = $data + C::t($this->_table . '_archive')->fetch_all(array_diff($uids, array_keys($data)), null, 0);
}
}
return $data;
}
示例8: build_cache_diytemplatename
function build_cache_diytemplatename()
{
$data = array();
$apps = array('portal', 'forum', 'group', 'home');
$nullname = lang('portalcp', 'diytemplate_name_null');
$scriptarr = $lostname = array();
foreach (C::t('common_diy_data')->range() as $datarow) {
$datarow['name'] = $datarow['name'] ? $datarow['name'] : lang('portalcp', $datarow['targettplname'], '', '');
if (empty($datarow['name'])) {
$lostname[$datarow['targettplname']] = $datarow['targettplname'];
$datarow['name'] = $nullname;
}
$data[$datarow['targettplname']] = dhtmlspecialchars($datarow['name']);
$curscript = substr($datarow['targettplname'], 0, strpos($datarow['targettplname'], '/'));
if (in_array($curscript, $apps)) {
$scriptarr[$curscript][$datarow['targettplname']] = true;
}
}
if ($lostname) {
require_once libfile('function/portalcp');
foreach (getdiytplnames($lostname) as $pre => $datas) {
foreach ($datas as $id => $name) {
$data[$pre . $id] = $name;
}
}
}
savecache('diytemplatename', $data);
foreach ($scriptarr as $curscript => $value) {
savecache('diytemplatename' . $curscript, $value);
}
}
示例9: getGlobalPostString
private function getGlobalPostString($action)
{
global $_G;
$setting = $_G['setting'];
$mySiteId = empty($_G['setting']['my_siteid']) ? '' : $_G['setting']['my_siteid'];
$siteName = $_G['setting']['bbname'];
$siteUrl = $_G['siteurl'];
$ucUrl = rtrim($_G['setting']['ucenterurl'], '/') . '/';
$siteCharset = $_G['charset'];
$siteTimeZone = $_G['setting']['timeoffset'];
$mySiteKey = empty($_G['setting']['my_sitekey']) ? '' : $_G['setting']['my_sitekey'];
$siteKey = C::t('common_setting')->fetch('siteuniqueid');
$siteLanguage = $_G['config']['output']['language'];
$siteVersion = $_G['setting']['version'];
$utilService = Cloud::loadClass('Service_Util');
$myVersion = $utilService->getApiVersion();
$productType = 'DISCUZX';
$siteRealNameEnable = '';
$siteRealAvatarEnable = '';
$siteEnableApp = intval($setting['my_app_status']);
$key = $mySiteId . $siteName . $siteUrl . $ucUrl . $siteCharset . $siteTimeZone . $siteRealNameEnable . $mySiteKey . $siteKey;
$key = md5($key);
$siteTimeZone = urlencode($siteTimeZone);
$siteName = urlencode($siteName);
$register = false;
return sprintf('action=%s&productType=%s&key=%s&mySiteId=%d&siteName=%s&siteUrl=%s&ucUrl=%s&siteCharset=%s&siteTimeZone=%s&siteEnableRealName=%s&siteEnableRealAvatar=%s&siteKey=%s&siteLanguage=%s&siteVersion=%s&myVersion=%s&siteEnableApp=%s&from=cloud', $action, $productType, $key, $mySiteId, $siteName, $siteUrl, $ucUrl, $siteCharset, $siteTimeZone, $siteRealNameEnable, $siteRealAvatarEnable, $siteKey, $siteLanguage, $siteVersion, $myVersion, $siteEnableApp);
}
示例10: _updatePass
private function _updatePass($res, $oldpassword, $newpassword)
{
global $_G;
$oldpassword = $oldpassword ? urldecode($oldpassword) : '';
$newpassword = $newpassword ? urldecode($newpassword) : '';
if (!empty($newpassword) && $newpassword != addslashes($newpassword)) {
// 抱歉,密码空或包含非法字符:新密码
return $this->makeErrorInfo($res, lang('message', 'profile_passwd_illegal'));
}
loaducenter();
$ucresult = uc_user_edit(addslashes($_G['username']), $oldpassword, $newpassword);
if ($ucresult == -1) {
// 原密码不正确,您不能修改密码或 Email 或安全提问
return $this->makeErrorInfo($res, lang('message', 'profile_passwd_wrong'));
}
$setarr['password'] = md5(random(10));
C::t('common_member')->update($_G['uid'], $setarr);
$secretStr = AppbymeUserAccess::getSecretStr($_G['uid'], $newpassword);
$newAccessSecret = $secretStr['accessSecret'];
$data = array('user_access_secret' => $newAccessSecret);
$result = AppbymeUserAccess::updateUserAccess($data, $_G['uid']);
// if (!$result) {
// return $this->makeErrorInfo($res, 'user_info_edit_error');
// }
$res['token'] = $secretStr['accessToken'];
$res['secret'] = $newAccessSecret;
return $res;
}
示例11: output
function output()
{
global $_G;
//如果拉取过,就在db里面标明
if (isset($_REQUEST['pull']) && isset($_REQUEST['pull']) == '1') {
$setting = array('bigapp_similes_zip' => '1');
C::t('common_setting')->update_batch($setting);
$variable['pull'] = '1';
} else {
if (!isset($_REQUEST['type']) || isset($_REQUEST['type']) && $_REQUEST['type'] == '0') {
//$type_cnt = 0;
foreach (C::t('forum_imagetype')->fetch_all_by_type('smiley') as $type) {
$available = $type['available'];
if ($available == '0') {
continue;
}
$id = $type['typeid'];
$tmp = array();
$tmp['name'] = $type['name'];
$tmp['directory'] = $type['directory'];
$smiley_cnt = 0;
foreach (C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $smiley) {
$tmp['smiley'][$smiley_cnt]['code'] = $smiley['code'];
$tmp['smiley'][$smiley_cnt]['url'] = $smiley['url'];
$tmp['smiley'][$smiley_cnt]['id'] = $smiley['id'];
$smiley_cnt++;
}
$variable['smilies'][] = $tmp;
}
}
}
bigapp_core::result(bigapp_core::variable($variable));
}
示例12: onNotificationsGet
public function onNotificationsGet($uId)
{
$notify = $result = array();
$result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
$i = 0;
foreach (C::t('home_notification')->fetch_all_by_uid($uId, 1) as $value) {
$i++;
if (!$result['notification']['mostRecent']) {
$result['notification']['mostRecent'] = $value['dateline'];
}
}
$result['notification']['unread'] = $i;
loaducenter();
$pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
if ($pmarr['count']) {
$result['message']['unread'] = $pmarr['count'];
$result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
}
$fIds = array();
foreach (C::t('home_friend_request')->fetch_all_by_uid($uId) as $value) {
if (!$result['friendRequest']['mostRecent']) {
$result['friendRequest']['mostRecent'] = $value['dateline'];
}
$fIds[] = $value['uid'];
}
$result['friendRequest']['uIds'] = $fIds;
return $result;
}
示例13: plugin_myrepeats
function plugin_myrepeats()
{
global $_G;
if (!$_G['uid']) {
return;
}
/* 读取可以使用马甲的用户组 usergroups 变量值。需要注意参数的读取方式,详情见插件手册-参数读取 。 */
$myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['use rgroups']);
if (in_array('', $myrepeatsusergroups)) {
$myrepeatsusergroups = array();
}
$userlist = array();
/* 对当前登录用户进行马甲验证, 即当前用户组不再权限许可范围内, 但其他帐号所在用户组有权限, 则当 前用户也有使用权限。*/
if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
if (!isset($_G['cookie']['myrepeat_rr'])) {
/* 这里需要注意一下你所建的数据表对象的构建, 即 source/plugin/myrepeats/t able/下的 table_新建表名.php */
$users = count(C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']));
dsetcookie('myrepeat_rr', 'R' . $users, 86400);
} else {
$users = substr($_G['cookie']['myrepeat_rr'], 1);
}
if (!$users) {
return '';
}
}
/* 前台显示代码 */
$this->value['global_usernav_extra1'] = '<script>' . 'function showmyrepeats() {if(!$(\'myrepeats_menu\')) {' . 'menu=document.createElement(\'div\');menu.id=\'myrepeats_menu\';menu.style .display=\'none\';menu.className=\'p_pop\';' . '$(\'append_parent\').appendChild(menu);' . 'ajaxget(\'plugin.php?id=myrepeats:switch&list=yes\',\'myrepeats_menu\',\'a jaxwaitid\');}' . 'showMenu({\'ctrlid\':\'myrepeats\',\'duration\':2});}' . '</script>' . '<span class="pipe">|</span><a id="myrepeats" href="home.php?mod=spacecp&ac=plugin& id=myrepeats:memcp" class="showmenu cur1" onmouseover="delayShow(this, showmyrepeat s)">' . lang('plugin/myrepeats', 'switch') . '</a>' . "\n";
}
示例14: common
function common()
{
global $_G;
$this->page = intval($_GET['page']) ? intval($_GET['page']) : 1;
loadcache('forum_guide');
$dateline = 0;
$maxnum = 50000;
if ($_G['setting']['guide']['newdt']) {
$dateline = time() - intval($_G['setting']['guide']['newdt']);
}
$maxtid = C::t('forum_thread')->fetch_max_tid();
$limittid = max(0, $maxtid - $maxnum);
$tids = array_slice($_G['cache']['forum_guide']['new']['data'], ($this->page - 1) * $this->perpage, $this->perpage);
$query = C::t('forum_thread')->fetch_all_for_guide('new', $limittid, $tids, $_G['setting']['heatthread']['guidelimit'], $dateline);
$threadlist = array();
rsort($query);
foreach ($query as $thread) {
$this->field('author', '0', $thread['author']);
$this->field('dateline', '0', $thread['dateline']);
$this->field('replies', '1', $thread['replies']);
$this->field('views', '2', $thread['views']);
$this->id = $thread['tid'];
$this->title = $thread['subject'];
$this->image = '';
$this->icon = '1';
$this->poptype = '0';
$this->popvalue = '';
$this->clicktype = 'tid';
$this->clickvalue = $thread['tid'];
$this->insertrow();
}
}
示例15: output
public static function output()
{
global $_G;
if (!empty($_G['uid'])) {
if (self::$tmpavatarbig && self::$tmpavatarmiddle && self::$tmpavatarsmall) {
$avatar1 = self::byte2hex(file_get_contents(self::$tmpavatarbig));
$avatar2 = self::byte2hex(file_get_contents(self::$tmpavatarmiddle));
$avatar3 = self::byte2hex(file_get_contents(self::$tmpavatarsmall));
$extra = '&avatar1=' . $avatar1 . '&avatar2=' . $avatar2 . '&avatar3=' . $avatar3;
$result = self::uc_api_post_ex('user', 'rectavatar', array('uid' => $_G['uid']), $extra);
@unlink(self::$tmpavatar);
@unlink(self::$tmpavatarbig);
@unlink(self::$tmpavatarmiddle);
@unlink(self::$tmpavatarsmall);
if ($result == '<?xml version="1.0" ?><root><face success="1"/></root>') {
$variable = array('uploadavatar' => 'api_uploadavatar_success');
$tableext = '';
$member = C::t('common_member')->fetch($_G['uid'], false, 1);
if (!$member) {
self::error('api_uploadavatar_user_not_exists');
}
$tableext = isset($member['_inarchive']) ? '_archive' : '';
C::t('common_member' . $tableext)->update($_G['uid'], array('avatarstatus' => '1'));
bigapp_core::result(bigapp_core::variable($variable));
} else {
self::error('api_uploadavatar_uc_error');
}
}
} else {
self::error('api_uploadavatar_unavailable_user');
}
}