本文整理汇总了PHP中ElggGroup::getSubtype方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggGroup::getSubtype方法的具体用法?PHP ElggGroup::getSubtype怎么用?PHP ElggGroup::getSubtype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggGroup
的用法示例。
在下文中一共展示了ElggGroup::getSubtype方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transferIcons
/**
* Transfer group icons to new filestore location
* Before 3.0, group icons where owned by the group owner
* and located in /groups/<guid><size>.jpg
* relative to group owner's filestore directory
* In 3.0, we are moving these to default filestore location
* relative to group's filestore directory
*
* @param \ElggGroup $group Group entity
* @param \Elgg\Upgrade\Result $result Upgrade result
* @return \Elgg\Upgrade\Result
*/
public function transferIcons(\ElggGroup $group, \Elgg\Upgrade\Result $result)
{
$sizes = elgg_get_icon_sizes('group', $group->getSubtype());
$dataroot = elgg_get_config('dataroot');
$dir = (new \Elgg\EntityDirLocator($group->owner_guid))->getPath();
$prefix = 'groups/';
foreach ($sizes as $size => $opts) {
$filename = "{$group->guid}{$size}.jpg";
$filestorename = "{$dataroot}{$dir}{$prefix}{$filename}";
if (!file_exists($filestorename)) {
// nothing to move
continue;
}
$icon = $group->getIcon($size);
// before transferring the file, we need to make sure
// the directory structure of the new filestore location exists
$icon->open('write');
$icon->close();
if (!rename($filestorename, $icon->getFilenameOnFilestore())) {
$result->addError("\n\t\t\t\t\tFailed to transfer file from '{$filestorename}'\n\t\t\t\t\tto {$icon->getFilenameOnFilestore()}\n\t\t\t\t");
$error = true;
}
}
if ($error) {
$result->addFailures();
} else {
$result->addSuccesses();
}
return $result;
}
示例2: group_subtypes_get_identifier
/**
* Returns page identifier for a group entity
*
* @param ElggGroup $entity Group entity
* @return string
*/
function group_subtypes_get_identifier(ElggGroup $entity)
{
$type = $entity->getType();
$subtype = $entity->getSubtype();
return elgg_trigger_plugin_hook('page_identifier', "{$type}:{$subtype}", ['entity' => $entity], 'groups');
}