当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggGroup::getSubtype方法代码示例

本文整理汇总了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;
 }
开发者ID:elgg,项目名称:elgg,代码行数:42,代码来源:GroupIconTransfer.php

示例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');
}
开发者ID:hypeJunction,项目名称:Elgg-group_subtypes,代码行数:12,代码来源:start.php


注:本文中的ElggGroup::getSubtype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。