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


PHP FormatPossessive函数代码示例

本文整理汇总了PHP中FormatPossessive函数的典型用法代码示例。如果您正苦于以下问题:PHP FormatPossessive函数的具体用法?PHP FormatPossessive怎么用?PHP FormatPossessive使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FormatPossessive函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ActivityHeadline

 /**
  * The ActivityType table has some special sprintf search/replace values in the
  * FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
  * used on this page (the user profile page). The FullHeadline field is to be
  * used on the main activity page. The replacement definitions are as follows:
  *  %1 = ActivityName
  *  %2 = ActivityName Possessive
  *  %3 = RegardingName
  *  %4 = RegardingName Possessive
  *  %5 = Link to RegardingName's Wall
  *  %6 = his/her
  *  %7 = he/she
  *  %8 = route & routecode
  *
  * @param object $Activity An object representation of the activity being formatted.
  * @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
  *  looking at.
  * @return string
  */
 public static function ActivityHeadline($Activity, $ProfileUserID = '')
 {
     $Session = Gdn::Session();
     if ($Session->UserID == $Activity->ActivityUserID) {
         $ActivityName = $ActivityNameP = Gdn::Translate('You');
     } else {
         $ActivityName = $Activity->ActivityName;
         $ActivityNameP = FormatPossessive($ActivityName);
     }
     if ($ProfileUserID != $Activity->ActivityUserID) {
         // If we're not looking at the activity user's profile, link the name
         $ActivityNameD = urlencode($Activity->ActivityName);
         $ActivityName = Anchor($ActivityName, '/garden/profile/' . $ActivityNameD);
         $ActivityNameP = Anchor($ActivityNameP, '/garden/profile/' . $ActivityNameD);
     }
     $Gender = Translate($Activity->ActivityGender == 'm' ? 'his' : 'her');
     $Gender2 = Translate($Activity->ActivityGender == 'm' ? 'he' : 'she');
     if ($Session->IsValid() && ($Session->UserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $Session->UserID)) {
         $Gender = $Gender2 = 'your';
     }
     if ($Session->UserID == $Activity->RegardingUserID) {
         $RegardingName = $RegardingNameP = Gdn::Translate('your');
     } else {
         $RegardingName = $Activity->RegardingName == '' ? Gdn::Translate('somebody') : $Activity->RegardingName;
         $RegardingNameP = '';
         //FormatPossessive($RegardingName);
     }
     $RegardingWall = '';
     if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
         // If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
         $RegardingName = $RegardingProfile = $Gender;
         $RegardingNameP = $RegardingProfileP = $Gender;
     } else {
         if ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
             // If there is a regarding user and we're not looking at his/her profile, link the name.
             $RegardingNameD = urlencode($Activity->RegardingName);
             $RegardingName = Anchor($RegardingName, '/garden/profile/' . $RegardingNameD);
             $RegardingNameP = Anchor($RegardingNameP, '/garden/profile/' . $RegardingNameD);
             $RegardingWall = Anchor('wall', '/garden/profile/activity/' . $RegardingNameD . '#Activity_' . $Activity->ActivityID);
         }
     }
     if ($RegardingWall == '') {
         $RegardingWall = Gdn::Translate('wall');
     }
     if ($Activity->Route == '') {
         $Route = Translate($Activity->RouteCode);
     } else {
         $Route = Anchor($Activity->RouteCode, $Activity->Route);
     }
     return sprintf($ProfileUserID == $Activity->ActivityUserID || $ProfileUserID == '' ? $Activity->FullHeadline : $Activity->ProfileHeadline, $ActivityName, $ActivityNameP, $RegardingName, $RegardingNameP, $RegardingWall, $Gender, $Gender2, $Route);
 }
开发者ID:kidmax,项目名称:Garden,代码行数:70,代码来源:class.format.php

