本文整理汇总了PHP中Wekit类的典型用法代码示例。如果您正苦于以下问题:PHP Wekit类的具体用法?PHP Wekit怎么用?PHP Wekit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wekit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
* 执行搜索
* @return array
*/
public function search()
{
$result = array();
//$resource = Wind::getComponent('i18n');
$parser = Wekit::load('ADMIN:service.srv.AdminSearchLangParserService');
$texts = $parser->parseSearchLang();
foreach ($this->_menus as $k1 => $v1) {
list($s1, $t1) = $this->_check($v1['name']);
if ($s1) {
$v1['name'] = $t1;
$result[$k1] = $v1;
}
//$desc = $resource->getMessage("ADMIN:search.{$k}");
$desc = $texts[$k1];
if ($desc) {
$subItems = array();
$matchMain = false;
if (is_array($desc['items'])) {
foreach ($desc['items'] as $v) {
list($s, $t) = $this->_check($v);
if ($s) {
$result[$k1]['items'][] = $t;
$matchMain = true;
}
}
}
if (count($desc) > 1) {
//二级
foreach ($desc as $k2 => $v2) {
if ($k2 == 'items') {
continue;
}
$tmp = array();
if ($v2['items']) {
foreach ($v2['items'] as $v3) {
list($s, $t) = $this->_check($v3);
$s && ($tmp['items'][] = $t);
}
if ($tmp['items']) {
$tmp['name'] = $k2;
$tmp['url'] = $v2['url'];
}
}
$tmp && ($subItems[] = $tmp);
}
}
if ($matchMain || $subItems) {
$tmp = null;
if (!$s1) {
$result[$k1]['items'] && ($tmp = $result[$k1]['items']);
$v1['name'] = $t1;
$result[$k1] = $v1;
}
$result[$k1]['sub'] = $subItems;
$tmp && ($result[$k1]['items'] = $tmp);
}
}
}
return $result;
}
示例2: getUrl
/**
* 获取全站url信息
*
* @return obj
*/
public function getUrl()
{
$_consts = Wekit::S('publish');
foreach ($_consts as $const => $value) {
if (defined($const)) {
continue;
}
if ($const === 'PUBLIC_URL' && !$value) {
$value = Wind::getComponent('request')->getBaseUrl(true);
if (defined('BOOT_PATH') && 0 === strpos(BOOT_PATH, PUBLIC_PATH)) {
$path = substr(BOOT_PATH, strlen(PUBLIC_PATH));
!empty($path) && ($value = substr($value, 0, -strlen($path)));
}
}
define($const, $value);
}
$url = new stdClass();
$url->base = PUBLIC_URL;
$url->res = WindUrlHelper::checkUrl(PUBLIC_RES, $url->base);
$url->css = WindUrlHelper::checkUrl(PUBLIC_RES . '/css/', $url->base);
$url->images = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/', $url->base);
$url->js = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/dev/', $url->base);
$url->attach = WindUrlHelper::checkUrl(PUBLIC_ATTACH, $url->base);
$url->themes = WindUrlHelper::checkUrl(PUBLIC_THEMES, $url->base);
$url->extres = WindUrlHelper::checkUrl(PUBLIC_THEMES . '/extres/', $url->base);
return $url;
}
示例3: run
public function run()
{
$this->setCurrentLeft('avatar');
$isAvatarBan = false;
if (Pw::getstatus($this->loginUser->info['status'], PwUser::STATUS_BAN_AVATAR)) {
Wind::import('SRV:user.srv.PwBanBp');
$banBp = new PwBanBp($this->loginUser->uid);
if (false === $banBp->checkIfBanAvatar()) {
$banBp->recoveryBanAvatarError();
} elseif ($banBp->endDateTimeBanAvatar()) {
$this->loginUser->info['status'] = $banBp->callEndDateTimeBanAvatar();
} else {
$isAvatarBan = true;
$info = $banBp->getBanAvatarInfo();
if ($info['created_userid'] == 0) {
$info['operator'] = 'system';
} else {
$operatorInfo = Wekit::load('user.PwUser')->getUserByUid($info['created_userid']);
$info['operator'] = $operatorInfo['username'];
}
$this->setOutput($info, 'banInfo');
}
}
$windidApi = $this->_getWindid();
$this->setOutput($windidApi->showFlash($this->loginUser->uid), 'avatarFlash');
$this->setOutput($windidApi->showFlash($this->loginUser->uid, 0), 'avatarArr');
$this->setOutput($isAvatarBan, 'isAvatarBan');
$this->setOutput($this->getInput('type'), 'type');
$this->setLayout('');
$this->setTemplate('profile_avatar');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$lang = Wind::getComponent('i18n');
PwSeoBo::setCustomSeo($lang->getMessage('SEO:profile.avatar.run.title'), '', '');
}
示例4: afterRegister
public function afterRegister($userDm)
{
if ($this->bp->config['type'] != 2) {
return false;
}
/* @var $inviteDs PwInviteCode */
$inviteDs = Wekit::load('invite.PwInviteCode');
if ($this->inviteInfo['created_userid']) {
$codeDm = new PwInviteCodeDm();
$codeDm->setInvitedUid($userDm->uid)->setModifiedTime(Pw::getTime())->setIfused(1)->setCode($this->code);
//别人赠送的邀请码
$inviteDs->updateCode($codeDm);
$creditType = $this->bp->config['invite.reward.credit.type'];
$creditNum = $this->bp->config['invite.reward.credit.num'];
//邀请人获得加奖励
//[积分日志] 成功邀请好友积分奖励
/* @var $creditBo PwCreditBo */
$creditBo = PwCreditBo::getInstance();
$creditBo->addLog('invite_reward', array($creditType => $creditNum), new PwUserBo($this->inviteInfo['created_userid']), array('friend' => $userDm->getField('username')));
$creditBo->set($this->inviteInfo['created_userid'], $creditType, $creditNum);
//邀请成功相互关注 被邀请者关注邀请者
/* @var $attention PwAttentionService */
$attention = Wekit::load('attention.srv.PwAttentionService');
$attention->addFollow($userDm->uid, $this->inviteInfo['created_userid']);
// $attention->addFollow($this->inviteInfo['created_userid'], $userDm->uid);
} else {
$codeDm = new PwInviteCodeDm();
$codeDm->setInvitedUid($userDm->uid)->setIfused(1)->setModifiedTime(Pw::getTime())->setCreateUid($userDm->uid)->setCode($this->code);
//自己购买的邀请码
$inviteDs->updateCode($codeDm);
}
return true;
}
示例5: ignoreNotice
/**
* 忽略
*
* @param array $notice
*/
public function ignoreNotice($notice, $ignore = 1)
{
if (!$notice) {
return false;
}
return Wekit::load('message.srv.PwNoticeService')->setIgnoreNotice($notice['typeid'], $notice['uid'], $ignore);
}
示例6: doModifyAction
/**
* 设置伪静态
*/
public function doModifyAction()
{
list($format, $isopen) = $this->getInput(array('format', 'isopen'));
$bo = new PwConfigSet('rewrite');
foreach ($format as $k => $v) {
if (empty($v) && isset($isopen[$k])) {
$this->showError('REWRITE:format.empty');
}
$bo->set("format.{$k}", $v);
}
$addons = Wekit::load('domain.srv.PwDomainService')->getRewriteAddOns();
$rewriteData = array();
$unique = array();
foreach ($addons as $k1 => $v1) {
$open = isset($isopen[$k1]) ? 1 : 0;
$bo->set("isopen.{$k1}", $open);
if ($open) {
$format_i = preg_replace('/\\{\\w+\\}/', '', $format[$k1]);
if (in_array($format_i, $unique)) {
$this->showError(array('REWRITE:format.conflict', array($format[$k1])));
}
$unique[] = $format_i;
if ($k1 == 'thread') {
$rewriteData['cate'] = array('format' => $format[$k1], 'pattern' => $this->_compileFormat($format[$k1]), 'route' => 'bbs/cate/run');
}
$rewriteData[$k1] = array('format' => $format[$k1], 'pattern' => $this->_compileFormat($format[$k1]), 'route' => $v1[2]);
}
}
$bo->flush();
Wekit::C()->setConfig('site', 'rewrite', $rewriteData);
Wekit::load('domain.srv.PwDomainService')->refreshTplCache();
Wekit::load('SRV:nav.srv.PwNavService')->updateConfig();
$this->showMessage('success');
}
示例7: checkVerify
public function checkVerify($inputCode)
{
Wind::import('WINDID:service.verify.srv.PwVerifyService');
$srv = new PwVerifyService('PwVerifyService_getVerifyType');
$config = Wekit::C('verify');
return $srv->checkVerify($config['type'], $inputCode);
}
示例8: createHtmlAfterUserInfo
public function createHtmlAfterUserInfo($user, $read)
{
$showuserinfo = Wekit::C('site', 'app.torrent.showuserinfo');
if (is_array($showuserinfo) && !in_array('threadside', $showuserinfo)) {
return;
}
$peers = Wekit::load('EXT:torrent.service.PwTorrentPeer')->fetchTorrentPeerByUid($user['uid']);
$torrents = Wekit::load('EXT:torrent.service.PwTorrent')->fetchTorrentByUid($user['uid']);
$histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($user['uid']);
$seeding = $leeching = 0;
if (is_array($peers)) {
foreach ($peers as $peer) {
if ($peer['seeder'] == 'yes') {
$seeding++;
} else {
$leeching++;
}
}
}
if (is_array($histories)) {
foreach ($histories as $history) {
$downloaded_total += $history['downloaded'];
$uploaded_total += $history['uploaded'];
}
}
if ($downloaded_total != 0) {
$rotio = round($uploaded_total / $downloaded_total, 2);
} else {
$rotio = 'Inf.';
}
echo '<div id="PTInfo">下载:' . $leeching . '<br>做种:' . $seeding . '<br>发布: ' . count($torrents) . '<br>分享率: ' . $rotio . '<br>下载量: ' . PwUtils::readableDataTransfer($downloaded_total) . '<br>上传量: ' . PwUtils::readableDataTransfer($uploaded_total) . '</div>';
}
示例9: compile
public function compile($key, $content)
{
$content = substr($content, 8, -1);
if (!$content) {
return '';
}
$themeBaseUrl = 'Wekit::app()->themes';
preg_match('/(\\w*.)?(\\w*.)?(css|js|images)(.\\w*)?/i', $content, $matchs);
if (!$matchs) {
return '';
}
if (empty($matchs[3])) {
return '';
}
$pack = $theme = '';
if (!empty($matchs[1])) {
$themeType = trim($matchs[1], '.');
$pack = Wekit::C('site', 'theme.' . $themeType . '.pack');
$theme = empty($matchs[2]) ? '\'.Wekit::C(\'site\', \'theme.' . $themeType . '.default\').\'' : trim($matchs[2], '.');
} else {
list($theme, $pack) = $this->windViewerResolver->getWindView()->getTheme(0);
$pack && ($pack = str_replace('THEMES:', '', $pack));
}
$content = $pack ? '.\'/' . str_replace('.', '/', $pack) . '\'' : '';
$content .= $theme ? '.\'/' . $theme . '\'' : '';
$content .= '.\'/' . $matchs[3] . '\'';
if ($matchs[3] === 'css') {
$content .= '.Wekit::getGlobal(\'theme\',\'debug\')';
}
$content = '<?php echo ' . $themeBaseUrl . $content . '; ?>';
$content = str_replace('\'.\'', '', $content);
return $content;
}
示例10: run
public function run()
{
$dm = new PwTopicDm(true);
$dm->addLastposttime(-$this->downtime)->setDowned($this->downed);
Wekit::load('forum.PwThread')->batchUpdateThread($this->tids, $dm, PwThread::FETCH_MAIN);
Wekit::load('log.srv.PwLogService')->addThreadManageLog($this->srv->user, 'down', $this->srv->getData(), $this->_reason, $this->downtime);
}
示例11: compile
public function compile($key, $content)
{
$content = array();
$content[] = '<?php';
if (Wekit::load('APPCENTER:service.srv.PwDebugApplication')->inDevMode2()) {
$_content = $this->_devHook();
$content[] = 'echo \'' . $_content . '\';';
}
if (!$this->args) {
$this->args = '';
} else {
$this->args = preg_replace(array('/\\s*array\\s*\\(\\s*/i', '/\\s*\\)\\s*$/i'), '', $this->args);
}
$this->method = $this->method ? $this->method : 'runDo';
if ($this->class) {
$this->args = "'" . $this->name . "'" . ($this->args ? "," . $this->args : '');
$callback = 'array(' . $this->class . ', "' . $this->method . '")';
} elseif ($this->name) {
$callback = 'array(PwSimpleHook::getInstance("' . $this->name . '"), "' . $this->method . '")';
} else {
$callback = '"' . $this->method . '"';
}
$this->args = 'array(' . $this->args . ')';
$this->alias = trim($this->alias);
$content[] = 'PwHook::display(' . $callback . ', ' . $this->args . ', "' . $this->alias . '", $__viewer);';
$content[] = '?>';
return implode("\r\n", $content);
}
示例12: appDo
public function appDo($space)
{
if (!in_array('profile', Wekit::C('site', 'app.torrent.showuserinfo'))) {
return '';
}
$user = Wekit::load('EXT:torrent.service.PwTorrentUser')->getTorrentUserByUid($space->{'spaceUid'});
$torrents = Wekit::load('EXT:torrent.service.PwTorrent')->fetchTorrentByUid($space->{'spaceUid'});
$histories = Wekit::load('EXT:torrent.service.PwTorrentHistory')->fetchTorrentHistoryByUid($space->{'spaceUid'});
$passkey = $user['passkey'];
$posted = count($torrents);
foreach ($histories as $history) {
$downloaded_total += $history['downloaded'];
$uploaded_total += $history['uploaded'];
}
$downloaded_total = floor($downloaded_total / 1048567);
$uploaded_total = floor($uploaded_total / 1048567);
if ($downloaded_total != 0) {
$rotio = round($uploaded_total / $downloaded_total, 2);
} else {
$rotio = 'Inf.';
}
echo '<div class="space_profile"><h3><strong>PT个人信息</strong></h3>';
if ($space->{'visitUid'} == $space->{'spaceUid'}) {
echo '<dl class="cc"><dt>Passkey:</dt><dd><span id="passkey" style="background-color:rgb(51,51,51); color:rgb(51,51,51);">' . $passkey . '</span> <button class="btn" id="btnToggle" onclick="if ($(\'#btnToggle\').text() == \'显示\') {$(\'#passkey\').css(\'background\', \'white\'); $(\'#btnToggle\').text(\'隐藏\');} else {$(\'#passkey\').css(\'background\', \'rgb(51,51,51)\');$(\'#btnToggle\').text(\'显示\');}">显示</button></dd></dl>';
echo '<dl class="cc"><dt>订阅地址:</dt><dd><a href="' . WindUrlHelper::createUrl('/app/torrent/index/rss?uid=' . $space->{'spaceUid'} . '&passkey=' . $passkey) . '">RSS 链接(请勿泄露)</a><a href="' . WindUrlHelper::createUrl('/app/torrent/index/my') . '" class="btn">管理</a></dd></dl>';
}
echo '<dl class="cc"><dt>下载:</dt><dd>' . $downloaded_total . ' M</dd></dl>';
echo '<dl class="cc"><dt>上传:</dt><dd>' . $uploaded_total . ' M</dd></dl>';
echo '<dl class="cc"><dt>分享率:</dt><dd>' . $rotio . '</dd></dl>';
echo '<dl class="cc"><dt>发布:</dt><dd>' . $posted . '</dd></dl>';
echo '</div>';
}
示例13: run
public function run($uid)
{
/* @var $srv PwMessageService */
$srv = Wekit::load('SRV:message.srv.PwMessageService');
$srv->deleteUserMessages($uid, true, true);
return true;
}
示例14: gainReward
public function gainReward($uid, $reward, $taskname)
{
$userBo = Wekit::getLoginUser();
list($id) = explode('-', $reward['value'], 2);
$time = abs(intval($reward['time']));
/* @var $userBelongDs PwUserBelong */
$userBelongDs = Wekit::load('user.PwUserBelong');
$info = $userBelongDs->getUserBelongs($uid);
$_groups = array();
foreach ($info as $_item) {
$_groups[$_item['gid']] = $_item['endtime'];
}
$_groups[$id] = $time ? Pw::getTime() + 24 * 3600 * $time : 0;
/* @var $userService PwUserService */
$userService = Wekit::load('user.srv.PwUserService');
list($gid, $groups) = $userService->caculateUserGroupid($userBo->gid, $_groups);
$dm = new PwUserInfoDm($uid);
$dm->setGroupid($gid)->setGroups($groups);
/* @var $userDs PwUser */
$userDs = Wekit::load('user.PwUser');
$result = $userDs->editUser($dm, PwUser::FETCH_MAIN);
if ($result instanceof PwError) {
return $result;
}
return true;
}
示例15: addPost
public function addPost($pid, $tid)
{
if ($pid < 1 && $tid < 1) {
return false;
}
return Wekit::load('like.PwLikeContent')->updateLastPid($this->likeid, $pid);
}