本文整理汇总了PHP中C类的典型用法代码示例。如果您正苦于以下问题:PHP C类的具体用法?PHP C怎么用?PHP C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: foo
function foo()
{
$x = new C();
$y = $x->simpleRet($x);
var_dump($x);
var_dump($y);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:hopt-ret7.php
示例2: main
function main()
{
print "Test begin\n";
foo();
// Tricky case: $this is the last reference
$x = new C();
$x->bluh();
print "Test end\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:destruct.php
示例3: main
function main()
{
$c = new C();
for ($i = 0; $i < 3; $i++) {
test();
foo();
$c->snoot();
if ($i == 1) {
fb_intercept('foo', 'bar', false);
fb_intercept('C::__call', 'swizzle');
}
}
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:intercept2.php
示例4: testSiblings
public function testSiblings()
{
$node = new Node();
$node->appendChild($a = new A());
$b = new B($node);
$node->prependChild($c = new C());
$node->appendChild($d = new D());
$a->remove();
$this->assertSame(null, $c->getPreviousSibling());
$this->assertSame($b, $c->getNextSibling());
$this->assertSame(null, $d->getNextSibling());
$this->assertSame($b, $d->getPreviousSibling());
$this->assertSame($c, $b->getPreviousSibling());
$this->assertSame($d, $b->getNextSibling());
}
开发者ID:talesoft,项目名称:tale-tree,代码行数:15,代码来源:NodeTest.php
示例5: _loadConfig
private static function _loadConfig($confFile)
{
$confFile = C::filterChars($confFile);
$file = CONF_PATH . DS . $confFile . '.php';
$res = C::loadFile($file);
return $res;
}
开发者ID:zer0131,项目名称:OneFox,代码行数:7,代码来源:Config.php
示例6: setType
public function setType($data)
{
if (!is_string($data) || !array_key_exists($data, C::g('MENUITEM_TYPE'))) {
throw new Exception('INVALID MENUITEM TYPE PARAMETER', 500);
}
$this->type = $data;
}
开发者ID:monkeytie,项目名称:korona,代码行数:7,代码来源:menuitem.class.php
示例7: yar
public function yar()
{
var_dump(isset($this));
$obj = new static();
var_dump($obj->cls);
C::yar();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:static_new.php
示例8: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_GET['id']);
if (empty($id)) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if (!in_array($idtype, array('pid', 'cid'))) {
showmessage(lang('magic/namepost', 'namepost_use_error'));
}
if ($idtype == 'pid') {
$_G['tid'] = intval($_GET['ptid']);
$post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$authorid = $post['authorid'];
$author = $post['anonymous'] ? '' : 1;
} elseif ($idtype == 'cid') {
$comment = C::t('home_comment')->fetch($id);
$authorid = $comment['authorid'];
$author = $comment['author'];
}
if ($author) {
showmessage('magicuse_bad_object');
}
$member = getuserbyuid($authorid);
if (!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
showmessage(lang('magic/namepost', 'namepost_info_user_noperm'));
}
$author = daddslashes($member['username']);
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id);
showmessage(lang('magic/namepost', 'magic_namepost_succeed'), 'javascript:;', array('uid' => $authorid, 'username' => $author, 'avatar' => 1), array('alert' => 'right'));
}
开发者ID:softhui,项目名称:discuz,代码行数:34,代码来源:magic_namepost.php
示例9: onConnectSetConfig
public function onConnectSetConfig($data)
{
global $_G;
$settingFields = array('connectappid', 'connectappkey');
if (!$data) {
return false;
}
$setting = C::t('common_setting')->fetch_all(array('connect'));
$connectData = (array) dunserialize($setting['connect']);
if (!is_array($connectData)) {
$connectData = array();
}
$settings = array();
foreach ($data as $k => $v) {
if (in_array($k, $settingFields)) {
$settings[$k] = $v;
} else {
$connectData[$k] = $v;
}
}
if ($connectData) {
$settings['connect'] = $connectData;
}
if ($settings) {
C::t('common_setting')->update_batch($settings);
return true;
}
return false;
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:29,代码来源:Connect.php
示例10: usesubmit
function usesubmit()
{
global $_G;
$idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : '';
if (!in_array($idtype, $this->idtypearray)) {
showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
if (empty($_GET['id'])) {
showmessage(lang('magic/highlight', 'highlight_info_nonexistence_' . $idtype));
}
if ($idtype == 'tid') {
$info = getpostinfo($_GET['id'], $idtype, array('fid', 'authorid', 'subject'));
$this->_check($info['fid']);
magicthreadmod($_GET['id']);
C::t('forum_thread')->update($_GET['id'], array('highlight' => $_GET['highlight_color'], 'moderated' => 1));
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
$expiration = TIMESTAMP + $this->parameters['expiration'] * 3600;
updatemagicthreadlog($_GET['id'], $this->magic['magicid'], $expiration > 0 ? 'EHL' : 'HLT', $expiration);
if ($info['authorid'] != $_G['uid']) {
notification_add($info['authorid'], 'magic', lang('magic/highlight', 'highlight_notification'), array('tid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
}
} elseif ($idtype == 'blogid') {
$info = getpostinfo($_GET['id'], $idtype, array('uid', 'subject'));
C::t('home_blogfield')->update($_GET['id'], array('magiccolor' => $_GET['highlight_color']));
if ($info['uid'] != $_G['uid']) {
notification_add($info['uid'], 'magic', lang('magic/highlight', 'highlight_notification_blogid'), array('blogid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $_GET['id']);
showmessage(lang('magic/highlight', 'highlight_succeed_' . $idtype), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:32,代码来源:magic_highlight.php
示例11: common
function common()
{
global $_G;
if ($_GET['do'] == 'recommend') {
if (!$_GET['hash'] || FORMHASH != $_GET['hash'] || !$_GET['pid'] || !$_GET['tid'] || !$_G['uid']) {
mobile_core::result(mobile_core::variable(array('result' => -1)));
}
$_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
if (!$_G['wechat']['setting']['wsq_allow'] || !in_array($_GET['tid'], (array) $_G['wechat']['setting']['showactivity']['tids'])) {
mobile_core::result(mobile_core::variable(array('result' => -2)));
}
$postinfo = C::t('forum_post')->fetch('tid:' . $_GET['tid'], $_GET['pid']);
if (!$postinfo) {
mobile_core::result(mobile_core::variable(array('result' => -3)));
}
$post = C::t('forum_debatepost')->fetch($_GET['pid']);
if (!$post) {
C::t('forum_debatepost')->insert(array('pid' => $_GET['pid'], 'tid' => $_GET['tid'], 'dateline' => TIMESTAMP, 'stand' => 0, 'voters' => 1, 'voterids' => "{$_G['uid']}\t"));
mobile_core::result(mobile_core::variable(array('result' => 1)));
} elseif (strpos("\t" . $post['voterids'], "\t{$_G['uid']}\t") === FALSE) {
C::t('forum_debatepost')->update_voters($_GET['pid'], $_G['uid']);
mobile_core::result(mobile_core::variable(array('result' => 1)));
} else {
mobile_core::result(mobile_core::variable(array('result' => 0)));
}
}
}
开发者ID:hacktea8,项目名称:d_z_s_t_u_d_e_n_t,代码行数:27,代码来源:showactivity.php
示例12: update
public static function update($data)
{
//CHECK
$checks = array('defaultLanguage' => 'is_string-!is_empty', 'availableLanguages' => 'is_array-!is_empty', 'defaultBaseUrl' => 'is_string-!is_empty', 'availableBaseUrl' => 'is_array-!is_empty');
if (!KLib\Validator::arrayCheck($data, $checks)) {
throw new Exception('INVALID CONFIG DATA', 500);
}
if (!array_key_exists($data['defaultLanguage'], C::g('LIST_LANGUAGE'))) {
throw new Exception('INVALID CONFIG DATA', 500);
}
foreach ($data['availableLanguages'] as $id) {
if (!array_key_exists(strtoupper($id), C::g('LIST_LANGUAGE'))) {
throw new Exception('INVALID CONFIG DATA', 500);
}
$availableLanguages[] = "'" . strtoupper($id) . "'";
}
if (!filter_var('http://' . $data['defaultBaseUrl'], FILTER_VALIDATE_URL)) {
throw new Exception('INVALID CONFIG DATA', 500);
}
foreach ($data['availableBaseUrl'] as $id) {
if (!filter_var('http://' . $id, FILTER_VALIDATE_URL)) {
throw new Exception('INVALID CONFIG DATA', 500);
}
$availableBaseUrls[] = "'" . $id . "'";
}
$raw = "<?php\n### Default language\n### Index of LIST_LANGUAGE\nC::s('DEFAULT_LANG', '" . $data['defaultLanguage'] . "');\n### Language available\n### List of index of LIST_LANGUAGE\nC::s('DEFAULT_AVAILABLE_LANG', array(" . implode(', ', $availableLanguages) . "));\n### Default baseUrl\n### eg. 'www.korona.io'\nC::s('DEFAULT_BASEURL', '" . $data['defaultBaseUrl'] . "');\n### List of available baseUrl\n### eg. 'www.korona.io'\nC::s('DEFAULT_AVAILABLE_BASEURL', array(" . implode(', ', $availableBaseUrls) . "));";
return file_put_contents(self::$configPath, $raw);
}
开发者ID:monkeytie,项目名称:korona,代码行数:28,代码来源:configfile.class.php
示例13: usesubmit
function usesubmit()
{
global $_G;
$list = $uids = array();
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$limit = $num + 20;
$giftMagicID = C::t('common_magic')->fetch_by_identifier('gift');
$mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0;
if ($mid) {
foreach (C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) {
$uids[] = intval($value['uid']);
}
}
if ($uids) {
$counter = 0;
$members = C::t('common_member')->fetch_all($uids);
foreach (C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) {
$value = array_merge($members[$uid], $value);
$info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
$value['avatar'] = addcslashes(avatar($uid, 'small'), "'");
$list[$uid] = $value;
$counter++;
if ($counter >= $num) {
break;
}
}
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_detector');
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:34,代码来源:magic_detector.php
示例14: __construct
public function __construct($attributes = null)
{
if ($attributes !== null) {
C::guardIsArray($attributes);
}
$this->_attributes = $attributes;
}
开发者ID:lechimp-p,项目名称:php-formlets,代码行数:7,代码来源:TextAreaFormlet.php
示例15: getdata
function getdata($style, $parameter)
{
$advid = 0;
if (!empty($parameter['title'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['title']);
if (empty($adv)) {
$advid = C::t('common_advertisement_custom')->insert(array('name' => $parameter['title']), true);
} else {
$advid = $adv['id'];
}
} elseif (!empty($parameter['adv'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['adv']);
$advid = intval($adv['id']);
} else {
$return = 'Empty Ads';
}
if ($advid) {
$flag = false;
if (getglobal('inajax')) {
$flag = true;
setglobal('inajax', 0);
}
$return = adshow('custom_' . $advid);
if ($flag) {
setglobal('inajax', 1);
}
}
return array('html' => $return, 'data' => null);
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:29,代码来源:block_adv.php
示例16: getsetting
function getsetting()
{
global $_G;
$settings = array('fids' => array('title' => 'couplebanner_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'couplebanner_groups', 'type' => 'mselect', 'value' => array()), 'category' => array('title' => 'couplebanner_category', 'type' => 'mselect', 'value' => array()), 'position' => array('title' => 'couplebanner_position', 'type' => 'mradio', 'value' => array(array(1, 'couplebanner_position_left'), array(2, 'couplebanner_position_right')), 'default' => 1), 'coupleadid' => array('title' => 'couplebanner_coupleadid', 'type' => 'select', 'value' => array()), 'disableclose' => array('title' => 'couplebanner_disableclose', 'type' => 'mradio', 'value' => array(array(0, 'couplebanner_show'), array(1, 'couplebanner_hidden')), 'default' => 0));
loadcache(array('forums', 'grouptype'));
$settings['fids']['value'][] = $settings['groups']['value'][] = array(0, ' ');
$settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'couplebanner_index');
if (empty($_G['cache']['forums'])) {
$_G['cache']['forums'] = array();
}
foreach ($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat(' ', 4) : ($forum['type'] == 'sub' ? str_repeat(' ', 8) : '')) . $forum['name']);
}
foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
$settings['groups']['value'][] = array($gid, str_repeat(' ', 4) . $group['name']);
if ($group['secondlist']) {
foreach ($group['secondlist'] as $sgid) {
$settings['groups']['value'][] = array($sgid, str_repeat(' ', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
}
}
}
foreach (C::t('common_advertisement')->fetch_all_by_type('couplebanner') as $couple) {
$settings['coupleadid']['value'][] = array($couple['advid'], $couple['title']);
}
loadcache('portalcategory');
$this->categoryvalue[] = array(-1, 'couplebanner_index');
$this->getcategory(0);
$settings['category']['value'] = $this->categoryvalue;
return $settings;
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:30,代码来源:adv_couplebanner.php
示例17: 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;
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:25,代码来源:table_common_member_profile.php
示例18: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
$blog = magic_check_idtype($id, $idtype);
$num = 10;
$list = $ids = $note_inserts = array();
$fusername = dimplode($_POST['fusername']);
if ($fusername) {
$query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num);
$note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
foreach ($query as $value) {
$ids[] = $value['fuid'];
$value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
$list[] = $value;
$note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']);
}
}
if (empty($ids)) {
showmessage('magicuse_has_no_valid_friend');
}
foreach ($note_inserts as $note_insert) {
C::t('home_notification')->insert($note_insert);
}
C::t('common_member')->increase($ids, array('newprompt' => 1));
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
$op = 'show';
include template('home/magic_call');
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:magic_call.php
示例19: 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);
}
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:34,代码来源:task_member.php
示例20: build_cache_heats
function build_cache_heats()
{
global $_G;
$addsql = '';
$data = array();
if (discuz_process::islocked('update_heats_list')) {
return false;
}
if ($_G['setting']['indexhot']['status']) {
require_once libfile('function/post');
$_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
$messageitems = 2;
$limit = $_G['setting']['indexhot']['limit'];
foreach (C::t('forum_thread')->fetch_all_heats() as $heat) {
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']);
$heat = array_merge($heat, (array) $post);
if ($limit == 0) {
break;
}
if ($messageitems > 0) {
$heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
$data['message'][$heat['tid']] = $heat;
} else {
unset($heat['message']);
$data['subject'][$heat['tid']] = $heat;
}
$messageitems--;
$limit--;
}
$data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
}
savecache('heats', $data);
discuz_process::unlock('update_heats_list');
}
开发者ID:softhui,项目名称:discuz,代码行数:34,代码来源:cache_heats.php
注:本文中的C类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论