addonsHook() публичный статический Метод

单个调用钩子
public static addonsHook ( string $addonsName, string $name, array $param = [], boolean $admin = false )
$addonsName string 插件名称
$name string 钩子名称
$param array 相关参数
$admin boolean 是否是管理员
Пример #1
0
 public function checkNewTarget()
 {
     $url = "https://www.sidatz.com/";
     require 'addons/library/phpQuery/QueryList.class.php';
     $reg = array("content" => array("ul.news:eq(0)", "text"));
     $hj = new QueryList($url, $reg);
     $arr_content = $hj->jsonArr;
     //dump($arr_content);
     if (stripos($arr_content[0]["content"], "暂无新标") > 0) {
         $this->ajaxReturn(null, "无新标", 0);
     }
     $arr['content'] = $arr_content[0]['content'];
     //echo $hj->getJSON();
     //$arr['content']=iconv("gb2312","utf-8",$arr_content[0]['content']);
     //dump($arr_content);
     //exit(urldecode(json_encode(array('status'=>1,'info'=>'教务通知详情','data'=>$arr))));
     $push_user_alias = "*";
     $_POST['n_title'] = "有新标了,来看看吧0.0";
     $_POST['n_content'] = "四达投资有新标了,快去用抢标助手抢标吧!";
     $_POST['n_extras'] = "";
     $_POST['push_user_alias'] = $push_user_alias;
     //推送所有人
     $_POST['getPushResult'] = 0;
     Addons::addonsHook("JPush", "doAddPush", array(), true);
     $this->ajaxReturn($arr, "新标情况", 1);
 }
 public function doAdmin()
 {
     $addonInfo = model('Addons')->getAddon($_GET['pluginid']);
     $result = array('status' => true, 'info' => "");
     Addons::addonsHook($addonInfo['name'], $_GET['page'], array('result' => &$result));
     //dump($result);
     if ($result['status']) {
         $this->success($result['info']);
     } else {
         $this->error($result['info']);
     }
 }
Пример #3
0
 public function displayAddons()
 {
     $result = array();
     $param['res'] =& $result;
     $param['type'] = $_REQUEST['type'];
     Addons::addonsHook(t($_GET['addon']), t($_GET['hook']), $param);
     isset($result['url']) && $this->assign("jumpUrl", $result['url']);
     isset($result['title']) && $this->setTitle($result['title']);
     isset($result['jumpUrl']) && $this->assign('jumpUrl', $result['jumpUrl']);
     if (isset($result['status']) && !$result['status']) {
         $this->error($result['info']);
     }
     if (isset($result['status']) && $result['status']) {
         $this->success($result['info']);
     }
 }
Пример #4
0
 public function displayAddons()
 {
     $result = array();
     $param['res'] =& $result;
     $param['type'] = $_REQUEST['type'];
     $config = model('AddonData')->lget('login');
     if (!in_array($param['type'], $config['open'])) {
         $this->error("该同步操作管理员已关闭");
     }
     Addons::addonsHook($_GET['addon'], $_GET['hook'], $param);
     isset($result['url']) && $this->assign("jumpUrl", $result['url']);
     isset($result['title']) && $this->setTitle($result['title']);
     isset($result['jumpUrl']) && $this->assign('jumpUrl', $result['jumpUrl']);
     if (isset($result['status']) && !$result['status']) {
         $this->error($result['info']);
     }
     if (isset($result['status']) && $result['status']) {
         $this->success($result['info']);
     }
 }
Пример #5
0
 public function doAdmin()
 {
     $addonInfo = model('Addon')->getAddon(intval($_GET['pluginid']));
     $result = array('status' => true, 'info' => "");
     F('Cache_App', null);
     Addons::addonsHook($addonInfo['name'], t($_GET['page']), array('result' => &$result), true);
     //dump($result);
     if ($result['status']) {
         $_POST['jumpUrl'] && $this->assign('jumpUrl', $_POST['jumpUrl']);
         $this->success($result['info']);
     } else {
         $this->error($result['info']);
     }
 }
 public function addonsRequest()
 {
     Addons::addonsHook(t($_REQUEST['addon']), t($_REQUEST['hook']));
 }
Пример #7
0
 public function posterDetail()
 {
     $posterTypeDao = D('PosterType');
     $poster = D('Poster');
     $id = intval($_GET['id']);
     if ($id == 0) {
         $this->error("错误的信息地址.请检查后再访问");
         exit;
     }
     $posterData = $poster->getPoster($id, $this->mid);
     if (!$posterData) {
         $this->assign('jumpUrl', U('poster/Index/index'));
         $this->error("这个信息被删除或者不允许查看");
         exit;
     }
     $posterType = $posterTypeDao->getType($posterData['pid']);
     $posterTypeExtraField = $posterTypeDao->getExtraField($posterType['extraField']);
     unset($posterType['extraField']);
     if ($posterData['uid'] == $this->mid) {
         $posterData['name'] = '我';
         $this->assign('admin', 1);
     } else {
         $posterData['name'] = getUserName($posterData['uid']);
     }
     $this->assign('poster', $posterData);
     $this->assign('uid', $posterData['uid']);
     $this->assign('extraField', $posterTypeExtraField);
     $this->assign('type', $posterType);
     //话题符号
     $huati = $posterData['posterSmallType'] == NULL ? "" : "#" . $posterData['posterSmallType'] . "#";
     $huati = "#" . $posterData['posterType'] . "#" . $huati;
     $this->assign('huati', $huati);
     //dump($_SESSION);
     //自动分享微博
     if ($_GET["autoShare"]) {
         $_POST["content"] = "";
         $_POST["body"] = "我在" . $huati . "中发布了'" . $posterData['title'] . "'。来看看吧0.0!";
         $_POST['source_url'] = U('//posterDetail', array('id' => $id));
         $_POST['type'] = $posterData['attach_id'] == NULL ? "post" : "postimage";
         $_POST['app_name'] = "public";
         $_POST['attach_id'] = $posterData['attach_id'];
         //exit(dump($_POST));
         $this->My_PostFeed();
         //发微博
     }
     //自动弹框分享微博
     if ($_GET['user_to_share']) {
         $_SESSION['new_poster'] = $posterData['attach_id'] ? $posterData['attach_id'] : 1;
     }
     // dump($posterData);
     // //发私信提醒
     if ($_GET['auto_to_sendMessage']) {
         $FollowUserList = D('PosterTypeFollow')->getFollowUserList($posterData['pid']);
         $push_user_alias = "";
         foreach ($FollowUserList as $key => $value) {
             $d['to'] = $value['uid'];
             $d['content'] = "我在您关注的#" . $posterData['posterType'] . "#中发布了'" . $posterData['title'] . "'。来看看吧0.0->点击" . U('//posterDetail', array('id' => $id));
             $d['attach_ids'] = $posterData['attach_id'];
             $this->my_doPostMessage($d);
             $push_user_alias = $push_user_alias . $value['uid'] . ",";
             //推送
             if ($key % 1000 == 999 || count($FollowUserList) - 1 == $key) {
                 $_POST['n_title'] = "新的提醒";
                 $_POST['n_content'] = "有人在您关注的分类中发布了‘" . $posterData['title'] . "’,来看看吧0.0";
                 $_POST['n_extras'] = json_encode(array('go_url' => SITE_URL, 'app' => 'poster', 'posterDetail' => $id));
                 $_POST['push_user_alias'] = $push_user_alias;
                 //推送所有人
                 $_POST['getPushResult'] = 0;
                 Addons::addonsHook("JPush", "doAddPush", array(), true);
                 $push_user_alias = "";
                 //还原
             }
         }
         $FollowUserList = D('PosterSmallTypeFollow')->getFollowUserList($posterData['type']);
         $push_user_alias = "";
         foreach ($FollowUserList as $key => $value) {
             $d['to'] = $value['uid'];
             $d['content'] = "我在您关注的#" . $posterData['posterSmallType'] . "#中发布了'" . $posterData['title'] . "'。来看看吧0.0->点击" . U('//posterDetail', array('id' => $id));
             $d['attach_ids'] = $posterData['attach_id'];
             $this->my_doPostMessage($d);
             //推送
             $push_user_alias = $push_user_alias . $value['uid'] . ",";
             if ($key % 1000 == 999 || count($FollowUserList) - 1 == $key) {
                 $_POST['n_title'] = "新的提醒";
                 $_POST['n_content'] = "有人在您关注的分类中发布了‘" . $posterData['title'] . "’,来看看吧0.0";
                 $_POST['n_extras'] = json_encode(array('go_url' => SITE_URL, 'app' => 'poster', 'posterDetail' => $id));
                 $_POST['push_user_alias'] = $push_user_alias;
                 //推送所有人
                 $_POST['getPushResult'] = 0;
                 Addons::addonsHook("JPush", "doAddPush", array(), true);
                 $push_user_alias = "";
                 //还原
             }
         }
     }
     //exit;
     $this->display();
 }