/** * (non-PHPdoc) * @see Ai1ec_Connector_Plugin::handle_feeds_page_post() */ public function handle_feeds_page_post() { // Get tag and category here as they are needed in more than one function. $category = isset($_POST['ai1ec_facebook_feed_category']) ? $_POST['ai1ec_facebook_feed_category'] : ''; $tag = isset($_POST['ai1ec_facebook_feed_tags']) ? $_POST['ai1ec_facebook_feed_tags'] : ''; $enable_comments = false; $display_map = false; if (isset($_POST['ai1ec_facebook_comments_enabled']) && $_POST['ai1ec_facebook_comments_enabled'] > 0) { $enable_comments = 1; } if (isset($_POST['ai1ec_facebook_map_display_enabled']) && $_POST['ai1ec_facebook_map_display_enabled'] > 0) { $display_map = 1; } // Handle when the user wants to subscribe to his events if (isset($_POST['ai1ec_facebook_subscribe_yours'])) { // Get the user from session $facebook_user = $this->get_current_facebook_user_from_cache(); // Get the id of the user $current_user_id = $facebook_user->get_id(); // SUbscribe to it $this->subscribe_users(array($current_user_id), Ai1ec_Facebook_Graph_Object_Collection::FB_USER, $category, $tag, $enable_comments, $display_map); // Set the user as subscribed $facebook_user->set_subscribed(TRUE); // Set tag and categorsave_current_facebook_user_in_sessiony for the current user $facebook_user->set_category($category); $facebook_user->set_tag($tag); $facebook_user->set_enable_comments($enable_comments); $facebook_user->set_display_map($display_map); // Save the user back into the Session $this->save_facebook_user_in_cache($facebook_user); } // Handle when the user logs out if (isset($_POST['ai1ec_logout_facebook'])) { $this->do_facebook_logout(); } // Handle when the user subscribe other users. if (isset($_POST['ai1ec_subscribe_users'])) { foreach (Ai1ec_Facebook_Graph_Object_Collection::$fb_all_types as $type) { $name = Ai1ec_Facebook_Tab::FB_MULTISELECT_NAME . $type; if (isset($_POST[$name])) { $this->subscribe_users($_POST[$name], $type, $category, $tag, $enable_comments, $display_map); } } } // Handle when saving app_id_and secret from the modal if (isset($_POST[self::FB_SUBMIT_MODAL_NAME])) { $app_id = $_POST['ai1ec_facebook_app_id_modal']; $secret = $_POST['ai1ec_facebook_app_secret_modal']; $facebook_app = Ai1ec_Facebook_Factory::get_facebook_application_instance($app_id, $secret); try { $facebook_app->get_back_an_access_token_from_facebook_for_the_app(); $this->update_app_id_and_secret($app_id, $secret); $this->do_facebook_login(); } catch (Ai1ec_Error_Validating_App_Id_And_Secret $e) { $this->error_message_after_validating_app_id_and_secret = __($e->getMessage(), AI1EC_PLUGIN_NAME); } catch (Exception $e) { $this->error_message_after_validating_app_id_and_secret = __($e->getMessage(), AI1EC_PLUGIN_NAME); } } }