Beispiel #1
0
 public function _empty()
 {
     $plugin_name = $_GET['_module'];
     $action_name = $_GET['_action'];
     $info = model('plugin')->info_table($plugin_name);
     if (empty($info)) {
         cpError::show($_GET['_module'] . '模块或插件不存在');
     } else {
         if ($info['status'] == 1) {
             if (Plugin::run($plugin_name, $action_name) == false) {
                 cpError::show($_GET['_module'] . '模块或插件不存在');
             }
         } else {
             cpError::show($_GET['_module'] . '模块或插件不存在');
         }
     }
 }
Beispiel #2
0
 public function plus_hook($module, $action, $data = NULL, $return = false)
 {
     $action_name = 'hook_' . $module . '_' . $action;
     $list = $this->model->table('plugin')->where('status=1')->select();
     $plugin_list = Plugin::get();
     if (!empty($list)) {
         foreach ($list as $value) {
             $action_array = $plugin_list[$value['file']];
             if (!empty($action_array)) {
                 if (in_array($action_name, $action_array)) {
                     if ($return) {
                         return Plugin::run($value['file'], $action_name, $data, $return);
                     } else {
                         Plugin::run($value['file'], $action_name, $data);
                     }
                 }
             }
         }
     }
 }
Author: Andrey "Rarst" Savchenko
Version: 1.2
Author URI: http://www.rarst.net/
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
namespace Rarst\Fragment_Cache;

if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
global $fragment_cache;
$fragment_cache = new Plugin(array('timeout' => HOUR_IN_SECONDS, 'update_server' => new \TLC_Transient_Update_Server()));
$fragment_cache->add_fragment_handler('menu', 'Rarst\\Fragment_Cache\\Menu_Cache');
$fragment_cache->add_fragment_handler('widget', 'Rarst\\Fragment_Cache\\Widget_Cache');
$fragment_cache->add_fragment_handler('gallery', 'Rarst\\Fragment_Cache\\Gallery_Cache');
$fragment_cache->run();
<?php

/*
Plugin Name: Markdown
Plugin URI:  https://github.com/goblindegook/wp-markdown-g
Description: Markdown formatting support.
Version:     1.3.1
Author:      Luís Rodrigues
Author URI:  http://goblindegook.net/
License:     GPLv2
*/
namespace goblindegook\WP\Markdown;

if (!defined('WPINC')) {
    die;
}
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require_once __DIR__ . '/vendor/autoload.php';
}
\add_action('plugins_loaded', function () {
    $plugin = new Plugin('wp-markdown', '1.1.2');
    $plugin->run();
});
Beispiel #5
0
 public function uninstall()
 {
     $id = intval($_POST['id']);
     $this->alert_str($id, 'int', true);
     //获取插件信息
     $info = model('plugin')->info_data($id);
     if (empty($info)) {
         $this->msg('插件信息获取失败!', 0);
     }
     //获取配置信息
     $config = model('plugin')->info($info['file']);
     if (empty($config)) {
         $this->msg('配置信息获取失败!', 0);
     }
     $dir = __ROOTDIR__ . '/plugins/' . $info['file'];
     if (!empty($info['file'])) {
         $data = @Plugin::run($info['file'], 'plugin_ini_data', '', true);
     }
     @Plugin::run($info['file'], 'uninstall', $info);
     //删除表
     if (!empty($data)) {
         foreach ($data as $value) {
             model('plugin')->del_table($value);
         }
     }
     //删除菜单
     model('plugin')->del_menu($info['mid']);
     //删除主表
     model('plugin')->del($id);
     //删除完毕
     $this->msg($info['file']);
 }
Beispiel #6
0
<?php

namespace Korobochkin\Memories;

/*
Plugin Name: Memories
Plugin URI:  https://github.com/korobochkin/memories
Description: Save Instagram moments in WordPress.
Version:     0.0.0
Author:      Kolya Korobochkin
Author URI:  http://korobochkin.com/
License:     GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Domain Path: /languages
Text Domain: memories
*/
/**
 * Autoloader for all classes.
 *
 * @since 0.0.0
 */
require_once 'inc/autoloader.php';
/*
 * Run this plugin right now.
 */
Plugin::run();
Beispiel #7
0
/**
 * Instantiate and run the plugin
 *
 * Check is Woocommerce is active, instantiate Plugin class, call function for boot base plugin actions.
 *
 * @return void
 */
