本文整理汇总了PHP中DevblocksPlatform::strToPermalink方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::strToPermalink方法的具体用法?PHP DevblocksPlatform::strToPermalink怎么用?PHP DevblocksPlatform::strToPermalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::strToPermalink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContext
function getContext($issue, &$token_labels, &$token_values, $prefix=null) {
if(is_null($prefix))
$prefix = 'Milestone:';
$translate = DevblocksPlatform::getTranslationService();
// Polymorph
if(is_numeric($issue)) {
$issue = DAO_Issue::get($issue);
} elseif($issue instanceof Model_Issue) {
// It's what we want already.
} else {
$article = null;
}
/* @var $article Model_Issue */
// Token labels
$token_labels = array(
'id' => $prefix.$translate->_('common.id'),
'title' => $prefix.$translate->_('issue.title'),
'body' => $prefix.$translate->_('issue.body'),
'created|date' => $prefix.$translate->_('issue.created_date'),
'updated|date' => $prefix.$translate->_('issue.updated_date'),
'closed|date' => $prefix.$translate->_('issue.closed_date'),
'milestone_id'=> $prefix.$translate->_('issue.milestone_id'),
'state' => $prefix.$translate->_('issue.state'),
);
// Token values
$token_values = array();
// Token values
if(null != $article) {
$token_values['id'] = $issue->id;
$token_values['title'] = $issue->title;
$token_values['body'] = $issue->body;
$token_values['created_date'] = $issue->created_date;
$token_values['updated_date'] = $issue->updated_date;
$token_values['closed_date'] = $issue->closed_date;
$token_values['milestone_id'] = $issue->milestone_id;
$token_values['state'] = $issue->state;
// Milestones
if(null != ($categories = $article->getCategories()) && is_array($categories)) {
$token_values['categories'] = array();
foreach($categories as $category_id => $trail) {
foreach($trail as $step_id => $step) {
if(!isset($token_values['categories'][$category_id]))
$token_values['categories'][$category_id] = array();
$token_values['categories'][$category_id][$step_id] = $step->name;
}
}
}
// URL
$url_writer = DevblocksPlatform::getUrlService();
$token_values['record_url'] = $url_writer->writeNoProxy(sprintf("c=issues&action=issues&id=%d-%s", $issue->id, DevblocksPlatform::strToPermalink($issue->title)), true);
}
return TRUE;
}
示例2: getContext
function getContext($milestone, &$token_labels, &$token_values, $prefix=null) {
if(is_null($prefix))
$prefix = 'GithubMilestone:';
$translate = DevblocksPlatform::getTranslationService();
// Polymorph
if(is_numeric($milestone)) {
$milestone = DAO_Milestone::get($milestone);
} elseif($milestone instanceof Model_Milestone) {
// It's what we want already.
} else {
$article = null;
}
/* @var $article Model_Milestone */
// Token labels
$token_labels = array(
'id' => $prefix.$translate->_('common.id'),
'name' => $prefix.$translate->_('github_milestone.name'),
'description' => $prefix.$translate->_('github_milestone.description'),
'created_date|date' => $prefix.$translate->_('github_milestone.created_date'),
'due_date|date' => $prefix.$translate->_('github_milestone.due_date'),
'state' => $prefix.$translate->_('github_milestone.state'),
);
// Token values
$token_values = array();
// Token values
if(null != $article) {
$token_values['id'] = $milestone->id;
$token_values['name'] = $milestone->name;
$token_values['description'] = $milestone->description;
$token_values['created_date'] = $milestone->created_date;
$token_values['due_date'] = $milestone->due_date;
$token_values['state'] = $milestone->state;
// Milestones
if(null != ($categories = $article->getCategories()) && is_array($categories)) {
$token_values['categories'] = array();
foreach($categories as $category_id => $trail) {
foreach($trail as $step_id => $step) {
if(!isset($token_values['categories'][$category_id]))
$token_values['categories'][$category_id] = array();
$token_values['categories'][$category_id][$step_id] = $step->name;
}
}
}
// URL
$url_writer = DevblocksPlatform::getUrlService();
$token_values['record_url'] = $url_writer->writeNoProxy(sprintf("c=github&action=milestones&id=%d-%s", $milestone->id, DevblocksPlatform::strToPermalink($milestone->name)), true);
}
return TRUE;
}