Plugin Directory

Changeset 441114


Ignore:
Timestamp:
09/20/2011 11:49:28 PM (15 years ago)
Author:
mthomas9
Message:

Choose between file_get_contents and curl for API

Location:
purlem-personal-url-marketing/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • purlem-personal-url-marketing/trunk/purlem.php

    r438217 r441114  
    44Plugin URI: http://purlem.com
    55Description: Personalize your blog to visitors and track results with Personalized URLs (PURLs). <strong>The Plugin Requires a <a href='http://www.purlem.com'>Purlem Account</a>.</strong>
    6 Version: 1.1.2
     6Version: 1.1.3
    77Author: Marty Thomas
    88Author URI: http://purlem.com/company
     
    7171
    7272function display_purl_code() {
    73     $data = @file_get_contents('http://www.purlapi.com/lp/index.php?ID='.$_GET["ID"].'&name='.$_GET["purl"].'&page='.$_GET["page"].'&test='.$_GET["test"].'&wordpress='.$_GET["wordpress"]);
     73    if(get_option('purlapi') == 'file_get_contents') {
     74        $data = @file_get_contents('http://www.purlapi.com/lp/index.php?ID='.$_GET["ID"].'&name='.$_GET["purl"].'&page='.$_GET["page"].'&test='.$_GET["test"].'&wordpress='.$_GET["wordpress"]);
     75    } else {
     76        $curl = @curl_init(); curl_setopt ($curl, CURLOPT_URL, 'http://www.purlapi.com/lp/index.php?ID='.$_GET["ID"].'&name='.$_GET["purl"].'&page='.$_GET["page"].'&test='.$_GET["test"].'&wordpress='.$_GET["wordpress"]);
     77        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);         
     78        $data = curl_exec ($curl);
     79        curl_close ($curl);
     80    }
    7481    $user = json_decode($data);
    7582    @session_start();
     
    130137  <table class="form-table">
    131138 
    132   <tr valign="top">
     139  <tr valign="top" style="background-color:#f4f4f4; border-bottom: 1px solid #e6e6e6;">
    133140  <th scope="row">Purlem Client ID:</th>
    134   <td><input name="purlemID" type="text" value="<?php echo get_option('purlemID'); ?>" size="10" /></td>
     141  <td><input name="purlemID" type="text" value="<?php echo get_option('purlemID'); ?>" size="10" style="font-size:16px;" /></td>
    135142  </tr>
    136143   
    137   <tr valign="top">
     144  <tr valign="top" style="background-color:#f4f4f4; border-bottom: 1px solid #ccc;">
    138145  <th scope="row">Page URL: </th>
    139   <td><input name="purlemURI" type="text" value="<?php echo get_option('purlemURI'); ?>" size="50" /><br />
    140   <i>The full URL of the blog page to be personalized.</i></td>
    141   </tr>
    142  
    143    <tr valign="top">
     146  <td><input name="purlemURI" type="text" value="<?php echo get_option('purlemURI'); ?>" size="50" style="font-size:16px;" /><br />
     147  <i style="color:gray;font-size:11px;">The full URL of the blog page to be personalized.</i></td>
     148  </tr>
     149 
     150  <tr valign="top" style="border-bottom: 1px solid #e6e6e6;">
    144151  <th scope="row">Show Form in Content Area: </th>
    145152  <td><input <?php if (!(strcmp(get_option('showPurlForm'),"Y"))) {echo "checked=\"checked\"";} ?> name="showPurlForm" type="checkbox" value="Y" /></td>
    146153  </tr>
     154
     155  <tr valign="top">
     156  <th scope="row">API Type: </th>
     157  <td>
     158  <?php if (!(strcmp(get_option('purlapi'),"curl"))) {
     159    $curl = 'checked';
     160  } else {
     161    $file_get_contents = 'checked';
     162  }?>
     163  <input type="radio" name="purlapi" value="file_get_contents" <?php echo $file_get_contents; ?>> file_get_contents  &nbsp;  <input type="radio" name="purlapi" value="curl" <?php echo $curl; ?>> curl
     164  <br />
     165  <i style="color:gray;font-size:11px;">If you receive a "PURL NOT FOUND" error, try using curl.</i>
     166  </td>
     167  </tr>
    147168 
    148169 
    149170  </table>
    150171 
     172  <input type="hidden" name="apiType" value="update" />
    151173  <input type="hidden" name="action" value="update" />
    152   <input type="hidden" name="page_options" value="purlemID,purlemURI,showPurlForm" />
     174  <input type="hidden" name="page_options" value="purlemID,purlemURI,showPurlForm,purlapi" />
    153175 
    154176  <p class="submit">
  • purlem-personal-url-marketing/trunk/readme.txt

    r438217 r441114  
    44Link: http://purlem.com/
    55Requires at least: 2.1
    6 Tested up to: 3.1.3
    7 Stable tag: 1.1.2
     6Tested up to: 3.2.1
     7Stable tag: 1.1.3
    88
    99Personalize your blog to visitors and track results with Personalized URLs (PURLs). The Plugin Requires a Purlem Account.
Note: See TracChangeset for help on using the changeset viewer.