當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tracker::formatAuthorString方法代碼示例

本文整理匯總了PHP中Tracker::formatAuthorString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracker::formatAuthorString方法的具體用法?PHP Tracker::formatAuthorString怎麽用?PHP Tracker::formatAuthorString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tracker的用法示例。


在下文中一共展示了Tracker::formatAuthorString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDescription

 public function getDescription(array $activity)
 {
     $author_string = Tracker::formatAuthorString($activity['user_id'], $activity['fallback_username']);
     // If the item type is numeric, we're dealing with an entry
     if (is_numeric($activity['item_type'])) {
         $item = Tracker::formatEntryItem($activity);
     } else {
         $item = Tracker::formatElementItem($activity);
     }
     // Concat author string, activity type, and an item description
     if (!is_null($item)) {
         $replacements = array($author_string, $item);
         // Don't merge description so make sure each string can be translated accurately:
         // this is important if other languages need reflexive or splitted verbs (like German for example)
         switch ($activity['action_type']) {
             case 'deleted':
                 $description = __('%1$s deleted %2$s.', $replacements);
                 break;
             case 'updated':
                 $description = __('%1$s updated %2$s.', $replacements);
                 break;
             case 'created':
                 $description = __('%1$s created %2$s.', $replacements);
                 break;
             case 'enabled':
                 $description = __('%1$s enabled %2$s.', $replacements);
                 break;
             case 'disabled':
                 $description = __('%1$s disabled %2$s.', $replacements);
                 break;
             case 'logged in':
                 $description = __('%1$s logged in %2$s.', $replacements);
                 break;
             case 'attempted to log in':
                 $description = __('%1$s attempted to log in %2$s.', $replacements);
                 break;
             case 'reset':
                 $description = __('%1$s reset %2$s.', $replacements);
                 break;
             case 'attempted to reset':
                 $description = __('%1$s attempted to reset %2$s.', $replacements);
                 break;
             case 'changed':
                 $description = __('%1$s changed %2$s.', $replacements);
                 break;
             case 'requested to reset':
                 $description = __('%1$s requested to reset %2$s.', $replacements);
                 break;
             case 'uninstalled':
                 $description = __('%1$s uninstalled %2$s.', $replacements);
                 break;
             default:
                 $description = __('%1$s %2$s %3$s.', array($author_string, $activity['action_type'], $item));
                 break;
         }
         return $description;
     }
 }
開發者ID:rc1,項目名稱:tracker,代碼行數:58,代碼來源:class.tracker.php


注:本文中的Tracker::formatAuthorString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。