本文整理汇总了PHP中C类的典型用法代码示例。如果您正苦于以下问题:PHP C类的具体用法?PHP C怎么用?PHP C使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了C类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foo
function foo()
{
$x = new C();
$y = $x->simpleRet($x);
var_dump($x);
var_dump($y);
}
示例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";
}
示例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');
}
}
}
示例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());
}
示例5: _loadConfig
private static function _loadConfig($confFile)
{
$confFile = C::filterChars($confFile);
$file = CONF_PATH . DS . $confFile . '.php';
$res = C::loadFile($file);
return $res;
}
示例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;
}
示例7: yar
public function yar()
{
var_dump(isset($this));
$obj = new static();
var_dump($obj->cls);
C::yar();
}
示例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'));
}
示例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;
}
示例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));
}
示例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)));
}
}
}
示例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);
}
示例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');
}
示例14: __construct
public function __construct($attributes = null)
{
if ($attributes !== null) {
C::guardIsArray($attributes);
}
$this->_attributes = $attributes;
}
示例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);
}