Facebook_Helpers::get_tab_content()

The tab content.

Contents


Return Return

(string) the HTML content of the tab.


Source Source

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

	public function get_tab_content() {

		ob_start();

		$message = '';

		$message .= $this->get_inline_style();

		$message .= sprintf(
			'<p>%s</p><p>%s</p>',
			__(
				'Connecting to Automator Facebook API requires 
                    that you connect your existing Facebook Account with Automator App. 
                    You must grant Automator App an access to the Facebook Pages and the Instagram Business Account (if you need Instagram later) 
                    that you manage in order for Automator to work properly.',
				'uncanny-automator'
			),
			__(
				"Click the 'Connect Facebook Pages' to get started and click on the 'Disconnect Facebook Pages' to disconnect your Facebook account.",
				'uncanny-automator'
			)
		);

		$tab = filter_input( 1, 'tab', 513 );

		if ( 'facebook_api' !== $tab ) {
			return $message;
		}

		$error_status = filter_input( INPUT_GET, 'status', FILTER_DEFAULT );

		if ( 'error' === $error_status ) {
			$message .= '<div class="error error-message">' . __( 'An error was encountered while authenticating. Permission is denied.', 'uncanny-automator' ) . '</div>';
		}

		if ( $this->is_user_connected() ) : ?>

			<?php $user = $this->get_user_connected(); ?>

			<?php if ( isset( $user['user_id'] ) && ! empty( isset( $user['user_id'] ) ) ) : ?>

				<h4> 
					<?php esc_html_e( 'Facebook Account', 'automator-pro' ); ?>
				</h4>

				<div class="uo-fb-connected-account">	

					<?php $fb_profile_link = '#'; // Dont show facebook profile. ?>

					<a class="uo-fb-connected-account__user-card" href="<?php echo esc_url( $fb_profile_link ); ?>" title="<?php echo esc_attr( $user['name'] ); ?>">
						<img alt="<?php echo esc_attr( $user['name'] ); ?>" width="24" src="<?php echo esc_url( $user['picture'] ); ?>" />
						<?php echo esc_html( $user['name'] ); ?>
					</a>

				</div>

			<?php endif; ?>

			<h4>
				<?php esc_html_e( 'Linked pages', 'uncanny-automator' ); ?>
			</h4>

			<div id="uo-user-fb-pages">
				<p>
					<span class="dashicons dashicons-image-rotate uo-preloader-rotate"></span>
					<?php esc_html_e( 'Please wait while we fetch the Facebook Pages that you have linked to Automator App...', 'uncanny-automator' ); ?>
				</p>
			</div>

			<p>
				<span class="dashicons dashicons-info-outline" style="font-size: 14px; position: relative; top: 3.25px;"></span>
				<?php esc_html_e( 'Click on the Change Account Settings button to re-connect your Facebook Account and Facebook Pages.', 'uncanny-automator' ); ?>
			</p>
			<a title="<?php esc_attr_e( 'Change Account Settings', 'uncanny-automator' ); ?>" href="<?php echo esc_url( $this->get_login_dialog_uri() ); ?>" class="uo-settings-btn uo-settings-btn--secondary">
				<?php esc_html_e( 'Change Account Settings', 'uncanny-automator' ); ?>
			</a>

			<?php
			$this->get_inline_js();
			$message .= ob_get_clean();

		endif;

		return $message;
	}