本文整理汇总了PHP中Source::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Source::create方法的具体用法?PHP Source::create怎么用?PHP Source::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Source
的用法示例。
在下文中一共展示了Source::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSave
public function testSave()
{
Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a');
$s = Source::create(array('type' => 'bitcoin', 'currency' => 'usd', 'amount' => '100', 'owner[email]' => 'gdb@stripe.com'));
$this->assertSame('bitcoin', $s->type);
$source = Source::retrieve($s->id);
$this->assertSame(100, $source->amount);
}
示例2: processFile
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;
}
示例3: makeSourceFromAddress
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;
}
示例4: testCreate
public function testCreate()
{
$this->mockRequest('POST', '/v1/sources', array('type' => 'bitcoin', 'amount' => 1000, 'currency' => 'usd', 'owner' => array('email' => 'jenny.rosen@example.com')), array('id' => 'src_foo', 'object' => 'source'));
$source = Source::create(array('type' => 'bitcoin', 'amount' => 1000, 'currency' => 'usd', 'owner' => array('email' => 'jenny.rosen@example.com')));
$this->assertSame($source->id, 'src_foo');
}
示例5: Subscription
\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 = "";