<?php
// Mimic the actuall admin-ajax.
define( 'DOING_AJAX', true );

if( ! isset( $_REQUEST[ 'action' ] ) )
    die( '-1' );

global $swifty_build_use;
$swifty_build_use = 'build';

if( $swifty_build_use == 'build' ) {
    require_once( '../../../../../wp-load.php' );
} else {
    // __FILE__ understands symlinks too well. So we use a environment variable
    require_once( getenv( 'WP_LOAD_PHP' ) );
}

// Typical headers.
header( 'Content-Type: text/html' );
send_nosniff_header();

// Caching.
$expires = 60 * 15;        // 15 minutes
header( 'Pragma: public' );
header( 'Cache-Control: maxage=' . $expires );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires ) . ' GMT' );

$action = esc_attr(trim($_REQUEST['action']));

// A bit of security.
$allowed_actions = array(
    'ssd_dynamic_css'
);

////For logged in users
//add_action('wp_ajax_custom_action1', 'handler_fun1');
//add_action('wp_ajax_custom_action2', 'handler_fun1');
//
////For guests
//add_action('wp_ajax_nopriv_custom_action2', 'handler_fun2');
//add_action('wp_ajax_nopriv_custom_action1', 'handler_fun1');

if( in_array( $action, $allowed_actions ) ) {
    if( is_user_logged_in() )
        do_action( 'wp_ajax_' . $action );
    else
        do_action( 'wp_ajax_nopriv_' . $action );
} else {
    die( '-1' );
}