示例2: ActivityHeadline

 /**
  * The ActivityType table has some special sprintf search/replace values in the
  * FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
  * used on this page (the user profile page). The FullHeadline field is to be
  * used on the main activity page. The replacement definitions are as follows:
  *  %1$s = ActivityName
  *  %2$s = ActivityName Possessive
  *  %3$s = RegardingName
  *  %4$s = RegardingName Possessive
  *  %5$s = Link to RegardingName's Wall
  *  %6$s = his/her
  *  %7$s = he/she
  *  %8$s = route & routecode
  *  %9$s = gender suffix (some languages require this).
  *
  * @param object $Activity An object representation of the activity being formatted.
  * @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
  *  looking at.
  * @return string
  */
 public static function ActivityHeadline($Activity, $ProfileUserID = '', $ViewingUserID = '')
 {
     if ($ViewingUserID == '') {
         $Session = Gdn::Session();
         $ViewingUserID = $Session->IsValid() ? $Session->UserID : -1;
     }
     $GenderSuffixCode = 'First';
     $GenderSuffixGender = $Activity->ActivityGender;
     if ($ViewingUserID == $Activity->ActivityUserID) {
         $ActivityName = $ActivityNameP = T('You');
     } else {
         $ActivityName = $Activity->ActivityName;
         $ActivityNameP = FormatPossessive($ActivityName);
         $GenderSuffixCode = 'Third';
     }
     if ($ProfileUserID != $Activity->ActivityUserID) {
         // If we're not looking at the activity user's profile, link the name
         $ActivityNameD = urlencode($Activity->ActivityName);
         $ActivityName = Anchor($ActivityName, '/profile/' . $Activity->ActivityUserID . '/' . $ActivityNameD);
         $ActivityNameP = Anchor($ActivityNameP, '/profile/' . $Activity->ActivityUserID . '/' . $ActivityNameD);
         $GenderSuffixCode = 'Third';
     }
     $Gender = T($Activity->ActivityGender == 'm' ? 'his' : 'her');
     $Gender2 = T($Activity->ActivityGender == 'm' ? 'he' : 'she');
     if ($ViewingUserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $ViewingUserID) {
         $Gender = $Gender2 = T('your');
     }
     $IsYou = FALSE;
     if ($ViewingUserID == $Activity->RegardingUserID) {
         $IsYou = TRUE;
         $RegardingName = T('you');
         $RegardingNameP = T('your');
         $GenderSuffixGender = $Activity->RegardingGender;
     } else {
         $RegardingName = $Activity->RegardingName == '' ? T('somebody') : $Activity->RegardingName;
         $RegardingNameP = FormatPossessive($RegardingName);
         if ($Activity->ActivityUserID != $ViewingUserID) {
             $GenderSuffixCode = 'Third';
         }
     }
     $RegardingWall = '';
     $RegardingWallLink = '';
     if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
         // If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
         $RegardingName = $RegardingProfile = $Gender;
         $RegardingNameP = $RegardingProfileP = $Gender;
     } else {
         if ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
             // If there is a regarding user and we're not looking at his/her profile, link the name.
             $RegardingNameD = urlencode($Activity->RegardingName);
             if (!$IsYou) {
                 $RegardingName = Anchor($RegardingName, '/profile/' . $Activity->RegardingUserID . '/' . $RegardingNameD);
                 $RegardingNameP = Anchor($RegardingNameP, '/profile/' . $Activity->RegardingUserID . '/' . $RegardingNameD);
                 $GenderSuffixCode = 'Third';
                 $GenderSuffixGender = $Activity->RegardingGender;
             }
             $RegardingWallActivityPath = '/profile/activity/' . $Activity->RegardingUserID . '/' . $RegardingNameD . '#Activity_' . $Activity->ActivityID;
             $RegardingWallLink = Url($RegardingWallActivityPath);
             $RegardingWall = Anchor(T('wall'), $RegardingWallActivityPath);
         }
     }
     if ($RegardingWall == '') {
         $RegardingWall = T('wall');
     }
     if ($Activity->Route == '') {
         $ActivityRouteLink = '';
         if ($Activity->RouteCode) {
             $Route = T($Activity->RouteCode);
         } else {
             $Route = '';
         }
     } else {
         $ActivityRouteLink = Url($Activity->Route);
         $Route = Anchor(T($Activity->RouteCode), $Activity->Route);
     }
     //if ($Activity->ActivityID == 131) d($ActivityRouteLink, $Activity);
     // Translate the gender suffix.
     $GenderSuffixCode = "GenderSuffix.{$GenderSuffixCode}.{$GenderSuffixGender}";
     $GenderSuffix = T($GenderSuffixCode, '');
     if ($GenderSuffix == $GenderSuffixCode) {
//.........这里部分代码省略.........
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:class.format.php

示例3: ActivityHeadline

 /**
  * The ActivityType table has some special sprintf search/replace values in the
  * FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
  * used on this page (the user profile page). The FullHeadline field is to be
  * used on the main activity page. The replacement definitions are as follows:
  *  %1 = ActivityName
  *  %2 = ActivityName Possessive
  *  %3 = RegardingName
  *  %4 = RegardingName Possessive
  *  %5 = Link to RegardingName's Wall
  *  %6 = his/her
  *  %7 = he/she
  *  %8 = route & routecode
  *
  * @param object $Activity An object representation of the activity being formatted.
  * @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
  *  looking at.
  * @return string
  */
 public static function ActivityHeadline($Activity, $ProfileUserID = '', $ViewingUserID = '')
 {
     if ($ViewingUserID == '') {
         $Session = Gdn::Session();
         $ViewingUserID = $Session->IsValid() ? $Session->UserID : -1;
     }
     if ($ViewingUserID == $Activity->ActivityUserID) {
         $ActivityName = $ActivityNameP = T('You');
     } else {
         $ActivityName = $Activity->ActivityName;
         $ActivityNameP = FormatPossessive($ActivityName);
     }
     if ($ProfileUserID != $Activity->ActivityUserID) {
         // If we're not looking at the activity user's profile, link the name
         $ActivityNameD = urlencode($Activity->ActivityName);
         $ActivityName = Anchor($ActivityName, '/profile/' . $Activity->ActivityUserID . '/' . $ActivityNameD);
         $ActivityNameP = Anchor($ActivityNameP, '/profile/' . $Activity->ActivityUserID . '/' . $ActivityNameD);
     }
     $Gender = T($Activity->ActivityGender == 'm' ? 'his' : 'her');
     $Gender2 = T($Activity->ActivityGender == 'm' ? 'he' : 'she');
     if ($ViewingUserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $ViewingUserID) {
         $Gender = $Gender2 = T('your');
     }
     $IsYou = FALSE;
     if ($ViewingUserID == $Activity->RegardingUserID) {
         $IsYou = TRUE;
         $RegardingName = T('you');
         $RegardingNameP = T('your');
     } else {
         $RegardingName = $Activity->RegardingName == '' ? T('somebody') : $Activity->RegardingName;
         $RegardingNameP = FormatPossessive($RegardingName);
     }
     $RegardingWall = '';
     if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
         // If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
         $RegardingName = $RegardingProfile = $Gender;
         $RegardingNameP = $RegardingProfileP = $Gender;
     } else {
         if ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
             // If there is a regarding user and we're not looking at his/her profile, link the name.
             $RegardingNameD = urlencode($Activity->RegardingName);
             if (!$IsYou) {
                 $RegardingName = Anchor($RegardingName, '/profile/' . $Activity->RegardingUserID . '/' . $RegardingNameD);
                 $RegardingNameP = Anchor($RegardingNameP, '/profile/' . $Activity->RegardingUserID . '/' . $RegardingNameD);
             }
             $RegardingWall = Anchor(T('wall'), '/profile/activity/' . $Activity->RegardingUserID . '/' . $RegardingNameD . '#Activity_' . $Activity->ActivityID);
         }
     }
     if ($RegardingWall == '') {
         $RegardingWall = T('wall');
     }
     if ($Activity->Route == '') {
         $Route = T($Activity->RouteCode);
     } else {
         $Route = Anchor(T($Activity->RouteCode), $Activity->Route);
     }
     /*
       Debug:
     return $ActivityName
     .'/'.$ActivityNameP
     .'/'.$RegardingName
     .'/'.$RegardingNameP
     .'/'.$RegardingWall
     .'/'.$Gender
     .'/'.$Gender2
     .'/'.$Route
     */
     return sprintf($ProfileUserID == $Activity->ActivityUserID || $ProfileUserID == '' ? T($Activity->FullHeadline) : T($Activity->ProfileHeadline), $ActivityName, $ActivityNameP, $RegardingName, $RegardingNameP, $RegardingWall, $Gender, $Gender2, $Route);
 }
