Example #1
0
 public function testSave()
 {
     Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a');
     $s = Source::create(array('type' => 'bitcoin', 'currency' => 'usd', 'amount' => '100', 'owner[email]' => '*****@*****.**'));
     $this->assertSame('bitcoin', $s->type);
     $source = Source::retrieve($s->id);
     $this->assertSame(100, $source->amount);
 }
Example #2
0
	public static function processFile($path, $name){
		$repository = Repository::create(uniqid() . "/$name");
		
		if(Source::analyzable($path)){
			$source = Source::create($path, "upload");
			$repository->add($source->id);
		}
		
		$repository->save();
		
		return $repository->id;
	}
Example #3
0
 public function makeSourceFromAddress($xmlurl, &$resultString)
 {
     $this->init($xmlurl);
     $source = null;
     if ($this->sp->data) {
         $source = Source::create(strip_tags($this->sp->get_title()), $this->sp->get_link(), strip_tags($this->sp->get_description()), $xmlurl);
     } else {
         if ($this->sp->error()) {
             $resultString = $this->sp->error() . " on " . $xmlurl;
         } else {
             $resultString = 'Error fetching or parsing ' . $xmlurl;
         }
     }
     $this->cleanUp();
     return $source;
 }
Example #4
0
 public function testCreate()
 {
     $this->mockRequest('POST', '/v1/sources', array('type' => 'bitcoin', 'amount' => 1000, 'currency' => 'usd', 'owner' => array('email' => '*****@*****.**')), array('id' => 'src_foo', 'object' => 'source'));
     $source = Source::create(array('type' => 'bitcoin', 'amount' => 1000, 'currency' => 'usd', 'owner' => array('email' => '*****@*****.**')));
     $this->assertSame($source->id, 'src_foo');
 }
Example #5
0
        \t<input name="tags" type="text" id="tags" size="10" value=""/>
        </div
\t</div>
\t<br />
\t<div id="saveconfig">
        <input name="subscribe" type="submit" id="subscribe" value="Subscribe"/>
\t</div>
</div>
</form>
EOD;
if (isset($_POST['subscribe']) && $_POST['subscribe'] == 'Subscribe') {
    echo '<div id="core">';
    /* Case 1: complete the subscription */
    $storage = SubscriptionStorage::getInstance();
    $sub = new Subscription();
    $source = Source::create(stripslashes($_POST['chantitle']), stripslashes($_POST['htmlurl']), stripslashes($_POST['chandesc']), $_POST['feedurl']);
    $sub->source = $source;
    $sub->shownItems = $_POST['shownnews'];
    $sub->isActive = $_POST['isactive'] == 'yes';
    $sub->tags = explode(',', $_POST['tags']);
    // TODO error handling
    $storage->storeSubscription($sub);
    displayStatus('Subscription complete');
    echo '</div>';
} elseif (isset($siteurl) && $siteurl != '') {
    /* Case 2: parse web page given in the form
                  display a form for each feed
       */
    echo '<div id="core">';
    @($fp = fopen($siteurl, "r"));
    $sitehtmldata = "";