WordPress 3.7.1-web截屏插件整合教程-Xproer.ScreenCapture

插件下載(PHP):wordpress 3.7.1,javascript


說明:因爲許多插件可能使用相同鉤子,致使衝突,因此提供手支方式整合。php

1.上傳插件目錄。css

說明:WordPress 3.7.1 使用的是TinyMCE4.x。插件目錄必須是TinyMCE4.x的插件目錄java

clip_image001

2.在functions.php中增長插件初始化代碼和編輯器工具欄按鈕jquery

爲編輯器增長工具欄按鈕編輯器

clip_image002

增長插件初始化代碼:wordpress

clip_image003

示例代碼:工具

//WordPaster插件-加載ui

function ScreenCapture_Plugin()url

{

$plugins = array('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',"ScreenCapture_Plugin");

//WordPaster插件-初始化

function ScreenCapture_init(){

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

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

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

//截屏插件

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

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

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

//截屏插件

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

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

echo '</script>';

}

add_action( 'admin_print_scripts', ScreenCapture_init' );

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

clip_image004

4.修改ScreenCapture.js中的PostUrl

clip_image005

整合效果:

clip_image007

相關文章
相關標籤/搜索