Skip to content

Commit

Permalink
Added protocol options for http or https.
Browse files Browse the repository at this point in the history
  • Loading branch information
matason committed Jun 23, 2010
1 parent 0598b24 commit 47e5990
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plings.module
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ function plings_fetch_plings($filter_type, $filter_value, $format = 'xml', $peri
}

// The base Plings URL.
$plings_url = variable_get('plings_url', 'http://feeds.plings.net');
$plings_url = variable_get('plings_protocol', 'http') . '://' . variable_get('plings_url', 'feeds.plings.net');

// Construct the rest of URL adding in the request parameters.
// Construct the rest of the URL adding in the request parameters.
$url = $plings_url . '/' . $format . '.activity.php/' . $period . '/' . $filter_type . '/' . $filter_value . '?APIKey=' . $plings_api_key . '&MaxResults=' . $limit;

// Make the request to Plings.
Expand Down
11 changes: 10 additions & 1 deletion plings.pages.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
* Provide an admin form for Plings settings.
*/
function plings_admin_form($form_state) {
// Protocol for fetching Plings.
$form['plings_protocol'] = array(
'#type' => 'select',
'#title' => t('Protocol'),
'#description' => t('Choose the protocol to use when fetching Plings.'),
'#options' => drupal_map_assoc(array('http', 'https'), 't'),
'#default_value' => variable_get('plings_protocol', 'http'),
);

// Plings requires an API Key to work.
$form['plings_api_key'] = array(
'#type' => 'textfield',
Expand Down Expand Up @@ -95,4 +104,4 @@ function plings_required_select_validate($element, &$form_state) {
if ($element['#value'] === '0') {
form_error($element, t('This field is required.'));
}
}
}

0 comments on commit 47e5990

Please sign in to comment.