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();
    }
}
                }
            }
        }
    }
    public static function state_dropdown($country, $name = 'state', $selected = '')
    {
        global $sunshine;
        $states = array();
        if ($country == '') {
            $country = $sunshine->options['country'];
        }
        if (isset(SunshineCountries::$states[$country])) {
            $states = SunshineCountries::$states[$country];
        }
        if ($selected == '') {
            $selected = SunshineUser::get_user_meta($name);
        }
        if ($states) {
            echo '<select name="' . $name . '">';
            echo '<option value="">' . __('Select state', 'sunshine') . '</option>';
            foreach ($states as $code => $name) {
                echo '<option value="' . $code . '" ' . selected($selected, $code, 0) . '>' . $name . '</option>';
            }
            echo '</select>';
        } else {
            echo '<input type="text" name="' . $name . '" value="' . $selected . '" />';
        }
    }
}
SunshineCountries::instance();