当前位置: 首页>>代码示例>>PHP>>正文


PHP Campaign::FindByUrlName方法代码示例

本文整理汇总了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;
 }
开发者ID:GodOfConquest,项目名称:redonate,代码行数:16,代码来源:campaign.php

示例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";
开发者ID:GodOfConquest,项目名称:redonate,代码行数:31,代码来源:donate.php


注:本文中的Campaign::FindByUrlName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。