本文整理匯總了PHP中Campaign::FindByUrlName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Campaign::FindByUrlName方法的具體用法?PHP Campaign::FindByUrlName怎麽用?PHP Campaign::FindByUrlName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Campaign
的用法示例。
在下文中一共展示了Campaign::FindByUrlName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GenerateUrlName
public static function GenerateUrlName($name)
{
$found = false;
$iteration = 0;
$sUrlName = "";
try {
while (true) {
$sUrlName = generate_urlname($name, $iteration);
$result = Campaign::FindByUrlName($sUrlName);
$iteration += 1;
}
} catch (NotFoundException $e) {
/* Current UrlName is not in use */
}
return $sUrlName;
}
示例2: die
/*
* ReDonate is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if (!isset($_APP)) {
die("Unauthorized.");
}
try {
$sCampaign = Campaign::FindByUrlName($router->uParameters[1]);
} catch (NotFoundException $e) {
/* TODO: 404 via RouterException */
throw new RouterException("No such campaign.");
}
try {
$sPaymentMethod = new PaymentMethod($router->uParameters[2]);
} catch (NotFoundException $e) {
throw new RouterException("No such payment method.");
}
if ($sPaymentMethod->sCampaignId !== $sCampaign->sId) {
throw new RouterException("Payment method does not belong to campaign.");
}
switch ($sPaymentMethod->sType) {
case PaymentMethod::PAYPAL:
$sMethodName = "PayPal";