本文整理汇总了PHP中Wind::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Wind::getComponent方法的具体用法?PHP Wind::getComponent怎么用?PHP Wind::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wind
的用法示例。
在下文中一共展示了Wind::getComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContents
/**
* (non-PHPdoc)
* @see PwTagAction::getContents()
*/
public function getContents($ids)
{
$threads = $this->_getThreadDs()->fetchThread($ids, PwThread::FETCH_ALL);
$array = array();
if ($threads) {
$fids = array();
foreach ($threads as $v) {
$fids[] = $v['fid'];
}
$user = Wekit::getLoginUser();
$forums = $this->_getForumDs()->fetchForum($fids);
$forbidFids = $this->getForbidVisitForum($user, $forums);
$lang = Wind::getComponent('i18n');
foreach ($threads as $k => $v) {
if ($v['disabled'] > 0) {
$content = $lang->getMessage('BBS:forum.thread.disabled');
$v['subject'] = $content;
$v['content'] = $content;
} elseif (in_array($v['fid'], $forbidFids)) {
$content = $lang->getMessage('BBS:forum.thread.right.error');
$v['subject'] = $content;
$v['content'] = $content;
}
$v['forum_name'] = $forums[$v['fid']]['name'];
$v['created_time_auto'] = pw::time2str($v['created_time'], 'auto');
$v['type_id'] = $forums[$v['fid']]['name'];
$array[$k] = $v;
}
}
return $array;
}
示例2: run
public function run()
{
$page = $this->getInput('page');
$this->page = $page < 1 ? 1 : intval($page);
list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
$timestamp = PW::getTime();
$startTime = $timestamp - 7 * 86400;
$endTime = $timestamp;
$total = $this->_getPollDs()->countPollByTime($startTime, $endTime);
$pollInfo = array();
if ($total) {
Wind::import('SRV:poll.srv.dataSource.PwFetchPollByTime');
$pollDisplay = new PwPollDisplay(new PwFetchPollByTime($startTime, $endTime, $limit, $start, array('voter_num' => 0, 'created_time' => 0)));
$pollInfo = $this->_buildPoll($pollDisplay->gather());
}
$latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
$latestPoll = $latestPollDisplay->gather();
$this->setOutput($total, 'total');
$this->setOutput($pollInfo, 'pollInfo');
$this->setOutput($latestPoll, 'latestPoll');
$this->setOutput($this->page, 'page');
$this->setOutput($this->perpage, 'perpage');
$this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
if ($this->page > 1) {
$seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.page.title', array($this->page)), $lang->getMessage('vote.hot.run.description'), '');
} else {
$seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.title'), '', $lang->getMessage('SEO:vote.hot.run.description'));
}
Wekit::setV('seo', $seoBo);
}
示例3: replyAction
/**
* 回复列表
*/
public function replyAction()
{
list($page, $perpage) = $this->getInput(array('page', 'perpage'));
$page = $page ? $page : 1;
$perpage = $perpage ? $perpage : $this->perpage;
list($start, $limit) = Pw::page2limit($page, $perpage);
$count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid);
if ($count) {
$tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start);
$posts = $tids = array();
foreach ($tmpPosts as $v) {
$tids[] = $v['tid'];
}
$threads = $this->_getThreadDs()->fetchThread($tids);
foreach ($tmpPosts as $v) {
$v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
$v['content'] = Pw::substrs($v['content'], 30);
$v['created_time'] = PW::time2str($v['created_time'], 'auto');
$posts[] = $v;
}
}
$this->setOutput($count, 'count');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput($posts, 'posts');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例4: _compile
/**
* 分析其中的脚本
*
* @param string $content
* @return string
*/
private function _compile($content)
{
if ($route = Wind::getComponent('router')->getRoute('pw')) {
if ($route->dynamicDomain) {
if (3 == count($route->dynamicDomain)) {
$content = $route->dynamicDomain[0] . $route->dynamicDomain[1] . $content . $route->dynamicDomain[2];
} else {
$content = $route->dynamicDomain[0] . $route->dynamicDomain[1] . $route->dynamicDomain[4] . $route->dynamicDomain[2] . $content . $route->dynamicDomain[3];
}
$content = preg_replace_callback('/<\\?php(.*?)\\?>/is', array($this, '_parse'), $content);
} else {
if ($route->dynamic) {
if (false !== strpos($content, '{fname}')) {
$temp = explode('{fname}', $content, 2);
foreach ($this->_variables as $key => $var) {
$temp[0] = str_replace($key, '\',' . $var . ',\'', $temp[0]);
$temp[1] = str_replace($key, '\',' . $var . ',\'', $temp[1]);
}
$content = $route->dynamic[0] . 'echo \'' . $temp[0] . '\',' . $route->dynamic[1] . ',\'' . $temp[1] . '\';?>';
}
$content = preg_replace_callback('/<\\?php(.*?)\\?>/is', array($this, '_parse'), $content);
}
}
if ($route->dynamicHost) {
$content = ltrim(str_replace($route->dynamicHost, '', $content), '/');
}
$route->dynamicDomain = $route->dynamic = $route->dynamicDomain = null;
}
return $content;
}
示例5: taAction
public function taAction()
{
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$lang = Wind::getComponent('i18n');
PwSeoBo::setCustomSeo($lang->getMessage('SEO:like.mylike.ta.title'), '', '');
}
示例6: run
public function run()
{
$page = $this->getInput('page');
$this->page = $page < 1 ? 1 : intval($page);
list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
$total = $this->_getPollVoterDs()->countByUid(Wekit::getLoginUser()->uid);
$poll = $total ? $this->_getPollVoterDs()->getPollByUid(Wekit::getLoginUser()->uid, $limit, $start) : array();
$pollInfo = array();
if ($poll) {
$pollid = array();
foreach ($poll as $value) {
$pollid[] = $value['poll_id'];
}
Wind::import('SRV:poll.srv.dataSource.PwFetchPollByPollid');
$pollDisplay = new PwPollDisplay(new PwFetchPollByPollid($pollid, count($pollid)));
$pollInfo = $this->_buildPoll($pollDisplay->gather(), 'my');
}
$latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
$latestPoll = $latestPollDisplay->gather();
$this->setOutput($total, 'total');
$this->setOutput($pollInfo, 'pollInfo');
$this->setOutput($latestPoll, 'latestPoll');
$this->setOutput($this->page, 'page');
$this->setOutput($this->perpage, 'perpage');
$this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:vote.my.run.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例7: emailAction
/**
* 电子邮件用户激活
*/
public function emailAction()
{
list($page, $perpage) = $this->getInput(array('page', 'perpage'));
$page = $page ? $page : 1;
$perpage = $perpage ? $perpage : $this->perpage;
$count = $this->_getDs()->countUnActived();
$list = array();
if ($count > 0) {
$totalPage = ceil($count / $perpage);
$page > $totalPage && ($page = $totalPage);
$result = $this->_getDs()->getUnActivedList($perpage, intval(($page - 1) * $perpage));
/* @var $userDs PwUser */
$userDs = Wekit::load('user.PwUser');
$list = $userDs->fetchUserByUid(array_keys($result), PwUser::FETCH_MAIN);
$list = WindUtility::mergeArray($result, $list);
}
$this->setOutput($count, 'count');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput(array('perpage' => $perpage), 'args');
$this->setOutput($list, 'list');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:manage.user.email.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例8: sendErrorMessage
protected function sendErrorMessage($errorMessage, $errorcode)
{
if (!is_object($errorMessage)) {
$_tmp = $errorMessage;
/* @var $errorMessage WindErrorMessage */
$errorMessage = Wind::getComponent('errorMessage');
$errorMessage->addError($_tmp);
}
/* @var $router WindRouter */
$moduleName = $this->handlerAdapter->getModule();
if ($moduleName === 'error') {
throw new WindFinalException($errorMessage->getError(0));
}
if (!($_errorAction = $errorMessage->getErrorAction())) {
$module = $this->getModules($moduleName);
$_errorClass = Wind::import(@$module['error-handler']);
$_errorAction = 'error/' . $_errorClass . '/run/';
$this->setModules('error', array('controller-path' => array_search($_errorClass, Wind::$_imports), 'controller-suffix' => '', 'error-handler' => ''));
}
/* @var $forward WindForward */
$forward = Wind::getComponent('forward');
$error = array('message' => $errorMessage->getError(), 'code' => $errorcode);
$forward->forwardAction($_errorAction, array('__error' => $error, '__errorDir' => $this->getConfig('error-dir')), false, false);
$this->doDispatch($forward);
}
示例9: showErrorMessage
protected function showErrorMessage($message, $file, $line, $trace, $errorcode)
{
list($fileLines, $trace) = $this->crash($file, $line, $trace);
if (Wind::$isDebug & 2) {
$log = $message . "\r\n" . $file . ":" . $line . "\r\n";
foreach ($trace as $key => $value) {
$log .= $value . "\r\n";
}
Wind::getComponent('windLogger')->error($log, 'error', true);
}
$message = nl2br($message);
$errDir = Wind::getRealPath($this->errorDir, false);
if ($this->isClosed) {
$errPage = 'close';
} elseif (is_file($errDir . '/' . $errorcode . '.htm')) {
$errPage = $errorcode;
} else {
$errPage = 'error';
}
$title = $this->getResponse()->codeMap($errorcode);
$title = $title ? $errorcode . ' ' . $title : 'unknowen error';
$__vars['title'] = ucwords($title);
$__vars['message'] = $message;
if (Wind::$isDebug & 1) {
$__vars['debug']['file'] = $file;
$__vars['debug']['line'] = $line;
$__vars['debug']['trace'] = $trace;
$__vars['debug']['fileLines'] = $fileLines;
}
$this->render($__vars, $errorcode, $errDir, $errPage);
}
示例10: buildTitle
public function buildTitle($param = 0, $extendParams = null, $aggregatedNotice = null)
{
$params = array();
$msg = '';
switch ($extendParams['change_type']) {
//转账
case 'transfer':
$params['{username}'] = '<a href="' . WindUrlHelper::createUrl('space/index/run', array('uid' => $extendParams['fromUid'])) . '">' . $extendParams['fromUserName'] . '</a>';
$params['{num}'] = $extendParams['num'];
$params['{unit}'] = $extendParams['unit'];
$params['{credit}'] = $extendParams['credit'];
$msg = 'CREDIT:transfer.to.notice.format';
break;
//转换:
//转换:
case 'exchange':
$params['{credit1}'] = $extendParams['credit1'];
$params['{num1}'] = $extendParams['num1'];
$params['{unit1}'] = $extendParams['unit1'];
$params['{credit2}'] = $extendParams['credit2'];
$params['{num2}'] = $extendParams['num2'];
$params['{unit2}'] = $extendParams['unit2'];
$msg = 'CREDIT:exchange.notice.format';
break;
case 'pay':
$params['{credit}'] = $extendParams['credit'];
$params['{num}'] = $extendParams['num'];
$params['{unit}'] = $extendParams['unit'];
$params['{price}'] = $extendParams['price'];
$msg = 'CREDIT:pay.notice.format';
break;
}
return Wind::getComponent('i18n')->getMessage($msg, $params);
}
示例11: getDB
public function getDB()
{
if (!$this->_baseInstance) {
$this->_baseInstance = Wind::getComponent('db');
}
return $this->_baseInstance;
}
示例12: afterAction
public function afterAction($handlerAdapter)
{
parent::afterAction($handlerAdapter);
$debug = Wekit::C('site', 'debug') || !Wekit::C('site', 'css.compress');
Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
$this->setTheme('site', null);
/* @var $resource WindLangResource */
$resource = Wind::getComponent('i18n');
$_error = $this->getForward()->getVars('message');
if ($resource !== null) {
foreach ($_error as $key => $value) {
if (is_array($value)) {
list($value, $var) = $value;
} else {
$var = array();
}
$message = $resource->getMessage($value, $var);
$message && ($_error[$key] = $message);
}
}
$this->getForward()->setVars(array('message' => $_error, '__error' => ''));
$type = $this->getRequest()->getAcceptTypes();
// 如果是含有上传的递交,不能采用ajax的方式递交,需要以html的方式递交,并且返回的结果需要是json格式,将以json=1传递过来标志
$json = $this->getInput('_json');
$requestJson = $this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false;
if ($requestJson || $json == 1) {
$this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::V('charset'));
echo Pw::jsonEncode($this->getForward()->getVars());
exit;
}
}
示例13: beforeAction
public function beforeAction($handlerAdapter)
{
parent::beforeAction($handlerAdapter);
$this->_var = $this->getRequest()->getRequest();
$this->_conf = Wekit::C('pay');
if (!$this->_conf['ifopen']) {
$this->paymsg($this->_conf['reason']);
}
if (!$this->_conf['alipay']) {
$this->paymsg('onlinepay.settings.alipay.error');
}
$http = Wind::getComponent('httptransfer', array('http://notify.alipay.com/trade/notify_query.do'));
$veryfy_result2 = trim($http->post(array('notify_id' => $this->_var['notify_id'], 'partner' => $this->_conf['alipaypartnerID'])), "\r\n");
//兼容支付宝urlencode之后伪静态+号无法rawurldecode的处理方案
isset($this->_var['notify_time']) && ($this->_var['notify_time'] = urldecode($this->_var['notify_time']));
ksort($this->_var);
reset($this->_var);
$arg = '';
foreach ($this->_var as $key => $value) {
if ($value && !in_array($key, array('p', 'm', 'c', 'a', 'sign', 'sign_type'))) {
$arg .= "{$key}={$value}&";
}
}
$veryfy_result1 = $this->_var['sign'] == md5(substr($arg, 0, -1) . $this->_conf['alipaykey']) ? true : false;
if (!$veryfy_result1 || !preg_match("/true/i", $veryfy_result2)) {
$this->paymsg('onlinepay.auth.fail', 'fail');
}
}
示例14: run
public function run()
{
$ips = $this->_loadSafeService()->getAllowIps();
$ips = implode(',', $ips);
$this->setOutput($ips, 'ips');
$this->setOutput(Wind::getComponent('request')->getClientIp(), 'clientIp');
}
示例15: run
public function run()
{
list($type, $page) = $this->getInput(array('type', 'page'));
$page = intval($page);
$page < 1 && ($page = 1);
$perpage = 20;
list($start, $limit) = Pw::page2limit($page, $perpage);
$noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid, $type, $start, $limit);
$noticeList = $this->_getNoticeService()->formatNoticeList($noticeList);
$typeCounts = $this->_getNoticeService()->countNoticesByType($this->loginUser->uid);
//类型
$typeid = intval($type);
//获取未读通知数
$unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->loginUser->uid);
$this->_readNoticeList($unreadCount, $noticeList);
//count
$count = intval($typeCounts[$typeid]['count']);
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput($count, 'count');
$this->setOutput(ceil($count / $perpage), 'totalpage');
$this->setOutput(array('type' => $typeid), 'args');
$this->setOutput($typeid, 'typeid');
$this->setOutput($typeCounts, 'typeCounts');
$this->setOutput($noticeList, 'noticeList');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', '');
Wekit::setV('seo', $seoBo);
}