get( 'Version' );
$client_id = '380204239234502';
$base_url = "https://www.facebook.com/$api_version/dialog/oauth";
$redirect_uri = flatsome_api_url() . '/facebook/authorize/';
$scope = 'pages_read_engagement,instagram_basic,public_profile';
$state = urlencode( admin_url( "admin.php?page=optionsframework&tab=of-option-instagram&ver=$version" ) );
$response_type = 'code';
return "$base_url?client_id=$client_id&response_type=$response_type&scope=$scope&redirect_uri=$redirect_uri&state=$state";
}
function flatsome_facebook_login_button_html() {
$url = flatsome_facebook_oauth_url();
ob_start(); ?>
$id ) {
if ( is_array( $old_values ) && array_key_exists( $username, $old_values ) ) {
$result[ $username ] = $old_values[ $username ];
} else {
$result[ $username ] = $id;
}
}
return $result;
}
add_filter( 'pre_set_theme_mod_facebook_accounts', 'flatsome_facebook_set_theme_mod', 10, 2 );
/**
* Deletes the Instagram oEmbed cache and transients.
*
* @return void
*/
function flatsome_facebook_clear_cache() {
global $wpdb;
if ( isset( $_POST['flatsome_instagram_clear_cache'] ) ) {
delete_option( 'flatsome_instagram_oembed_cache' );
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_flatsome\_instagram%');" );
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_timeout\_flatsome\_instagram%');" );
}
}
add_action( 'of_save_options_before', 'flatsome_facebook_clear_cache' );