function sunshine_init()
{
    global $sunshine;
    add_rewrite_endpoint($sunshine->options['endpoint_gallery'], EP_PERMALINK | EP_PAGES);
    add_rewrite_endpoint($sunshine->options['endpoint_image'], EP_PERMALINK | EP_PAGES);
    add_rewrite_endpoint($sunshine->options['endpoint_order'], EP_PERMALINK | EP_PAGES);
    SunshineUser::instance();
    SunshineCountries::instance();
    $functions = SUNSHINE_PATH . 'themes/' . $sunshine->options['theme'] . '/functions.php';
    if (file_exists($functions)) {
        include_once $functions;
    }
    if (is_admin()) {
        include_once 'admin/sunshine-admin.php';
    } else {
        SunshineSession::instance();
        SunshinePaymentMethods::instance();
        SunshineEmail::instance();
        SunshineFrontend::instance();
    }
}