function shareaholic_advanced_settings_form_submit($form, &$form_state)
{
    if (ShareaholicUtilities::has_tos_and_apikey()) {
        ShareaholicUtilities::update_options(array('disable_og_tags' => $form_state['values']['disable_og_tags'] === 1 ? 'on' : 'off', 'disable_internal_share_counts_api' => $form_state['values']['disable_internal_share_counts_api'] === 1 ? 'on' : 'off'));
        drupal_set_message(t('Settings Saved: please clear your cache.'), 'status');
    }
}
Exemple #2
0
 /**
  * Checks whether the api key has been verified
  * using the rails endpoint. Once the key has
  * been verified, we store that away so that we
  * don't have to check again.
  *
  * @return bool
  */
 public static function api_key_verified()
 {
     $settings = self::get_settings();
     if (isset($settings['api_key_verified']) && $settings['api_key_verified']) {
         return true;
     }
     $api_key = $settings['api_key'];
     if (!$api_key) {
         return false;
     }
     $response = ShareaholicCurl::get(Shareaholic::API_URL . '/publisher_tools/' . $api_key . '/verified');
     $result = $response['body'];
     if ($result == 'true') {
         ShareaholicUtilities::update_options(array('api_key_verified' => true));
     }
 }
Exemple #3
0
 /**
  * Checks whether the api key has been verified
  * using the rails endpoint. Once the key has
  * been verified, we store that away so that we
  * don't have to check again.
  *
  * @return bool
  */
 public static function api_key_verified()
 {
     $settings = self::get_settings();
     if (isset($settings['api_key_verified']) && $settings['api_key_verified']) {
         return true;
     }
     $api_key = $settings['api_key'];
     if (!$api_key) {
         return false;
     }
     $response = drupal_http_request(self::API_URL . '/publisher_tools/' . $api_key . '/verified', array('method' => 'GET'));
     if (self::has_bad_response($response, 'FailedApiKeyVerified')) {
         return false;
     }
     $response = (array) $response;
     $result = $response['data'];
     if ($result == 'true') {
         ShareaholicUtilities::update_options(array('api_key_verified' => true));
         return true;
     }
     return false;
 }
Exemple #4
0
 /**
  * This function is in charge of determining whether to send the "get started" email
  */
 public static function welcome_email()
 {
     // check whether email has been sent
     if (ShareaholicUtilities::get_option('welcome_email_sent') != true) {
         ShareaholicAdmin::send_welcome_email();
         // set flag that the email has been sent
         ShareaholicUtilities::update_options(array('welcome_email_sent' => true));
     }
 }
Exemple #5
0
 /**
  * This function is for all settings that are specific to wordpress
  * and are not stored in a publisher configuration object. So far
  * this only inclues disabling the tracking.
  */
 private static function transform_wordpress_specific_settings()
 {
     $new_shareaholic_settings = array();
     $analytics_settings = get_option('ShareaholicAnalytics');
     $sexybookmarks_settings = get_option('SexyBookmarks');
     $new_shareaholic_settings['disable_og_tags'] = $sexybookmarks_settings['ogtags'] == '0' ? 'on' : 'off';
     ShareaholicUtilities::update_options($new_shareaholic_settings);
 }