本文整理汇总了PHP中Wind::getApp方法的典型用法代码示例。如果您正苦于以下问题:PHP Wind::getApp方法的具体用法?PHP Wind::getApp怎么用?PHP Wind::getApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wind
的用法示例。
在下文中一共展示了Wind::getApp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($handlerAdapter)
{
parent::beforeAction($handlerAdapter);
$charset = 'utf-8';
$_windidkey = $this->getInput('windidkey', 'get');
$_time = (int) $this->getInput('time', 'get');
$_clientid = (int) $this->getInput('clientid', 'get');
if (!$_time || !$_clientid) {
$this->output(WindidError::FAIL);
}
$clent = $this->_getAppDs()->getApp($_clientid);
if (!$clent) {
$this->output(WindidError::FAIL);
}
if (WindidUtility::appKey($clent['id'], $_time, $clent['secretkey']) != $_windidkey) {
$this->output(WindidError::FAIL);
}
$time = Windid::getTime();
if ($time - $_time > 120) {
$this->output(WindidError::TIMEOUT);
}
$charset = $clent['charset'] == 1 ? 'utf8' : 'gbk';
$baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true) . '/';
$config = array('windid' => 'client', 'serverUrl' => $baseUrl, 'clientId' => $clent['id'], 'clientKey' => $clent['secretkey'], 'clientDb' => 'mysql', 'clientCharser' => $charset);
WindidClientBo::getInstance($config);
}
示例2: beforeAction
public function beforeAction($handlerAdapter)
{
$this->setOutput(NEXT_VERSION, 'wind_version');
$_consts = (include Wind::getRealPath('CONF:publish.php', true));
foreach ($_consts as $const => $value) {
if (defined($const)) {
continue;
}
if ($const === 'PUBLIC_URL' && !$value) {
$value = Wind::getApp()->getRequest()->getBaseUrl(true);
}
define($const, $value);
}
$url = array();
$url['base'] = PUBLIC_URL;
$url['res'] = WindUrlHelper::checkUrl(PUBLIC_RES, PUBLIC_URL);
$url['css'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/css/', PUBLIC_URL);
$url['images'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/', PUBLIC_URL);
$url['js'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/dev/', PUBLIC_URL);
$url['attach'] = WindUrlHelper::checkUrl(PUBLIC_ATTACH, PUBLIC_URL);
Wekit::setGlobal($url, 'url');
$this->setOutput('phpwind 8.7 to 9.0', 'wind_version');
//ajax递交编码转换
$token = $this->getInput('token', 'get');
$lockFile = Wind::getRealPath('DATA:setup.setup.lock', true);
if (file_exists($lockFile) && !$token) {
$this->showError('升级程序已被锁定, 如需重新运行,请先删除setup.lock');
}
$encryptToken = trim(file_get_contents($lockFile));
if (md5($token) != $encryptToken) {
$this->showError('升级程序访问异常! 重新安装请先删除setup.lock');
}
}
示例3: checkAction
public function checkAction()
{
require_once Wind::getRealPath('ACLOUD:aCloud');
ACloudSysCoreCommon::setGlobal('g_siteurl', PUBLIC_URL);
ACloudSysCoreCommon::setGlobal('g_sitename', 'phpwind');
ACloudSysCoreCommon::setGlobal('g_charset', Wind::getApp()->getResponse()->getCharset());
list($this->BenchService, $operate) = array(ACloudSysCoreCommon::loadSystemClass('administor', 'bench.service'), strtolower($this->getInput("operate")));
return $operate == 'reset' ? $this->reset() : $this->checkEnvironment();
}
示例4: init
protected function init()
{
$router = Wind::getComponent('router');
$this->default_m || ($this->default_m = Wind::getApp()->getConfig('default-module', '', $router->getDefaultModule()));
if ($this->getConfig('default')) {
$router->setDefaultModule($this->default_m);
}
$this->init = true;
}
示例5: run
public function run()
{
$this->setOutput("Error message", "errorHeader");
$this->setOutput($this->error, "errors");
$errDir = Wind::getApp()->getConfig('errorpage');
!$errDir && ($errDir = $this->errorDir);
$this->setTemplatePath($errDir);
$this->setTemplate('erroraction');
}
示例6: testGetInstance
/**
* Tests WindFactory->getInstance()
*/
public function testGetInstance()
{
$this->assertTrue(Wind::getApp()->getComponent("forward") instanceof WindForward);
try {
Wind::getApp()->getComponent("notExistCom");
} catch (WindException $e) {
return;
}
$this->fail("GetInstance Test Error");
}
示例7: checkUrl
/**
* url检查
*
* 当$absolute === true且url不包含协议部分时,默认加上当前应用的协议部分.
* @param string $url 需要检查合法性的url
* @param boolean $absolute 是否为绝对路径
* @return string
*/
public static function checkUrl($url, $absolute = true)
{
if ($absolute) {
$_baseUrl = $absolute === true ? Wind::getApp()->getRequest()->getBaseUrl(true) : $absolute;
if (strpos($url, '://') === false) {
$url = trim($_baseUrl, '/') . '/' . trim($url, '/');
}
}
return $url;
}
示例8: synLogin
public function synLogin($uid)
{
Wind::import('SRC:service.user.bo.PwUserBo');
Wind::import('SRC:service.user.srv.PwLoginService');
$userBo = new PwUserBo($uid);
$srv = new PwLoginService();
$ip = Wind::getApp()->getRequest()->getClientIp();
$srv->welcome($userBo, $ip);
return true;
}
示例9: showErrorMessage
protected function showErrorMessage($message, $file, $line, $trace, $errorcode)
{
$log = $message . "\r\n" . $file . ":" . $line . "\r\n";
list($fileLines, $trace) = WindUtility::crash($file, $line, $trace);
foreach ($trace as $key => $value) {
$log .= $value . "\r\n";
}
if (WIND_DEBUG & 2) {
Wind::getApp()->getComponent('windLogger')->error($log, 'error', true);
}
exit($log);
}
示例10: compile
public function compile($key, $content)
{
if (!$this->message) {
return $content;
}
$resource = Wind::getApp()->getComponent('i18n');
$resource !== null && ($this->message = $resource->getMessage($this->message));
if (!$this->params) {
return $this->message;
}
return '<?php echo WindUtility::strtr("' . $this->message . '", ' . $this->params . ');?>';
}
示例11: getAction
/**
* 获取验证码
*/
public function getAction()
{
$rand = $this->getInput('rand', 'get');
$config = Wekit::C('verify');
$config['type'] = $config['type'] ? $config['type'] : 'image';
Wind::import('SRV:verify.srv.PwVerifyService');
$srv = new PwVerifyService('PwVerifyService_getVerifyType');
if ($rand) {
$srv->getVerify($config['type']);
exit;
}
$url = WindUrlHelper::createUrl('verify/index/get', array('rand' => Pw::getTime()), '', 'pw');
$display = $srv->getOutType($config['type']);
if ($display == 'flash') {
$html = '<embed align="middle"
width="' . $config['width'] . '"
height="' . $config['height'] . '"
type="application/x-shockwave-flash"
allowscriptaccess="sameDomain"
menu="false"
bgcolor="#ffffff"
wmode="transparent"
quality="high"
src="' . $url . '">';
if ($config['voice']) {
$url = WindUrlHelper::createUrl('verify/index/getAudio', array('songVolume' => 100, 'autoStart' => 'false', 'repeatPlay' => 'false', 'showDownload' => 'false', 'rand' => Pw::getTime()), '', 'pw');
$html .= '<embed height="20" width="25"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
quality="high"
src="' . Wind::getApp()->getResponse()->getData('G', 'url', 'images') . '/audio.swf?file=' . urlencode($url) . '">';
}
$html .= '<a id="J_verify_update_a" href="#" role="button">换一个</a>';
} elseif ($display == 'image') {
$html = '<img id="J_verify_update_img" src="' . $url . '"
width="' . $config['width'] . '"
height="' . $config['height'] . '" >';
if ($config['voice']) {
$url = WindUrlHelper::createUrl('verify/index/getAudio', array('songVolume' => 100, 'autoStart' => 'false', 'repeatPlay' => 'false', 'showDownload' => 'false', 'rand' => Pw::getTime()), '', 'pw');
$html .= '<span title="点击后键入您听到的内容"><embed wmode="transparent" height="20" width="25"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
quality="high"
src="' . Wind::getApp()->getResponse()->getData('G', 'url', 'images') . '/audio.swf?file=' . urlencode($url) . '"></span>';
}
$html .= '<a id="J_verify_update_a" href="#" role="button">换一个</a>';
} else {
$html = $srv->getVerify($config['type']);
}
$this->setOutput($html, 'html');
$this->showMessage("operate.success");
}
示例12: testFormFilter
public function testFormFilter()
{
$_SERVER['SCRIPT_FILENAME'] = "index.php";
$_SERVER['SCRIPT_NAME'] = 'index.php';
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=test';
$_POST['shi'] = 'shi';
$_POST['long'] = 'long';
Wind::application('EnableValidata', $this->getConfigData())->run();
$testForm = Wind::getApp()->getRequest()->getAttribute("testForm");
$this->assertEquals("shi", $testForm->getShi());
$this->assertEquals("long", $testForm->getLong());
}
示例13: synLogin
public function synLogin($uid)
{
Wind::import('SRC:service.user.bo.PwUserBo');
Wind::import('SRC:service.user.srv.PwLoginService');
$userBo = new PwUserBo($uid);
if ($userBo->isExists() && !Pw::getstatus($userBo->info['status'], PwUser::STATUS_UNACTIVE)) {
$srv = new PwLoginService();
$ip = Wind::getApp()->getRequest()->getClientIp();
$srv->setLoginCookie($userBo, $ip, 1);
}
exit;
//return true;
}
示例14: testDispatch
/**
* Tests WindDispatcher->dispatch()
*/
public function testDispatch()
{
$_SERVER['SCRIPT_FILENAME'] = "index.php";
$_SERVER['SCRIPT_NAME'] = 'index.php';
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=noPrint';
$front = Wind::application('long', array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest'))))))->run();
$forward = new WindForward();
$forward->setIsReAction(true);
$forward->setAction('/long/test');
ob_start();
Wind::getApp()->doDispatch($forward);
$this->assertEquals(ob_get_clean(), 'LongController-test');
}
示例15: getDao
/**
* 返回Dao类实例
*
* $className接受两种形式呃参数如下
* <ul>
* <li>'namespace:path'</li>
* <li>'className'</li>
* </ul>
*
* @param string $className Dao名字
* @return WindDao
* @throws WindDaoException 如果获取实例错误抛出异常
*/
public function getDao($className)
{
try {
if (strpos($className, ":") === false) {
$className = $this->getDaoResource() . '.' . $className;
}
Wind::getApp()->getWindFactory()->addClassDefinitions($className, array('path' => $className, 'scope' => 'application'));
$daoInstance = Wind::getApp()->getWindFactory()->getInstance($className);
$daoInstance->setDelayAttributes(array('connection' => array('ref' => 'db')));
return $daoInstance;
} catch (Exception $exception) {
throw new WindDaoException('[dao.WindDaoFactory] create dao ' . $className . ' fail.' . $exception->getMessage());
}
}