zoukankan      html  css  js  c++  java
  • WordPress-Word图片上传插件整合教程-Xproer.WordPaster

    插件下载(PHP):wordpress 3.7.1,


    说明:由于许多插件可能使用相同钩子,导致冲突,所以提供手支方式整合。

    1.上传插件目录。

    说明:WordPress 3.7.1 使用的是TinyMCE4.x。插件目录必须是TinyMCE4.x的插件目录

    clip_image001

    2.在functions.php中增加插件初始化代码和编辑器工具栏按钮

    为编辑器增加工具栏按钮

    clip_image002

    增加插件初始化代码:

    clip_image003

    示例代码:

    //WordPaster插件-加载

    function WordPaster_Plugin()

    {

    $plugins = array('wordpaster','screencapture'); //Add any more plugins you want to load here

    $plugins_array = array();

    //Build the response - the key is the plugin name, value is the URL to the plugin JS

    foreach ($plugins as $plugin ) {

    $plugins_array[ $plugin ] = plugins_url($plugin."/") . 'editor_plugin.js';

    }

    return $plugins_array;

    }

    add_filter('mce_external_plugins',"WordPaster_Plugin");

    //WordPaster插件-初始化

    function WordPaster_init(){

    echo '<link type="text/css" rel="Stylesheet" href="' . WP_PLUGIN_URL . '/wordpaster/css/WordPaster.css"/>'." ";

    echo '<link type="text/css" rel="stylesheet" href="' . WP_PLUGIN_URL . '/wordpaster/css/ui-lightness/jquery-ui-1.8.11.custom.css" />'." ";

    echo '<script type="text/javascript" src="' . WP_PLUGIN_URL . '/wordpaster/js/jquery.min.js" charset="utf-8"></script>'." ";

    echo '<script type="text/javascript" src="' . WP_PLUGIN_URL . '/wordpaster/js/jquery-ui-1.8.11.custom.min.js"></script>'." ";

    echo '<script type="text/javascript" src="' . WP_PLUGIN_URL . '/wordpaster/js/WordPaster.js" charset="utf-8"></script>'." ";

    //截屏插件

    echo '<link type="text/css" rel="Stylesheet" href="' . WP_PLUGIN_URL . '/screencapture/css/ScreenCapture.css"/>'." ";

    echo '<script type="text/javascript" src="' . WP_PLUGIN_URL . '/screencapture/js/ScreenCapture.js" charset="utf-8"></script>'." ";

    echo '<script language="javascript" type="text/javascript">'." ";

    echo ' var pasterMgr = new PasterManager();'." ";

    echo ' pasterMgr.Load();//load WordPaster'." ";

    echo ' pasterMgr.Init(null);'." ";

    //截屏插件

    echo ' var scpMgr = new CaptureManager();'." ";

    echo ' scpMgr.Init(null);'." ";

    echo '</script>';

    }

    add_action( 'admin_print_scripts', 'WordPaster_init' );

    3.修改upload.php返回路径。

    clip_image004

    4.修改WordPaster.js中的PostUrl

    clip_image005

    整合效果:

    clip_image007

  • 相关阅读:
    Firefox功能强大的浏览器 (转)
    常用的dnet开源项目
    15 个 JavaScript Web UI 库
    关于Web路径的备忘
    推荐几个.NET开源图表组件(转)
    C#开源资源大汇总 (转)
    jQuery对select操作小结 转载
    非对称加密RSA的应用及在C#中的实现(转)
    Web开发人员应当知道的15个开源项目
    css中float和列表图片liststyleimage不能正常解析的说明
  • 原文地址:https://www.cnblogs.com/xproer/p/3475093.html
Copyright © 2011-2022 走看看