本文整理匯總了PHP中_WP_Editors::qt_buttons方法的典型用法代碼示例。如果您正苦於以下問題:PHP _WP_Editors::qt_buttons方法的具體用法?PHP _WP_Editors::qt_buttons怎麽用?PHP _WP_Editors::qt_buttons使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類_WP_Editors
的用法示例。
在下文中一共展示了_WP_Editors::qt_buttons方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editor_settings
/**
* @static
*
* @global string $wp_version
* @global string $tinymce_version
*
* @param string $editor_id
* @param array $set
*/
public static function editor_settings($editor_id, $set)
{
global $wp_version, $tinymce_version;
if (empty(self::$first_init)) {
if (is_admin()) {
add_action('admin_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('admin_print_footer_scripts', array(__CLASS__, 'enqueue_scripts'), 1);
} else {
add_action('wp_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('wp_print_footer_scripts', array(__CLASS__, 'enqueue_scripts'), 1);
}
}
if (self::$this_quicktags) {
$qtInit = array('id' => $editor_id, 'buttons' => '');
if (is_array($set['quicktags'])) {
$qtInit = array_merge($qtInit, $set['quicktags']);
}
if (empty($qtInit['buttons'])) {
$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
}
if ($set['_content_editor_dfw']) {
$qtInit['buttons'] .= ',dfw';
}
/**
* Filters the Quicktags settings.
*
* @since 3.3.0
*
* @param array $qtInit Quicktags settings.
* @param string $editor_id The unique editor ID, e.g. 'content'.
*/
$qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
self::$qt_settings[$editor_id] = $qtInit;
self::$qt_buttons = array_merge(self::$qt_buttons, explode(',', $qtInit['buttons']));
}
if (self::$this_tinymce) {
if (empty(self::$first_init)) {
self::$baseurl = includes_url('js/tinymce');
$mce_locale = get_locale();
self::$mce_locale = $mce_locale = empty($mce_locale) ? 'en' : strtolower(substr($mce_locale, 0, 2));
// ISO 639-1
/** This filter is documented in wp-admin/includes/media.php */
$no_captions = (bool) apply_filters('disable_captions', '');
$ext_plugins = '';
if ($set['teeny']) {
/**
* Filters the list of teenyMCE plugins.
*
* @since 2.7.0
*
* @param array $plugins An array of teenyMCE plugins.
* @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
self::$plugins = $plugins = apply_filters('teeny_mce_plugins', array('colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink'), $editor_id);
} else {
/**
* Filters the list of TinyMCE external plugins.
*
* The filter takes an associative array of external plugins for
* TinyMCE in the form 'plugin_name' => 'url'.
*
* The url should be absolute, and should include the js filename
* to be loaded. For example:
* 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.
*
* If the external plugin adds a button, it should be added with
* one of the 'mce_buttons' filters.
*
* @since 2.5.0
*
* @param array $external_plugins An array of external TinyMCE plugins.
*/
$mce_external_plugins = apply_filters('mce_external_plugins', array());
$plugins = array('charmap', 'colorpicker', 'hr', 'lists', 'media', 'paste', 'tabfocus', 'textcolor', 'fullscreen', 'wordpress', 'wpautoresize', 'wpeditimage', 'wpemoji', 'wpgallery', 'wplink', 'wpdialogs', 'wptextpattern', 'wpview', 'wpembed');
if (!self::$has_medialib) {
$plugins[] = 'image';
}
/**
* Filters the list of default TinyMCE plugins.
*
* The filter specifies which of the default plugins included
* in WordPress should be added to the TinyMCE instance.
*
* @since 3.3.0
*
* @param array $plugins An array of default TinyMCE plugins.
*/
$plugins = array_unique(apply_filters('tiny_mce_plugins', $plugins));
if (($key = array_search('spellchecker', $plugins)) !== false) {
// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
// It can be added with 'mce_external_plugins'.
//.........這裏部分代碼省略.........
示例2: editor_settings
public static function editor_settings($editor_id, $set)
{
$first_run = false;
if (empty(self::$first_init)) {
if (is_admin()) {
add_action('admin_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('admin_footer', array(__CLASS__, 'enqueue_scripts'), 1);
} else {
add_action('wp_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('wp_footer', array(__CLASS__, 'enqueue_scripts'), 1);
}
}
if (self::$this_quicktags) {
$qtInit = array('id' => $editor_id, 'buttons' => '');
if (is_array($set['quicktags'])) {
$qtInit = array_merge($qtInit, $set['quicktags']);
}
if (empty($qtInit['buttons'])) {
$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
}
if ($set['dfw']) {
$qtInit['buttons'] .= ',fullscreen';
}
$qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
self::$qt_settings[$editor_id] = $qtInit;
self::$qt_buttons = array_merge(self::$qt_buttons, explode(',', $qtInit['buttons']));
}
if (self::$this_tinymce) {
if (empty(self::$first_init)) {
self::$baseurl = includes_url('js/tinymce');
self::$mce_locale = $mce_locale = '' == get_locale() ? 'en' : strtolower(substr(get_locale(), 0, 2));
// only ISO 639-1
$no_captions = (bool) apply_filters('disable_captions', '');
$plugins = array('inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs');
$first_run = true;
$ext_plugins = '';
if ($set['teeny']) {
self::$plugins = $plugins = apply_filters('teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs'), $editor_id);
} else {
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
The url should be absolute and should include the js file name to be loaded. Example:
array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
*/
$mce_external_plugins = apply_filters('mce_external_plugins', array());
if (!empty($mce_external_plugins)) {
/*
The following filter loads external language files for TinyMCE plugins.
It takes an associative array 'plugin_name' => 'path', where path is the
include path to the file. The language file should follow the same format as
/tinymce/langs/wp-langs.php and should define a variable $strings that
holds all translated strings.
When this filter is not used, the function will try to load {mce_locale}.js.
If that is not found, en.js will be tried next.
*/
$mce_external_languages = apply_filters('mce_external_languages', array());
$loaded_langs = array();
$strings = '';
if (!empty($mce_external_languages)) {
foreach ($mce_external_languages as $name => $path) {
if (@is_file($path) && @is_readable($path)) {
include_once $path;
$ext_plugins .= $strings . "\n";
$loaded_langs[] = $name;
}
}
}
foreach ($mce_external_plugins as $name => $url) {
$url = set_url_scheme($url);
$plugins[] = '-' . $name;
$plugurl = dirname($url);
$strings = $str1 = $str2 = '';
if (!in_array($name, $loaded_langs)) {
$path = str_replace(content_url(), '', $plugurl);
$path = WP_CONTENT_DIR . $path . '/langs/';
if (function_exists('realpath')) {
$path = trailingslashit(realpath($path));
}
if (@is_file($path . $mce_locale . '.js')) {
$strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";
}
if (@is_file($path . $mce_locale . '_dlg.js')) {
$strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";
}
if ('en' != $mce_locale && empty($strings)) {
if (@is_file($path . 'en.js')) {
$str1 = @file_get_contents($path . 'en.js');
$strings .= preg_replace('/([\'"])en\\./', '$1' . $mce_locale . '.', $str1, 1) . "\n";
}
if (@is_file($path . 'en_dlg.js')) {
$str2 = @file_get_contents($path . 'en_dlg.js');
$strings .= preg_replace('/([\'"])en\\./', '$1' . $mce_locale . '.', $str2, 1) . "\n";
}
}
if (!empty($strings)) {
$ext_plugins .= "\n" . $strings . "\n";
}
}
//.........這裏部分代碼省略.........
示例3: editor_settings
public static function editor_settings($editor_id, $set)
{
global $editor_styles;
$first_run = false;
if (empty(self::$first_init)) {
if (is_admin()) {
add_action('admin_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('admin_footer', array(__CLASS__, 'enqueue_scripts'), 1);
} else {
add_action('wp_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
add_action('wp_footer', array(__CLASS__, 'enqueue_scripts'), 1);
}
}
if (self::$this_quicktags) {
$qtInit = array('id' => $editor_id, 'buttons' => '');
if (is_array($set['quicktags'])) {
$qtInit = array_merge($qtInit, $set['quicktags']);
}
if (empty($qtInit['buttons'])) {
$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
}
if ($set['dfw']) {
$qtInit['buttons'] .= ',fullscreen';
}
$qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
self::$qt_settings[$editor_id] = $qtInit;
self::$qt_buttons = array_merge(self::$qt_buttons, explode(',', $qtInit['buttons']));
}
if (self::$this_tinymce) {
if (empty(self::$first_init)) {
self::$baseurl = includes_url('js/tinymce');
self::$mce_locale = $mce_locale = '' == get_locale() ? 'en' : strtolower(substr(get_locale(), 0, 2));
// only ISO 639-1
$no_captions = (bool) apply_filters('disable_captions', '');
//Firefox does not work with TinyMCE correctly if TinyMCE loads plugins so we start off with an empty list of plugins
$plugins = array();
// $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wpdialogs' );
$plugins = array('paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wpdialogs');
// inlinepopups plugin is required and supported only for TinyMCE Version 3
if ($set['major_version'] < 4) {
array_unshift($plugins, 'spellchecker');
array_unshift($plugins, 'inlinepopups');
} else {
array_unshift($plugins, 'textcolor');
array_unshift($plugins, 'charmap');
}
$first_run = true;
if ($set['teeny']) {
self::$plugins = $plugins = apply_filters('teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wpdialogs'), $editor_id);
$ext_plugins = '';
} else {
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
The url should be absolute and should include the js file name to be loaded. Example:
array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
*/
if ($set['major_version'] < 4) {
$mce_external_plugins = apply_filters('mce_external_plugins', array());
} else {
$mce_external_plugins = apply_filters('mce_external_plugins', array('link' => OP_LIB_URL . 'js/tinymce/plugins/op_link/plugin.js'));
}
$ext_plugins = '';
if (!empty($mce_external_plugins)) {
/*
The following filter loads external language files for TinyMCE plugins.
It takes an associative array 'plugin_name' => 'path', where path is the
include path to the file. The language file should follow the same format as
/tinymce/langs/wp-langs.php and should define a variable $strings that
holds all translated strings.
When this filter is not used, the function will try to load {mce_locale}.js.
If that is not found, en.js will be tried next.
*/
//$mce_external_languages = apply_filters('mce_external_languages', array());
$loaded_langs = array();
$strings = '';
// if ( ! empty($mce_external_languages) ) {
// foreach ( $mce_external_languages as $name => $path ) {
// if ( @is_file($path) && @is_readable($path) ) {
// include_once($path);
// $ext_plugins .= $strings . "\n";
// $loaded_langs[] = $name;
// }
// }
// }
foreach ($mce_external_plugins as $name => $url) {
if (is_ssl()) {
$url = str_replace('http://', 'https://', $url);
}
$plugins[] = '-' . $name;
$plugurl = dirname($url);
$strings = $str1 = $str2 = '';
if (!in_array($name, $loaded_langs)) {
$path = str_replace(content_url(), '', $plugurl);
$path = WP_CONTENT_DIR . $path . '/langs/';
if (function_exists('realpath')) {
$path = trailingslashit(realpath($path));
}
if (@is_file($path . $mce_locale . '.js')) {
//.........這裏部分代碼省略.........