Пример #1
0
/**
 * Filters WP Editor Buttons depending on plugin's settings.
 *
 * @package WP Idea Stream
 * @subpackage core/functions
 *
 * @since 2.0.0
 *
 * @param  array  $buttons the list of buttons for the editor
 * @uses   wp_idea_stream_idea_editor_link() should we include the link/unlink button ?
 * @uses   wp_idea_stream_idea_editor_image() should we include the image (url) button ?
 * @return array           the filtered list of buttons to match plugin's needs
 */
function wp_idea_stream_teeny_button_filter($buttons = array())
{
    $remove_buttons = array('wp_more', 'spellchecker', 'wp_adv');
    if (!wp_idea_stream_idea_editor_link()) {
        $remove_buttons = array_merge($remove_buttons, array('link', 'unlink'));
    }
    // Remove unused buttons
    $buttons = array_diff($buttons, $remove_buttons);
    // Eventually add the image button
    if (wp_idea_stream_idea_editor_image()) {
        $buttons = array_diff($buttons, array('fullscreen'));
        array_push($buttons, 'image', 'fullscreen');
    }
    return $buttons;
}
Пример #2
0
/**
 * WP Editor's link button callback
 *
 * @package WP Idea Stream
 * @subpackage admin/settings
 *
 * @since 2.0.0
 *
 * @uses   checked() to add a checked attribute if needed
 * @uses   wp_idea_stream_idea_editor_link() to get the active option
 * @return string HTML output
 */
function wp_idea_stream_editor_link_setting_callback()
{
    ?>

	<input name="_ideastream_editor_link" id="_ideastream_editor_link" type="checkbox" value="1" <?php 
    checked(wp_idea_stream_idea_editor_link());
    ?>
 />
	<label for="_ideastream_editor_link"><?php 
    esc_html_e('Allow users to add links to their ideas', 'wp-idea-stream');
    ?>
</label>

	<?php 
}