本文整理汇总了PHP中WindUtility类的典型用法代码示例。如果您正苦于以下问题:PHP WindUtility类的具体用法?PHP WindUtility怎么用?PHP WindUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 初始化安装程序
*/
public function __construct()
{
$this->_appId = 'L000' . time() . WindUtility::generateRandStr(4);
$this->_config = @(include Wind::getRealPath(self::CONF_PATH, true));
$this->tmpPath = Wind::getRealPath($this->getConfig('tmp_dir') . '.' . Pw::getTime(), false);
$this->tmpInstallLog = Wind::getRealPath($this->getConfig('log_dir'), false);
}
示例2: 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);
}
示例3: __call
/**
* 重载了魔术方法__call
*
* 当类的方法访问不到时调用该方法,在这里的实现是配置类属性对象的延迟加载策略
* <code>
* //延迟访问某个属性,当使用这种方式调用时该方法被调用,并访问该类中的$_delayAttributes属性,并创建该属性对象并返回
* $this->_getMethodName();
* </code>
* @param string $methodName
* @param array $args
* @return mixed
*/
public function __call($methodName, $args)
{
$_prefix = substr($methodName, 0, 4);
$_propertyName = substr($methodName, 4);
$_propertyName = WindUtility::lcfirst($_propertyName);
if ($_prefix == '_get') {
if (!$this->{$_propertyName} && isset($this->_delayAttributes[$_propertyName])) {
$_property = $this->_delayAttributes[$_propertyName];
$_value = null;
if (isset($_property['value'])) {
$_value = $_property['value'];
} elseif (isset($_property['ref'])) {
$_value = Wind::getApp()->getWindFactory()->getInstance($_property['ref'], $args);
} elseif (isset($_property['path'])) {
$_className = Wind::import($_property['path']);
$_value = WindFactory::createInstance($_className, $args);
}
$this->{$_propertyName} = $_value;
/*unset($this->delayAttributes[$_propertyName]);*/
}
return $this->{$_propertyName};
} elseif ($_prefix == '_set') {
$this->{$_propertyName} = $args[0];
}
}
示例4: run
/**
* 关注-首页
*/
public function run()
{
$type = $this->getInput('type');
$page = intval($this->getInput('page'));
$page < 1 && ($page = 1);
$perpage = 20;
list($start, $limit) = Pw::page2limit($page, $perpage);
$url = $classCurrent = array();
$typeCounts = $this->_getTypeDs()->countUserType($this->loginUser->uid);
if ($type) {
$tmp = $this->_getTypeDs()->getUserByType($this->loginUser->uid, $type, $limit, $start);
$follows = $this->_getDs()->fetchFollows($this->loginUser->uid, array_keys($tmp));
$count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
$url['type'] = $type;
$classCurrent[$type] = 'current';
} else {
$follows = $this->_getDs()->getFollows($this->loginUser->uid, $limit, $start);
$count = $this->loginUser->info['follows'];
$classCurrent[0] = 'current';
}
$uids = array_keys($follows);
$fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
$userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
$service = $this->_getService();
$typeArr = $service->getAllType($this->loginUser->uid);
$userType = $service->getUserType($this->loginUser->uid, $uids);
foreach ($userType as $key => $value) {
$tmp = array();
foreach ($value as $k => $v) {
$tmp[$v] = $typeArr[$v];
}
ksort($tmp);
$userType[$key] = $tmp;
}
$follows = WindUtility::mergeArray($follows, $userList);
if (!$type && !$follows) {
$num = 30;
$uids = $this->_getRecommendService()->getOnlneUids($num);
$uids = array_slice($uids, 0, 24);
$this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
}
$this->setOutput($follows, 'follows');
$this->setOutput($typeArr, 'typeArr');
$this->setOutput($type, 'type');
$this->setOutput($userType, 'userType');
$this->setOutput($typeCounts, 'typeCounts');
$this->setOutput($fans, 'fans');
$this->setOutput($classCurrent, 'classCurrent');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput($count, 'count');
$this->setOutput($url, 'url');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:bbs.follow.run.title'), '', '');
Wekit::setV('seo', $seoBo);
}
示例5: getDetailList
public function getDetailList($notice)
{
$list = $uids = array();
$extendParams = $notice['extend_params'];
$uids = array_keys($extendParams);
$userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN);
$list['follows'] = $this->_getAttention()->fetchFollows($notice['uid'], array_keys($userList));
$list['fans'] = WindUtility::mergeArray(array_unique($extendParams), $userList);
return $list;
}
示例6: run
/**
* 运行当前应用
*
* @param string $name 应用名称默认‘phpwind’
* @param array $components 组建配置信息 该组建配置将会覆盖原组建配置,默认为空
*/
public static function run($name = 'phpwind', $components = array())
{
$config = WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/' . $name . '.php');
if (!empty($components)) {
$config['components'] = (array) $components + $config['components'];
}
/* @var $application WindWebFrontController */
$application = Wind::application($name, $config);
$application->registeFilter(new PwFrontFilters($application));
$application->run();
}
示例7: __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;
}
示例8: 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);
}
示例9: addThread
/**
* 发表帖子 钩子
*/
public function addThread($tid)
{
$data = $this->inputData;
if (intval($data['isopen'] != 1)) {
return false;
}
$tid = intval($tid);
if ($tid < 1) {
return false;
}
$token = strtolower(WindUtility::generateRandStr(10));
$dm = $this->_getEncryptPostsDm();
$dm->setTid($tid)->setToken($token);
return $this->_getEncryptPostsDs()->add($dm);
}
示例10: run
/**
* 关注-首页
*/
public function run()
{
$type = $this->getInput('type');
$page = intval($this->getInput('page'));
$page < 1 && ($page = 1);
$perpage = 20;
list($start, $limit) = Pw::page2limit($page, $perpage);
$args = $classCurrent = array();
/* $typeCounts = $this->_getTypeDs()->countUserType($this->space->spaceUid);
if ($type) {
$tmp = $this->_getTypeDs()->getUserByType($this->space->spaceUid, $type, $limit, $start);
$follows = $this->_getDs()->fetchFollows($this->space->spaceUid, array_keys($tmp));
$count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
$classCurrent[$type] = 'current';
$args = array('type' => $type);
} else {*/
$follows = $this->_getDs()->getFollows($this->space->spaceUid, $limit, $start);
$count = $this->space->spaceUser['follows'];
$classCurrent[0] = 'current';
//}
$uids = array_keys($follows);
$fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
$myfollows = $this->_getDs()->fetchFollows($this->loginUser->uid, $uids);
$userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_ALL);
$service = $this->_getService();
$args['uid'] = $this->space->spaceUid;
$follows = WindUtility::mergeArray($follows, $userList);
if (!$follows && $this->space->tome == PwSpaceBo::MYSELF) {
$num = 20;
$uids = $this->_getRecommendService()->getRecommendAttention($this->loginUser->uid, $num);
$this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
}
$this->setOutput($fans, 'fans');
$this->setOutput($follows, 'follows');
$this->setOutput($myfollows, 'myfollows');
$this->setOutput($classCurrent, 'classCurrent');
$this->setOutput($args, 'args');
$this->setOutput($page, 'page');
$this->setOutput($perpage, 'perpage');
$this->setOutput($count, 'count');
$this->setOutput('follows', 'src');
// seo设置
Wind::import('SRV:seo.bo.PwSeoBo');
$seoBo = PwSeoBo::getInstance();
$lang = Wind::getComponent('i18n');
$seoBo->setCustomSeo($lang->getMessage('SEO:space.follows.run.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $lang->getMessage('SEO:space.follows.run.description', array($this->space->spaceUser['username'])));
Wekit::setV('seo', $seoBo);
}
示例11: initConfig
public function initConfig($config, $factory)
{
is_array($config) || ($config = $factory->getInstance('configParser')->parse($config));
foreach ($config['web-apps'] as $key => $value) {
if (isset($this->_config['web-apps'][$key])) {
continue;
}
$rootPath = empty($value['root-path']) ? dirname($_SERVER['SCRIPT_FILENAME']) : Wind::getRealPath($value['root-path'], true);
Wind::register($rootPath, $key, true);
if ('default' !== $key && !empty($config['default'])) {
$value = WindUtility::mergeArray($config['default'], $value);
}
$this->setConfig($key, $value);
}
$this->_config['router'] = isset($config['router']) ? $config['router'] : array();
}
示例12: addAction
public function addAction()
{
$struct = $this->getInput('struct', 'post');
$model = $this->getInput('model', 'post');
$pageid = $this->getInput('pageid', 'post');
if (!$model) {
$this->showError('operate.fail');
}
Wekit::load('design.PwDesignPermissions');
$permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid);
if ($permissions < PwDesignPermissions::IS_DESIGN) {
$this->showError("DESIGN:permissions.fail");
}
Wind::import('SRV:design.bo.PwDesignModelBo');
$bo = new PwDesignModelBo($model);
if (!$bo->isModel()) {
$this->showError('operate.fail');
}
$cls = sprintf('PwDesign%sDataService', ucwords($model));
Wind::import('SRV:design.srv.model.' . $model . '.' . $cls);
$service = new $cls();
$decorator = $service->decorateAddProperty($model);
$_models = array();
$service = $this->_getDesignService();
$types = $service->getDesignModelType();
$models = $service->getModelList();
foreach ($models as $k => $v) {
$_models[$v['type']][] = array('name' => $v['name'], 'model' => $k);
}
$ds = $this->_getModuleDs();
$pageInfo = $this->_getPageDs()->getPage($pageid);
$module['module_name'] = $pageInfo['page_name'] . '_' . WindUtility::generateRandStr(4);
$cache['expired'] = 15;
$this->setOutput($cache, 'cache');
$this->setOutput($module, 'module');
$this->setOutput($types, 'types');
$this->setOutput($_models, 'models');
$this->setOutput($bo->getProperty(), 'property');
$this->setOutput($bo->getModel(), 'modelInfo');
$this->setOutput($decorator, 'decorator');
$this->setOutput($model, 'model');
$this->setOutput($pageid, 'pageid');
$this->setOutput($struct, 'struct');
}
示例13: dorunAction
public function dorunAction()
{
$this->getRequest()->isPost() || $this->showError('operate.fail');
list($windid, $serverUrl, $clientId, $clientKey, $connect) = $this->getInput(array('windid', 'serverUrl', 'clientId', 'clientKey', 'connect'), 'post');
if ($windid == 'local') {
$serverUrl = Wekit::C('site', 'info.url') . '/windid';
$clientId = 1;
!$clientKey && ($clientKey = md5(WindUtility::generateRandStr(10)));
$connect = 'db';
}
$config = new PwConfigSet('windid');
$config->set('windid', $windid)->set('serverUrl', $serverUrl)->set('clientId', $clientId)->set('clientKey', $clientKey)->set('connect', $connect);
if ($windid == 'client') {
list($dbhost, $dbport, $dbuser, $dbpwd, $dbname, $dbprefix, $dbcharset) = $this->getInput(array('dbhost', 'dbport', 'dbuser', 'dbpwd', 'dbname', 'dbprefix', 'dbcharset'), 'post');
$config->set('db.host', $dbhost)->set('db.port', $dbport)->set('db.user', $dbuser)->set('db.pwd', $dbpwd)->set('db.name', $dbname)->set('db.prefix', $dbprefix)->set('db.charset', $dbcharset);
}
$config->flush();
if ($clientId) {
Wekit::C()->reload('windid');
$service = WindidApi::api('app');
WindidApi::getDm('app');
if (!$service->getApp($clientId)) {
$charset = Wekit::V('charset');
$charset = str_replace('-', '', strtolower($charset));
if (!in_array($charset, array('gbk', 'utf8', 'big5'))) {
$charset = 'utf8';
}
$dm = new WindidAppDm();
$dm->setId($clientId)->setApiFile('windid.php')->setIsNotify(1)->setIsSyn(1)->setAppName(Wekit::C('site', 'info.name'))->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setAppIp(Wind::getComponent('request')->getClientIp())->setCharset($charset);
$service->addApp($dm);
} elseif ($clientKey) {
$dm = new WindidAppDm($clientId);
$dm->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setCharset($charset);
$service->editApp($dm);
}
}
$_avatarUrl = WindidApi::api('avatar')->getAvatarUrl();
if ($_avatarUrl != WindidError::SERVER_ERROR) {
Wekit::C()->setConfig('site', 'avatarUrl', $_avatarUrl);
}
$this->showMessage('ADMIN:success');
}
示例14: preHandle
public function preHandle()
{
if (!$this->form) {
return null;
}
$className = Wind::import($this->form);
$form = WindFactory::createInstance($className);
$methods = get_class_methods($form);
foreach ($methods as $method) {
if (0 !== strpos($method, 'set') || '' == ($_tmp = substr($method, 3))) {
continue;
}
if (null === ($input = $this->getRequest()->getRequest(WindUtility::lcfirst($_tmp), null))) {
continue;
}
call_user_func_array(array($form, $method), array($input));
}
$form->validate();
$this->getRequest()->setAttribute($form, WindUtility::lcfirst($className));
$this->sendError($form->getErrorAction(), $form->getErrors());
}
示例15: 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($list, 'list');
}