| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) or die(); |
| 3 |
/** @var \Gianism\UI\Screen $this */ |
| 4 |
/** @var \Gianism\Service\Facebook $instance */ |
| 5 |
?> |
| 6 |
<h3><i class="lsf lsf-facebook"></i> Facebook</h3> |
| 7 |
<table class="form-table"> |
| 8 |
<tbody> |
| 9 |
<tr> |
| 10 |
<th><label><?php $this->e( 'Connect with Facebook' ); ?></label></th> |
| 11 |
<td> |
| 12 |
<?php $this->switch_button( 'fb_enabled', $this->option->is_enabled( 'facebook' ), 1 ) ?> |
| 13 |
<p class="description"> |
| 14 |
<?php |
| 15 |
printf( |
| 16 |
$this->_( 'You have to create %1$s App <a target="_blank" href="%2$s">here</a> to get required infomation.' ), |
| 17 |
'Facebook', |
| 18 |
'https://developers.facebook.com/apps' |
| 19 |
); |
| 20 |
printf( |
| 21 |
$this->_( 'See detail at <a href="%1$s">%2$s</a>.' ), |
| 22 |
$this->setting_url( 'setup' ), |
| 23 |
$this->_( 'How to set up' ) |
| 24 |
); |
| 25 |
?> |
| 26 |
</p> |
| 27 |
</td> |
| 28 |
</tr> |
| 29 |
<tr> |
| 30 |
<th><label for="fb_app_id"><?php $this->e( 'App ID' ); ?></label></th> |
| 31 |
<td> |
| 32 |
<input type="text" class="regular-text" name="fb_app_id" id="fb_app_id" |
| 33 |
value="<?php echo esc_attr( $instance->fb_app_id ) ?>"/> |
| 34 |
</td> |
| 35 |
</tr> |
| 36 |
<tr> |
| 37 |
<th><label for="fb_app_secret"><?php $this->e( 'App Secret' ); ?></label></th> |
| 38 |
<td> |
| 39 |
<input type="text" class="regular-text" name="fb_app_secret" id="fb_app_secret" |
| 40 |
value="<?php echo esc_attr( $instance->fb_app_secret ) ?>"/> |
| 41 |
</td> |
| 42 |
</tr> |
| 43 |
<tr> |
| 44 |
<th><label for="fb_version"><?php $this->e( 'API Version' ); ?></label></th> |
| 45 |
<td> |
| 46 |
<input type="text" class="regular-text" name="fb_version" id="fb_version" placeholder="<?php echo esc_attr( $instance->minimum_api_version ) ?>" |
| 47 |
value="<?php echo esc_attr( $instance->fb_version ) ?>"/> |
| 48 |
<p class="description"> |
| 49 |
<?php |
| 50 |
$this->new_from( '3.0.0' ); |
| 51 |
echo wp_kses_post( sprintf( __( 'Enter Facebook API version for your app. Facebook API\'s life cycle is 2 years. Format should be <code>v0.0</code>. Less than minimum version <code>%s</code> will be ignored.', 'wp-gianism' ), $instance->minimum_api_version ) ); |
| 52 |
?> |
| 53 |
</p> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
<tr> |
| 57 |
<th><label for="fb_redirect_uri"><?php esc_html_e( 'Redirect URI', 'wp-gianism' ); ?></label></th> |
| 58 |
<td> |
| 59 |
<?php $end_point = $instance->get_redirect_endpoint(); ?> |
| 60 |
<input type="text" class="regular-text" name="fb_redirect_uri" id="fb_redirect_uri" readonly |
| 61 |
value="<?php echo esc_attr( $end_point ) ?>"/> |
| 62 |
<a class="button" href="<?php echo esc_attr( $end_point ) ?>" |
| 63 |
onclick="window.prompt('<?php esc_attr_e( 'Please copy this URL.', 'wp-gianism' ) ?>', this.href); return false;"><?php $this->e( 'Copy' ) ?></a> |
| 64 |
<p class="description"> |
| 65 |
<?php |
| 66 |
$this->new_from( '3.0.9' ); |
| 67 |
$setting_uri = 'https://developers.facebook.com/apps/' . $instance->fb_app_id . '/fb-login/settings/'; |
| 68 |
echo wp_kses_post( sprintf( |
| 69 |
// translators: %1$s is fb URL, %2$s blog post URL. |
| 70 |
__( 'Since March 2018, Facebook changes redirect URIs policy and you must set URI above as <a href="%1$s" target="_blank">Valid OAuth Redirect URIs</a>. For more detail, see our <a href="%2$s" target="_blank">blog post</a>.', 'wp-gianism' ), |
| 71 |
esc_attr( $setting_uri ), |
| 72 |
'https://gianism.info/2018/03/23/failed-facebook-login-since-2018/' |
| 73 |
) ); |
| 74 |
?> |
| 75 |
|
| 76 |
</p> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<tr> |
| 80 |
<th><label><?php $this->e( 'Use Facebook API' ); ?></label></th> |
| 81 |
<td> |
| 82 |
<?php $this->switch_button( 'fb_use_api', $instance->fb_use_api ) ?> |
| 83 |
<p class="description"> |
| 84 |
<?php |
| 85 |
$this->new_from( '2.2' ); |
| 86 |
$this->e( 'If enabled, you can get Facebook API Token for this site.' ); |
| 87 |
?> |
| 88 |
</p> |
| 89 |
<?php if ( $instance->fb_use_api ) : ?> |
| 90 |
<p class="notice"> |
| 91 |
<?php printf( $this->_( 'You must set up token on <a href="%s">Facebook API page</a>.' ), $this->setting_url( 'fb-api' ) ) ?> |
| 92 |
</p> |
| 93 |
<?php endif; ?> |
| 94 |
</td> |
| 95 |
</tr> |
| 96 |
</tbody> |
| 97 |
</table> |
| 98 |
<?php submit_button(); ?> |
| 99 |
|