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


PHP get_registered_entity_types函数代码示例

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


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

示例1: canReshareEntity

 /**
  * Check if resharing of this entity is allowed
  *
  * @param \ElggEntity $entity the entity to check
  *
  * @return bool
  */
 protected static function canReshareEntity(\ElggEntity $entity)
 {
     if (!$entity instanceof \ElggEntity) {
         return false;
     }
     // only allow objects and groups
     if (!$entity instanceof \ElggObject && !$entity instanceof \ElggGroup) {
         return false;
     }
     // comments and discussion replies are never allowed
     $blocked_subtypes = ['comment', 'discussion_reply'];
     if (in_array($entity->getSubtype(), $blocked_subtypes)) {
         return false;
     }
     // by default allow searchable entities
     $reshare_allowed = false;
     if ($entity instanceof \ElggGroup) {
         $reshare_allowed = true;
     } else {
         $searchable_entities = get_registered_entity_types($entity->getType());
         if (!empty($searchable_entities)) {
             $reshare_allowed = in_array($entity->getSubtype(), $searchable_entities);
         }
     }
     // trigger hook to allow others to change
     $params = ['entity' => $entity, 'user' => elgg_get_logged_in_user_entity()];
     return (bool) elgg_trigger_plugin_hook('reshare', $entity->getType(), $params, $reshare_allowed);
 }
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:35,代码来源:Menus.php

示例2: site_search

/**
 * Performs a search of the elgg site
 *
 * @return array $results search result
 */
function site_search($query, $offset, $limit, $sort, $order, $search_type, $entity_type, $entity_subtype, $owner_guid, $container_guid)
{
    $params = array('query' => $query, 'offset' => $offset, 'limit' => $limit, 'sort' => $sort, 'order' => $order, 'search_type' => $search_type, 'type' => $entity_type, 'subtype' => $entity_subtype, 'owner_guid' => $owner_guid, 'container_guid' => $container_guid);
    $types = get_registered_entity_types();
    foreach ($types as $type => $subtypes) {
        $results = elgg_trigger_plugin_hook('search', $type, $params, array());
        if ($results === FALSE) {
            // someone is saying not to display these types in searches.
            continue;
        }
        if ($results['count']) {
            foreach ($results['entities'] as $single) {
                //search matched critera
                /*
                $result['search_matched_title'] = $single->getVolatileData('search_matched_title');
                $result['search_matched_description'] = $single->getVolatileData('search_matched_description');
                $result['search_matched_extra'] = $single->getVolatileData('search_matched_extra');
                */
                if ($type == 'group' || $type == 'user') {
                    $result['title'] = $single->name;
                } else {
                    $result['title'] = $single->title;
                }
                $result['guid'] = $single->guid;
                $result['type'] = $single->type;
                $result['subtype'] = get_subtype_from_id($single->subtype);
                $result['avatar_url'] = get_entity_icon_url($single, 'small');
                $return[$type] = $result;
            }
        }
    }
    return $return;
}
开发者ID:manumatrix,项目名称:elgg-web-services,代码行数:38,代码来源:core.php

示例3: __construct

 public function __construct()
 {
     $types = get_registered_entity_types();
     $custom_types = elgg_trigger_plugin_hook('search_types', 'get_types', $params, array());
     $types['object'] = array_merge($types['object'], $custom_types);
     $this->types = $types;
 }
开发者ID:rubenve,项目名称:elasticsearch,代码行数:7,代码来源:ESFilter.php

示例4: elasticsearch_get_registered_entity_types_for_search

/**
 * Get the type/subtypes for search in ElasticSearch
 *
 *  @return false|array
 */
function elasticsearch_get_registered_entity_types_for_search()
{
    $type_subtypes = get_registered_entity_types();
    foreach ($type_subtypes as $type => $subtypes) {
        if (empty($subtypes)) {
            // repair so it can be used in elgg_get_entities*
            $type_subtypes[$type] = ELGG_ENTITIES_ANY_VALUE;
        }
    }
    return elgg_trigger_plugin_hook('search', 'type_subtype_pairs', $type_subtypes, $type_subtypes);
}
开发者ID:coldtrick,项目名称:elasticsearch,代码行数:16,代码来源:functions.php

