• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_entity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_entity函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entity函数的具体用法?PHP get_entity怎么用?PHP get_entity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_entity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bookmark_tools_get_folders

function bookmark_tools_get_folders($container_guid = 0)
{
    $result = false;
    if (empty($container_guid)) {
        $container_guid = elgg_get_page_owner_guid();
    }
    if (!empty($container_guid)) {
        $options = array("type" => "object", "subtype" => BOOKMARK_TOOLS_SUBTYPE, "container_guid" => $container_guid, "limit" => false);
        if ($folders = elgg_get_entities($options)) {
            $parents = array();
            foreach ($folders as $folder) {
                $parent_guid = (int) $folder->parent_guid;
                if (!empty($parent_guid)) {
                    if ($temp = get_entity($parent_guid)) {
                        if ($temp->getSubtype() != BOOKMARK_TOOLS_SUBTYPE) {
                            $parent_guid = 0;
                        }
                    } else {
                        $parent_guid = 0;
                    }
                } else {
                    $parent_guid = 0;
                }
                if (!array_key_exists($parent_guid, $parents)) {
                    $parents[$parent_guid] = array();
                }
                $parents[$parent_guid][] = $folder;
            }
            $result = bookmark_tools_sort_folders($parents, 0);
        }
    }
    return $result;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:33,代码来源:functions.php


示例2: createWidget

 /**
  * @see elgg_create_widget
  * @access private
  * @since 1.9.0
  */
 public function createWidget($owner_guid, $handler, $context, $access_id = null)
 {
     if (empty($owner_guid) || empty($handler) || !$this->validateType($handler)) {
         return false;
     }
     $owner = get_entity($owner_guid);
     if (!$owner) {
         return false;
     }
     $widget = new \ElggWidget();
     $widget->owner_guid = $owner_guid;
     $widget->container_guid = $owner_guid;
     // @todo - will this work for group widgets?
     if (isset($access_id)) {
         $widget->access_id = $access_id;
     } else {
         $widget->access_id = get_default_access();
     }
     if (!$widget->save()) {
         return false;
     }
     // private settings cannot be set until \ElggWidget saved
     $widget->handler = $handler;
     $widget->context = $context;
     return $widget->getGUID();
 }
开发者ID:cyrixhero,项目名称:Elgg,代码行数:31,代码来源:WidgetsService.php


示例3: subsite_manager_siteid_hook

function subsite_manager_siteid_hook($hook, $type, $return, $params)
{
    global $SUBSITE_MANAGER_CUSTOM_DOMAIN;
    $result = false;
    elgg_register_classes(dirname(__FILE__) . "/classes/");
    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "") {
        $protocol = "https";
    } else {
        $protocol = "http";
    }
    if (strpos($_SERVER["HTTP_HOST"], "www.") === 0) {
        $alt_host = str_replace("www.", "", $_SERVER["HTTP_HOST"]);
    } else {
        $alt_host = "www." . $_SERVER["HTTP_HOST"];
    }
    $url = $protocol . "://" . $_SERVER["HTTP_HOST"] . "/";
    $alt_url = $protocol . "://" . $alt_host . "/";
    if ($site = get_site_by_url($url)) {
        $result = $site->getGUID();
    } elseif ($site = get_site_by_url($alt_url)) {
        $result = $site->getGUID();
    } else {
        // no site found, forward to main site
        $default_site_guid = (int) datalist_get("default_site");
        $default_site = get_entity($default_site_guid);
        forward($default_site->url);
    }
    return $result;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:29,代码来源:system.php


示例4: odt_editor_page_handler

/**
 * Dispatches odt_editor pages.
 * URLs take the form of
 *  Save as:       odt_editor/saveas/<guid>
 *
 * @param array $page
 * @return bool
 */
function odt_editor_page_handler($page)
{
    $odt_editor_pages_dir = elgg_get_plugins_path() . 'odt_editor/pages';
    $page_type = $page[0];
    switch ($page_type) {
        case 'saveas':
            set_input('guid', $page[1]);
            include "{$odt_editor_pages_dir}/odt_editor/saveas.php";
            break;
        case 'create':
            $container = get_entity($page[1]);
            if (!$container) {
                $container = get_loggedin_userid();
            }
            // show new document in WebODF editor page
            // 0 as indicator for new document
            set_input('guid', 0);
            set_input('container_guid', $page[1]);
            include "{$odt_editor_pages_dir}/file/odt_editor.php";
            $result = false;
            break;
        case 'gettemplate':
            include "{$odt_editor_pages_dir}/odt_editor/gettemplate.php";
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:pleio,项目名称:odt_editor,代码行数:37,代码来源:page_handlers.php


示例5: recursive_breadcrumb

/**
 * View a single blogbook
 *
 * @package Elggtblogs
 */
function recursive_breadcrumb($tblog)
{
    if ($tblog->parent_guid != '') {
        recursive_breadcrumb(get_entity($tblog->parent_guid));
    }
    elgg_push_breadcrumb($tblog->title, "/blogbook/view/{$tblog->guid}");
}
开发者ID:mustafabicer,项目名称:elggplugins,代码行数:12,代码来源:view.php


示例6: registerUserHover

 /**
  * Adds menu items to the user hover menu
  *
  * @param string $hook        hook name
  * @param string $entity_type hook type
  * @param array  $returnvalue current return value
  * @param array  $params      parameters
  *
  * @return array
  */
 public static function registerUserHover($hook, $entity_type, $returnvalue, $params)
 {
     $guid = get_input('guid');
     $user = elgg_extract('entity', $params);
     if (empty($guid) || empty($user)) {
         return;
     }
     $event = get_entity($guid);
     if (!$event instanceof \Event) {
         return;
     }
     if (!$event->canEdit()) {
         return;
     }
     $result = $returnvalue;
     // kick from event (assumes users listed on the view page of an event)
     $href = 'action/event_manager/event/rsvp?guid=' . $event->getGUID() . '&user=' . $user->getGUID() . '&type=' . EVENT_MANAGER_RELATION_UNDO;
     $item = \ElggMenuItem::factory(['name' => 'event_manager_kick', 'text' => elgg_echo('event_manager:event:relationship:kick'), 'href' => $href, 'is_action' => true, 'section' => 'action']);
     $result[] = $item;
     $user_relationship = $event->getRelationshipByUser($user->getGUID());
     if ($user_relationship == EVENT_MANAGER_RELATION_ATTENDING_PENDING) {
         // resend confirmation
         $href = 'action/event_manager/event/resend_confirmation?guid=' . $event->getGUID() . '&user=' . $user->getGUID();
         $item = \ElggMenuItem::factory(['name' => 'event_manager_resend_confirmation', 'text' => elgg_echo("event_manager:event:menu:user_hover:resend_confirmation"), 'href' => $href, 'is_action' => true, 'section' => 'action']);
         $result[] = $item;
     }
     if (in_array($user_relationship, [EVENT_MANAGER_RELATION_ATTENDING_PENDING, EVENT_MANAGER_RELATION_ATTENDING_WAITINGLIST])) {
         // move to attendees
         $href = 'action/event_manager/attendees/move_to_attendees?guid=' . $event->getGUID() . '&user=' . $user->getGUID();
         $item = \ElggMenuItem::factory(['name' => 'event_manager_move_to_attendees', 'text' => elgg_echo('event_manager:event:menu:user_hover:move_to_attendees'), 'href' => $href, 'is_action' => true, 'section' => 'action']);
         $result[] = $item;
     }
     return $result;
 }
开发者ID:coldtrick,项目名称:event_manager,代码行数:44,代码来源:Menus.php


示例7: anypage_widgets_convert

/**
 * Anypage Widgets convert
 *
 * Convers a description/text into content with widgets.
 * It replaces BBCode tags with content from widgets, for example:
 * [WIDGET:home]
 *
 * @param string $description Description to transform
 *
 * @return string Transformed description
 */
function anypage_widgets_convert($description)
{
    return preg_replace_callback('/\\[WIDGET:[^]]+\\]/', function ($matches) {
        $paramsString = substr(strip_tags($matches[0]), 8, -1);
        $params = (array) explode(':', $paramsString);
        if (!isset($params[0])) {
            return 'Widget ID not defined.';
        }
        $widget = get_entity($params[0]);
        if (!myvox_instanceof($widget, 'object', 'widget')) {
            return 'Widget not found.';
        }
        $style = '';
        foreach ($params as $param) {
            $subparam = explode('|', $param);
            switch ($subparam[0]) {
                case 'style':
                    if (isset($subparam[1]) && isset($subparam[2])) {
                        $style .= $subparam[1] . ': ' . $subparam[2] . ';';
                    }
                    break;
            }
        }
        return myvox_view('anypage_widgets/widget', array('body' => myvox_view_entity($widget), 'style' => $style));
    }, $description);
}
开发者ID:centillien,项目名称:anypage_widgets,代码行数:37,代码来源:start.php


示例8: group_tools_groupicon_page_handler

/**
 * Take over the groupicon page handler for fallback
 *
 * @param array $page the url elements
 *
 * @return void
 */
function group_tools_groupicon_page_handler($page)
{
    // group guid
    if (!isset($page[0])) {
        header("HTTP/1.1 400 Bad Request");
        exit;
    }
    $group_guid = $page[0];
    $group = get_entity($group_guid);
    if (empty($group) || !elgg_instanceof($group, "group")) {
        header("HTTP/1.1 400 Bad Request");
        exit;
    }
    $owner_guid = $group->getOwnerGUID();
    $icontime = (int) $group->icontime;
    if (empty($icontime)) {
        header("HTTP/1.1 404 Not Found");
        exit;
    }
    // size
    $size = "medium";
    if (isset($page[1])) {
        $icon_sizes = elgg_get_config("icon_sizes");
        if (!empty($icon_sizes) && array_key_exists($page[1], $icon_sizes)) {
            $size = $page[1];
        }
    }
    $params = array("group_guid" => $group_guid, "guid" => $owner_guid, "size" => $size, "icontime" => $icontime);
    $url = elgg_http_add_url_query_elements("mod/group_tools/pages/groups/thumbnail.php", $params);
    forward($url);
}
开发者ID:n8b,项目名称:VMN,代码行数:38,代码来源:page_handlers.php


示例9: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $user = elgg_get_logged_in_user_entity();
     $object = get_entity($params->guid);
     if (!$object || !$object->canWriteToContainer(0, 'object', 'comment')) {
         throw new GraphException("You are not allowed to comment on this object", 403);
     }
     $comment_text = $params->comment;
     $comment = new ElggComment();
     $comment->owner_guid = $user->guid;
     $comment->container_guid = $object->guid;
     $comment->description = $comment_text;
     $comment->access_id = $object->access_id;
     if (!$comment->save()) {
         throw new GraphException(elgg_echo("generic_comment:failure"));
     }
     // Notify if poster wasn't owner
     if ($object->owner_guid != $user->guid) {
         $owner = $object->getOwnerEntity();
         notify_user($owner->guid, $user->guid, elgg_echo('generic_comment:email:subject', array(), $owner->language), elgg_echo('generic_comment:email:body', array($object->title, $user->name, $comment->description, $comment->getURL(), $user->name, $user->getURL()), $owner->language), array('object' => $comment, 'action' => 'create'));
     }
     $return = array('nodes' => array('comment' => $comment));
     // Add to river
     $river_id = elgg_create_river_item(array('view' => 'river/object/comment/create', 'action_type' => 'comment', 'subject_guid' => $user->guid, 'object_guid' => $comment->guid, 'target_guid' => $object->guid));
     if ($river_id) {
         $river = elgg_get_river(array('ids' => $river_id));
         $return['nodes']['activity'] = $river ? $river[0] : $river_id;
     }
     return $return;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:33,代码来源:ObjectComments.php


示例10: phpmailer_extract_from_email

/**
 * Determine the best from email address
 *
 * @return string with email address
 */
function phpmailer_extract_from_email()
{
    global $CONFIG;
    $from_email = '';
    $site = get_entity($CONFIG->site_guid);
    // If there's an email address, use it - but only if its not from a user.
    if (isset($from->email) && !$from instanceof ElggUser) {
        $from_email = $from->email;
        // Has the current site got a from email address?
    } else {
        if ($site && isset($site->email)) {
            $from_email = $site->email;
            // If we have a url then try and use that.
        } else {
            if (isset($from->url)) {
                $breakdown = parse_url($from->url);
                $from_email = 'noreply@' . $breakdown['host'];
                // Handle anything with a url
                // If all else fails, use the domain of the site.
            } else {
                $from_email = 'noreply@' . get_site_domain($CONFIG->site_guid);
            }
        }
    }
    return $from_email;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:start.php


示例11: badges_userpoints

/**
 * This method is called when a users points are updated.
 * We check to see what the users current balance is and
 * assign the appropriate badge.
 */
function badges_userpoints($hook, $type, $return, $params)
{
    if ($params['entity']->badges_locked) {
        return true;
    }
    $points = $params['entity']->userpoints_points;
    $badge = get_entity($params['entity']->badges_badge);
    $options = array('type' => 'object', 'subtype' => 'badge', 'limit' => false, 'order_by_metadata' => array('name' => 'badges_userpoints', 'direction' => DESC, 'as' => integer));
    $options['metadata_name_value_pairs'] = array(array('name' => 'badges_userpoints', 'value' => $points, 'operand' => '<='));
    $entities = elgg_get_entities_from_metadata($options);
    if ((int) elgg_get_plugin_setting('lock_high', 'elggx_badges')) {
        if ($badge->badges_userpoints > $entities[0]->badges_userpoints) {
            return true;
        }
    }
    if ($badge->guid != $entities[0]->guid) {
        $params['entity']->badges_badge = $entities[0]->guid;
        if (!elgg_trigger_plugin_hook('badges:update', 'object', array('entity' => $user), true)) {
            $params['entity']->badges_badge = $badge->guid;
            return false;
        }
        // Announce it on the river
        $user_guid = $params['entity']->getGUID();
        elgg_delete_river(array("view" => 'river/object/badge/assign', "subject_guid" => $user_guid, "object_guid" => $user_guid));
        elgg_delete_river(array("view" => 'river/object/badge/award', "subject_guid" => $user_guid, "object_guid" => $user_guid));
        elgg_create_river_item(array('view' => 'river/object/badge/award', 'action_type' => 'award', 'subject_guid' => $user_guid, 'object_guid' => $user_guid));
    }
    return true;
}
开发者ID:iionly,项目名称:elggx_badges,代码行数:34,代码来源:start.php


示例12: renderURLHTML

 public static function renderURLHTML($url)
 {
     $favicon = "http://g.etfv.co/{$url}";
     if (class_exists('UFCOE\\Elgg\\Url')) {
         $sniffer = new Url();
         $guid = $sniffer->getGuid($url);
         if ($entity = get_entity($guid)) {
             $favicon = $entity->getIconURL('tiny');
             if (elgg_instanceof($entity->user)) {
                 $text = "@{$entity->username}";
             } else {
                 $text = isset($entity->name) ? $entity->name : $entity->title;
             }
         }
     }
     if (!$text) {
         $embedder = new Embedder($url);
         $meta = $embedder->extractMeta('oembed');
         if ($meta->title) {
             $text = $meta->title;
         } else {
             $text = elgg_get_excerpt($url, 35);
         }
     }
     return elgg_view('output/url', array('text' => "<span class=\"favicon\" style=\"background-image:url({$favicon})\"></span><span class=\"link\">{$text}</span>", 'href' => $url, 'class' => 'extractor-link'));
 }
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:26,代码来源:Extractor.php


示例13: elgg_tokeninput_explode_field_values

/**
 * Unserialize tokeninput field values before performing an action
 */
function elgg_tokeninput_explode_field_values($hook, $type, $return, $params)
{
    $elgg_tokeninput_fields = (array) get_input('elgg_tokeninput_fields', array());
    $elgg_tokneinput_autocomplete = (array) get_input('elgg_tokeninput_autocomplete', array());
    if (!empty($elgg_tokeninput_fields)) {
        foreach ($elgg_tokeninput_fields as $field_name) {
            $values = explode(',', get_input($field_name, ''));
            if (in_array($field_name, $elgg_tokneinput_autocomplete)) {
                foreach ($values as $key => $value) {
                    $user = get_entity($value);
                    if ($user instanceof ElggUser) {
                        $values[$key] = $user->username;
                    }
                }
                if (sizeof($values) === 1) {
                    $values = array_values($values)[0];
                }
            }
            set_input($field_name, $values);
        }
    }
    set_input('elgg_tokeninput_fields', null);
    set_input('elgg_tokeninput_autocomplete', null);
    return $return;
}
开发者ID:n8b,项目名称:VMN,代码行数:28,代码来源:start.php


示例14: getResponse

 /**
  * Handle a request for a file
  *
  * @param Request $request HTTP request
  * @return Response
  */
 public function getResponse($request)
 {
     $response = new Response();
     $response->prepare($request);
     $path = implode('/', $request->getUrlSegments());
     if (!preg_match('~download-file/g(\\d+)$~', $path, $m)) {
         return $response->setStatusCode(400)->setContent('Malformatted request URL');
     }
     $this->application->start();
     $guid = (int) $m[1];
     $file = get_entity($guid);
     if (!$file instanceof ElggFile) {
         return $response->setStatusCode(404)->setContent("File with guid {$guid} does not exist");
     }
     $filenameonfilestore = $file->getFilenameOnFilestore();
     if (!is_readable($filenameonfilestore)) {
         return $response->setStatusCode(404)->setContent('File not found');
     }
     $last_updated = filemtime($filenameonfilestore);
     $etag = '"' . $last_updated . '"';
     $response->setPublic()->setEtag($etag);
     if ($response->isNotModified($request)) {
         return $response;
     }
     $response = new BinaryFileResponse($filenameonfilestore, 200, array(), false, 'attachment');
     $response->prepare($request);
     $expires = strtotime('+1 year');
     $expires_dt = (new DateTime())->setTimestamp($expires);
     $response->setExpires($expires_dt);
     $response->setEtag($etag);
     return $response;
 }
开发者ID:nirajkaushal,项目名称:Elgg,代码行数:38,代码来源:DownloadFileHandler.php


示例15: tearDown

 /**
  * Remove the entities that are created for each test
  */
 protected function tearDown()
 {
     foreach ($this->guids as $guid) {
         $e = get_entity($guid);
         $e->delete();
     }
 }
开发者ID:ibou77,项目名称:elgg,代码行数:10,代码来源:RelationshipsTest.php


示例16: execute

 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $count = count($this->guids);
     $success = $notfound = 0;
     foreach ($this->guids as $guid) {
         $message = get_entity($guid);
         if (!$message instanceof Message) {
             $notfound++;
             continue;
         }
         $message->markRead($this->threaded);
         $success++;
     }
     if ($count > 1) {
         $msg[] = elgg_echo('inbox:markread:success', array($success));
         if ($notfound > 0) {
             $msg[] = elgg_echo('inbox:error:notfound', array($notfound));
         }
     } else {
         if ($success) {
             $msg[] = elgg_echo('inbox:markread:success:single');
         } else {
             $msg[] = elgg_echo('inbox:markread:error');
         }
     }
     $msg = implode('<br />', $msg);
     if ($success < $count) {
         $this->result->addError($msg);
     } else {
         $this->result->addMessage($msg);
     }
 }
开发者ID:n8b,项目名称:VMN,代码行数:35,代码来源:MarkAsRead.php


示例17: westorElggMan_cron_handler

function westorElggMan_cron_handler($hook, $entity_type, $returnvalue, $params)
{
    global $CONFIG;
    // old elgg bevore 1.7.0
    global $is_admin;
    $is_admin = true;
    if (function_exists("elgg_set_ignore_access")) {
        // new function for access overwrite
        elgg_set_ignore_access(true);
    }
    $context = westorElggMan_get_context();
    westorElggMan_set_context('westorElggMan');
    $prefix = $CONFIG->dbprefix;
    $sql = "SELECT {$prefix}metadata.entity_guid\nFROM (({$prefix}metadata AS {$prefix}metadata_1 INNER JOIN {$prefix}metastrings AS {$prefix}metastrings_3\nON {$prefix}metadata_1.name_id = {$prefix}metastrings_3.id) INNER JOIN {$prefix}metastrings\nAS {$prefix}metastrings_2 ON {$prefix}metadata_1.value_id = {$prefix}metastrings_2.id) INNER JOIN (({$prefix}metadata INNER JOIN {$prefix}metastrings ON {$prefix}metadata.name_id = {$prefix}metastrings.id) INNER JOIN {$prefix}metastrings AS {$prefix}metastrings_1 ON {$prefix}metadata.value_id = {$prefix}metastrings_1.id) ON {$prefix}metadata_1.entity_guid = {$prefix}metadata.entity_guid\nWHERE ((({$prefix}metastrings.string)='waitForSend') AND (({$prefix}metastrings_1.string)='1')\nAND (({$prefix}metastrings_3.string)='hiddenTo') AND (({$prefix}metastrings_2.string)<>'1'))";
    // and (scheduled is null || scheduled <= now());
    try {
        $result = get_data($sql);
    } catch (Exception $e) {
        westorElggMan_set_context($context);
        throw new Exception($e);
    }
    if (is_array($result)) {
        $elggMan = new class_elggMan();
        foreach ($result as $row) {
            $message = get_entity($row->entity_guid);
            if (is_object($message) && $message->getSubtype() == "messages") {
                $elggMan->sendMsgNow($message);
            }
        }
    }
    westorElggMan_set_context($context);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:32,代码来源:start.php


示例18: unserialize

 /**
  * Unserializes the event object stored in the database
  *
  * @param string $serialized Serialized string
  * @return string
  */
 public function unserialize($serialized)
 {
     $data = unserialize($serialized);
     if (isset($data->action)) {
         $this->action = $data->action;
     }
     if (isset($data->object_id) && isset($data->object_type)) {
         switch ($data->object_type) {
             case 'object':
             case 'user':
             case 'group':
             case 'site':
                 $this->object = get_entity($data->object_id);
                 break;
             case 'annotation':
                 $this->object = elgg_get_annotation_from_id($data->object_id);
                 break;
             case 'metadata':
                 $this->object = elgg_get_metadata_from_id($data->object_id);
                 break;
             case 'relationship':
                 $this->object = get_relationship($data->object_id);
         }
     }
     if (isset($data->actor_guid)) {
         $this->actor = get_entity($data->actor_guid);
     }
 }
开发者ID:elgg,项目名称:elgg,代码行数:34,代码来源:EventSerialization.php


示例19: theme_ffd_fivestar_get_top_users

function theme_ffd_fivestar_get_top_users($n_days = 21, $eps = 0.5)
{
    $options = array('annotation_name' => 'fivestar', 'where' => 'n_table.time_created > ' . (time() - 3600 * 24 * $n_days), 'order_by' => 'n_table.time_created desc', 'limit' => 250);
    $annotations = elgg_get_annotations($options);
    $top_users = array();
    foreach ($annotations as $annotation) {
        $user = $annotation->getEntity()->getOwnerGuid();
        if (!array_key_exists($user, $top_users)) {
            $top_users[$user] = array();
        }
        $top_users[$user][] = $annotation->value / 100;
    }
    $max_scores = 0;
    foreach ($top_users as $guid => $scores) {
        if (count($scores) > $max_scores) {
            $max_scores = count($scores);
        }
    }
    // calculate the average score
    $top_users = array_map(function ($scores) use($max_scores, $eps) {
        return $eps * (array_sum($scores) / count($scores)) * ((1 - $eps) * (count($scores) / $max_scores));
    }, $top_users);
    arsort($top_users);
    $top_users = array_slice($top_users, 0, 10, true);
    $users = array();
    foreach ($top_users as $guid => $score) {
        $users[] = get_entity($guid);
    }
    return $users;
}
开发者ID:pleio,项目名称:theme_ffd,代码行数:30,代码来源:functions.php


示例20: au_group_tag_menu_page_handler

function au_group_tag_menu_page_handler($page, $identifier)
{
    //show the page of search results
    // assumes url of group/guid/tag
    // if the tag is 'all' then will display a tagcloud
    switch ($page[0]) {
        case 'group':
            $entity = get_entity($page[1]);
            if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') {
                return false;
            }
            elgg_push_breadcrumb($entity->name, $entity->getURL());
            //should be OK if this is empty
            $tag = $page[2];
            elgg_push_breadcrumb($tag);
            if ($tag == "all") {
                //show a tag cloud for all group tags
                //arbitrarily set to a max of 640 tags - should be enough for anyone :-)
                $title = elgg_echo("au_group_tag_menu:tagcloud");
                $options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags'));
                $thetags = elgg_get_tags($options);
                //make it an alphabetical tag cloud, not with most popular first
                sort($thetags);
                //find the highest tag count for scaling the font
                $max = 0;
                foreach ($thetags as $key) {
                    if ($key->total > $max) {
                        $max = $key->total;
                    }
                }
                $content = "  ";
                //loop through and generate tags so they display nicely
                //in the group, not as a dumb search page
                foreach ($thetags as $key) {
                    $url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag);
                    $taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag'));
                    //  get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this)
                    $size = round(log($key->total) / log($max + 0.0001) * 100) + 30;
                    if ($size < 100) {
                        $size = 100;
                    }
                    // generate the link
                    $content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> &nbsp; ";
                }
            } else {
                //show the results for the selected tag
                $title = elgg_echo("au_group_tag_menu:title") . "{$tag}";
                $options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false);
                $content = elgg_list_entities_from_metadata($options);
            }
            //display the page
            if (!$content) {
                $content = elgg_echo('au_group_tag_menu:noresults');
            }
            $layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false));
            echo elgg_view_page($title, $layout);
            break;
    }
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:60,代码来源:start.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_entity_as_row函数代码示例发布时间:2022-05-15
下一篇:
PHP get_entities_from_relationship函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap