本文整理汇总了PHP中_WP_Editors::has_medialib方法的典型用法代码示例。如果您正苦于以下问题:PHP _WP_Editors::has_medialib方法的具体用法?PHP _WP_Editors::has_medialib怎么用?PHP _WP_Editors::has_medialib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_WP_Editors
的用法示例。
在下文中一共展示了_WP_Editors::has_medialib方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editor
/**
* Outputs the HTML for a single instance of the editor.
*
* @param string $content The initial content of the editor.
* @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
* @param array $settings See the _parse_settings() method for description.
*/
public static function editor($content, $editor_id, $settings = array())
{
$set = self::parse_settings($editor_id, $settings);
$editor_class = ' class="' . trim($set['editor_class'] . ' wp-editor-area') . '"';
$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
$rows = ' rows="' . (int) $set['textarea_rows'] . '"';
$switch_class = 'tmce-active';
$toolbar = $buttons = '';
if (!current_user_can('upload_files')) {
$set['media_buttons'] = false;
}
if (self::$this_quicktags && self::$this_tinymce) {
$switch_class = 'tmce-active';
add_filter('the_editor_content', 'wp_richedit_pre');
/*
if ( 'html' == wp_default_editor() ) {
add_filter('the_editor_content', 'wp_htmledit_pre');
} else {
add_filter('the_editor_content', 'wp_richedit_pre');
$switch_class = 'tmce-active';
}*/
$buttons .= '<a id="' . $editor_id . '-html" class="hide-if-no-js wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">' . __('HTML') . "</a>\n";
$buttons .= '<a id="' . $editor_id . '-tmce" class="hide-if-no-js wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">' . __('Visual') . "</a>\n";
}
echo '<div id="wp-' . $editor_id . '-wrap" class="wp-editor-wrap ' . $switch_class . '">';
if (self::$editor_buttons_css) {
wp_print_styles('editor-buttons');
self::$editor_buttons_css = false;
}
if (!empty($set['editor_css'])) {
echo $set['editor_css'] . "\n";
}
if (!empty($buttons) || $set['media_buttons']) {
echo '<div id="wp-' . $editor_id . '-editor-tools" class="wp-editor-tools">';
echo $buttons;
if ($set['media_buttons']) {
self::$has_medialib = true;
if (!function_exists('media_buttons')) {
include ABSPATH . 'wp-admin/includes/media.php';
}
echo '<div id="wp-' . $editor_id . '-media-buttons" class="hide-if-no-js wp-media-buttons">';
do_action('media_buttons', $editor_id);
echo "</div>\n";
}
echo "</div>\n";
}
$the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $rows . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
printf($the_editor, $content);
echo "\n</div>\n\n";
if ($set['disable_init'] === false) {
self::editor_settings($editor_id, $set);
}
}
示例2: editor
/**
* Outputs the HTML for a single instance of the editor.
*
* @static
* @param string $content The initial content of the editor.
* @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
* @param array $settings See the _parse_settings() method for description.
*/
public static function editor($content, $editor_id, $settings = array())
{
$set = self::parse_settings($editor_id, $settings);
$editor_class = ' class="' . trim(esc_attr($set['editor_class']) . ' wp-editor-area') . '"';
$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
$default_editor = 'html';
$buttons = $autocomplete = '';
$editor_id_attr = esc_attr($editor_id);
if ($set['drag_drop_upload']) {
self::$drag_drop_upload = true;
}
if (!empty($set['editor_height'])) {
$height = ' style="height: ' . (int) $set['editor_height'] . 'px"';
} else {
$height = ' rows="' . (int) $set['textarea_rows'] . '"';
}
if (!current_user_can('upload_files')) {
$set['media_buttons'] = false;
}
if (self::$this_tinymce) {
$autocomplete = ' autocomplete="off"';
if (self::$this_quicktags) {
$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
// 'html' is used for the "Text" editor tab.
if ('html' !== $default_editor) {
$default_editor = 'tinymce';
}
$buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce" class="wp-switch-editor switch-tmce"' . ' data-wp-editor-id="' . $editor_id_attr . '">' . __('Visual') . "</button>\n";
$buttons .= '<button type="button" id="' . $editor_id_attr . '-html" class="wp-switch-editor switch-html"' . ' data-wp-editor-id="' . $editor_id_attr . '">' . _x('Text', 'Name for the Text editor tab (formerly HTML)') . "</button>\n";
} else {
$default_editor = 'tinymce';
}
}
$switch_class = 'html' === $default_editor ? 'html-active' : 'tmce-active';
$wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
if ($set['_content_editor_dfw']) {
$wrap_class .= ' has-dfw';
}
echo '<div id="wp-' . $editor_id_attr . '-wrap" class="' . $wrap_class . '">';
if (self::$editor_buttons_css) {
wp_print_styles('editor-buttons');
self::$editor_buttons_css = false;
}
if (!empty($set['editor_css'])) {
echo $set['editor_css'] . "\n";
}
if (!empty($buttons) || $set['media_buttons']) {
echo '<div id="wp-' . $editor_id_attr . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
if ($set['media_buttons']) {
self::$has_medialib = true;
if (!function_exists('media_buttons')) {
include ABSPATH . 'wp-admin/includes/media.php';
}
echo '<div id="wp-' . $editor_id_attr . '-media-buttons" class="wp-media-buttons">';
/**
* Fires after the default media button(s) are displayed.
*
* @since 2.5.0
*
* @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
do_action('media_buttons', $editor_id);
echo "</div>\n";
}
echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
echo "</div>\n";
}
$quicktags_toolbar = '';
if (self::$this_quicktags) {
if ('content' === $editor_id && !empty($GLOBALS['current_screen']) && $GLOBALS['current_screen']->base === 'post') {
$toolbar_id = 'ed_toolbar';
} else {
$toolbar_id = 'qt_' . $editor_id_attr . '_toolbar';
}
$quicktags_toolbar = '<div id="' . $toolbar_id . '" class="quicktags-toolbar"></div>';
}
/**
* Filters the HTML markup output that displays the editor.
*
* @since 2.1.0
*
* @param string $output Editor's HTML markup.
*/
$the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id_attr . '-editor-container" class="wp-editor-container">' . $quicktags_toolbar . '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr($set['textarea_name']) . '" ' . 'id="' . $editor_id_attr . '">%s</textarea></div>');
// Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
if (self::$this_tinymce) {
add_filter('the_editor_content', 'format_for_editor', 10, 2);
}
/**
* Filters the default editor content.
*
* @since 2.1.0
//.........这里部分代码省略.........
示例3: editor
/**
* Outputs the HTML for a single instance of the editor.
*
* @param string $content The initial content of the editor.
* @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
* @param array $settings See the _parse_settings() method for description.
*/
public static function editor($content, $editor_id, $settings = array())
{
$set = self::parse_settings($editor_id, $settings);
$editor_class = ' class="' . trim($set['editor_class'] . ' wp-editor-area') . '"';
$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
$switch_class = 'html-active';
$toolbar = $buttons = $autocomplete = '';
if ($set['drag_drop_upload']) {
self::$drag_drop_upload = true;
}
if (!empty($set['editor_height'])) {
$height = ' style="height: ' . $set['editor_height'] . 'px"';
} else {
$height = ' rows="' . $set['textarea_rows'] . '"';
}
if (!current_user_can('upload_files')) {
$set['media_buttons'] = false;
}
if (!self::$this_quicktags && self::$this_tinymce) {
$switch_class = 'tmce-active';
$autocomplete = ' autocomplete="off"';
} elseif (self::$this_quicktags && self::$this_tinymce) {
$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
$autocomplete = ' autocomplete="off"';
// 'html' is used for the "Text" editor tab.
if ('html' === $default_editor) {
add_filter('the_editor_content', 'wp_htmledit_pre');
$switch_class = 'html-active';
} else {
add_filter('the_editor_content', 'wp_richedit_pre');
$switch_class = 'tmce-active';
}
$buttons .= '<button type="button" id="' . $editor_id . '-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">' . __('Visual') . "</button>\n";
$buttons .= '<button type="button" id="' . $editor_id . '-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">' . _x('Text', 'Name for the Text editor tab (formerly HTML)') . "</button>\n";
}
$wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
if ($set['_content_editor_dfw']) {
$wrap_class .= ' has-dfw';
}
echo '<div id="wp-' . $editor_id . '-wrap" class="' . $wrap_class . '">';
if (self::$editor_buttons_css) {
wp_print_styles('editor-buttons');
self::$editor_buttons_css = false;
}
if (!empty($set['editor_css'])) {
echo $set['editor_css'] . "\n";
}
if (!empty($buttons) || $set['media_buttons']) {
echo '<div id="wp-' . $editor_id . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
if ($set['media_buttons']) {
self::$has_medialib = true;
if (!function_exists('media_buttons')) {
include ABSPATH . 'wp-admin/includes/media.php';
}
echo '<div id="wp-' . $editor_id . '-media-buttons" class="wp-media-buttons">';
/**
* Fires after the default media button(s) are displayed.
*
* @since 2.5.0
*
* @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
do_action('media_buttons', $editor_id);
echo "</div>\n";
}
echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
echo "</div>\n";
}
/**
* Filter the HTML markup output that displays the editor.
*
* @since 2.1.0
*
* @param string $output Editor's HTML markup.
*/
$the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' . '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' . 'id="' . $editor_id . '">%s</textarea></div>');
/**
* Filter the default editor content.
*
* @since 2.1.0
*
* @param string $content Default editor content.
*/
$content = apply_filters('the_editor_content', $content);
printf($the_editor, $content);
echo "\n</div>\n\n";
self::editor_settings($editor_id, $set);
}