示例5: elgg_extract

<?php

/**
 * Search form for internal content
 *
 * @uses $vars['container'] optional container
 */
$container = elgg_extract('container', $vars, elgg_get_logged_in_user_entity());
$content_options = [];
$content_types = get_registered_entity_types();
if (!empty($content_types)) {
    $content_options = [ELGG_ENTITIES_ANY_VALUE => elgg_echo('all')];
    foreach ($content_types as $type => $subtypes) {
        if (!empty($subtypes)) {
            foreach ($subtypes as $subtype) {
                $content_options["{$type}:{$subtype}"] = elgg_echo("item:{$type}:{$subtype}");
            }
        } else {
            $content_options[$type] = elgg_echo("item:{$type}");
        }
    }
    natcasesort($content_options);
}
$search = elgg_view('input/text', ['name' => 'q', 'placeholder' => elgg_echo('embed_extended:internal_content:placeholder')]);
if (!empty($content_options)) {
    $search .= elgg_view('input/select', ['name' => 'type_subtype', 'options_values' => $content_options]);
}
$search .= elgg_view('input/submit', ['value' => elgg_echo('search')]);
$result = elgg_format_element('div', [], $search);
if (elgg_is_logged_in()) {
    $match_owner = elgg_view('input/checkbox', ['name' => 'match_owner', 'value' => 1, 'label' => elgg_echo('embed_extended:internal_content:match_owner')]);
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:31,代码来源:internal_content.php

示例6: elgg_list_registered_entities

/**
 * Returns a viewable list of entities based on the registered types.
 *
 * @see elgg_view_entity_list
 *
 * @param array $options Any elgg_get_entity() options plus:
 *
 * 	full_view => BOOL Display full view entities
 *
 * 	list_type_toggle => BOOL Display gallery / list switch
 *
 * 	allowed_types => true|ARRAY True to show all types or an array of valid types.
 *
 * 	pagination => BOOL Display pagination links
 *
 * @return string A viewable list of entities
 * @since 1.7.0
 */
function elgg_list_registered_entities(array $options = array())
{
    elgg_register_rss_link();
    $defaults = array('full_view' => false, 'allowed_types' => true, 'list_type_toggle' => false, 'pagination' => true, 'offset' => 0, 'types' => array(), 'type_subtype_pairs' => array());
    $options = array_merge($defaults, $options);
    $types = get_registered_entity_types();
    foreach ($types as $type => $subtype_array) {
        if (in_array($type, $options['allowed_types']) || $options['allowed_types'] === true) {
            // you must explicitly register types to show up in here and in search for objects
            if ($type == 'object') {
                if (is_array($subtype_array) && count($subtype_array)) {
                    $options['type_subtype_pairs'][$type] = $subtype_array;
                }
            } else {
                if (is_array($subtype_array) && count($subtype_array)) {
                    $options['type_subtype_pairs'][$type] = $subtype_array;
                } else {
                    $options['type_subtype_pairs'][$type] = ELGG_ENTITIES_ANY_VALUE;
                }
            }
        }
    }
    if (!empty($options['type_subtype_pairs'])) {
        $count = elgg_get_entities(array_merge(array('count' => true), $options));
        if ($count > 0) {
            $entities = elgg_get_entities($options);
        } else {
            $entities = array();
        }
    } else {
        $count = 0;
        $entities = array();
    }
    $options['count'] = $count;
    return elgg_view_entity_list($entities, $options);
}
开发者ID:elgg,项目名称:elgg,代码行数:54,代码来源:entities.php

示例7: elgg_solr_get_indexable_count

/**
 * Returns a number of indexable documents
 * @return int
 */
function elgg_solr_get_indexable_count()
{
    $registered_types = get_registered_entity_types();
    $solr_entities = elgg_get_config('solr_entities');
    if (is_array($solr_entities)) {
        foreach ($solr_entities as $type => $subtypes) {
            foreach ($subtypes as $subtype => $callback) {
                if ($subtype == 'default') {
                    continue;
                }
                $registered_types[$type][] = $subtype;
            }
        }
    }
    $ia = elgg_set_ignore_access(true);
    $count = 0;
    foreach ($registered_types as $type => $subtypes) {
        $options = array('type' => $type, 'count' => true);
        if ($subtypes) {
            $options['subtypes'] = $subtypes;
        }
        $count += elgg_get_entities($options);
    }
    elgg_set_ignore_access($ia);
    return $count;
}
开发者ID:arckinteractive,项目名称:elgg_solr,代码行数:30,代码来源:functions.php

示例8: elgg_list_registered_entities

/**
 * Returns a viewable list of entities based on the registered types.
 *
 * @see elgg_view_entity_list
 *
 * @param array $options Any elgg_get_entity() options plus:
 *
 * 	full_view => BOOL Display full view entities
 *
 * 	list_type_toggle => BOOL Display gallery / list switch
 *
 * 	allowed_types => TRUE|ARRAY True to show all types or an array of valid types.
 *
 * 	pagination => BOOL Display pagination links
 *
 * @return string A viewable list of entities
 * @since 1.7.0
 */
function elgg_list_registered_entities(array $options = array())
{
    global $autofeed;
    $autofeed = true;
    $defaults = array('full_view' => TRUE, 'allowed_types' => TRUE, 'list_type_toggle' => FALSE, 'pagination' => TRUE, 'offset' => 0, 'types' => array(), 'type_subtype_pairs' => array());
    $options = array_merge($defaults, $options);
    //backwards compatibility
    if (isset($options['view_type_toggle'])) {
        $options['list_type_toggle'] = $options['view_type_toggle'];
    }
    $types = get_registered_entity_types();
    foreach ($types as $type => $subtype_array) {
        if (in_array($type, $options['allowed_types']) || $options['allowed_types'] === TRUE) {
            // you must explicitly register types to show up in here and in search for objects
            if ($type == 'object') {
                if (is_array($subtype_array) && count($subtype_array)) {
                    $options['type_subtype_pairs'][$type] = $subtype_array;
                }
            } else {
                if (is_array($subtype_array) && count($subtype_array)) {
                    $options['type_subtype_pairs'][$type] = $subtype_array;
                } else {
                    $options['type_subtype_pairs'][$type] = ELGG_ENTITIES_ANY_VALUE;
                }
            }
        }
    }
    $count = elgg_get_entities(array_merge(array('count' => TRUE), $options));
    $entities = elgg_get_entities($options);
    return elgg_view_entity_list($entities, $count, $options['offset'], $options['limit'], $options['full_view'], $options['list_type_toggle'], $options['pagination']);
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:49,代码来源:entities.php

示例9: get_input

} else {
    $owner_guid_array = $owner_guid;
}
$friends = (int) get_input('friends', 0);
if ($friends > 0) {
    if ($friends = get_user_friends($friends, '', 9999)) {
        $owner_guid_array = array();
        foreach ($friends as $friend) {
            $owner_guid_array[] = $friend->guid;
        }
    } else {
        $owner_guid = -1;
    }
}
// Set up submenus
if ($object_types = get_registered_entity_types()) {
    foreach ($object_types as $object_type => $subtype_array) {
        if (is_array($subtype_array) && sizeof($subtype_array)) {
            foreach ($subtype_array as $object_subtype) {
                $label = 'item:' . $object_type;
                if (!empty($object_subtype)) {
                    $label .= ':' . $object_subtype;
                }
                global $CONFIG;
                add_submenu_item(elgg_echo($label), $CONFIG->wwwroot . "search/?tag=" . urlencode($tag) . "&subtype=" . $object_subtype . "&object=" . urlencode($object_type) . "&tagtype=" . urlencode($md_type) . "&owner_guid=" . urlencode($owner_guid));
            }
        }
    }
    add_submenu_item(elgg_echo('all'), $CONFIG->wwwroot . "search/?tag=" . urlencode($tag) . "&owner_guid=" . urlencode($owner_guid));
}
if (empty($objecttype) && empty($subtype)) {
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:index.php

示例10: get_registered_entity_types

<?php

$subtypes = get_registered_entity_types('group');
if (empty($subtypes)) {
    return;
}
$subtype_options = array('' => '');
foreach ($subtypes as $subtype) {
    $subtype_options[$subtype] = elgg_echo("group:{$subtype}");
}
$dbprefix = elgg_get_config('dbprefix');
$options = array('selects' => array('ge.name AS name'), 'types' => 'group', 'limit' => 100, 'joins' => array("JOIN {$dbprefix}groups_entity ge ON ge.guid = e.guid"), 'wheres' => array("e.subtype = 0"), 'order_by' => 'ge.name ASC', 'callback' => false, 'count' => true);
$count = elgg_get_entities($options);
if (!$count) {
    return;
}
$options['count'] = false;
$groups = new ElggBatch('elgg_get_entities', $options);
$table = '<table class="elgg-table-alt">';
foreach ($groups as $group) {
    $table .= '<tr>';
    $table .= '<td>' . $group->name . '</td>';
    $table .= '<td>' . elgg_view('input/select', array('name' => "groups[{$group->guid}]", 'options_values' => $subtype_options)) . '</td>';
    $table .= '</tr>';
}
$table .= '</table>';
echo elgg_view_module('info', elgg_echo('admin:groups:subtypes:change_subtype'), $table, array('class' => 'groups-subtypes-config-module'));
echo elgg_view('input/submit');
开发者ID:hypeJunction,项目名称:Elgg-group_subtypes,代码行数:28,代码来源:change_subtype.php

示例11: elasticsearch_get_subtypes

function elasticsearch_get_subtypes()
{
    $types = get_registered_entity_types();
    $types['object'] = array_merge($types['object'], elgg_trigger_plugin_hook('search_types', 'get_types', $params, array()));
    return $types;
}
开发者ID:pleio,项目名称:elasticsearch,代码行数:6,代码来源:functions.php

示例12: getSubtypeOptions

 /**
  * Returns a list of subtype options
  * @return array
  */
 public function getSubtypeOptions()
 {
     $types = get_registered_entity_types();
     $types = elgg_trigger_plugin_hook('search_types', 'get_queries', [], $types);
     return elgg_extract($this->getEntityType(), $types);
 }
开发者ID:hypejunction,项目名称:hypelists,代码行数:10,代码来源:EntityList.php

示例13: list_registered_entities

/**
 * Returns a viewable list of entities based on the registered types
 *
 * @see elgg_view_entity_list
 * 
 * @param string $type The type of entity (eg "user", "object" etc)
 * @param string $subtype The arbitrary subtype of the entity
 * @param int $owner_guid The GUID of the owning user
 * @param int $limit The number of entities to display per page (default: 10)
 * @param true|false $fullview Whether or not to display the full view (default: true)
 * @param true|false $viewtypetoggle Whether or not to allow gallery view 
 * @return string A viewable list of entities
 */
function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $allowedtypes = true)
{
    $typearray = array();
    if ($object_types = get_registered_entity_types()) {
        foreach ($object_types as $object_type => $subtype_array) {
            if (is_array($subtype_array) && sizeof($subtype_array) && (in_array($object_type, $allowedtypes) || $allowedtypes === true)) {
                foreach ($subtype_array as $object_subtype) {
                    $typearray[$object_type][] = $object_subtype;
                }
            }
        }
    }
    $offset = (int) get_input('offset');
    $count = get_entities('', $typearray, $owner_guid, "", $limit, $offset, true);
    $entities = get_entities('', $typearray, $owner_guid, "", $limit, $offset);
    return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
}
开发者ID:jricher,项目名称:Elgg,代码行数:30,代码来源:entities.php

示例14: index_search

function index_search()
{
    $entityTypes = array();
    if ($_GET['check']) {
        foreach ($_GET['check'] as $entityType) {
            $entityTypes[] = $entityType;
        }
    }
    // $search_type == all || entities || trigger plugin hook
    $search_type = get_input('search_type', 'all');
    // @todo there is a bug in get_input that makes variables have slashes sometimes.
    // @todo is there an example query to demonstrate ^
    // XSS protection is more important that searching for HTML.
    $query = stripslashes(get_input('index-query', get_input('tag', '')));
    if (function_exists('mb_convert_encoding')) {
        $display_query = mb_convert_encoding($query, 'HTML-ENTITIES', 'UTF-8');
    } else {
        // if no mbstring extension, we just strip characters
        $display_query = preg_replace("/[^-]/", "", $query);
    }
    $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false);
    // check that we have an actual query
    if (!$query) {
        $title = sprintf(elgg_echo('search:results'), "\"{$display_query}\"");
        $body = elgg_view_title(elgg_echo('search:search_error'));
        $body .= elgg_echo('search:no_query');
        $layout = elgg_view_layout('one_sidebar', array('content' => $body));
        echo elgg_view_page($title, $layout);
        return;
    }
    // get limit and offset.  override if on search dashboard, where only 2
    // of each most recent entity types will be shown.
    $limit = $search_type == 'all' ? 2 : get_input('limit', 10);
    $offset = $search_type == 'all' ? 0 : get_input('offset', 0);
    $order = get_input('order', 'desc');
    if ($order != 'asc' && $order != 'desc') {
        $order = 'desc';
    }
    // set up search params
    $params = array('query' => $query, 'offset' => $offset, 'limit' => $limit, 'sort' => $sort, 'order' => $order, 'search_type' => $search_type, 'type' => $entity_type, 'subtype' => $entity_subtype, 'owner_guid' => $owner_guid, 'container_guid' => $container_guid, 'pagination' => $search_type == 'all' ? FALSE : TRUE);
    $types = get_registered_entity_types();
    //$types['object']
    foreach ($types as $type => $subtypes) {
        //only include subtypes the user wishes to search for
        foreach ($subtypes as $key => $subtype) {
            $flag = false;
            error_log($type . $key . $subtype);
            foreach ($entityTypes as $entityType) {
                if ($subtype == $entityType) {
                    $flag = true;
                }
            }
            if ($flag !== true) {
                //var_dump($types[$type][$key]);
                unset($types[$type][$key]);
                //$types = array_values($types);
            }
        }
        //only include types user wishes to search for - this is only for groups and users as they are not sub types
        $flag = false;
        if ($type != 'object') {
            foreach ($entityTypes as $entityType) {
                if ($type == $entityType) {
                    $flag = true;
                }
            }
            if ($flag !== true) {
                unset($types[$type]);
            }
        }
    }
    // add sidebar items for all and native types
    // @todo should these maintain any existing type / subtype filters or reset?
    $data = htmlspecialchars(http_build_query(array('q' => $query, 'entity_subtype' => $entity_subtype, 'entity_type' => $entity_type, 'owner_guid' => $owner_guid, 'search_type' => 'all')));
    $url = elgg_get_site_url() . "search?{$data}";
    $menu_item = new ElggMenuItem('all', elgg_echo('all'), $url);
    elgg_register_menu_item('page', $menu_item);
    foreach ($types as $type => $subtypes) {
        // @todo when using index table, can include result counts on each of these.
        if (is_array($subtypes) && count($subtypes)) {
            foreach ($subtypes as $subtype) {
                $label = "item:{$type}:{$subtype}";
                $data = htmlspecialchars(http_build_query(array('q' => $query, 'entity_subtype' => $subtype, 'entity_type' => $type, 'owner_guid' => $owner_guid, 'search_type' => 'entities', 'friends' => $friends)));
                $url = elgg_get_site_url() . "search?{$data}";
                $menu_item = new ElggMenuItem($label, elgg_echo($label), $url);
                elgg_register_menu_item('page', $menu_item);
            }
        } else {
            $label = "item:{$type}";
            $data = htmlspecialchars(http_build_query(array('q' => $query, 'entity_type' => $type, 'owner_guid' => $owner_guid, 'search_type' => 'entities', 'friends' => $friends)));
            $url = elgg_get_site_url() . "search?{$data}";
            $menu_item = new ElggMenuItem($label, elgg_echo($label), $url);
            elgg_register_menu_item('page', $menu_item);
        }
    }
    // start the actual search
    $results_html = '';
    if ($search_type == 'all' || $search_type == 'entities') {
        // to pass the correct current search type to the views
        $current_params = $params;
//.........这里部分代码省略.........
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:101,代码来源:functions.php

示例15: get_entity_views

/**
 * a static list of entity subtypes for views
 * @return string
 */
function get_entity_views()
{
    $types = get_registered_entity_types('object');
    sort($types);
    return $types;
}
开发者ID:beck24,项目名称:embedly_cards,代码行数:10,代码来源:start.php


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