Created
July 2, 2012 09:53
-
-
Save jsilvestre/3032385 to your computer and use it in GitHub Desktop.
Facebook feed grabber WP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function authenticate( ) { | |
// Check that we have an App ID | |
if ( $this->appId == null ) | |
return false; | |
// Check that we have a secret | |
if ( $this->secret == null ) | |
return false; | |
// Make our facebook connection. | |
$this->facebook = new Facebook(array( | |
'appId' => $this->appId, | |
'secret' => $this->secret, | |
)); | |
/* START CHANGE */ | |
// proxy support | |
if(array_key_exists('proxy_url', $this->options) && !empty($this->options['proxy_url'])) { | |
Facebook::$CURL_OPTS[CURLOPT_PROXY] = $this->options['proxy_url']; | |
} | |
/* END CHANGE */ | |
if ( $this->facebook === false ) | |
return false; | |
else | |
return $this; | |
} | |
// End authenticate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* - - - - - - | |
Register our settings. | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
function settings_api_init() { | |
register_setting( 'facebook-feed-grabber', 'ffg_options', array(&$this, 'validate_options') ); | |
// App ID & Secret | |
add_settings_section('fb_app_info', __('Facebook App ID & Secret'), array(&$this, 'setting_section_callback_function'), __file__); | |
add_settings_field('ffg_app_id', __('App ID'), array(&$this, 'app_id_field'), __file__, 'fb_app_info'); | |
add_settings_field('ffg_secret', __('App Secret'), array(&$this, 'secret_field'), __FILE__, 'fb_app_info'); | |
add_settings_field('ffg_verify', __('Verify App Id & Secret'), array(&$this, 'verify_button'), __FILE__, 'fb_app_info'); | |
// Misc Settings | |
add_settings_section('misc_settings', __('Misc Settings'), array(&$this, 'setting_section_callback_function'), __file__); | |
add_settings_field('ffg_default_feed', __('Default Feed'), array(&$this, 'default_feed_field'), __file__, 'misc_settings'); | |
add_settings_field('ffg_num_entries', __('Number of Entries'), array(&$this, 'num_entries_field'), __file__, 'misc_settings'); | |
/* START CHANGE */ | |
add_settings_field('ffg_proxy_url', __('Proxy URL'), array(&$this, 'proxy_url_field'), | |
__file__, 'misc_settings'); | |
/* END CHANGE */ | |
add_settings_field('ffg_show_title', __('Show Title'), array(&$this, 'show_title_checkbox'), __FILE__, 'misc_settings'); | |
add_settings_field('ffg_limit', __('Limit to Posts From Feed'), array(&$this, 'limit_checkbox'), __FILE__, 'misc_settings'); | |
// add_settings_field('ffg_show_thumbnails', __('Show Thumbnails'), array(&$this, 'show_thumbnails_checkbox'), __FILE__, 'misc_settings' ); | |
add_settings_field('ffg_style_sheet', __('Styles Sheet'), array(&$this, 'style_sheet_radio'), __FILE__, 'misc_settings'); | |
add_settings_field('delete_options', __('Delete Options on Deactivation'), array(&$this, 'delete_options_checkbox'), __FILE__, 'misc_settings'); | |
} | |
// End settings_api_init() | |
// ............. | |
/* START CHANGE */ | |
/* - - - - - - | |
Proxy URL field | |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
function proxy_url_field() { | |
?> | |
<input type="text" name="ffg_options[proxy_url]" value="<?php echo esc_attr($this->options['proxy_url']); ?>" class="regular-text" /> | |
<span class="description"><?php _e('If your server connects to internet via a proxy, set the URL. Otherwise leave blank.') ?></span> | |
<?php | |
} | |
// End proxy_url_field() | |
/* END CHANGE */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment