Facebook_Helpers::__construct()


Source Source

File: src/integrations/facebook/helpers/facebook-helpers.php

	public function __construct() {

		$this->load_options = Automator()->helpers->recipe->maybe_load_trigger_options( __CLASS__ );

		$this->setting_tab = 'facebook_api';

		$this->fb_endpoint_uri = AUTOMATOR_API_URL . 'v2/facebook';

		$this->wp_ajax_action = 'automator_integration_facebook_capture_token';

		// Allow overwrite in wp-config.php.
		if ( DEFINED( 'UO_AUTOMATOR_DEV_FB_ENDPOINT_URL' ) ) {
			$this->fb_endpoint_uri = UO_AUTOMATOR_DEV_FB_ENDPOINT_URL;
		}

		// Adds new section to tab.
		add_filter( 'automator_settings_tabs', array( $this, 'add_facebook_api_settings' ), 15 );

		// Adds new button to settings tab.
		add_filter( 'automator_after_settings_extra_buttons', array( $this, 'facebook_connect_button_html' ), 10, 3 );

		// Capturing the OAuth Token and user id.
		add_action( "wp_ajax_{$this->wp_ajax_action}", array( $this, $this->wp_ajax_action ), 10 );

		// Add a disconnect button.
		add_action( "wp_ajax_{$this->wp_ajax_action}_disconnect", array( $this, sprintf( '%s_disconnect', $this->wp_ajax_action ) ) );

		// Add a fetch user pages action.
		add_action( "wp_ajax_{$this->wp_ajax_action}_fetch_user_pages", array( $this, sprintf( '%s_fetch_user_pages', $this->wp_ajax_action ) ) );

	}