function Init()
 {
     // I18n
     load_plugin_textdomain(c_al2fb_text_domain, false, dirname(plugin_basename(__FILE__)) . '/language/');
     // Image request
     if (isset($_GET['al2fb_image'])) {
         $img = dirname(__FILE__) . '/wp-blue-s.png';
         header('Content-type: image/png');
         readfile($img);
         exit;
     }
     // Data URI request
     if (isset($_GET['al2fb_data_uri'])) {
         $post = get_post($_GET['al2fb_data_uri']);
         $data_uri = self::Get_first_image($post);
         // data:image/png;base64,
         // data:[<MIME-type>][;charset=<encoding>][;base64],<data>
         $semi = strpos($data_uri, ';');
         $comma = strpos($data_uri, ',');
         $content_type = substr($data_uri, 5, $semi - 5);
         $data = substr($data_uri, $comma + 1);
         header('Content-type: ' . $content_type);
         echo base64_decode($data);
         exit;
     }
     // Facebook registration
     if (isset($_REQUEST['al2fb_reg'])) {
         WPAL2Int::Facebook_registration();
         exit;
     }
     // Facebook login
     if (isset($_REQUEST['al2fb_login'])) {
         WPAL2Int::Facebook_login();
         exit;
     }
     // Facebook subscription
     if (isset($_REQUEST['al2fb_subscription'])) {
         self::Handle_fb_subscription();
         exit;
     }
     // Set default capability
     if (!get_option(c_al2fb_option_min_cap)) {
         update_option(c_al2fb_option_min_cap, 'edit_posts');
     }
     // Enqueue style sheet
     if (is_admin()) {
         $css_name = $this->Change_extension(basename($this->main_file), '-admin.css');
         $css_url = plugins_url($css_name, __FILE__);
         wp_register_style('al2fb_style_admin', $css_url);
         wp_enqueue_style('al2fb_style_admin');
     } else {
         $upload_dir = wp_upload_dir();
         $css_name = $this->Change_extension(basename($this->main_file), '.css');
         if (file_exists($upload_dir['basedir'] . '/' . $css_name)) {
             $css_url = $upload_dir['baseurl'] . '/' . $css_name;
         } else {
             if (file_exists(TEMPLATEPATH . '/' . $css_name)) {
                 $css_url = get_bloginfo('template_directory') . '/' . $css_name;
             } else {
                 $css_url = plugins_url($css_name, __FILE__);
             }
         }
         wp_register_style('al2fb_style', $css_url);
         wp_enqueue_style('al2fb_style');
     }
     if (get_option(c_al2fb_option_use_ssp) || is_admin()) {
         wp_enqueue_script('jquery');
     }
     // Social share privacy
     if (get_option(c_al2fb_option_use_ssp)) {
         wp_enqueue_script('socialshareprivacy', plugins_url('/js/jquery.socialshareprivacy.js', __FILE__), array('jquery'));
     }
     // Check user capability
     if (current_user_can(get_option(c_al2fb_option_min_cap))) {
         if (is_admin()) {
             // Initiate Facebook authorization
             if (isset($_REQUEST['al2fb_action']) && $_REQUEST['al2fb_action'] == 'init') {
                 // Debug info
                 update_option(c_al2fb_log_redir_init, date('c'));
                 // Get current user
                 global $user_ID;
                 get_currentuserinfo();
                 // Clear cache
                 WPAL2Int::Clear_fb_pages_cache($user_ID);
                 WPAL2Int::Clear_fb_groups_cache($user_ID);
                 WPAL2Int::Clear_fb_friends_cache($user_ID);
                 // Redirect
                 $auth_url = WPAL2Int::Authorize_url($user_ID);
                 try {
                     // Check
                     if (ini_get('safe_mode') || ini_get('open_basedir') || $this->debug) {
                         update_option(c_al2fb_log_redir_check, 'No');
                     } else {
                         $response = WPAL2Int::Request($auth_url, '', 'GET');
                         update_option(c_al2fb_log_redir_check, date('c'));
                     }
                     // Redirect
                     wp_redirect($auth_url);
                     exit;
                 } catch (Exception $e) {
                     // Register error
                     update_option(c_al2fb_log_redir_check, $e->getMessage());
                     update_option(c_al2fb_last_error, $e->getMessage());
                     update_option(c_al2fb_last_error_time, date('c'));
                     // Redirect
                     if (is_multisite()) {
                         global $blog_id;
                         $error_url = get_admin_url($blog_id, 'admin.php?page=' . $this->main_plugin_name, 'admin');
                     } else {
                         $error_url = admin_url('admin.php?page=' . $this->main_plugin_name);
                     }
                     $error_url .= '&al2fb_action=error';
                     $error_url .= '&error=' . urlencode($e->getMessage());
                     wp_redirect($error_url);
                     exit;
                 }
             }
         }
         // Handle Facebook authorization
         WPAL2Int::Authorize();
     }
     self::Upgrade();
 }