/**
  * Connect to Pocket grab data
  *
  * @param $post_settings_array
  *
  * @return $saves
  */
 public function connect_to_pocket($post_settings_array)
 {
     $args = array('consumerKey' => $post_settings_array['consumer_key']);
     $pocket = new Pocket($args);
     // Retrieve the user's list of both unread and archived items (min. limit 5)
     // http://getpocket.com/developer/docs/v3/retrieve for a list of parameters
     $params = array('state' => 'all', 'sort' => 'newest', 'detailType' => 'complete', 'count' => 10);
     $saves = $pocket->retrieve($params, $post_settings_array['access_token']);
     return $saves;
 }
 public function TestData($Sender)
 {
     return;
     echo "<div class=\"TestPocket\"><h3>Test Data</h3>";
     echo '<ul class="Variables">';
     echo self::_Var('path', Gdn::Request()->Path());
     echo self::_Var('page', Pocket::PageName($Sender));
     //      $RequestArgs = Gdn::Request()->GetRequestArguments();
     //      foreach ($RequestArgs as $Type => $Args) {
     //         if ($Type == Gdn_Request::INPUT_COOKIES)
     //            continue;
     //         foreach ($Args as $Name => $Value) {
     //            echo self::_Var("$Type.$Name", $Value);
     //         }
     //      }
     echo '</ul>';
     echo "</div>";
 }
Exemple #3
0
 /** Load the pocket's data from an array.
  *
  *  @param array $Data
  */
 public function Load($Data)
 {
     $this->Body = $Data['Body'];
     $this->Disabled = $Data['Disabled'];
     $this->Format = $Data['Format'];
     $this->Location = $Data['Location'];
     $this->Name = $Data['Name'];
     $this->Page = $Data['Page'];
     $this->MobileOnly = $Data['MobileOnly'];
     $this->MobileNever = $Data['MobileNever'];
     $this->Type = val('Type', $Data, Pocket::TYPE_DEFAULT);
     $this->EmbeddedNever = GetValue('EmbeddedNever', $Data);
     $this->ShowInDashboard = GetValue('ShowInDashboard', $Data);
     // parse the frequency.
     $Repeat = $Data['Repeat'];
     list($this->RepeatType, $this->RepeatFrequency) = Pocket::ParseRepeat($Repeat);
 }
Exemple #4
0
 * and retrieving the user's Pocket data
 *
 * @package     php-Pocket
 * @author      Dan Chen
 * @license     MIT License
*/
// Show all errors/warnings
error_reporting(E_ALL);
ini_set('display_errors', '1');
const NEWLINE = '<br /><br />';
require 'Pocket.php';
$params = array('consumerKey' => '');
if (empty($params['consumerKey'])) {
    die('Please fill in your Pocket App Consumer Key');
}
$pocket = new Pocket($params);
if (isset($_GET['authorized'])) {
    // Convert the requestToken into an accessToken
    // Note that a requestToken can only be covnerted once
    // Thus refreshing this page will generate an auth error
    $user = $pocket->convertToken($_GET['authorized']);
    /*
    	$user['access_token']	the user's access token for calls to Pocket
    	$user['username']	the user's pocket username
    */
    print_r($user);
    // Set the user's access token to be used for all subsequent calls to the Pocket API
    $pocket->setAccessToken($user['access_token']);
    echo NEWLINE;
    // Add a url to the user's pocket
    // http://getpocket.com/developer/docs/v3/add for a list of params
 /**
  * derp?
  *
  * @param $Sender
  */
 public function testData($Sender)
 {
     return;
     echo "<div class=\"TestPocket\"><h3>Test Data</h3>";
     echo '<ul class="Variables">';
     echo self::_var('path', Gdn::request()->path());
     echo self::_var('page', Pocket::pageName($Sender));
     echo '</ul>';
     echo "</div>";
 }