本文整理汇总了PHP中Wekit::app方法的典型用法代码示例。如果您正苦于以下问题:PHP Wekit::app方法的具体用法?PHP Wekit::app怎么用?PHP Wekit::app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wekit
的用法示例。
在下文中一共展示了Wekit::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->logfile = Wind::getRealPath(Wekit::app()->logFile, true);
if (!WindFile::isFile($this->logfile)) {
WindFile::write($this->logfile, "<?php die;?>\n");
}
}
示例2: run
public function run()
{
$ips = $this->_loadSafeService()->getAllowIps();
$ips = implode(',', $ips);
$this->setOutput($ips, 'ips');
$this->setOutput(Wekit::app()->clientIp, 'clientIp');
}
示例3: cut
public function cut()
{
static $isDel = false;
$outFile = $this->getFileName();
$outDir = $this->getSaveDir($this->moduleid);
$cut = new PwCutImage();
$image = $this->getRealPath($outFile);
if (!$image) {
return array('', '', $this->store->get($this->image, 0));
}
//返回原图片
$cut->image = $image;
$cut->outImage = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/' . $outDir . $outFile;
$cut->cutWidth = $this->thumbW;
$cut->cutHeight = $this->thumbH;
$cut->quality = 90;
$cut->forceThumb = true;
$cut->forceScale = true;
if ($cut->cut() !== false) {
if (!$this->store instanceof PwStorageLocal) {
$localFile = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/' . $outDir . $outFile;
$this->store->save($localFile, $outDir . $outFile);
$attachUrl = $this->store->get('', 0);
WindFile::del(Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/_tmp/' . $outFile);
WindFile::del($localFile);
} else {
$attachUrl = Wekit::app()->attach . '/';
}
return array($outDir, $outFile, $attachUrl);
}
return array('', '', $this->store->get($this->image, 0));
//返回原图片
}
示例4: 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::app()->charset);
exit(Pw::jsonEncode($this->getForward()->getVars()));
}
}
示例5: run
public function run()
{
header("Content-type: text/html; charset=" . Wekit::app()->charset);
//$pwServer['HTTP_USER_AGENT'] = 'Shockwave Flash';
$swfhash = 1;
echo Pw::jsonEncode(array('uid' => $this->loginUser->uid, 'a' => 'dorun', 'verify' => $swfhash));
$this->setTemplate('');
}
示例6: getTime
/**
* 获取当前时间戳
*
* @return int
*/
public function getTime()
{
$timestamp = time();
if (Wekit::app() && ($cvtime = Wekit::C('site', 'time.cv'))) {
$timestamp += $cvtime * 60;
}
return $timestamp;
}
示例7: get
/**
* 获取web地址
*
* @param string $path 相对存储地址
* @param int $ifthumb 是否获取缩略图
* @return string
*/
public function get($path, $ifthumb)
{
$dir = '';
if ($ifthumb & 2) {
$dir = 'thumb/mini/';
} elseif ($ifthumb & 1) {
$dir = 'thumb/';
}
return Wekit::app()->attach . '/' . $dir . $path;
}
示例8: afterAction
/**
* 重写下afterAction,不去i18n解析
*
*/
public function afterAction($handlerAdapter)
{
$_error = $this->getForward()->getVars('message');
$this->getForward()->setVars(array('message' => $_error, '__error' => ''));
$type = $this->getRequest()->getAcceptTypes();
if ($this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false) {
$this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::app()->charset);
exit(Pw::jsonEncode($this->getForward()->getVars()));
}
}
示例9: txt
public function txt($charset = 'utf-8')
{
$pageInfo = $this->pageInfo;
$_modules = array();
//$ids = explode(',', $pageInfo['module_ids']);
$modules = $this->_getModuleDs()->getByPageid($pageInfo['page_id']);
$fromCharset = Wekit::app()->charset;
foreach ($modules as $k => $v) {
if (!$v['isused']) {
continue;
}
unset($v['isused'], $v['module_id']);
$v['module_property'] = unserialize($v['module_property']);
$v['module_cache'] = unserialize($v['module_cache']);
$v['module_style'] = unserialize($v['module_style']);
$v['module_title'] = unserialize($v['module_title']);
$v = $this->_conv($v, $fromCharset, $charset);
$v['module_property'] = serialize($v['module_property']);
$v['module_cache'] = serialize($v['module_cache']);
$v['module_style'] = serialize($v['module_style']);
$v['module_title'] = serialize($v['module_title']);
$_modules[$k] = $v;
}
$names = explode(',', $pageInfo['struct_names']);
$structures = $this->_getStructureDs()->fetchStruct($names);
foreach ($structures as &$v) {
$v['struct_title'] = unserialize($v['struct_title']);
$v['struct_style'] = unserialize($v['struct_style']);
$v = $this->_conv($v, $fromCharset, $charset);
$v['struct_title'] = serialize($v['struct_title']);
$v['struct_style'] = serialize($v['struct_style']);
}
$txtSegment = array();
$segments = $this->_getSegmentDs()->getSegmentByPageid($pageInfo['page_id']);
foreach ($segments as $k => $v) {
if (!$v['segment_tpl']) {
continue;
}
$txtSegment[$k] = $this->_conv($v['segment_struct'], $fromCharset, $charset);
}
$txtPage['module_ids'] = $pageInfo['module_ids'];
$txtPage['struct_names'] = $pageInfo['struct_names'];
$_nr = "\n";
$_time = Pw::getTime();
$_title = $_nr;
$_text['page'] = $txtPage;
$_text['segment'] = $txtSegment;
$_text['structure'] = $structures;
$_text['module'] = $_modules;
$_text = wordwrap(base64_encode(serialize($_text)), 100, $_nr, true);
$_end = $_nr;
$filename = $pageInfo['page_name'] ? $pageInfo['page_name'] : $_time;
$_text = $_title . $_text . $_end;
return array('content' => $_text, 'filename' => $filename, 'ext' => 'txt');
}
示例10: execute
public function execute()
{
$data = array();
$data['site_version'] = WIND_VERSION;
$data['site_url'] = PUBLIC_URL ? PUBLIC_URL : $_SERVER['SERVER_NAME'];
$data = Wekit::config('site');
$data['site_charset'] = Wekit::app()->charset;
$data['site_name'] = $data['info.name'];
$data['site_time'] = time();
return $data;
}
示例11: registerTmpUser
public function registerTmpUser($from = 1, $key = '')
{
//need to check if registered user exists or not
if (empty($key) == false) {
//if has key, then check if this key has user or not
$tmpFound = $this->getbyKey($from, $key);
if (empty($tmpFound) == false) {
//if has user info, then return user's information
$userid = $tmpFound['userid'];
return Windid::load('user.WindidUser')->getUserByUid($userid, WindidUser::FETCH_MAIN);
}
}
Wind::import('SRC:service.user.dm.PwUserInfoDm');
$userDm = new PwUserInfoDm();
$password = substr(md5(rand() . '123456'), 0, 15);
//order number: 13 number and 3 random number
$currentTimeStamp = strtotime("+0 day");
$prefix = 'tmp';
if ($from == 1) {
$prefix = 'web';
} else {
if ($from == 2) {
$prefix = 'app';
} else {
if ($from == 3) {
$prefix = 'wx';
}
}
}
$username = $prefix . rand(10, 99) . $currentTimeStamp;
$userDm->setUsername($username);
$userDm->setPassword($password);
$userDm->setRegdate(Pw::getTime());
$userDm->setLastvisit(Pw::getTime());
$userDm->setRegip(Wekit::app()->clientIp);
Wind::import('SRV:user.srv.PwRegisterService');
Wind::import('APPS:u.service.helper.PwUserHelper');
Wind::import('SRV:user.validator.PwUserValidator');
Wind::import('Wind:utility.WindValidator');
Wind::import('SRV:user.srv.PwLoginService');
$registerService = new PwRegisterService();
$registerService->setUserDm($userDm);
$info = $registerService->register();
$userService = Wekit::load('user.srv.PwUserService');
$userService->updateLastLoginData($info['uid'], Wekit::app()->clientIp);
$userService->createIdentity($info['uid'], $password);
$dm = new App_Tmpuser_Dm();
$dm->setUserId($info['uid']);
$dm->setFrom($from);
$dm->setKey($key);
$this->add($dm);
return $info;
}
示例12: __construct
/**
* manifest path
*
* @param string $manifest
*/
public function __construct($manifest, $extends = array())
{
is_string($manifest) && ($manifest = Wind::getComponent('configParser')->parse($manifest));
if ($extends) {
$manifest = WindUtility::mergeArray($manifest, $extends);
$charset = isset($manifest['application']['charset']) ? $manifest['application']['charset'] : 'utf-8';
} else {
$charset = Wekit::app()->charset;
}
strncasecmp($charset, 'utf', 3) && ($manifest = WindConvert::convert($manifest, $charset, 'utf-8'));
$this->manifest = $manifest;
}
示例13: getAuthorizeURL
public function getAuthorizeURL($sessionId)
{
$result = $this->checkStatus();
if ($result !== true) {
return new PwError($result);
}
if (!$sessionId) {
return new PwError('登录失败,请重试');
}
$params = array("service" => "alipay.auth.authorize", "partner" => $this->appKey, "target_service" => $this->target_service, "return_url" => $this->getCallBackUrl('alipay'), "anti_phishing_key" => $this->anti_phishing_key, "exter_invoke_ip" => $this->exter_invoke_ip, "_input_charset" => strtolower(Wekit::app()->charset));
return $this->alipay_gateway_new . '?' . http_build_query($this->_buildRequestPara($params));
}
示例14: __construct
public function __construct()
{
$config = Wekit::C('email');
$this->_config = array('mailOpen' => $config['mailOpen'], 'mailMethod' => $config['mailMethod'], 'host' => $config['mail.host'], 'port' => $config['mail.port'], 'from' => $config['mail.from'], 'auth' => $config['mail.auth'], 'user' => $config['mail.user'], 'password' => $config['mail.password'], 'timeout' => 20);
//尝试链接超时时间
$this->_mail = new WindMail();
$this->_mail->setCharset(Wekit::app()->charset);
$this->_mail->setDate(date('r', Pw::getTime()));
$this->_mail->setContentEncode(WindMail::ENCODE_BASE64);
$this->_mail->setContentType(WindMail::MIME_HTML);
$this->_mail->setFrom($this->_config['from'], Wekit::C('site', 'info.name'));
}
示例15: preHandle
public function preHandle()
{
/* 模板变量设置 */
$url = array();
$app = Wekit::app();
$url['base'] = $app->baseUrl;
$url['res'] = $app->res;
$url['css'] = $app->css;
$url['images'] = $app->images;
$url['js'] = $app->js;
$url['attach'] = $app->attach;
$url['extres'] = $app->extres;
Wekit::setGlobal($url, 'url');
}