public static function serve() { if (!function_exists('curl_init')) { return false; } $google = Wdgpo_GoogleAuth::get_instance(); $google->import_gplus_data(); }
private function _add_settings_page_help() { $auth = Wdgpo_GoogleAuth::get_instance(); $this->_help->add_page('settings_page_wdgpo', array(array('id' => 'wdgpo-intro', 'title' => __('Intro', 'wdgpo'), 'content' => '<p>' . __('This is where you configure <b>Google+</b> plugin for your site', 'wdgpo') . '</p>'), array('id' => 'wdgpo-general', 'title' => __('General Info', 'wdgpo'), 'content' => '' . '<p>' . __('The Google+ Plugin is your one-stop solution for total WordPress - Google Plus integration. This is the only plugin you\'ll ever need to take full advantage of Google\'s social media tools.', 'wdgpo') . '</p>' . '<p><b>' . __('Check out the Google+ Plugin\'s awesome features:', 'wdgpo') . '</b></p>' . '<ul>' . '<li>' . __('<b>Add a +1 button to your site</b> and let visitors spread the word about your content.', 'wdgpo') . '</li>' . '<li>' . __('<b>Integrate your WordPress site with Google Pages</b> so people can easily add you to their circles.', 'wdgpo') . '</li>' . '<li>' . __('<b>Post directly to WordPress from Google+</b> for a faster blogging experience.', 'wdgpo') . '</li>' . '<li>' . __('<b>Post from G+ directly to your BuddyPress activity stream</b>', 'wdgpo') . '</li>' . '</ul>' . ''), array('id' => 'wdgpo-google-setup', 'title' => __('Setting up your Google+ account info', 'wdgpo'), 'content' => '' . '<p>' . __('Follow these steps to set up <em>My Google+ page ID</em> and <em>My Google+ profile ID</em> fields', 'wdgpo') . '</p>' . '<ol>' . '<li>' . __('If you don\'t already own a Google+ account, go to the <a href="https://plus.google.com/" target="_blank">Google+ page</a> and get an account', 'wdgpo') . '</li>' . '<li>' . __('Once you have an account, sign in', 'wdgpo') . '</li>' . '<li>' . __('Next, click on your name and in the URL at the top is a long number right before <code>/posts</code>', 'wdgpo') . '</li>' . '<li>' . __('Copy the number (approximately 21 characters)', 'wdgpo') . '</li>' . '<li>' . __('Paste it into <em>My Google+ profile ID</em> field', 'wdgpo') . '</li>' . '<li>' . __('To set up Google+ page ID, navigate to your Google+ page', 'wdgpo') . '</li>' . '<li>' . __('Copy the long number at the end of the URL (approximately 20ish characters)', 'wdgpo') . '</li>' . '<li>' . __('Paste it into <em>My Google+ page ID</em> field', 'wdgpo') . '</li>' . '</ol>' . ''), array('id' => 'wdgpo-api-setup', 'title' => __('Setting up Google API settings', 'wdgpo'), 'content' => '' . '<p>' . __('Follow these steps to set up <em>My Google+ page ID</em> and <em>My Google+ profile ID</em> fields', 'wdgpo') . '</p>' . "<ol>" . "<li><a href='https://code.google.com/apis/console/'>" . __('Create a project in Google API Console', 'wdgpo') . '</a></li>' . '<li>' . __('Under "Services" tab, turn "Google+ API" to <b>ON</b>', 'wdgpo') . '</li>' . '<li>' . sprintf(__("Under "API Access" click "Create oAuth Client Access." Fill in your details and use this as your "Authorized Redirect URIs": <code>%s</code>", 'wdgpo'), esc_url($auth->get_redirect_url())) . '</li>' . '<li>' . __('Copy your <b>Client ID</b> and <b>Client secret</b> values and paste them in the corresponding fields on this page', 'wdgpo') . '</li>' . '<li>' . __('Save your plugin settings and click the "Authenticate" button', 'wdgpo') . '</li>' . "</ol>" . ''), array('id' => 'wdgpo-plusone', 'title' => __('Settings', 'wdgpo'), 'content' => '' . '<h4>' . __('Google +1 settings', 'wdgpo') . '</h4>' . '<p>' . __('Set up appearance and behavior of your +1 buttons. For integration with your Google Analytics setup, see <b>Google Analytics integration</b> further down the page.', 'wdgpo') . '</p>' . '<h4>' . __('Google+ Pages and Profiles', 'wdgpo') . '</h4>' . '<p>' . __('Set up your Google+ identities for Google+ Pages integration and syncing posts with WordPress.', 'wdgpo') . '</p>' . '<h4>' . __('Google+ activities import', 'wdgpo') . '</h4>' . '<p>' . __('Set up synchronisation of your Google+ profiles and your WordPress blog.', 'wdgpo') . '</p>' . '')), $this->_sidebar, true); }
function create_gplus_app_settings_box() { if (!function_exists('curl_init')) { return false; } $opt = $this->_get_option(); $page_id = esc_attr(@$opt['gplus_page_id']); $profile_id = esc_attr(@$opt['gplus_profile_id']); $client_id = esc_attr(@$opt['gplus_client_id']); $client_secret = esc_attr(@$opt['gplus_client_secret']); $auth = Wdgpo_GoogleAuth::get_instance(); echo "<ol>"; echo "<li><a href='https://code.google.com/apis/console/'>" . __('Create a project in Google API Console', 'wdgpo') . '</a></li>'; echo '<li>' . __('Under "Services" tab, turn "Google+ API" to <b>ON</b>', 'wdgpo') . '</li>'; echo '<li>' . sprintf(__("Under "API Access" click "Create oAuth Client Access." Fill in your details and use this as your "Authorized Redirect URIs": <code>%s</code>", 'wdgpo'), esc_url($auth->get_redirect_url())) . '</li>'; echo '<li>' . __('Copy your <b>Client ID</b> and <b>Client secret</b> values and paste them in the fields below', 'wdgpo') . '</li>'; echo '<li>' . __('Save your plugin settings and click the "Authenticate" button', 'wdgpo') . '</li>'; echo "</ol>"; echo '<label for="wdgpo-gplus_client_id">' . __('Client ID', 'wdgpo') . '</label>' . "<input type='text' id='wdgpo-gplus_client_id' name='wdgpo[gplus_client_id]' class='widefat' value='{$client_id}' />" . "</br>\n"; echo '<label for="wdgpo-gplus_client_secret">' . __('Client secret', 'wdgpo') . '</label>' . "<input type='text' id='wdgpo-gplus_client_secret' name='wdgpo[gplus_client_secret]' class='widefat' value='{$client_secret}' />" . "</br>\n"; $url = $auth->get_auth_url(); if (!$page_id && !$profile_id) { echo '<p><b>' . __('You need to set up the page and/or profile ID fields to enable Google+ integration.', 'wdgpo') . '</b></p>'; } if (!$client_id || !$client_secret) { echo '<p><b>' . __('You need to set up your app info to enable Google+ imports.', 'wdgpo') . '</b></p>'; } if ($client_id && $client_secret && $url && ($page_id || $profile_id)) { echo "<input type='hidden' id='wdgpo-gplus_auth_url' value='" . esc_url($url) . "' />"; echo "<p><input type='button' id='wdgpo-gplus_authenticate' value='" . esc_attr(__('Authenticate', 'wdgpo')) . "' /></p>\n"; } else { if ($client_id && $client_secret && ($page_id || $profile_id)) { echo "<p><input type='button' id='wdgpo-gplus_test_import' value='" . esc_attr(__('Test', 'wdgpo')) . "' /></p>\n"; echo "<p><small><a href='#' id='wdgpo-gplus_deauthenticate'>" . esc_attr(__('Deauthenticate', 'wdgpo')) . "</a></small></p>\n"; } } }
function json_gplus_import_now() { if (!function_exists('curl_init')) { return false; } $google = Wdgpo_GoogleAuth::get_instance(); $data = $google->import_gplus_data(); header('Content-type: application/json'); echo json_encode(array("results" => $data)); die; }