| 1 |
<?php |
| 2 |
/** |
| 3 |
* Connect Tab Facebook |
| 4 |
* |
| 5 |
* @package Powerkit |
| 6 |
* @subpackage Extensions |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( powerkit_connect( 'facebook_app_access_token' ) ) { |
| 10 |
?> |
| 11 |
|
| 12 |
<h3><?php esc_html_e( 'Facebook Account', 'powerkit' ); ?></h3> |
| 13 |
|
| 14 |
<p><span class="tab-badge-success"><?php esc_html_e( '✓ Account successfully connected', 'powerkit' ); ?></span></p> |
| 15 |
|
| 16 |
<?php |
| 17 |
$accounts = powerkit_connect( 'facebook_app_accounts' ); |
| 18 |
|
| 19 |
if ( $accounts ) { |
| 20 |
$usernames = array(); |
| 21 |
|
| 22 |
foreach ( $accounts as $account ) { |
| 23 |
if ( isset( $account['username'] ) ) { |
| 24 |
$usernames[] = sprintf( '<code>%s</code>', $account['username'] ); |
| 25 |
} else { |
| 26 |
$usernames[] = sprintf( '<code>%s</code>', $account['id'] ); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
if ( 1 === count( $usernames ) ) { |
| 31 |
?> |
| 32 |
<p><?php esc_html_e( 'Your Facebook page ID:', 'powerkit' ); ?> <?php echo wp_kses_post( implode( ', ', $usernames ) ); ?><?php esc_html_e( '. Please use this ID in settings when requested.', 'powerkit' ); ?></p> |
| 33 |
<?php |
| 34 |
} else { |
| 35 |
?> |
| 36 |
<p><?php esc_html_e( 'Available Facebook page IDs:', 'powerkit' ); ?> <?php echo wp_kses_post( implode( ', ', $usernames ) ); ?><?php esc_html_e( '. Please use one of these IDs in settings when requested.', 'powerkit' ); ?></p> |
| 37 |
<?php |
| 38 |
|
| 39 |
} |
| 40 |
} |
| 41 |
?> |
| 42 |
|
| 43 |
<form method="post" class="form-logout"> |
| 44 |
<?php wp_nonce_field(); ?> |
| 45 |
|
| 46 |
<input type="hidden" name="logout_account_type" value="facebook"> |
| 47 |
|
| 48 |
<p class="submit"> |
| 49 |
<input class="button button-primary" name="logout_account" type="submit" value="<?php esc_html_e( 'Disconnect', 'powerkit' ); ?>" /> |
| 50 |
</p> |
| 51 |
</form> |
| 52 |
<?php } else { ?> |
| 53 |
|
| 54 |
<h3><?php esc_html_e( 'Facebook Account', 'powerkit' ); ?></h3> |
| 55 |
|
| 56 |
<p><?php esc_html_e( 'Connect your Facebook account to automatically fetch the number of followers of your Facebook page.', 'powerkit' ); ?></p> |
| 57 |
<?php |
| 58 |
} |
| 59 |
|
| 60 |
?> |
| 61 |
|
| 62 |
<hr><br> |
| 63 |
|
| 64 |
<p><?php echo sprintf( __( 'You may also change the number of followers manually on <a href="%s" target="_blank">this page</a>.', 'powerkit' ), admin_url( 'options-general.php?page=powerkit_social_links' ) ); ?></p> |
| 65 |
|
| 66 |
<br> |
| 67 |
|
| 68 |
<form class="basic" method="post"> |
| 69 |
<h3><?php esc_html_e( 'Manual Settings', 'powerkit' ); ?></h3> |
| 70 |
|
| 71 |
<table class="form-table"> |
| 72 |
<tbody> |
| 73 |
<tr> |
| 74 |
<th scope="row"> |
| 75 |
<label for="powerkit_connect_facebook_app_id" class="title"> |
| 76 |
<?php esc_html_e( 'Facebook App ID', 'powerkit' ); ?> |
| 77 |
</label> |
| 78 |
</th> |
| 79 |
<td> |
| 80 |
<input class="regular-text" name="powerkit_connect_facebook_app_id" id="powerkit_connect_facebook_app_id" type="text" value="<?php echo esc_attr( get_option( 'powerkit_connect_facebook_app_id' ) ); ?>" /> |
| 81 |
<p class="description"><?php esc_html_e( 'The Facebook App ID is required if you want to display Facebook comments or Fanpage block on your site.', 'powerkit' ); ?></p> |
| 82 |
</td> |
| 83 |
</tr> |
| 84 |
</tbody> |
| 85 |
</table> |
| 86 |
|
| 87 |
<?php wp_nonce_field(); ?> |
| 88 |
|
| 89 |
<p class="submit"> |
| 90 |
<input class="button button-primary" name="save_facebook_settings" type="submit" value="<?php esc_html_e( 'Save manual settings', 'powerkit' ); ?>" /> |
| 91 |
</p> |
| 92 |
</form> |
| 93 |
|