本文整理汇总了PHP中WeUtility类的典型用法代码示例。如果您正苦于以下问题:PHP WeUtility类的具体用法?PHP WeUtility怎么用?PHP WeUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WeUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
public function template($filename, $flag = TEMPLATE_INCLUDEPATH)
{
global $_W, $_GPC;
$_W['template'] = $_W['account']['template'];
$_W['template']['source'] = $_W['account']['template'];
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_W['template']}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$_W['template']}/{$this->mn}/{$filename}.tpl.php";
if (!empty($_GPC['__template'])) {
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_GPC['__template']}/{$filename}.html";
if (!is_file($source)) {
die('invalid debug template ' . $_GPC['__template']);
}
}
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$this->mn}/template/mobile/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$this->mn}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$filename}.html";
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
}
}
}
}
WeUtility::logging('compile source', array($source, $compile));
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例2: fans_search
private function fans_search($user, $fields = array())
{
global $_W;
$fields_str = self::$select_fields;
$sql = "SELECT {$fields_str} FROM " . tablename(self::$t_sys_fans) . " a, " . tablename(self::$t_sys_member) . " b WHERE a.openid = :openid AND a.uniacid= :uniacid AND a.uid = b.uid";
$fans = pdo_fetch($sql, array(':openid' => $user, ':uniacid' => $_W['uniacid']));
WeUtility::logging('sql', $fans);
return $fans;
}
示例3: receive
public function receive()
{
if ($this->message['msgtype'] == 'event') {
if ($this->message['event'] == 'subscribe' && !empty($this->message['ticket'])) {
$scene_id = $this->message['eventkey'];
WeUtility::logging("Receiver:SUBSCRIBE", $scene_id);
} elseif ($this->message['event'] == 'SCAN') {
$scene_id = $this->message['eventkey'];
WeUtility::logging("Receiver:SCAN", $scene_id);
}
}
}
示例4: refreshUserInfo
private function refreshUserInfo($from_user)
{
$follower = $from_user;
$qr_mgr = new UserManager('');
$userInfo = $qr_mgr->getUserInfo($follower);
if (empty($userInfo) or empty($userInfo['nickname']) or empty($userInfo['avatar'])) {
$weapi = new WechatAPI();
$userInfo = $weapi->getUserInfo($follower);
$qr_mgr->saveUserInfo($userInfo);
}
WeUtility::logging('refresh', $userInfo);
}
示例5: moduleInit
function moduleInit($name, $params = array())
{
if (empty($name)) {
return false;
}
$site = WeUtility::createModuleSite($name);
if (!is_error($site)) {
$method = 'shareResult';
if (method_exists($site, $method)) {
$site->{$method}($params);
exit('success');
}
}
}
示例6: 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;
}
示例7: curl_file_get_contents
public static function curl_file_get_contents($durl)
{
$r = null;
if (function_exists('curl_init') && function_exists('curl_exec')) {
WeUtility::logging("using curl");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $durl);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$r = curl_exec($ch);
curl_close($ch);
}
return $r;
}
示例8: 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);
}
示例9: fsock_http_request
public static function fsock_http_request($url, $timeout = 30)
{
$parsed = parse_url($url);
$host = $parsed['host'];
$path = $parsed['path'] . '?' . $parsed['query'];
$cookie = '';
$fp = fsockopen($host, 80, $errno, $errstr, $timeout);
WeUtility::logging('fsockopen', array($url, $errno, $errstr, $fp));
if (!$fp) {
return -1;
}
$out = "GET " . $path . " HTTP/1.1\r\n";
$out .= "Host: " . $host . "\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: " . $cookie . "\r\n\r\n";
fwrite($fp, $out);
fclose($fp);
}
示例10: doWebDelete
public function doWebDelete()
{
global $_GPC, $_W;
$rid = intval($_GPC['rid']);
$rule = pdo_fetch("SELECT id, module FROM " . tablename('rule') . " WHERE id = :id and uniacid=:uniacid", array(':id' => $rid, ':uniacid' => $_W['uniacid']));
if (empty($rule)) {
message('抱歉,要修改的规则不存在或是已经被删除!');
}
if (pdo_delete('rule', array('id' => $rid))) {
pdo_delete('rule_keyword', array('rid' => $rid));
//删除统计相关数据
pdo_delete('stat_rule', array('rid' => $rid));
pdo_delete('stat_keyword', array('rid' => $rid));
//调用模块中的删除
$module = WeUtility::createModule($rule['module']);
if (method_exists($module, 'ruleDeleted')) {
$module->ruleDeleted($rid);
}
}
message('规则操作成功!', $this->createWebUrl('manage'), 'success');
}
示例11:
<div><span style="display:inline-block; width:150px; font-weight:600;">[to]</span>当前公众号的OpenID</div>
<div><span style="display:inline-block; width:150px; font-weight:600;">[rule]</span>当前回复的回复编号</div>
</div>
<span class="help-block hide adv-setting" style="margin:5px 0;">可在回复内容的任何地方使用预定义标记来表示特定内容</span>
<div id="module-form">
<?php
if (!empty($rid)) {
?>
<?php
$rule['reply']->fieldsFormDisplay($rule['rule']['id']);
?>
<?php
} else {
?>
<?php
WeUtility::createModule($defaultmodule)->fieldsFormDisplay();
?>
</script>
<?php
}
?>
</div>
</td>
</tr>
<tr>
<th></th>
<td>
<button type="submit" class="btn btn-primary span3" name="submit" value="提交">提交</button>
<input type="hidden" name="token" value="<?php
echo $_W['token'];
?>
示例12: reply_search
$cfg = $m['config'];
$ds = reply_search("`uniacid` = 0 AND module = 'userapi' AND `status`=1");
$apis = array();
foreach ($ds as $row) {
$apis[$row['id']] = $row;
}
if ($_W['ispost'] && $_W['isajax']) {
$rids = explode(',', $_GPC['rids']);
if (is_array($rids)) {
$cfg = array();
foreach ($rids as $rid) {
if (!empty($apis[$rid])) {
$cfg[intval($rid)] = true;
}
}
$module = WeUtility::createModule('userapi');
$module->saveSettings($cfg);
}
exit;
}
$ds = array();
foreach ($apis as $row) {
$reply = pdo_fetch('SELECT * FROM ' . tablename('userapi_reply') . ' WHERE `rid`=:rid', array(':rid' => $row['id']));
$r = array();
$r['title'] = $row['name'];
$r['rid'] = $row['id'];
$r['description'] = $reply['description'];
$r['switch'] = $cfg[$r['rid']] ? ' checked="checked"' : '';
$ds[] = $r;
}
template('platform/service');
示例13: doWebDeleteAll
public function doWebDeleteAll()
{
global $_GPC, $_W;
foreach ($_GPC['idArr'] as $k => $rid) {
$rid = intval($rid);
if ($rid == 0) {
continue;
}
$rule = pdo_fetch("SELECT id, module FROM " . tablename('rule') . " WHERE id = :id and uniacid=:uniacid", array(':id' => $rid, ':uniacid' => $_W['uniacid']));
if (empty($rule)) {
$this->webmessage('抱歉,要修改的规则不存在或是已经被删除!');
}
if (pdo_delete('rule', array('id' => $rid))) {
pdo_delete('rule_keyword', array('rid' => $rid));
//删除统计相关数据
pdo_delete('stat_rule', array('rid' => $rid));
pdo_delete('stat_keyword', array('rid' => $rid));
//调用模块中的删除
$module = WeUtility::createModule($rule['module']);
if (method_exists($module, 'ruleDeleted')) {
$module->ruleDeleted($rid);
}
}
}
$this->webmessage('选择中的活动删除成功!', '', 0);
}
示例14: 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;
}
示例15: message
}
if (checksubmit('submit')) {
if (empty($_GPC['name'])) {
message('必须填写服务名称.');
}
$keywords = @json_decode(htmlspecialchars_decode($_GPC['keywords']), true);
if (empty($keywords)) {
message('必须填写有效的触发关键字.');
}
$rule = array('uniacid' => 0, 'name' => $_GPC['name'], 'module' => $m, 'status' => intval($_GPC['status']));
if (!empty($_GPC['istop']) && $_GPC['istop'] == 'true') {
$rule['displayorder'] = 255;
} else {
$rule['displayorder'] = range_limit($_GPC['displayorder'], 0, 254);
}
$module = WeUtility::createModule($m);
if (empty($module)) {
message('抱歉,模块不存在请重新其它模块!');
}
$msg = $module->fieldsFormValidate();
if (is_string($msg) && trim($msg) != '') {
message($msg);
}
if (!empty($rid)) {
$result = pdo_update('rule', $rule, array('id' => $rid));
} else {
$result = pdo_insert('rule', $rule);
$rid = pdo_insertid();
}
if (!empty($rid)) {
$sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid';