本文整理汇总了PHP中Addons类的典型用法代码示例。如果您正苦于以下问题:PHP Addons类的具体用法?PHP Addons怎么用?PHP Addons使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Addons类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkNewTarget
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);
}
示例2: getCallback
private function getCallback($type = '', $callbackurl = '')
{
if (!$callbackurl) {
$callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $type));
}
return urlencode($callbackurl);
}
示例3: checkUser
function checkUser()
{
if ($_REQUEST['code']) {
$redirect_uri = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'taobao', 'do' => "bind"));
$url = 'https://oauth.taobao.com/token';
$field = 'grant_type=authorization_code&client_id=' . TAOBAO_KEY . '&code=' . $_REQUEST['code'] . '&client_secret=' . TAOBAO_SECRET . '&redirect_uri=' . urlencode($redirect_uri);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $field);
$result = curl_exec($ch);
$res = json_decode($result, TRUE);
if ($res['taobao_user_id']) {
$_SESSION['taobao']['access_token']['oauth_token'] = $res['access_token'];
$_SESSION['taobao']['access_token']['oauth_token_secret'] = $res['refresh_token'];
$_SESSION['taobao']['isSync'] = 1;
$_SESSION['taobao']['uid'] = $res['taobao_user_id'];
$_SESSION['taobao']['uname'] = $res['taobao_user_nick'];
$_SESSION['taobao']['userface'] = '';
$_SESSION['open_platform_type'] = 'taobao';
return $res;
} else {
return false;
}
} else {
return false;
}
}
示例4: __construct
/**
* 架构函数,处理核心变量
* 使用字符串返回 不能有任何输出
*/
public function __construct()
{
//当前登录者uid
$GLOBALS['ts']['mid'] = $this->mid = intval($_SESSION['mid']);
//当前访问对象的uid
$GLOBALS['ts']['uid'] = $this->uid = intval($_REQUEST['uid'] == 0 ? $this->mid : $_REQUEST['uid']);
// 赋值当前访问者用户
$GLOBALS['ts']['user'] = $this->user = model('User')->getUserInfo($this->mid);
if ($this->mid != $this->uid) {
$GLOBALS['ts']['_user'] = model('User')->getUserInfo($this->uid);
} else {
$GLOBALS['ts']['_user'] = $GLOBALS['ts']['user'];
}
//当前用户的所有已添加的应用
$GLOBALS['ts']['_userApp'] = $userApp = model('UserApp')->getUserApp($this->uid);
//当前用户的统计数据
$GLOBALS['ts']['_userData'] = $userData = model('UserData')->getUserData($this->uid);
$this->site = D('Xdata')->get('admin_Config:site');
$this->site['logo'] = getSiteLogo($this->site['site_logo']);
$GLOBALS['ts']['site'] = $this->site;
//语言包判断
if (TRUE_APPNAME != 'public' && APP_NAME != TRUE_APPNAME) {
addLang(TRUE_APPNAME);
}
Addons::hook('core_filter_init_widget');
}
示例5: __construct
/**
* 架构函数
* @param boolean $location 是否本机调用,本机调用不需要认证
* @return void
*/
public function __construct($location = false)
{
//$this->mid = $_SESSION['mid'];
//外部接口调用
if ($location == false && !defined('DEBUG')) {
$this->verifyUser();
//本机调用
} else {
$this->mid = @intval($_SESSION['mid']);
}
$GLOBALS['ts']['mid'] = $this->mid;
//默认参数处理
$this->since_id = isset($_REQUEST['since_id']) ? intval($_REQUEST['since_id']) : '';
$this->max_id = isset($_REQUEST['max_id']) ? intval($_REQUEST['max_id']) : '';
$this->page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
$this->count = isset($_REQUEST['count']) ? intval($_REQUEST['count']) : 20;
$this->user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0;
$this->user_name = isset($_REQUEST['user_name']) ? h($_REQUEST['user_name']) : '';
$this->uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0;
$this->uname = isset($_REQUEST['uname']) ? h($_REQUEST['uname']) : '';
$this->id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$this->data = $_REQUEST;
// findPage
$_REQUEST[C('VAR_PAGE')] = $this->page;
//接口初始化钩子
Addons::hook('core_filter_init_api');
//控制器初始化
if (method_exists($this, '_initialize')) {
$this->_initialize();
}
}
示例6: execApp
/**
* 执行App控制器
* @access public
* @return void
*/
public static function execApp()
{
// 加载所有插件
if (C('APP_PLUGIN_ON')) {
tsload(CORE_LIB_PATH . '/addons.class.php');
tsload(CORE_LIB_PATH . '/addons/Hooks.class.php');
tsload(CORE_LIB_PATH . '/addons/AbstractAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/NormalAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/SimpleAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/TagsAbstract.class.php');
Addons::loadAllValidAddons();
}
//创建Action控制器实例
$className = MODULE_NAME . 'Action';
tsload(APP_ACTION_PATH . '/' . $className . '.class.php');
if (!class_exists($className)) {
$className = 'EmptyAction';
tsload(APP_ACTION_PATH . '/EmptyAction.class.php');
if (!class_exists($className)) {
throw_exception(L('_MODULE_NOT_EXIST_') . MODULE_NAME);
}
}
$module = new $className();
//异常处理
if (!$module) {
// 模块不存在 抛出异常
throw_exception(L('_MODULE_NOT_EXIST_') . MODULE_NAME);
}
//获取当前操作名
$action = ACTION_NAME;
//执行当前操作
call_user_func(array(&$module, $action));
return;
}
示例7: getCallback
private function getCallback($site = '', $type = 'bind', $callbackurl = '')
{
if (!$callbackurl) {
if ($type == 'bind') {
$callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $site, 'do' => "bind"));
} else {
$callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $site));
}
}
return urlencode($callbackurl);
}
示例8: getUrl
public function getUrl($call_back = null)
{
if (empty($this->_sina_akey) || empty($this->_sina_skey)) {
return false;
}
if (is_null($call_back)) {
$call_back = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'sina', 'do' => 'bind'));
}
$this->loginUrl = $this->_oauth->getAuthorizeURL($call_back);
return $this->loginUrl;
}
示例9: saveBeautifyLoginConfig
public function saveBeautifyLoginConfig()
{
$data = array();
$data['template'] = $_POST['template'] ? intval($_POST['template']) : 1;
$data['color'] = $_POST['color'] ? $_POST['color'] : "FFFFFF";
$res = model('AddonData')->lput('beautifyLogin', $data);
if ($res) {
$this->assign('jumpUrl', Addons::adminPage('beautifyLoginConfig'));
} else {
$this->error();
}
}
示例10: doAdmin
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']);
}
}
示例11: install
function install($addonid)
{
if ($addonid > 2) {
$addon = Addons::find($addonid);
Event::fire('backend.addons.install', array($addon));
$addon->installed = 1;
$addon->save();
return Redirect::to('addons/manage')->withMessage($this->notifyView(Lang::get('messages.addon_installed')));
} else {
return Redirect::to('addons/manage')->withMessage($this->notifyView(Lang::get('messages.no_access'), 'error'));
}
}
示例12: profile
public function profile()
{
$pUserProfile = D('UserProfile');
$pUserProfile->uid = $this->uid;
$data['userInfo'] = $pUserProfile->getUserInfo(true);
// 个人情况-钩子
Addons::hook('home_space_profile_intro', array('uid' => $this->uid, 'intro' => &$data['userInfo']['intro']['list']));
// 联系方式-钩子
Addons::hook('home_space_profile_contact', array('uid' => $this->uid, 'contact' => &$data['userInfo']['contact']['list']));
$this->assign($data);
$this->setTitle('Thông tin chi tiết của ' . getUserName($this->uid));
$this->display();
}
示例13: saveBeautifyCardConfig
public function saveBeautifyCardConfig()
{
$data = array();
$data['showMedals'] = $_REQUEST['showMedals'] ? 1 : 0;
$data['isSync'] = $_REQUEST['isSync'] ? 1 : 0;
$data['color'] = $_REQUEST['color'] ? $_REQUEST['color'] : 2;
$_POST && ($res = model('AddonData')->lput('beautifyCard', $data));
if ($res) {
$this->assign('jumpUrl', Addons::adminPage('beautifyCardConfig'));
} else {
$this->error();
}
}
示例14: init
/**
* App初始化
*/
public static function init()
{
// 设定错误和异常处理
set_error_handler(array('App', 'appError'));
set_exception_handler(array('App', 'appException'));
// Session初始化
if (!session_id()) {
session_start();
}
// 加载所有插件
if (C('APP_PLUGIN_ON')) {
Addons::loadAllValidAddons();
}
}
示例15: saveBeautifyCenterConfig
public function saveBeautifyCenterConfig()
{
$data = array();
$data['position'] = $_POST['position'] ? $_POST['position'] : 2;
$data['template'] = $_POST['template'] ? $_POST['template'] : 1;
$data['sync_bg'] = $_POST['sync_bg'] ? 1 : 0;
$data['consume_credit'] = $_POST['consume_credit'] == "on" ? 1 : 0;
$data['consume_quantity'] = $_POST['consume_quantity'] ? $_POST['consume_quantity'] : 50;
$_POST && ($res = model('AddonData')->lput('beautifyCenter', $data));
if ($res) {
$this->assign('jumpUrl', Addons::adminPage('beautifyCenterConfig'));
} else {
$this->error();
}
}