/**
* Set up TinyMCE button
*
* Add filters (assuming user is editing) for TinyMCE
*
* @uses     aye_set_general_defaults    Set default options
*
* @since 	2.0
*/
function youtube_embed_button()
{
    // Ensure user is in rich editor and button option is switched on
    if (get_user_option('rich_editing') == 'true') {
        $options = aye_set_general_defaults();
        if ($options['editor_button'] != '') {
            // Ensure shortcode cookie is set
            $editor_sc = aye_set_editor_sc();
            // Add filters
            add_filter('mce_external_plugins', 'add_youtube_embed_mce_plugin');
            add_filter('mce_buttons', 'register_youtube_embed_button');
        }
    }
}
    $expiry = 2147483647;
    // January 2038 (maximum value to avoid the integer overflow of the 2038 bug)
    setcookie('aye_mce_shortcode', $_POST['youtube_embed_editor_sc'], $expiry, aye_get_cookie_path());
    // If the option to clear the cache has been ticked run an SQL to clear them down
    if (!empty($_POST['youtube_embed_clear_cache'])) {
        global $wpdb;
        $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_%ye_video_%' OR option_name LIKE '_transient_%ye_type_%' OR option_name LIKE '_transient_%ye_title_%'");
        $update_message .= ' ' . __('Cache cleared.', 'youtube-embed');
    }
    echo '<div class="updated fade"><p><strong>' . $update_message . "</strong></p></div>\n";
}
// Get options
$options = aye_set_general_defaults();
$shortcode = aye_set_shortcode_option();
$url = aye_set_url_option();
$editor_sc = aye_set_editor_sc();
// Display ads
if ($options['donated'] != 1) {
    artiss_plugin_ads('youtube-embed', 990);
}
?>

<div class="updated fade"><p>Have you voted for which features of YouTube Embed you'd like to retain in version 3? <a href="http://www.artiss.co.uk/youtube-embed/youtube-embed-features-vote" target="_new">Click here</a> to vote!</p></div>

<p><?php 
_e('These are the general settings for Artiss YouTube Embed. Please select <a href="admin.php?page=aye-profile-options">Profiles</a> for default embedding settings.', 'youtube-embed');
?>
</p>

<form method="post" action="<?php 
echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=aye-general-options';