function sc_admin_page()
{
    $sc_updated = false;
    $sc_options = get_option('shortcoder_data');
    $sc_flags = get_option('shortcoder_flags');
    $title = __("Create a Shortcode", 'shortcoder');
    $button = __("Create Shortcode", 'shortcoder');
    $edit = 0;
    $sc_content = '';
    $sc_disable = 0;
    $sc_hide_admin = 0;
    // Insert shortcode
    if (isset($_POST["sc_form_main"]) && $_POST["sc_form_main"] == '1' && check_admin_referer('shortcoder_create_form')) {
        $sc_options = get_option('shortcoder_data');
        $sc_name = stripslashes($_POST['sc_name']);
        $sc_post_disabled = isset($_POST['sc_disable']) ? intval($_POST['sc_disable']) : 0;
        $sc_post_hideadmin = isset($_POST['sc_hide_admin']) ? intval($_POST['sc_hide_admin']) : 0;
        $sc_options[$sc_name] = array('content' => stripslashes($_POST['sc_content']), 'disabled' => $sc_post_disabled, 'hide_admin' => $sc_post_hideadmin);
        // Updating the DB
        update_option("shortcoder_data", $sc_options);
        $sc_updated = true;
        // Insert Message
        if ($sc_updated == 'true') {
            echo '<div class="message updated fade"><p>' . __('Shortcode updated successfully !', 'shortcoder') . '</p></div>';
        } else {
            echo '<div class="message error fade"><p>' . __('Unable to create shortcode !', 'shortcoder') . '</p></div>';
        }
    }
    // Edit shortcode
    if (isset($_POST["sc_form_edit"]) && $_POST["sc_form_edit"] == '1' && check_admin_referer('shortcoder_edit_form')) {
        $sc_options = get_option('shortcoder_data');
        $sc_name_edit = stripslashes($_POST['sc_name_edit']);
        if ($_POST["sc_form_action"] == "edit") {
            $sc_content = stripslashes($sc_options[$sc_name_edit]['content']);
            $sc_disable = $sc_options[$sc_name_edit]['disabled'];
            $sc_hide_admin = $sc_options[$sc_name_edit]['hide_admin'];
            $title = __('Edit this Shortcode - ', 'shortcoder') . '<small>' . $sc_name_edit . '</small>';
            $button = __('Update Shortcode', 'shortcoder');
            $edit = 1;
        } else {
            unset($sc_options[$sc_name_edit]);
            unset($sc_name_edit);
            update_option("shortcoder_data", $sc_options);
            echo '<div class="message updated fade"><p>' . __('Shortcode deleted successfully !', 'shortcoder') . '</p></div>';
        }
    }
    ?>

<!-- Shortcoder Admin page --> 

<div class="wrap">
<?php 
    sc_admin_buttons('fbrec');
    ?>
<h2><img width="32" height="32" src="<?php 
    echo SC_URL;
    ?>
/images/shortcoder.png" align="absmiddle"/> Shortcoder<sup class="smallText"> v<?php 
    echo SC_VERSION;
    ?>
</sup></h2>

<ul class="sc_share_wrap">
<li class="sc_donate" data-width="300" data-height="220" data-url="<?php 
    echo SC_URL . '/js/share.php?i=1';
    ?>
"><a href="#"></a></li>
<li class="sc_share"  data-width="350" data-height="85" data-url="<?php 
    echo SC_URL . '/js/share.php?i=2';
    ?>
"><a href="#"></a></li>
</ul>

<div id="content">
	
	<h3><?php 
    echo $title;
    ?>
 <?php 
    if ($edit == 1) {
        echo '<span class="button sc_back">&lt;&lt; ' . __("Back", 'shortcoder') . '</span>';
    }
    ?>
 </h3>
	
	<form method="post" id="sc_form">
	
		<div class="sc_section">
			<label for="sc_name" class="sc_fld_title"><?php 
    _e("Title:", 'shortcoder');
    ?>
:</label>
			<span class="sc_name_wrap"><input type="text" name="sc_name" id="sc_name" value="<?php 
    echo isset($sc_name_edit) ? $sc_name_edit : '';
    ?>
" placeholder="Enter a shortcode name" class="widefat" required="required"/><div id="sc_code"></div></span>
		</div>
		

		<div class="sc_section">
			<label for="sc_content" class="sc_fld_title"><?php 
    _e("Content:", 'shortcoder');
    ?>
:</label>
			<?php 
    wp_editor($sc_content, 'sc_content', array('wpautop' => false, 'textarea_rows' => 8));
    ?>
		</div>
		
		
		<div class="sc_section"><p><b>Note:</b> Use <strong style="color:#006600">%%someParameter%%</strong> to insert custom parameters. <a href="http://www.aakashweb.com/docs/shortcoder-doc/" target="_blank">Learn More</a></p></div>
		
		<div class="sc_section">
		
			<table width="100%"><tr>
				
				<td width="50%" class="sc_settings"><label><input name="sc_disable" type="checkbox" value="1" <?php 
    echo $sc_disable == "1" ? 'checked="checked"' : "";
    ?>
/> <?php 
    _e("Temporarily disable this shortcode", 'shortcoder');
    ?>
</label>
				<label><input name="sc_hide_admin" type="checkbox" value="1" <?php 
    echo $sc_hide_admin == "1" ? 'checked="checked"' : "";
    ?>
/> <?php 
    _e("Disable this Shortcode to admins", 'shortcoder');
    ?>
</label></td>
				
				<td><p align="right"><input type="submit" name="sc_submit" id="sc_submit" class="button-primary" value="<?php 
    echo $button;
    ?>
" /></p></td>
	
			</tr></table>
	
		</div>
		
		<?php 
    wp_nonce_field('shortcoder_create_form');
    ?>
		<input name="sc_form_main" type="hidden" value="1" />
	</form>
	
	<h3><?php 
    _e("Created Shortcodes", 'shortcoder');
    ?>
 <small>(<?php 
    _e("Click to edit", 'shortcoder');
    ?>
)</small></h3>
	<form method="post" id="sc_edit_form">
		<ul id="sc_list" class="clearfix">
		<?php 
    $sc_options = get_option('shortcoder_data');
    if (is_array($sc_options)) {
        foreach ($sc_options as $key => $value) {
            echo '<li>' . $key . '</li>';
        }
    }
    ?>
		</ul>
		
		<?php 
    wp_nonce_field('shortcoder_edit_form');
    ?>
		<input name="sc_form_edit" type="hidden" value="1" />
		<input name="sc_form_action" id="sc_form_action" type="hidden" value="edit" />
		<input name="sc_name_edit" id="sc_name_edit" type="hidden" />
	</form>
	
	<div id="sc_delete" title="Drag & drop shortcodes to delete"></div>
	
</div><!-- Content -->

<br/>
<p align="center">
	<a href="http://www.aakashweb.com/forum/" target="_blank">Report bugs</a> | <a href="http://www.aakashweb.com/forum/" target="_blank">Support Forum</a> | <a href="http://www.aakashweb.com/wordpress-plugins/shortcoder/" target="_blank">Help</a> | <a href="http://bit.ly/scdonate" target="_blank">Donate</a><br/><br/>
	<a href="#" class="sc_open_video">(Demo video)</a><br /><br />
	<a href="https://twitter.com/vaakash" target="_blank">Follow @vaakash</a><br/><br/>
	<a href="http://www.aakashweb.com/" target="_blank" class="sc_credits">a plugin from Aakash Web</a>
</p>


</div><!-- Wrap -->

<?php 
}
});

var sc_closeiframe = function(){
	$('.sc_share_iframe').remove();
}

function wsc(s){
	if(s == null)
		return '';
	return s.indexOf(' ') >= 0;
}
</script>
</head>
<body>
<?php 
sc_admin_buttons('fbrec');
?>
<h2><img src="images/shortcoder.png" align="absmiddle" alt="Shortcoder" width="35px"/> Insert shortcode to editor</h2>

<div class="sc_wrap">
<?php 
foreach ($sc_options as $key => $value) {
    if ($key != '_version_fix') {
        echo '<div class="sc_shortcode"><div class="sc_shortcode_name">' . $key;
        echo '</div>';
        preg_match_all('/%%[^%\\s]+%%/', $value['content'], $matches);
        echo '<div class="sc_params">';
        if (!empty($matches[0])) {
            echo '<h4>Available parameters: </h4>';
            $temp = array();
            foreach ($matches[0] as $k => $v) {