本文整理汇总了PHP中WeUtility::createModule方法的典型用法代码示例。如果您正苦于以下问题:PHP WeUtility::createModule方法的具体用法?PHP WeUtility::createModule怎么用?PHP WeUtility::createModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeUtility
的用法示例。
在下文中一共展示了WeUtility::createModule方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doWebstyle
public function doWebstyle()
{
global $_GPC, $_W;
$setting = $this->module['config'];
$setting["template"] = trim($_GPC["template"]);
$module = WeUtility::createModule($this->module['name']);
$module->saveTemplate($setting);
}
示例2: 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');
}
示例3: defined
*/
defined('IN_IA') or exit('Access Denied');
if ($_GPC['type'] == 'rule') {
$rid = intval($_GPC['id']);
$rule = pdo_fetch("SELECT id, module FROM " . tablename('rule') . " WHERE id = :id", array(':id' => $rid));
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('规则操作成功!', create_url('rule/display', array('module' => $rule['module'])));
} elseif ($_GPC['type'] == 'keyword') {
$rid = intval($_GPC['rid']);
$kid = intval($_GPC['kid']);
$rule = pdo_fetch("SELECT id, module FROM " . tablename('rule') . " WHERE id = :id", array(':id' => $rid));
if (empty($rule)) {
message('抱歉,要修改的规则不存在或是已经被删除!');
}
pdo_delete('rule_keyword', array('rid' => $rid, 'id' => $kid));
pdo_delete('stat_keyword', array('kid' => $kid));
message('关键字删除成功!', '', 'success');
示例4: module_build_form
function module_build_form($name, $rid)
{
$rid = intval($rid);
$m = WeUtility::createModule($name);
return $m->fieldsFormDisplay($rid);
}
示例5:
<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'];
?>
示例6: 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');
示例7: 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);
}
示例8: pdo_insert
pdo_insert('rule_keyword', $krow);
}
$rowtpl['incontent'] = $_GPC['incontent'];
$module->fieldsFormSubmit($rid);
message('回复规则保存成功!', url('platform/reply/post', array('m' => $m, 'rid' => $rid)));
} else {
message('回复规则保存失败, 请联系网站管理员!');
}
}
template('platform/reply-post');
}
if ($do == 'delete') {
$rid = intval($_GPC['rid']);
if (empty($rid)) {
message('非法访问.');
}
$reply = reply_single($rid);
if (empty($reply) || $reply['uniacid'] != $_W['uniacid']) {
message('抱歉,您操作的规则不在存或是已经被删除!', url('platform/reply', array('m' => $m)), 'error');
}
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($reply['module']);
if (method_exists($module, 'ruleDeleted')) {
$module->ruleDeleted($rid);
}
}
message('规则操作成功!', referer());
}
示例9: message
exit;
}
if ($do == 'setting') {
$name = $_GPC['m'];
$module = $modulelist[$name];
if (empty($module)) {
message('抱歉,你操作的模块不能被访问!');
}
if (!uni_user_module_permission_check($name . '_settings', $name)) {
message('您没有权限进行该操作');
}
define('CRUMBS_NAV', 1);
$ptr_title = '参数设置';
$module_types = module_types();
$config = $module['config'];
$obj = WeUtility::createModule($module['name']);
$obj->settingsDisplay($config);
exit;
}
if ($do == 'shortcut') {
$name = $_GPC['m'];
$module = $modulelist[$name];
if (empty($module)) {
message('抱歉,你操作的模块不能被访问!');
}
$setting = uni_setting($_W['uniacid'], array('shortcuts'));
$shortcuts = $setting['shortcuts'];
if (!is_array($shortcuts)) {
$shortcuts = array();
}
if ($_GPC['shortcut'] == '1') {
示例10: 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';
示例11: message
message('抱歉,模块不存在或是已经被删除!');
}
$modulename = !empty($_GPC['name']) ? $_GPC['name'] : 'basic';
$exist = false;
foreach ($modulelist as $m) {
if (strtolower($m['name']) == $modulename && $m['enabled']) {
$exist = true;
break;
}
}
if (!$exist) {
message('抱歉,你操作的模块不能被访问!');
}
$m = $_W['modules'][$modulename];
if ($m['isrulesingle']) {
$sql = 'SELECT `id` FROM ' . tablename('rule') . ' WHERE `weid`=:weid AND `module`=:module';
$pars = array();
$pars[':weid'] = $_W['weid'];
$pars[':module'] = $modulename;
$r = pdo_fetch($sql, $pars);
if ($r) {
exit('already:' . $r['id']);
}
}
$module = WeUtility::createModule($modulename);
if (is_error($module)) {
exit($module['message']);
}
$rid = intval($_GPC['id']);
exit($module->fieldsFormDisplay($rid));
}
示例12: 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)) {
echo json_encode(array('errno' => 1, 'error' => '抱歉,要修改的规则不存在或是已经被删除!'));
exit;
}
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('选择中的活动删除成功!', referer(), 'success');
echo json_encode(array('errno' => 0, 'error' => '选择中的活动删除成功!'));
exit;
}
示例13: foreach
$isexists = false;
foreach ($_W['account']['modules'] as $m) {
if (strtolower($m['name']) == strtolower($entry['module'])) {
$isexists = true;
}
}
if (!$isexists) {
message("访问非法, 没有操作权限. (module: {$entry['module']})");
}
}
$_GPC['__entry'] = $entry['title'];
$_GPC['__state'] = $entry['state'];
if (!empty($_W['modules'][$entry['module']]['handles']) && (count($_W['modules'][$entry['module']]['handles']) > 1 || !in_array('text', $_W['modules'][$entry['module']]['handles']))) {
$handlestips = true;
}
$module = WeUtility::createModule($entry['module']);
if (!is_error($module)) {
$method = 'do' . ucfirst($entry['do']);
if (method_exists($module, $method)) {
exit($module->{$method}());
}
}
$site = WeUtility::createModuleSite($entry['module']);
if (!is_error($site)) {
$site->module = array_merge($_W['modules'][$entry['module']], $_W['account']['modules'][$_W['modules'][$entry['module']]['mid']]);
$site->weid = $_W['weid'];
$site->inMobile = false;
$method = 'doWeb' . ucfirst($entry['do']);
if (method_exists($site, $method)) {
exit($site->{$method}());
}