本文整理汇总了PHP中WeUtility::createModuleProcessor方法的典型用法代码示例。如果您正苦于以下问题:PHP WeUtility::createModuleProcessor方法的具体用法?PHP WeUtility::createModuleProcessor怎么用?PHP WeUtility::createModuleProcessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeUtility
的用法示例。
在下文中一共展示了WeUtility::createModuleProcessor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
public function respond() {
global $_W, $engine;
$level = array();
if (!empty($_W['account']['modules'])) {
foreach ($_W['account']['modules'] as $row) {
if (!empty($row['displayorder']) && $row['displayorder'] < 127) {
$level[$row['displayorder']] = $row;
}
}
}
if (!empty($level)) {
$response = '';
for ($i = 1; $i <= 5; $i++) {
if (!empty($response)) {
$engine->response['module'] = $_W['module'];
return $response;
break;
}
if (empty($level[$i])) {
continue;
}
$_W['module'] = $level[$i]['name'];
$processor = WeUtility::createModuleProcessor($_W['module']);
$processor->message = $this->message;
$processor->inContext = false;
$processor->rule = $this->rule;
$engine->response['rule'] = $default['id'];
$response = $processor->respond();
}
}
if (!empty($_W['account']['default_period']) && empty($_W['cache']['default_period'])) {
return;
}
$response['FromUserName'] = $this->message['to'];
$response['ToUserName'] = $this->message['from'];
$response['MsgType'] = 'text';
$default = pdo_fetchcolumn("SELECT `default` FROM " . tablename('wechats') . " WHERE `weid`=:weid", array(':weid' => $_W['weid']));
if (is_array(iunserializer($default))) {
$default = iunserializer($default);
$_W['module'] = $default['module'];
$processor = WeUtility::createModuleProcessor($default['module']);
$processor->message = $this->message;
$processor->inContext = $this->inContext;
$processor->rule = $default['id'];
return $processor->respond();
}
$response['Content'] = stripslashes($default);
return $response;
}
示例2: respond
public function respond()
{
global $_W, $engine;
$sql = "SELECT `welcome` FROM " . tablename('wechats') . " WHERE `weid`=:weid";
$default = pdo_fetchcolumn($sql, array(':weid' => $_W['weid']));
if (is_array(iunserializer($default))) {
$default = iunserializer($default);
$_W['module'] = $default['module'];
$processor = WeUtility::createModuleProcessor($default['module']);
$processor->message = $this->message;
$processor->inContext = $this->inContext;
$processor->rule = $default['id'];
$processor->module = $_W['account']['modules'][$default['module']];
$engine->response['rule'] = $default['id'];
return $processor->respond();
}
return $this->respText($default);
}
示例3: process
private function process($param)
{
global $_W;
if (empty($param['module']) || !in_array($param['module'], $this->modules)) {
return false;
}
$processor = WeUtility::createModuleProcessor($param['module']);
$processor->message = $param['message'];
$processor->rule = $param['rule'];
$processor->priority = intval($param['priority']);
$processor->inContext = $param['context'] === true;
$response = $processor->respond();
if (empty($response)) {
return false;
}
return $response;
}
示例4: intval
echo $exit;
exit;
}
if ($do == 'end') {
$fanid = intval($_GPC['fanid']);
$fans = pdo_fetch('SELECT fanid,acid,openid FROM ' . tablename('mc_mapping_fans') . ' WHERE uniacid = :uniacid AND fanid = :id', array(':uniacid' => $_W['uniacid'], ':id' => $fanid));
$account = account_fetch($fans['acid']);
$message['from'] = $_W['openid'] = $fans['openid'];
$message['to'] = $account['original'];
if (!empty($message['to'])) {
$sessionid = md5($message['from'] . $message['to'] . $_W['uniacid']);
load()->classs('wesession');
load()->classs('account');
session_id($sessionid);
WeSession::start($_W['uniacid'], $_W['openid'], 300);
$processor = WeUtility::createModuleProcessor('chats');
$processor->end();
}
if (!empty($_GPC['from'])) {
$url = base64_decode($_GPC['from']);
} else {
$url = url('mc/fans/', array('acid' => $fans['acid']));
}
header('Location:' . $url);
exit;
}
function iurldecode($str)
{
if (!is_array($str)) {
return urldecode($str);
}
示例5: runhook
/**
* 运行模块勾子
* @param string $hookname
*/
function runhook($hookname) {
global $_W;
$hooks = $_W['cache']['hooks'][$_W['weid']];
if (empty($hooks)) {
cache_build_hook($_W['uid']);
$hooks = cache_load("hooks:{$_W['weid']}");
}
if (!empty($hooks[$hookname])) {
foreach ($hooks[$hookname] as $hook) {
$hookobj = WeUtility::createModuleProcessor($hook[0]);
if (method_exists($hookobj, $hook[1])) {
call_user_func(array($hookobj, $hook[1]));
}
}
}
}
示例6: doWebPreview
public function doWebPreview()
{
//'from_user' => base64_encode(authcode("fromuser", 'ENCODE'))
$url = create_url('mobile/module', array('name' => 'shopping3', 'do' => 'wlhome', 'weid' => $GLOBALS['_W']['weid']));
$processor = WeUtility::createModuleProcessor($this->module['name']);
$url = $processor->index();
header('Location: ' . $url);
}
示例7: respond
public function respond()
{
global $_W, $engine;
$level = array();
if (!empty($_W['account']['modules'])) {
foreach ($_W['account']['modules'] as $row) {
if (!empty($row['displayorder']) && $row['displayorder'] < 127) {
$level[$row['displayorder']] = $row;
}
}
}
if (!empty($level)) {
$response = '';
for ($i = 1; $i <= 5; $i++) {
if (!empty($response)) {
$engine->response['module'] = $_W['module'];
return $response;
break;
}
if (empty($level[$i])) {
continue;
}
$_W['module'] = $level[$i]['name'];
$processor = WeUtility::createModuleProcessor($_W['module']);
$processor->message = $this->message;
$processor->inContext = false;
$processor->rule = $this->rule;
$engine->response['rule'] = $default['id'];
$processor->module = $_W['account']['modules'][$_W['module']];
$response = $processor->respond();
}
}
if (!empty($_W['account']['default_period'])) {
$_W['cache']['default_period'] = TRUE;
$row = pdo_fetch("SELECT id, lastupdate FROM " . tablename('default_reply_log') . " WHERE from_user = '{$this->message['from']}' AND weid = '{$_W['weid']}'");
if (!empty($row)) {
if (TIMESTAMP - intval($row['lastupdate']) > intval($_W['account']['default_period'])) {
$_W['cache']['default_period'] = TRUE;
} else {
$_W['cache']['default_period'] = FALSE;
}
}
if (!empty($row)) {
pdo_update('default_reply_log', array('lastupdate' => TIMESTAMP), array('id' => $row['id']));
} else {
pdo_insert('default_reply_log', array('from_user' => $this->message['from'], 'lastupdate' => TIMESTAMP, 'weid' => $_W['weid']));
}
}
if (!empty($_W['account']['default_period']) && empty($_W['cache']['default_period'])) {
return;
}
$default = pdo_fetchcolumn("SELECT `default` FROM " . tablename('wechats') . " WHERE `weid`=:weid", array(':weid' => $_W['weid']));
if (is_array(iunserializer($default))) {
$default = iunserializer($default);
$_W['module'] = $default['module'];
$processor = WeUtility::createModuleProcessor($default['module']);
$processor->message = $this->message;
$processor->inContext = $this->inContext;
$processor->rule = $default['id'];
$processor->module = $_W['account']['modules'][$default['module']];
return $processor->respond();
}
return $this->respText($default);
}
示例8: process
private function process() {
$response = false;
if (empty($this->response['module']) || !in_array($this->response['module'], $this->modules)) {
return false;
}
$processor = WeUtility::createModuleProcessor($this->response['module']);
$processor->message = $this->message;
$processor->rule = $this->response['rule'];
$response = $processor->respond();
if(empty($response)) {
return false;
}
return $response;
}