开发者ID:sheldon,项目名称:Garden,代码行数:88,代码来源:class.format.php

示例4: activityHeadline

 /**
  * The ActivityType table has some special sprintf search/replace values in the
  * FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
  * used on this page (the user profile page). The FullHeadline field is to be
  * used on the main activity page. The replacement definitions are as follows:
  *  %1$s = ActivityName
  *  %2$s = ActivityName Possessive
  *  %3$s = RegardingName
  *  %4$s = RegardingName Possessive
  *  %5$s = Link to RegardingName's Wall
  *  %6$s = his/her
  *  %7$s = he/she
  *  %8$s = route & routecode
  *  %9$s = gender suffix (some languages require this).
  *
  * @param object $Activity An object representation of the activity being formatted.
  * @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
  *  looking at.
  * @return string
  */
 public static function activityHeadline($Activity, $ProfileUserID = '', $ViewingUserID = '')
 {
     $Activity = (object) $Activity;
     if ($ViewingUserID == '') {
         $Session = Gdn::session();
         $ViewingUserID = $Session->isValid() ? $Session->UserID : -1;
     }
     $GenderSuffixCode = 'First';
     $GenderSuffixGender = $Activity->ActivityGender;
     if ($ViewingUserID == $Activity->ActivityUserID) {
         $ActivityName = $ActivityNameP = T('You');
     } else {
         $ActivityName = $Activity->ActivityName;
         $ActivityNameP = FormatPossessive($ActivityName);
         $GenderSuffixCode = 'Third';
     }
     if ($ProfileUserID != $Activity->ActivityUserID) {
         // If we're not looking at the activity user's profile, link the name
         $ActivityNameD = urlencode($Activity->ActivityName);
         $ActivityName = Anchor($ActivityName, UserUrl($Activity, 'Activity'));
         $ActivityNameP = Anchor($ActivityNameP, UserUrl($Activity, 'Activity'));
         $GenderSuffixCode = 'Third';
     }
     $Gender = t('their');
     //TODO: this isn't preferable but I don't know a better option
     $Gender2 = t('they');
     //TODO: this isn't preferable either
     if ($Activity->ActivityGender == 'm') {
         $Gender = t('his');
         $Gender2 = t('he');
     } elseif ($Activity->ActivityGender == 'f') {
         $Gender = t('her');
         $Gender2 = t('she');
     }
     if ($ViewingUserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $ViewingUserID) {
         $Gender = $Gender2 = t('your');
     }
     $IsYou = false;
     if ($ViewingUserID == $Activity->RegardingUserID) {
         $IsYou = true;
         $RegardingName = t('you');
         $RegardingNameP = t('your');
         $GenderSuffixGender = $Activity->RegardingGender;
     } else {
         $RegardingName = $Activity->RegardingName == '' ? T('somebody') : $Activity->RegardingName;
         $RegardingNameP = formatPossessive($RegardingName);
         if ($Activity->ActivityUserID != $ViewingUserID) {
             $GenderSuffixCode = 'Third';
         }
     }
     $RegardingWall = '';
     $RegardingWallLink = '';
     if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
         // If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
         $RegardingName = $RegardingProfile = $Gender;
         $RegardingNameP = $RegardingProfileP = $Gender;
     } elseif ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
         // If there is a regarding user and we're not looking at his/her profile, link the name.
         $RegardingNameD = urlencode($Activity->RegardingName);
         if (!$IsYou) {
             $RegardingName = anchor($RegardingName, userUrl($Activity, 'Regarding'));
             $RegardingNameP = anchor($RegardingNameP, userUrl($Activity, 'Regarding'));
             $GenderSuffixCode = 'Third';
             $GenderSuffixGender = $Activity->RegardingGender;
         }
         $RegardingWallActivityPath = userUrl($Activity, 'Regarding');
         $RegardingWallLink = url($RegardingWallActivityPath);
         $RegardingWall = anchor(T('wall'), $RegardingWallActivityPath);
     }
     if ($RegardingWall == '') {
         $RegardingWall = t('wall');
     }
     if ($Activity->Route == '') {
         $ActivityRouteLink = '';
         if ($Activity->RouteCode) {
             $Route = t($Activity->RouteCode);
         } else {
             $Route = '';
         }
     } else {
//.........这里部分代码省略.........
开发者ID:ringoma,项目名称:vanilla,代码行数:101,代码来源:class.format.php

示例5: AddAccountOptionsToPanel

function AddAccountOptionsToPanel(&$Context, &$Panel, &$User)
{
    if ($Context->Session->UserID > 0) {
        $ApplicantOptions = $Context->GetDefinition("ApplicantOptions");
        $AccountOptions = $Context->GetDefinition("AccountOptions");
        if (($User->UserID == $Context->Session->UserID || $Context->Session->User->AdminUsers) && $User) {
            if ($User->UserID == $Context->Session->UserID) {
                $Panel->AddListItem($AccountOptions, $Context->GetDefinition("ChangeYourPersonalInformation"), $Context->SelfUrl . "?PostBackAction=Identity", "", 0);
                $Panel->AddListItem($AccountOptions, $Context->GetDefinition("ChangeYourPassword"), $Context->SelfUrl . "?PostBackAction=Password", "", 1);
            } elseif ($User->UserID != $Context->Session->UserID && $Context->Session->User->AdminUsers && $User) {
                $Username = FormatPossessive($User->Name);
                $Panel->AddListItem($Username . " " . $AccountOptions, $Context->GetDefinition("ChangePersonalInformation"), $Context->SelfUrl . "?PostBackAction=Identity&u=" . $User->UserID, "", 0);
                if ($User->RoleID == 0) {
                    $Panel->AddListItem($ApplicantOptions, $Context->GetDefinition("ApproveForMembership"), $Context->SelfUrl . "?u=" . $User->UserID . "&PostBackAction=ApproveUser");
                    $Panel->AddListItem($ApplicantOptions, $Context->GetDefinition("DeclineForMembership"), $Context->SelfUrl . "?u=" . $User->UserID . "&PostBackAction=DeclineUser");
                } else {
                    $Panel->AddListItem($Username . " " . $AccountOptions, $Context->GetDefinition("ChangeRole"), $Context->SelfUrl . "?PostBackAction=Role&u=" . $User->UserID);
                    $Panel->AddListItem($ApplicantOptions, $Context->GetDefinition("NewApplicantSearch"), "search.php?PostBackAction=Search&Keywords=roles:Applicant;sort:Date;&Type=Users");
                }
            }
        }
        if ($User->UserID == $Context->Session->UserID) {
            $Panel->AddListItem($AccountOptions, $Context->GetDefinition("ChangeForumFunctionality"), $Context->SelfUrl . "?PostBackAction=Functionality", "", 2);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:26,代码来源:account.php


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