*
* @package  Shortcodes Pro
* @author   Matt Varone
*/
// Start WordPress
require_once '../../../../wp-load.php';
// Check for Shortcodes Pro
if (!defined('MV_SHORTCODES_PRO_VERSION')) {
    die(__('Shortcodes Pro error. Plugin not initialized.', 'shortcodes-pro'));
}
// Check user is logged and with correct permissions.
if (!is_user_logged_in() or !current_user_can('edit_posts')) {
    $sp_base->die_error(__('Cheating?. Please verify your settings', 'shortcodes-pro'));
}
// Start the base class
$sp_base = new MV_ShortcodesPro_Base();
// Check to see if shortcode is being passed
if (!isset($_GET['shortcode'])) {
    $sp_base->die_error(__('Shortcode not found. Please verify your settings', 'shortcodes-pro'));
}
// Get the shortcode
$shortcode = $sp_base->get_shortcode(esc_attr($_GET['shortcode']));
// Check Shortcode
if (!$shortcode) {
    $sp_base->die_error(__('The Shortcode does not exist. Please verify your settings', 'shortcodes-pro'));
}
// Get Shortcode data
$post = get_post($shortcode, OBJECT);
$options = get_post_custom($post->ID);
// Check Button
if (isset($options['button'][0]) && $options['button'][0] != "on") {
*
* @package  Shortcodes Pro
* @author   Matt Varone
*/
// set the correct header
header("Content-type: application/x-javascript");
// require wordpress
require_once '../../../../wp-load.php';
if (!defined('MV_SHORTCODES_PRO_VERSION')) {
    die(__('Shortcodes Pro error. Could not initialize WordPress', 'shortcodes-pro'));
}
$out = "";
//get_transient( 'sp.get.buttons.edit' );
if ($out == "") {
    // start the base class
    $sp_base = new MV_ShortcodesPro_Base();
    // get all shortcode buttons
    $shortcodes = $sp_base->get_buttons();
    // check if we have shortcodes
    if (count($shortcodes) > 0) {
        // start the output
        $out = "(function() {\n";
        // loop trough each shortcode
        foreach ($shortcodes as $shortcode) {
            // create shortcode variables
            $shortcode_title = $shortcode->post_title;
            $shortcode_desc = get_post_meta($shortcode->ID, 'desc', true);
            $shortcode_type = get_post_meta($shortcode->ID, 'type', true);
            $shortcode_attributes = get_post_meta($shortcode->ID, 'attributes', true);
            $total_attributes = get_post_meta($shortcode->ID, 'totalattr', true);
            $shortcode_width_meta = (int) get_post_meta($shortcode->ID, 'width', true);