本文整理汇总了PHP中Text::name_text方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::name_text方法的具体用法?PHP Text::name_text怎么用?PHP Text::name_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::name_text方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _review_table_actas
function _review_table_actas($rr)
{
global $Me;
if (!get($rr, "contactId") || $rr->contactId == $Me->contactId) {
return "";
}
return ' <a href="' . selfHref(array("actas" => $rr->email)) . '">' . Ht::img("viewas.png", "[Act as]", array("title" => "Act as " . Text::name_text($rr))) . "</a>";
}
示例2: pcMembers
function pcMembers()
{
global $Conf, $Opt, $PcMembersCache;
if (!@$PcMembersCache || $Conf->setting("pc") <= 0 || $PcMembersCache[0] < $Conf->setting("pc") || $PcMembersCache[1] != @$Opt["sortByLastName"]) {
$pc = array();
$result = Dbl::q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where (roles&" . Contact::ROLE_PC . ")!=0");
$by_name_text = array();
$pctags = array("pc" => "pc");
while ($result && ($row = Contact::fetch($result))) {
$pc[$row->contactId] = $row;
if ($row->firstName || $row->lastName) {
$name_text = Text::name_text($row);
if (isset($by_name_text[$name_text])) {
$row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true;
}
$by_name_text[$name_text] = $row;
}
if ($row->contactTags) {
foreach (explode(" ", $row->contactTags) as $t) {
list($tag, $value) = TagInfo::split_index($t);
if ($tag) {
$pctags[strtolower($tag)] = $tag;
}
}
}
}
uasort($pc, "Contact::compare");
ksort($pctags);
$order = 0;
foreach ($pc as $row) {
$row->sort_position = $order;
++$order;
}
$PcMembersCache = array($Conf->setting("pc"), @$Opt["sortByLastName"], $pc, $pctags);
}
return $PcMembersCache[2];
}
示例3: json
public function json()
{
// find out who is light and who is heavy
// (light => less than 0.66 * (80th percentile))
$nass = array();
foreach ($this->r as $cid => $x) {
$nass[] = count($x);
}
sort($nass);
$heavy_boundary = 0;
if (count($nass)) {
$heavy_boundary = 0.66 * $nass[(int) (0.8 * count($nass))];
}
$contacts = pcMembers();
$need_contacts = [];
foreach ($this->r as $cid => $x) {
if (!isset($contacts[$cid]) && ctype_digit($cid)) {
$need_contacts[] = $cid;
}
}
if (count($need_contacts)) {
$result = Dbl::q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where contactId ?a", $need_contacts);
while ($result && ($row = Contact::fetch($result))) {
$contacts[$row->contactId] = $row;
}
}
$users = array();
$tags = $this->contact->can_view_reviewer_tags();
foreach ($this->r as $cid => $x) {
if ($cid != "conflicts") {
$users[$cid] = $u = (object) array();
$p = get($contacts, $cid);
if ($p) {
$u->name = Text::name_text($p);
}
if (count($x) < $heavy_boundary) {
$u->light = true;
}
if ($p && $tags && ($t = $p->viewable_color_classes($this->contact))) {
$u->color_classes = $t;
}
}
}
return (object) array("reviews" => $this->r, "deadlines" => $this->dl, "users" => $users);
}
示例4: name_for
private function name_for($pfx, $x)
{
$cid = is_object($x) ? $x->contactId : $x;
$key = $pfx . $cid;
if (isset($this->name_for_map_[$key])) {
return $this->name_for_map_[$key];
}
$pcm = pcMembers();
if (isset($pcm[$cid])) {
$x = $pcm[$cid];
} else {
if (!is_object($x) || !isset($x->email) || !isset($x->firstName) || !isset($x->lastName)) {
$x = self::find_by_id($cid);
$this->contact_sorter_map_[$cid] = $x->sorter;
}
}
if ($pfx !== "t") {
$n = Text::name_html($x);
} else {
$n = Text::name_text($x);
}
if ($pfx === "r" && ($colors = $this->reviewer_color_classes_for($x))) {
$n = '<span class="' . $colors . '">' . $n . '</span>';
}
return $this->name_for_map_[$key] = $n;
}
示例5: render_pset_row
function render_pset_row(Pset $pset, $students, Contact $s, $row, $pcmembers, $anonymous)
{
global $Conf, $Me, $Now, $Profile;
$row->sortprefix = "";
$ncol = 0;
$t0 = $Profile ? microtime(true) : 0;
$j = [];
$j["username"] = $s->github_username ?: $s->seascode_username ?: ($s->email ?: $s->huid);
if ($anonymous) {
$j["anon_username"] = $s->anon_username;
}
$j["sorter"] = $s->sorter;
++$ncol;
$j["name"] = Text::name_text($s);
if ($s->extension) {
$j["x"] = true;
}
if (!$anonymous) {
++$ncol;
}
if ($s->gradercid) {
$j["gradercid"] = $s->gradercid;
}
++$ncol;
// are any commits committed?
if (!$pset->gitless_grades) {
if (($s->placeholder || $s->gradehash === null) && $s->repoid && ($s->placeholder_at < $Now - 3600 && rand(0, 2) == 0 || $s->placeholder_at < $Now - 600 && rand(0, 10) == 0) && (!$s->repoviewable || !$s->gradehash)) {
// XXX this is slow given that most info is already loaded
$info = ContactView::user_pset_info($s, $pset);
$info->set_commit(null);
$s->gradehash = $info->commit_hash() ?: null;
$s->placeholder = 1;
Dbl::qe("insert into RepositoryGrade (repoid, pset, gradehash, placeholder, placeholder_at) values (?, ?, ?, 1, ?) on duplicate key update gradehash=(if(placeholder=1,values(gradehash),gradehash)), placeholder_at=values(placeholder_at)", $s->repoid, $pset->id, $s->gradehash, $Now);
if (!$s->repoviewable) {
$s->repoviewable = $s->can_view_repo_contents($info->repo);
}
}
if (!$s->gradehash || $s->dropped) {
$row->sortprefix = "~1 ";
}
}
if (count($pset->grades)) {
$gi = null;
if ($pset->gitless_grades) {
$gi = $pset->contact_grade_for($s);
} else {
if ($s->gradehash && !$s->placeholder) {
$gi = $pset->commit_notes($s->gradehash);
}
}
$gi = $gi ? $gi->notes : null;
if (!$pset->gitless_grades) {
if ($gi && get($gi, "linenotes")) {
$j["has_notes"] = true;
} else {
if ($Me->contactId == $s->gradercid) {
$s->incomplete = true;
}
}
if ($gi && $s->gradercid != get($gi, "gradercid") && $Me->privChair) {
$j["has_nongrader_notes"] = true;
}
++$ncol;
}
$garr = render_grades($pset, $gi, $s);
$ncol += count($garr->all);
$j["grades"] = $garr->allv;
$j["total"] = $garr->totalv;
if ($garr->differentk) {
$j["highlight_grades"] = $garr->differentk;
}
}
//echo "<td><a href=\"mailto:", htmlspecialchars($s->email), "\">",
//htmlspecialchars($s->email), "</a></td>";
if (!$pset->gitless && $s->url) {
$j["repo"] = RepositorySite::make_web_url($s->url, $Conf);
if (!$s->working) {
$j["repo_broken"] = true;
} else {
if (!$s->repoviewable) {
$j["repo_unconfirmed"] = true;
}
}
if ($s->open) {
$j["repo_too_open"] = true;
}
if ($s->pcid != $s->rpcid || $s->pcid && (!isset($students[$s->pcid]) || $students[$s->pcid]->repoid != $s->repoid)) {
$j["repo_partner_error"] = true;
}
}
++$ncol;
if (!get($row, "ncol") || $ncol > $row->ncol) {
$row->ncol = $ncol;
}
$s->visited = true;
return $j;
}
示例6: site_contact
public static function site_contact()
{
global $Opt;
if (!get($Opt, "contactEmail") || $Opt["contactEmail"] == "you@example.com") {
$result = Dbl::ql("select firstName, lastName, email from ContactInfo where (roles&" . (self::ROLE_CHAIR | self::ROLE_ADMIN) . ")!=0 order by (roles&" . self::ROLE_CHAIR . ") desc limit 1");
if ($result && ($row = $result->fetch_object())) {
$Opt["defaultSiteContact"] = true;
$Opt["contactName"] = Text::name_text($row);
$Opt["contactEmail"] = $row->email;
}
}
return new Contact((object) array("fullName" => $Opt["contactName"], "email" => $Opt["contactEmail"], "isChair" => true, "isPC" => true, "is_site_contact" => true, "contactTags" => null));
}
示例7: echo_linenote
function echo_linenote($file, $lineid, $note, LinenotesOrder $lnorder = null)
{
$note_object = null;
if (is_object($note)) {
// How the fuck did this shit get in the DB, why does PHP suck
$note_object = $note;
$note = [];
for ($i = 0; property_exists($note_object, $i); ++$i) {
$note[] = $note_object->{$i};
}
}
if (!is_array($note)) {
$note = array(false, $note);
}
if ($this->can_see_grades || $note[0]) {
echo '<tr class="diffl61 gw">', '<td colspan="2" class="difflnoteborder61"></td>', '<td class="difflnote61">';
if ($lnorder) {
$links = array();
//list($pfile, $plineid) = $lnorder->get_prev($file, $lineid);
//if ($pfile)
// $links[] = '<a href="#L' . $plineid . '_'
// . html_id_encode($pfile) . '">← Prev</a>';
list($nfile, $nlineid) = $lnorder->get_next($file, $lineid);
if ($nfile) {
$links[] = '<a href="#L' . $nlineid . '_' . html_id_encode($nfile) . '">Next ></a>';
} else {
$links[] = '<a href="#">Top</a>';
}
if (!empty($links)) {
echo '<div class="difflnoteptr61">', join(" ", $links), '</div>';
}
}
if ($this->pc_view && get($note, 2)) {
global $Conf;
$pcmembers = $Conf->pc_members_and_admins();
if (isset($pcmembers[$note[2]])) {
$p = $pcmembers[$note[2]];
echo '<div class="difflnoteauthor61">[', htmlspecialchars($p->firstNameAmbiguous ? Text::name_text($p) : $p->firstName), ']</div>';
}
}
if (!is_string($note[1])) {
error_log("fudge {$this->user->github_username} error: " . json_encode($note));
}
echo '<div class="note61', $note[0] ? ' commentnote' : ' gradenote', '">', htmlspecialchars($note[1]), '</div>', '<div class="clear"></div></td></tr>';
}
}
示例8: status_papers
private static function status_papers($status, $tracker, $acct)
{
global $Conf;
$pids = array_slice($tracker->ids, $tracker->position, 3);
$pc_conflicts = $acct->privChair || $acct->tracker_kiosk_state;
$col = $j = "";
if ($pc_conflicts) {
$col = ", allconfs.conflictIds";
$j = "left join (select paperId, group_concat(contactId) conflictIds from PaperConflict where paperId in (" . join(",", $pids) . ") group by paperId) allconfs on (allconfs.paperId=p.paperId)\n\t\t";
$pcm = pcMembers();
}
$result = $Conf->qe("select p.paperId, p.title, p.paperFormat, p.leadContactId, p.managerContactId, r.reviewType, conf.conflictType{$col}\n from Paper p\n left join PaperReview r on (r.paperId=p.paperId and " . ($acct->contactId ? "r.contactId={$acct->contactId}" : "false") . ")\n left join PaperConflict conf on (conf.paperId=p.paperId and " . ($acct->contactId ? "conf.contactId={$acct->contactId}" : "false") . ")\n {$j}where p.paperId in (" . join(",", $pids) . ")");
$papers = array();
while ($row = PaperInfo::fetch($result, $acct)) {
$papers[$row->paperId] = $p = (object) array();
if (($acct->privChair || !$row->conflictType || !get($status, "hide_conflicts")) && $acct->tracker_kiosk_state != 1) {
$p->pid = (int) $row->paperId;
$p->title = $row->title;
if ($format = $row->title_format()) {
$p->format = $format;
}
}
if ($acct->contactId > 0 && $row->managerContactId == $acct->contactId) {
$p->is_manager = true;
}
if ($row->reviewType) {
$p->is_reviewer = true;
}
if ($row->conflictType) {
$p->is_conflict = true;
}
if ($acct->contactId > 0 && $row->leadContactId == $acct->contactId) {
$p->is_lead = true;
}
if ($pc_conflicts) {
$p->pc_conflicts = array();
foreach (explode(",", (string) $row->conflictIds) as $cid) {
if ($pc = get($pcm, $cid)) {
$p->pc_conflicts[$pc->sort_position] = (object) array("email" => $pc->email, "name" => Text::name_text($pc));
}
}
ksort($p->pc_conflicts);
$p->pc_conflicts = array_values($p->pc_conflicts);
}
}
Dbl::free($result);
$status->papers = array();
foreach ($pids as $pid) {
$status->papers[] = $papers[$pid];
}
}
示例9: pcMembers
function pcMembers()
{
global $Conf;
$version = 2;
if (!isset($_SESSION["pcmembers"]) || !is_array($_SESSION["pcmembers"]) || count($_SESSION["pcmembers"]) < 3 || $Conf->setting("pc") <= 0 || $_SESSION["pcmembers"][0] < $Conf->setting("pc") || $_SESSION["pcmembers"][1] != $version || count($_SESSION["pcmembers"][2]) == 0) {
$pc = array();
$qa = ($Conf->sversion >= 35 ? ", contactTags" : "") . ($Conf->sversion >= 47 ? ", disabled" : "");
$result = $Conf->q("select firstName, lastName, affiliation, email, u.contactId contactId, roles{$qa} from ContactInfo u where (roles&" . Contact::ROLE_PC . ")!=0");
$by_name_text = array();
while ($row = edb_orow($result)) {
$pc[$row->contactId] = $row = Contact::make($row);
if ($row->firstName || $row->lastName) {
$name_text = Text::name_text($row);
if (isset($by_name_text[$name_text])) {
$row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true;
}
$by_name_text[$name_text] = $row;
}
}
uasort($pc, "Contact::compare");
$_SESSION["pcmembers"] = array($Conf->setting("pc"), $version, $pc);
}
return $_SESSION["pcmembers"][2];
}
示例10: same_authors
private function same_authors($pj, $opj)
{
$pj_ct = count(get($pj, "authors"));
$opj_ct = count(get($opj, "authors"));
if ($pj_ct != $opj_ct) {
return false;
}
for ($i = 0; $i != $pj_ct; ++$i) {
if (get($pj->authors[$i], "email") !== get($opj->authors[$i], "email") || get_s($pj->authors[$i], "affiliation") !== get_s($opj->authors[$i], "affiliation") || Text::name_text($pj->authors[$i]) !== Text::name_text($opj->authors[$i])) {
return false;
}
}
return true;
}
示例11: expandvar_recipient
function expandvar_recipient($what, $isbool)
{
global $Conf;
// rest is only there if we have a pset
if (!$this->pset) {
return self::EXPANDVAR_CONTINUE;
}
if ($what == "%PSET%" || $what == "%TITLE%") {
return $this->pset->title;
}
if ($what == "%REPO%") {
if ($this->pset->gitless) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
if (!$info || !$info->repo) {
return $isbool ? false : "(no repo)";
}
return $info->repo->web_url();
}
if ($what == "%PARTNER%") {
if (!$this->pset->partner) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
if (!$info || !$info->partner) {
return $isbool ? false : "N/A";
}
return Text::name_text($info->partner);
}
if (preg_match(',\\A%(?:COMMIT(?:|HASH|ABBREV|TITLE|DATE)|LATEHOURS)%\\z,', $what)) {
if ($this->pset->gitless) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
$recent = null;
if ($info && $info->has_commit_set()) {
$recent = $info->commit();
}
if (!$recent) {
if ($isbool) {
return false;
} else {
if ($what == "%COMMITABBREV%" || $what == "%COMMITDATE%") {
return "N/A";
} else {
return "(no commit)";
}
}
}
if ($what == "%COMMITHASH%") {
return $recent->hash;
}
if ($what == "%COMMITABBREV%") {
return substr($recent->hash, 0, 7);
}
if ($what == "%COMMIT%" && !$recent) {
return substr($recent->hash, 0, 7);
} else {
if (!$recent) {
return $isbool ? false : "(unknown)";
} else {
if ($what == "%COMMITTITLE%") {
return $recent->subject ?: "(empty)";
} else {
if ($what == "%COMMIT%") {
$subject = UnicodeHelper::utf8_prefix($recent->subject, 72);
if (strlen($subject) != strlen($recent->subject)) {
$subject .= "...";
}
return substr($recent->hash, 0, 7) . ($subject === "" ? "" : " {$subject}");
} else {
if ($what == "%COMMITDATE%") {
return date("Y/m/d H:i:s", $recent->commitat);
} else {
if ($what == "%LATEHOURS%") {
// XXX should use PsetView::late_hours
if ($this->pset->deadline_extension && ($this->recipient->extension || $info->partner && $info->partner->extension)) {
$deadline = $this->pset->deadline_extension;
} else {
if ($this->pset->deadline_college) {
$deadline = $this->pset->deadline_college;
} else {
$deadline = $this->pset->deadline;
}
}
if (!$deadline || $recent->commitat <= $deadline) {
return $isbool ? false : "0";
} else {
return (string) (int) (($recent->commitat - $deadline + 3599) / 3600);
}
}
}
}
}
}
}
}
if ($what == "%GRADEENTRIES%") {
$info = $this->get_pset_info();
//.........这里部分代码省略.........
示例12: content
function content($fieldId, $row)
{
global $Conf;
switch ($fieldId) {
case self::FIELD_NAME:
$t = Text::name_html($row);
if (trim($t) == "") {
$t = "[No name]";
}
$t = '<span class="taghl">' . $t . '</span>';
if ($this->contact->privChair) {
$t = "<a href=\"" . hoturl("profile", "u=" . urlencode($row->email) . $this->contactLinkArgs) . "\"" . ($row->disabled ? " class='uu'" : "") . ">{$t}</a>";
}
if ($row->roles & Contact::ROLE_CHAIR) {
$t .= ' <span class="pcrole">(chair)</span>';
} else {
if (($row->roles & (Contact::ROLE_ADMIN | Contact::ROLE_PC)) == (Contact::ROLE_ADMIN | Contact::ROLE_PC)) {
$t .= ' <span class="pcrole">(PC, sysadmin)</span>';
} else {
if ($row->roles & Contact::ROLE_ADMIN) {
$t .= ' <span class="pcrole">(sysadmin)</span>';
} else {
if ($row->roles & Contact::ROLE_PC && $this->limit != "pc") {
$t .= ' <span class="pcrole">(PC)</span>';
}
}
}
}
if ($this->contact->privChair && $row->email != $this->contact->email) {
$t .= " <a href=\"" . hoturl("index", "actas=" . urlencode($row->email)) . "\">" . Ht::img("viewas.png", "[Act as]", array("title" => "Act as " . Text::name_text($row))) . "</a>";
}
if ($row->disabled && $this->contact->isPC) {
$t .= ' <span class="hint">(disabled)</span>';
}
return $t;
case self::FIELD_EMAIL:
if (!$this->contact->isPC) {
return "";
}
$e = htmlspecialchars($row->email);
if (strpos($row->email, "@") === false) {
return $e;
} else {
return "<a href=\"mailto:{$e}\">{$e}</a>";
}
case self::FIELD_AFFILIATION:
case self::FIELD_AFFILIATION_ROW:
return htmlspecialchars($row->affiliation);
case self::FIELD_LASTVISIT:
if (!$row->lastLogin) {
return "Never";
}
return $Conf->printableTimeShort($row->lastLogin);
case self::FIELD_SELECTOR:
case self::FIELD_SELECTOR_ON:
$this->any->sel = true;
$c = "";
if ($fieldId == self::FIELD_SELECTOR_ON) {
$c = " checked='checked'";
}
return "<input type='checkbox' class='cb' name='pap[]' value='{$row->contactId}' tabindex='1' id='psel{$this->count}' onclick='rangeclick(event,this)' {$c}/>";
case self::FIELD_HIGHTOPICS:
case self::FIELD_LOWTOPICS:
if (!defval($row, "topicIds")) {
return "";
}
$wanthigh = $fieldId == self::FIELD_HIGHTOPICS;
$topics = array_combine(explode(",", $row->topicIds), explode(",", $row->topicInterest));
$nt = $nti = array();
foreach ($topics as $k => $v) {
if ($wanthigh ? $v > 0 : $v < 0) {
$nt[] = $k;
$nti[] = $v;
}
}
if (count($nt)) {
return PaperInfo::unparse_topic_list_html($nt, $nti, true);
} else {
return "";
}
case self::FIELD_REVIEWS:
if (!$row->numReviews && !$row->numReviewsSubmitted) {
return "";
}
$a1 = "<a href=\"" . hoturl("search", "t=s&q=re:" . urlencode($row->email)) . "\">";
if ($row->numReviews == $row->numReviewsSubmitted) {
return "{$a1}<b>{$row->numReviewsSubmitted}</b></a>";
} else {
return "{$a1}<b>{$row->numReviewsSubmitted}</b>/{$row->numReviews}</a>";
}
case self::FIELD_LEADS:
if (!$row->numLeads) {
return "";
}
return "<a href=\"" . hoturl("search", "t=s&q=lead:" . urlencode($row->email)) . "\">{$row->numLeads}</a>";
case self::FIELD_SHEPHERDS:
if (!$row->numShepherds) {
return "";
}
return "<a href=\"" . hoturl("search", "t=s&q=shepherd:" . urlencode($row->email)) . "\">{$row->numShepherds}</a>";
//.........这里部分代码省略.........
示例13: pc_members
function pc_members()
{
if ($this->_pc_members_cache === null) {
$pc = $pca = array();
$result = $this->q("select firstName, lastName, affiliation, email, contactId, roles, contactTags, disabled from ContactInfo where roles!=0 and (roles&" . Contact::ROLE_PCLIKE . ")!=0");
$by_name_text = $by_first_text = [];
$this->_pc_tags_cache = ["pc" => "pc"];
while ($result && ($row = Contact::fetch($result, $this))) {
$pca[$row->contactId] = $row;
if ($row->roles & Contact::ROLE_PC) {
$pc[$row->contactId] = $row;
}
if ($row->firstName || $row->lastName) {
$name_text = Text::name_text($row);
if (isset($by_name_text[$name_text])) {
$row->nameAmbiguous = $by_name_text[$name_text]->nameAmbiguous = true;
}
$by_name_text[$name_text] = $row;
}
if ($row->firstName) {
if (isset($by_first_text[$row->firstName])) {
$row->firstNameAmbiguous = $by_first_text[$row->firstName]->firstNameAmbiguous = true;
}
$by_first_text[$row->firstName] = $row;
}
if ($row->contactTags) {
foreach (explode(" ", $row->contactTags) as $t) {
list($tag, $value) = TagInfo::split_index($t);
if ($tag) {
$this->_pc_tags_cache[strtolower($tag)] = $tag;
}
}
}
}
Dbl::free($result);
uasort($pc, "Contact::compare");
$order = 0;
foreach ($pc as $row) {
$row->sort_position = $order;
++$order;
}
$this->_pc_members_cache = $pc;
uasort($pca, "Contact::compare");
$this->_pc_members_and_admins_cache = $pca;
ksort($this->_pc_tags_cache);
}
return $this->_pc_members_cache;
}
示例14: expandvar_recipient
function expandvar_recipient($what, $isbool)
{
global $Conf;
// rest is only there if we have a pset
if (!$this->pset) {
return self::EXPANDVAR_CONTINUE;
}
if ($what == "%PSET%" || $what == "%TITLE%") {
return $this->pset->title;
}
if ($what == "%REPO%") {
if ($this->pset->gitless) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
if (!$info || !$info->repo) {
return $isbool ? false : "(no repo)";
}
return Contact::repo_https_url($info->repo->url);
}
if ($what == "%PARTNER%") {
if (!$this->pset->partner) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
if (!$info || !$info->partner) {
return $isbool ? false : "N/A";
}
return Text::name_text($info->partner);
}
if (preg_match(',\\A%(?:COMMIT(?:|HASH|ABBREV|TITLE|DATE)|LATEHOURS)%\\z,', $what)) {
if ($this->pset->gitless) {
return $isbool ? false : self::EXPANDVAR_CONTINUE;
}
$info = $this->get_pset_info();
$recent = $info ? @$info->commit() : null;
if (!$recent) {
if ($isbool) {
return false;
} else {
if ($what == "%COMMITABBREV%" || $what == "%COMMITDATE%") {
return "N/A";
} else {
return "(no commit)";
}
}
}
if ($what == "%COMMITHASH%") {
return $recent->hash;
}
if ($what == "%COMMITABBREV%") {
return substr($recent->hash, 0, 7);
}
if ($what == "%COMMIT%" && !$recent) {
return substr($recent->hash, 0, 7);
} else {
if (!$recent) {
return $isbool ? false : "(unknown)";
} else {
if ($what == "%COMMITTITLE%") {
return $recent->subject ?: "(empty)";
} else {
if ($what == "%COMMIT%") {
$subject = utf8_substr($recent->subject, 0, 72);
if (strlen($subject) != strlen($recent->subject)) {
$subject .= "...";
}
return substr($recent->hash, 0, 7) . ($subject === "" ? "" : " {$subject}");
} else {
if ($what == "%COMMITDATE%") {
return date("Y/m/d H:i:s", $recent->commitat);
} else {
if ($what == "%LATEHOURS%") {
// XXX should use PsetView::late_hours
if ($this->pset->deadline_extension && ($this->recipient->extension || $info->partner && $info->partner->extension)) {
$deadline = $this->pset->deadline_extension;
} else {
if ($this->pset->deadline_college) {
$deadline = $this->pset->deadline_college;
} else {
$deadline = $this->pset->deadline;
}
}
if (!$deadline || $recent->commitat <= $deadline) {
return $isbool ? false : "0";
} else {
return (string) (int) (($recent->commitat - $deadline + 3599) / 3600);
}
}
}
}
}
}
}
}
return self::EXPANDVAR_CONTINUE;
}