本文整理匯總了PHP中Tags::toTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tags::toTags方法的具體用法?PHP Tags::toTags怎麽用?PHP Tags::toTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tags
的用法示例。
在下文中一共展示了Tags::toTags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTags
/**
* Return array of object tags
*
* @param void
* @return array
*/
function getTags()
{
return Tags::toTags(parent::getTags());
}
示例2: buildPortalIndex
/**
* Return portal tags index for a given portal project ID
*
* Index is an associative array of tags where key is the tag and value is
* associative array of options:
*
* - objects - IDs of all objects that have tags
* - normal objects - IDs of objects marked as normal
*
* @param integer $project_id
* @return array
*/
function buildPortalIndex($project_id)
{
$result = array();
$rows = db_execute_all('SELECT id, visibility, tags FROM ' . TABLE_PREFIX . 'project_objects WHERE project_id = ? AND tags != ? AND visibility >= ?', $project_id, '', VISIBILITY_NORMAL);
if (is_foreachable($rows)) {
foreach ($rows as $row) {
$tags = Tags::toTags($row['tags']);
if (is_foreachable($tags)) {
foreach ($tags as $tag) {
if (!isset($result[$tag])) {
$result[$tag] = array('objects' => array(), 'normal_objects' => array(), 'public_objects' => array());
}
// if
$result[$tag]['objects'][] = $row['id'];
switch ($row['visibility']) {
case VISIBILITY_NORMAL:
$result[$tag]['normal_objects'][] = $row['id'];
break;
case VISIBILITY_PUBLIC:
$result[$tag]['public_objects'][] = $row['id'];
break;
}
// switch
}
// foreach
}
// if
}
// foreach
}
// if
return $result;
}