Esempio n. 1
0
function fb_get_social_publisher_fields()
{
    global $facebook;
    if (!isset($facebook)) {
        return;
    }
    $fan_page_option = array();
    if (!$facebook->getUser()) {
        $fan_page_option = array('name' => 'publish_to_fan_page', 'type' => 'disabled_text', 'disabled_text' => '<a href="#" onclick="authFacebook(); return false;">' . __('Link your Facebook account to your WordPress account to enable.', 'facebook') . '</a>', 'help_text' => __('All new posts will be automatically published to this Facebook Page.', 'facebook'));
    } else {
        $accounts = fb_get_user_pages();
        $accounts_options = array('disabled' => '[Disabled]');
        $options = get_option('fb_options');
        if (isset($options['social_publisher']) && isset($options['social_publisher']['publish_to_fan_page']) && $options['social_publisher']['publish_to_fan_page'] != 'disabled') {
            preg_match_all("/(.*?)@@!!(.*?)@@!!(.*?)\$/su", $options['social_publisher']['publish_to_fan_page'], $fan_page_info, PREG_SET_ORDER);
        }
        foreach ($accounts as $account) {
            if (isset($account['name']) && isset($account['category']) && $account['category'] != 'Application') {
                $account_options_key = $account['name'] . "@@!!" . $account['id'] . "@@!!" . $account['access_token'];
                $accounts_options[$account_options_key] = $account['name'];
                if (isset($fan_page_info) && isset($fan_page_info[0]) && isset($fan_page_info[0][2])) {
                    if ($account['id'] == $fan_page_info[0][2]) {
                        $options['social_publisher']['publish_to_fan_page'] = $account_options_key;
                        update_option('fb_options', $options);
                    }
                }
            }
        }
        $fan_page_option = array('name' => 'publish_to_fan_page', 'type' => 'dropdown', 'options' => $accounts_options, 'help_text' => __('New posts will be publish to this Facebook Page.', 'facebook'));
    }
    $parent = array('name' => 'social_publisher', 'type' => 'checkbox', 'label' => __('Social Publisher', 'facebook'), 'description' => __('Social Publisher allows you to publish to an Author\'s Facebook Timeline and Fan Page.	Authors can also mention Facebook friends and pages. ', 'facebook'), 'help_link' => 'http://developers.facebook.com/wordpress', 'image' => plugins_url('images/settings_social_publisher.png', __FILE__));
    $children = array(array('name' => 'publish_to_authors_facebook_timeline', 'label' => "Publish to author's Timeline", 'type' => 'checkbox', 'default' => true, 'onclick' => "window.open(\"http://developers.facebook.com/wordpress#author-og-setup\", \"Open Graph Setup\", \"fullscreen=no\");", 'help_text' => __('Publish new posts to the author\'s Facebook Timeline and allow mentioning friends. You must setup Open Graph in your App Settings. Enable the feature to learn how.', 'facebook'), 'help_link' => 'http://developers.facebook.com/wordpress#author-og-setup'), $fan_page_option, array('name' => 'mentions_show_on_homepage', 'type' => 'checkbox', 'default' => true, 'help_text' => __('Authors can mentions Facebook friends and pages in posts.	Enable this to show mentions on the homepage, as part of the post and page previews.', 'facebook')), array('name' => 'mentions_position', 'type' => 'dropdown', 'default' => 'both', 'options' => array('top' => 'top', 'bottom' => 'bottom', 'both' => 'both'), 'help_text' => __('Authors can mentions Facebook friends and pages in posts.	This controls where mentions will be displayed in the posts.', 'facebook')));
    fb_construct_fields('settings', $children, $parent);
}
Esempio n. 2
0
function fb_get_subscribe_fields($placement = 'settings', $object = null)
{
    $fields_array = fb_get_subscribe_fields_array($placement);
    fb_construct_fields($placement, $fields_array['children'], $fields_array['parent'], $object);
}
Esempio n. 3
0
/**
 * Gets the main settings
 *
 * @since 1.0
 */
function fb_get_main_settings_fields()
{
    $children = array(array('name' => 'app_id', 'label' => 'App ID', 'type' => 'text', 'help_text' => __('Your App ID.', 'facebook')), array('name' => 'app_secret', 'type' => 'text', 'help_text' => __('Your App Secret.', 'facebook')), array('name' => 'app_namespace', 'type' => 'text', 'help_text' => __('Your App Namespace.', 'facebook')));
    fb_construct_fields('settings', $children);
}
Esempio n. 4
0
function fb_get_recommendations_box_fields($placement = 'settings', $object = null)
{
    $fields_array = fb_get_recommendations_box_fields_array($placement);
    fb_construct_fields($placement, $fields_array['children'], null, $object);
}
Esempio n. 5
0
function fb_get_activity_feed_fields($placement = 'settings', $object = null)
{
    $fields_array = fb_get_activity_feed_fields_array($placement);
    fb_construct_fields($placement, $fields_array['children'], null, $object);
}