Esempio n. 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;
}
Esempio n. 2
0
/**
 * Sanitize the featured image option.
 *
 * @since 2.3.0
 *
 * @param  int $option the featured image setting
 * @return int         the new featured image setting
 */
function wp_idea_stream_editor_featured_images_sanitize($option = 0)
{
    // People need to insert image before selecting a featured one.
    if (!wp_idea_stream_idea_editor_image()) {
        return 0;
    }
    return absint($option);
}