本文整理汇总了PHP中Wekit::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Wekit::load方法的具体用法?PHP Wekit::load怎么用?PHP Wekit::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wekit
的用法示例。
在下文中一共展示了Wekit::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
protected function run()
{
$forum = new PwForumBo($this->fid, true);
if (!$forum->isForum(true)) {
return new PwError('BBS:forum.unite.error.fid.exists.not');
}
if ($forum->foruminfo['type'] == 'category') {
return new PwError('BBS:forum.unite.error.fid.category');
}
if ($forum->getSubForums()) {
return new PwError('BBS:forum.unite.error.hassub');
}
$toforum = new PwForumBo($this->tofid);
if (!$toforum->isForum(true)) {
return new PwError('BBS:forum.unite.error.tofid.exists.not');
}
if ($toforum->foruminfo['type'] == 'category') {
return new PwError('BBS:forum.unite.error.tofid.category');
}
if ($this->fid == $this->tofid) {
return new PwError('BBS:forum.unite.error.same');
}
Wekit::load('forum.PwForum')->deleteForum($this->fid);
Wind::import('SRV:forum.dm.PwForumDm');
$dm = new PwForumDm($this->tofid);
$dm->addThreads($forum->foruminfo['threads'])->addPosts($forum->foruminfo['posts']);
Wekit::load('forum.PwForum')->updateForum($dm, PwForum::FETCH_STATISTICS);
Wekit::load('forum.srv.PwForumService')->updateForumStatistics($forum->foruminfo['parentid']);
Wekit::load('forum.srv.PwForumService')->updateForumStatistics($this->tofid);
return true;
}
示例2: postHandle
public function postHandle()
{
//门户管理模式 编译目录切换
if ($this->getRequest()->getPost('design')) {
$loginUser = Wekit::getLoginUser();
$designPermission = $loginUser->getPermission('design_allow_manage.push');
if ($designPermission > 0) {
$dir = Wind::getRealDir('DATA:design.template');
if (is_dir($dir)) {
WindFolder::rm($dir, true);
}
$this->forward->getWindView()->compileDir = 'DATA:design.template';
}
}
// SEO settings
Wind::import('SRV:seo.bo.PwSeoBo');
$sitename = Wekit::C('site', 'info.name');
PwSeoBo::set('{sitename}', $sitename);
Wekit::setGlobal(NEXT_VERSION . ' ' . NEXT_RELEASE, 'version');
Wekit::setGlobal(PwSeoBo::getData(), 'seo');
$this->setOutput($this->getRequest()->getIsAjaxRequest() ? '1' : '0', '_ajax_');
/*[设置给PwGlobalFilters需要的变量]*/
$_var = array('current' => $this->forward->getWindView()->templateName, 'a' => $this->router->getAction(), 'c' => $this->router->getController(), 'm' => $this->router->getModule());
$this->getResponse()->setData($_var, '_aCloud_');
Wekit::load('APPS:appcenter.service.srv.PwDebugApplication')->compile();
}
示例3: beforeAction
public function beforeAction($handlerAdapter)
{
parent::beforeAction($handlerAdapter);
$spaceUid = (int) $this->getInput('uid', 'get');
if ($spaceUid < 1) {
$userName = $this->getInput('username', 'get');
$user = Wekit::load('user.PwUser')->getUserByName($userName);
$spaceUid = isset($user['uid']) ? $user['uid'] : 0;
}
if ($spaceUid < 1) {
$this->forwardRedirect(WindUrlHelper::createUrl('u/login/run/'));
}
$this->space = new PwSpaceBo($spaceUid);
if (!$this->space->space['uid']) {
$user = Wekit::load('user.PwUser')->getUserByUid($spaceUid);
if ($user) {
Wekit::load('space.dm.PwSpaceDm');
$dm = new PwSpaceDm($spaceUid);
$dm->setVisitCount(0);
Wekit::load('space.PwSpace')->addInfo($dm);
$this->space = new PwSpaceBo($spaceUid);
} else {
$this->forwardRedirect(WindUrlHelper::createUrl('u/login/run/'));
}
}
$this->space->setTome($spaceUid, $this->loginUser->uid);
$this->space->setVisitUid($this->loginUser->uid);
$this->setTheme('space', null);
if ($this->space->allowView('space')) {
$this->forwardRedirect(WindUrlHelper::createUrl('space/index/run', array('uid' => $spaceUid)));
}
}
示例4: 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);
}
示例5: 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>';
}
示例6: 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>';
}
示例7: 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);
}
示例8: run
public function run($uid)
{
/* @var $srv PwMessageService */
$srv = Wekit::load('SRV:message.srv.PwMessageService');
$srv->deleteUserMessages($uid, true, true);
return true;
}
示例9: 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;
}
示例10: 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;
}
示例11: __get
public function __get($name)
{
$data = Wekit::load('config.PwConfig')->getValues($name);
$config = new PwConfigIniBo($data);
$this->{$name} = $config;
return $config;
}
示例12: check
public function check($postDm)
{
$data = $postDm->getData();
$content = Pw::substrs(Pw::stripWindCode($data['content']), 30) == $data['subject'] ? $data['content'] : $data['subject'] . $data['content'];
$banedStrLen = strlen($data['subject']);
$wordFilter = Wekit::load('SRV:word.srv.PwWordFilter');
list($type, $words, $isTip) = $wordFilter->filterWord($content);
if (!$type) {
return true;
}
$words = array_unique($words);
foreach ($words as $k => $v) {
if ($k < $banedStrLen) {
return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words)));
}
}
switch ($type) {
case 1:
return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words)));
case 2:
$this->_isVerified = 1;
if ($this->_confirm) {
return true;
}
case 3:
$this->_word = 1;
default:
return true;
}
return true;
}
示例13: _initInfo
private function _initInfo()
{
$this->uid = wekit::getLoginUser()->info['uid'];
// dump($this->uid);
$this->username = wekit::getLoginUser()->info['username'];
$this->onlinetime = intval(intval(wekit::getLoginUser()->info['onlinetime']) / 3600);
// $this->ip= wekit::getLoginUser()->info['lastloginip'];
// $this->ip=$_SERVER["REMOTE_ADDR"];
$this->ip = $this->GetIP();
Wind::import('SRV:credit.bo.PwCreditBo');
$userBelongSrv = Wekit::load('SRV:user.PwUserBelong');
// dump($userBelongSrv->getUserBelongs(7));
$this->gid = wekit::getLoginUser()->info['groupid'];
//$this->gid=8;//0 NULL 1会员2游客3管理员4总版主5论坛版主6禁止发言7未验证会员
if (($group = Wekit::cache()->get('group', $this->gid)) === false) {
$group = Wekit::cache()->get('group', 1);
}
// dump(Wekit::$_app);
// dump($this->gid);
//2015.1.17关闭group
if ($group) {
$this->groupInfo = array('name' => $group['name'], 'type' => $group['type'], 'image' => $group['image'], 'points' => $group['points']);
$this->permission = $group['permission'];
}
// dump($this->groupInfo);
$this->avatarPath = str_replace('_middle', '', Pw::getAvatar($this->uid));
//获取头像 √
}
示例14: 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');
}
示例15: unInstall
public function unInstall($install)
{
/* @var $ds PwConfig */
$ds = Wekit::load('config.PwConfig');
$ds->deleteConfig('app_majia');
return true;
}