本文整理汇总了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;
}