function srslide_insert_slide_js($content)
{
    $srslide_pid = get_option('srslide_pid');
    $srslide_api_key = get_option('srslide_api_key');
    // Validate PID and api_key
    if (!srslide_validate_pid($srslide_pid)) {
        return $content;
    }
    if (!srslide_validate_api_key($srslide_api_key)) {
        return $content;
    }
    // Return the content on anything other than post pages
    if (!is_singular()) {
        return $content;
    }
    // Skip attachments and only show on posts
    if (is_attachment()) {
        return $content;
    }
    // Only return slide_js on pages if srslide_use_pages is true
    if (is_page() && !get_option('srslide_use_pages')) {
        return $content;
    }
    global $post;
    $post_id = $post->ID;
    // If the post isn't published yet, we don't need a slide
    if ($post->post_status != 'publish') {
        return $content;
    }
    // Prep the variables
    $slide_article_icon = get_post_meta($post->ID, '_srslide_article_icon', true);
    $slide_article_icon = preg_replace('/"/', '', $slide_article_icon);
    $data['srslide_pid'] = $srslide_pid;
    $data['title'] = srslide_get_post_title($post);
    $data['authors'] = srslide_get_post_authors($post);
    $data['tags'] = srslide_get_post_tags($post);
    $data['channels'] = srslide_get_post_channels($post);
    $data['published_date'] = $post->post_date_gmt;
    $data['canonical_url'] = addslashes(get_permalink($post->ID));
    $data['srslide_plugin_version'] = SRSLIDE_PLUGIN_VERSION;
    $data['srslide_css_url'] = get_option('srslide_css_url');
    $data['srslide_header_text'] = addslashes(get_option('srslide_header_text'));
    $data['srslide_disable_on_post'] = json_encode(!(bool) get_post_meta($post->ID, '_srslide_disable_on_post', true));
    $data['slide_logo_elem'] = get_option('srslide_show_logo') ? '' : "\n      slide_logo: false,";
    $data['slide_icon_elem'] = $slide_article_icon ? "\n      icon: '" . addslashes($slide_article_icon) . "'," : '';
    $templateEngine = new Mustache();
    $tmpl = file_get_contents(dirname(__FILE__) . '/templates/srslide_js_tag.js');
    return $templateEngine->render($tmpl, $data) . $content;
}
 update_option('srslide_cat_as_chan', (int) $srslide_cat_as_chan);
 // Store bottom offset locally
 update_option('srslide_style_element_bottom', $srslide_style_element_bottom);
 // Validate header
 $header_length = strlen($srslide_header_text);
 if ($header_length < 1 or $header_length > 30) {
     $errors[] = __("Header text must be between 1 and 30 characters.", 'srslide');
 } else {
     update_option('srslide_header_text', strtoupper($srslide_header_text));
 }
 // Validate api_key
 if (!srslide_validate_api_key($srslide_api_key)) {
     $errors[] = __("API Key should be 32 characters. Please double check your entry.", 'srslide');
 }
 // Validate pid
 if (!srslide_validate_pid($srslide_pid)) {
     $errors[] = __("PID should be 24 characters. Please double check your entry.", 'srslide');
 }
 // Validate css options
 $url_error = false;
 if ($srslide_css_option == 1) {
     update_option('srslide_css_option', $srslide_css_option);
     update_option('srslide_css_url', '');
 } else {
     if ($srslide_css_option == 2) {
         if (function_exists('filter_var')) {
             if (!filter_var($srslide_css_url, FILTER_VALIDATE_URL)) {
                 $errors[] = __("The custom CSS URL you entered is invalid.  It must start with 'http'", 'srslide');
                 $url_error = true;
             }
         } else {