service->get( 'facebook' ); ?>

e( 'Token setting' ); ?>

admin; if ( is_wp_error( $error ) ) : ?>

get_error_code() === 410 ) : ?> e( 'Token is outdated. Click link and get new one.' ); ?> e( 'Token is not set. Please click link below and get one.' ); ?>

_( 'O.K. You have permission. If you want to renew token, please click link below. Token will be valid for %d days.' ), ( 60 - floor( ( time() - $this->option->get( 'gianism_facebook_admin_refreshed', 0 ) ) / 60 / 60 / 24 ) ) ); ?>

e( 'Get Token' ); ?> e( 'Read Only' ); ?> e( 'Get Token' ); ?> e( 'Publish' ); ?>

e( 'Account to use' ); ?>

admin ) ) : ?>

e( 'You need access token to manage accounts. Click links above and you can get Facebook API token.' ); ?>

admin_account ) : ?>

e( 'Failed to get your account. Please renew token.' ); ?>

e( 'Please select account to use.' ); ?>

e( 'Your Page' ); ?> admin_pages as $account ) { $out[] = sprintf( '', $account['id'], checked( $account['id'], $facebook->admin_id, false ), esc_html( $account['name'] ) ); } if ( $out ) : echo implode( '
', $out ); else : ?>

_( 'You can get token-ready Facebook PHP SDK\'s API client. For example, get latest news feed and show it on footer.' ), 'https://developers.facebook.com/docs/reference/php' ) ?>

' . $status . '';
});

/**
 * This function will return facebook's latest status
 *
 * @return string
 */
function my_fb_status(){
	// Use transient, because network I/O is slow.
	$status = get_transient('my_fb_status');
	if( false === $status ){
		// If settings are done,
		// You can get token-ready client with this function.
		$page = gianism_fb_page_api();
		if ( is_wp_error( $page ) ) {
			// Oops,
			return 'Sorry!';
		}
		// api method is SDK's method for Graph API
		$feeds = $fb->get("{$page_id}/feed");
		// Parse result and extract first message.
		foreach ( $feeds->getGraphEdge() as $fb_post ) {
			$status = $fb_post->getField( 'message' );
			break;
		}
		// Save it for 0.5h.
		set_transient( 'my_fb_status', $status, 60 * 60 * 0.5 );
	}
	return $status
}
PHP;
echo esc_html( $string );
?>

e( 'You should know about Facebook Graph API. Useful resources are below.' ); ?>

  1. Graph API Reference
  2. Graph API Explorer
  3. PHP SDK's documentation

_( 'For more detailed information, please visit our support site.' ), gianism_utm_link( 'https://gianism.info/', [ 'utm_medium' => 'fb-api', ] ) ); ?>