plugin.php,plugin.php
/**
* plugin.php 插件入口
*
* @copyright(C) 2005-2010 PHPCMS
* @licensehttp://www.phpcms.cn/license/
* @lastmodify2013-06-07
*/
define('PHPCMS_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
include PHPCMS_PATH.'phpcms/base.php';
$param = pc_base::load_sys_class('param');
pc_base::load_sys_func('plugin');
$cache = '';
if(isset($_GET['id'])) {
if(!preg_match("/^[a-z0-9_\-]+$/i",$_GET['id'])) showmessage((L('illegal_parameters')));
list($identification, $filename,$action) = explode('-', $_GET['id']);
$filename = !empty($filename) ? $filename : $identification;
$action = !empty($action) ? $action : 'init';
}
if(!preg_match("/^[a-z0-9_\-]+$/i", $identification)) showmessage(L('plugin_not_exist','','plugin'));
$cache = getcache($identification,'plugins');
if(!$cache['disable'] || $filename=='plugin_admin' || $filename=='hook') {
showmessage(L('plugin_not_exist','','plugin'));
} else {
$status = plugin_stat($cache['appid']);
if($status== 0 || $app_status == 1) {
showmessage(L('plugin_developing','','plugin'));
} elseif($status== 3) {
showmessage(L('plugin_be_locked','','plugin'));
}
$iframe = string2array($cache['iframe']);
if($iframe['url']) {
$cache_var = getcache($identification.'_var','plugins');
plugin_base::creat_iframe($cache,$cache_var);
} else {
plugin_base::creat_app($identification, $filename, $action);
}
}
class plugin_base {
/**
* 初始化插件
*/
public static function creat_app($id,$file,$action) {
define('PLUGIN_ID', $id);
define('PLUGIN_FILE', $file);
define('PLUGIN_ACTION', $action);
self::plugin_init();
}
/**
* 调用插件方法
*/
private function plugin_init() {
$controller = self::load_controller();
if (method_exists($controller, PLUGIN_ACTION)) {
if (preg_match('/^[_]/i', PLUGIN_ACTION)) {
exit('Plugin Error:You are visiting the action is to protect the private action');
} else {
call_user_func(array($controller, PLUGIN_ACTION));
}
} else {
exit(L('plugin_error_or_not_exist','','plugin'));
}
}
/**
* 加载插件控制器
* @param string $filename
* @param string $m
* @return obj
*/
private function load_controller($filename = '', $m = '') {
if (empty($filename)) $filename = PLUGIN_FILE;
if (empty($m)) $m = PLUGIN_ID;
$filepath = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR.$filename.'.class.php';
if (file_exists($filepath) && $filename !='plugin_admin') {
$classname = $filename;
include $filepath;
if ($mypath = pc_base::my_path($filepath)) {
$classname = 'MY_'.$filename;
include $mypath;
}
return new $classname;
} else {
exit(L('plugin_error_or_not_exist','','plugin'));
}
}
/**
* 加载插件模板
*/
final public static function plugin_tpl($file, $identification = '') {
$identification = empty($identification) && defined('PLUGIN_ID') ? PLUGIN_ID : $identification;
if(empty($identification)) return false;
return PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$identification.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$file.'.tpl.php';
}
public static function creat_iframe($cache = '',$cache_var = '') {
$iframe = string2array($cache['iframe']);
$width = $cache_var['width'] ? $cache_var['width'] : $iframe['width'];
$height = $cache_var['height'] ? $cache_var['height'] : $iframe['width'];
$url = $iframe['url'];
$SEO = seo(1, 0, $cache['name'], $cache['description'], $cache['name']);
include template('plugin','iframe');
}
}
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史
plugin.php,plugin.php相关推荐
- Android studio Mac 版 Plugin Error Plugin “GsonFormat4DataBinding“ is incompatible
Android studio Mac 版 Plugin Error Plugin "GsonFormat4DataBinding" is incompatible ...
- Plugin error: Plugin ‘Android Code Generator‘ is compatible with IntelliJ IDEA only because it does
目录 Plugin error: Plugin 'Android Code Generator' is compatible with IntelliJ IDEA only because it do ...
- linux idea 启动报错StartupAbortedException: Fatal error initializing plugin idea.plugin.protoeditor
ubuntu环境添加了protobuf插件导致出错. 删除.local/share/JetBrains/IntelliJIdea2020.2/下protobuf相关插件和 删除.cache下插件解决, ...
- vue里面_Vue中如何使用自定义插件(plugin)
Vue中如何使用自定义插件(plugin) 1.在根目录src下创建一个libs文件夹,在libs文件夹下面创建一个myPlugins文件夹,用来存放我们的自定义插件,在myPlugins文件夹下面再 ...
- Jenkins plugin
2019独角兽企业重金招聘Python工程师标准>>> 目前Hudson和Jenkins基本上就是同一个东西,Hudson的插件可以直接用于Jenkins.以下是参照Hudson w ...
- FD.io/VPP — VPP Agent — Telemetry Plugin
目录 文章目录 目录 Telemetry Plugin Telemetry Config Telemetry REST API Telemetry metrics VPP runtime VPP bu ...
- es中的Plugin机制
node在初始化时,会创建PluginsService对象. this.pluginsService = new PluginsService(tmpSettings, initialEnvironm ...
- MyBatis之简单了解Plugin
MyBatis的Configuration配置中有一个Plugin配置,根据其名可以解释为"插件",这个插件实质可以理解为"拦截器"."拦截器&quo ...
- 第 20 课时:GPU 管理和 Device Plugin 工作机制(车漾)
本文将主要分享以下几个方面的内容: 需求来源 GPU 的容器化 Kubernetes 的 GPU 管理 工作原理 课后思考与实践 需求来源 2016 年,随着 AlphaGo 的走红和 TensorF ...
最新文章
- pandas DataFrame(2)-行列索引及值的获取
- 谈吉日嘎拉的《白话反射技术》及其他(吵架篇)
- C++ Primer 5th笔记(chap 18 大型程序工具) 重载与命名空间
- python有多少关键字_Python挖词脚本,挖出几十万关键词不是梦带搜索量
- 【AI超级美发师】深度学习算法打造染发特效(附代码)
- [PHP] 项目实践中使用的IOC容器思想
- 浅谈最小生成树的算法思路(一)Prim算法
- 浅谈c#垃圾回收机制(GC)
- 体验VSTS源代码管理之一
- 自定义标签 —— 实现时间转换和输出功能
- 严重的 BootHole 漏洞影响所有 Linux 发行版和 Windows 系统(详细分析)
- js复杂对象和简单对象的简单转化
- java socket ipv6_Java支持IPv6研究
- 截图快捷键ctrl加什么
- 创建输入控件(input控件、文本框、密码框、单项选择、多项选择、重置与提交按钮的设置)
- Win10 如何将FAT32格式磁盘不用格式化无损转化为NFTS格式
- 基于Opencv和STM32物理鼠标的目标跟踪器
- 学习笔记 | 美团后台笔试+一面+二面
- ssm基于web图书租售管理系统的设计与实现毕业设计源码161609
- ie8下table th和td宽度width设置不生效解决办法
热门文章
- BT Dongle设计介绍
- 用python对某校园热水服务app进行测试,实现自动免费用水(仅供参考)
- .metadata\.plugins\org.eclipse.wst.server.core
- 海外博士/博士后职位网站汇总
- 完全平方数(c++基础)
- 【Linux】【CentOS】CentOS 网络管理
- android自定义刻度线,Android自定义控件之刻度尺控件
- 【三维点云】01-激光雷达原理与应用
- 联想thinkpad E470无线网络无法使用问题解决方法
- SSL/TLS会话的流量分析