function loaded()
{
    check_is_woocommerce_is_active();
    $plugin = new Plugin();
    $plugin->run();
}
Beispiel #8
0
 public function _empty()
 {
     header("content-type:text/html; charset=utf-8");
     //执行插件部分
     $module_name = in($_GET['_module']);
     $action_name = in($_GET['_action']);
     $plugin_info = $this->model->table('plugin')->where('file="' . $module_name . '"')->find();
     if (!empty($plugin_info)) {
         if ($plugin_info['status'] == 1) {
             if (Plugin::run($module_name, $action_name)) {
                 return;
             }
         }
     }
     //处理根目录
     $root = substr(str_replace('/', '\\/', __ROOT__), 1);
     if (empty($root)) {
         $root = '/';
     }
     //过滤URL
     $url = str_replace('index.php/', '', $_SERVER['REQUEST_URI']);
     $url = str_replace('index.php', '', $url);
     $url = str_replace('//', '/', $url);
     $url = str_replace('///', '/', $url);
     $url = explode('?', $url);
     $url = $url[0];
     $url = urldecode($url);
     if (substr($url, -10) == 'index.html') {
         $url = substr($url, 0, -10);
     }
     $urls = $url;
     //表单URL
     $form_list = $this->model->table('form')->where('display=1')->select();
     if (substr($root, -1) != '/') {
         $rooturl = $root . '/';
     } else {
         $rooturl = $root;
     }
     if (!empty($form_list)) {
         foreach ($form_list as $value) {
             if ($urls == $rooturl . $value['table'] || $urls == $rooturl . $value['table'] . '/' || $urls == $rooturl . $value['table'] . '/index.html' || $urls == $rooturl . $value['table'] . '/pages.html') {
                 model('rewrite')->form_url($value['table']);
                 return;
             }
             preg_match($root . '\\/' . $value['table'] . '\\/pages-(\\d+).html/i', $urls, $match);
             if ($match[0] == $url && !empty($match)) {
                 model('rewrite')->form_url($value['table'], $match[1]);
                 return;
             }
         }
     }
     //处理TAGURL
     $tagurl = explode('-', urldecode($module_name));
     if ($tagurl[0] == 'tags') {
         $tag = str_replace('tags-', '', urldecode($module_name));
         if ($urls == $rooturl . 'tags-' . $tag || $urls == $rooturl . 'tags-' . $tag . '/' || $urls == $rooturl . 'tags-' . $tag . '/index.html' || $urls == $rooturl . $tag . '/pages.html') {
             model('rewrite')->tags_url($tag);
             return;
         }
         preg_match($root . '\\/tags-' . $tag . '\\/pages-(\\d+).html/i', $urls, $match);
         if ($match[0] == $url && !empty($match)) {
             model('rewrite')->tags_url($tag, $match[1]);
             return;
         }
     }
     $mod_list = $this->model->table('model')->select();
     foreach ($mod_list as $value) {
         //栏目列表规则
         $url_catrgory = $value['url_category'];
         $url_catrgory_page = $value['url_category_page'];
         //栏目列表替换
         $patterns = array(".", "/", "{EXT}", "{CDIR}", "{P}");
         $replacements = array("\\.", "\\/", str_replace('.', '\\.', '.html'), "([a-z0-9_\\-]+)", "(\\d+)");
         if (substr($url, -1) != '/') {
             $url = $url . '/';
         }
         if (substr($url_catrgory, -1) != '/') {
             $url_catrgory = $url_catrgory . '/';
         }
         //处理栏目URL规则
         $url_catrgory = str_replace($patterns, $replacements, $url_catrgory);
         $url_catrgory_page = str_replace($patterns, $replacements, $url_catrgory_page);
         //判断栏目分页规则
         $url = $urls;
         preg_match($root . '\\/' . $url_catrgory_page . '/i', $url, $match);
         if (substr($match[0], 0, 1) != '/') {
             $match[0] = '/' . $match[0];
         }
         if ($match[0] == $url) {
             model('rewrite')->category($match[1], $match[2]);
             return;
         }
         unset($match);
         //判断栏目规则
         preg_match($root . '\\/' . $url_catrgory . '/i', $url, $match);
         if (substr($match[0], 0, 1) != '/') {
             $match[0] = '/' . $match[0];
         }
         if ($match[0] == $url) {
             model('rewrite')->category($match[1]);
             return;
         }
         unset($match);
         //内容列表规则
         $url_content = $value['url_content'];
         $url_content_page = $value['url_content_page'];
         //内容替换
         $patterns2 = array(".", "/", "{EXT}", "{CDIR}", "{P}", "{YY}", "{YYYY}", "{M}", "{D}", "{AID}", "{URLTITLE}");
         $replacements2 = array("\\.", "\\/", str_replace('.', '\\.', '.html'), "[a-z0-9_\\-]+", "(\\d+)", "\\d{2}", "\\d{4}", "\\d{2}", "\\d{2}", "(\\d+)", "([a-z0-9_\\-]+)");
         //处理内容URL规则
         $url_content = str_replace($patterns2, $replacements2, $url_content);
         $url_content_page = str_replace($patterns2, $replacements2, $url_content_page);
         $url = $urls;
         //判断内容分页规则
         preg_match($root . '\\/' . $url_content_page . '/i', $url, $match);
         if (substr($match[0], 0, 1) != '/') {
             $match[0] = '/' . $match[0];
         }
         if ($match[0] == $url) {
             model('rewrite')->content($match[1], end($match));
             return;
         }
         unset($match);
         //判断内容规则
         preg_match($root . '\\/' . $url_content . '/i', $url, $match);
         if (substr($match[0], 0, 1) != '/') {
             $match[0] = '/' . $match[0];
         }
         if ($match[0] == $url) {
             model('rewrite')->content($match[1]);
             return;
         }
         unset($match);
     }
     $this->error404();
 }