本文整理汇总了PHP中get_registered_entity_types函数的典型用法代码示例。如果您正苦于以下问题:PHP get_registered_entity_types函数的具体用法?PHP get_registered_entity_types怎么用?PHP get_registered_entity_types使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_registered_entity_types函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: seo_prepare_entity_data
/**
* Prepare entity SEF data
*
* @param \ElggEntity $entity Entity
* @return array|false
*/
function seo_prepare_entity_data(\ElggEntity $entity)
{
$path = seo_get_path($entity->getURL());
if (!$path || $path == '/') {
return false;
}
$type = $entity->getType();
switch ($type) {
case 'user':
if (elgg_is_active_plugin('profile')) {
$sef_path = "/profile/{$entity->username}";
}
break;
case 'group':
$subtype = $entity->getSubtype();
$registered = (array) get_registered_entity_types('group');
if (!$subtype || in_array($subtype, $registered)) {
if ($subtype && elgg_language_key_exists("item:group:{$subtype}", 'en')) {
$prefix = elgg_get_friendly_title(elgg_echo("item:group:{$subtype}", array(), 'en'));
} else {
$prefix = elgg_get_friendly_title(elgg_echo('item:group', array(), 'en'));
}
$friendly_title = elgg_get_friendly_title($entity->getDisplayName() ?: '');
$sef_path = "/{$prefix}/{$entity->guid}-{$friendly_title}";
}
break;
case 'object':
$subtype = $entity->getSubtype();
$registered = (array) get_registered_entity_types('object');
if (in_array($subtype, $registered)) {
if (elgg_language_key_exists("item:object:{$subtype}", 'en')) {
$prefix = elgg_get_friendly_title(elgg_echo("item:object:{$subtype}", array(), 'en'));
} else {
$prefix = elgg_get_friendly_title($subtype);
}
$friendly_title = elgg_get_friendly_title($entity->getDisplayName() ?: '');
$sef_path = "/{$prefix}/{$entity->guid}-{$friendly_title}";
}
break;
}
if (!$sef_path) {
$sef_path = $path;
}
$sef_data = seo_get_data($entity->getURL());
if (!is_array($sef_data)) {
$sef_data = array();
}
$entity_sef_data = ['path' => $path, 'sef_path' => $sef_path, 'title' => $entity->getDisplayName(), 'description' => elgg_get_excerpt($entity->description), 'keywords' => is_array($entity->tags) ? implode(',', $entity->tags) : $entity->tags, 'guid' => $entity->guid];
if ($entity->guid != $entity->owner_guid) {
$owner = $entity->getOwnerEntity();
if ($owner) {
$entity_sef_data['owner'] = seo_prepare_entity_data($owner);
}
}
if ($entity->guid != $entity->container_guid && $entity->owner_guid != $entity->container_guid) {
$container = $entity->getContainerEntity();
if ($container) {
$entity_sef_data['container'] = seo_prepare_entity_data($container);
}
}
if (empty($sef_data['admin_defined'])) {
$sef_data = array_merge($sef_data, $entity_sef_data);
} else {
foreach ($entity_sef_data as $key => $value) {
if (empty($sef_data[$key])) {
$sef_data[$key] = $value;
}
}
}
$entity_sef_metatags = elgg_trigger_plugin_hook('metatags', 'discovery', ['entity' => $entity, 'url' => elgg_normalize_url($sef_path)], []);
if (!empty($entity_sef_metatags)) {
foreach ($entity_sef_metatags as $key => $value) {
if (empty($sef_data['admin_defined']) || empty($sef_data['metatags'][$key])) {
$sef_data['metatags'][$key] = $value;
}
}
}
return $sef_data;
}
开发者ID:hypeJunction,项目名称:Elgg-seo,代码行数:85,代码来源:functions.php
示例17: list
}
$container_guid = ELGG_ENTITIES_ANY_VALUE;
if (!empty($match_container)) {
$container_guid = $match_container;
}
$type = ELGG_ENTITIES_ANY_VALUE;
$subtype = ELGG_ENTITIES_ANY_VALUE;
if (!empty($type_subtype)) {
list($type, $subtype) = explode(':', $type_subtype);
}
$entities = [];
$dbprefix = elgg_get_config('dbprefix');
// search objects
if ($type == ELGG_ENTITIES_ANY_VALUE || $type == 'object') {
if ($subtype == ELGG_ENTITIES_ANY_VALUE) {
$subtypes = get_registered_entity_types('object');
} else {
$subtypes = [$subtype];
}
$objects = elgg_get_entities(['type' => 'object', 'subtypes' => $subtypes, 'limit' => 10, 'owner_guid' => $owner_guid, 'container_guid' => $container_guid, 'joins' => ["JOIN {$dbprefix}objects_entity oe ON e.guid = oe.guid"], "wheres" => ["(oe.title LIKE '%{$q}%')"]]);
if (!empty($objects)) {
$entities = $objects;
}
}
// search groups
if (($type == ELGG_ENTITIES_ANY_VALUE || $type == 'group') && $container_guid == ELGG_ENTITIES_ANY_VALUE) {
$groups = elgg_get_entities(['type' => 'group', 'limit' => 10, 'owner_guid' => $owner_guid, 'joins' => ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"], 'wheres' => ["(ge.name LIKE '%{$q}%')"]]);
if (!empty($groups)) {
$entities = array_merge($entities, $groups);
}
}
开发者ID:coldtrick,项目名称:embed_extended,代码行数:31,代码来源:list.php
示例18: render_embed
/**
* Rendering an ECML embed
*
* @param string $hook Equals 'render:embed'
* @param string $type Equals 'ecml;
* @param string $content ECML string that needs to be converted
* @param array $params ECML tokenizaton results
* @uses string $params['keyword'] ECML keyword, i.e. embed in [embed guid="XXX"]
* @uses array $params['attributes'] ECML attributes, i.e. array('guid' => XXX) in [embed guid="XXX"]
*
* @return string Rendered ECML replacement
*/
function render_embed($hook, $type, $content, $params)
{
if ($hook != 'render:embed' || $params['keyword'] != 'embed') {
return $content;
}
$attributes = elgg_extract('attributes', $params);
// Return empty strings for embeds within embeds
if (elgg_in_context('embed')) {
return '';
}
elgg_push_context('embed');
if (isset($attributes['context'])) {
$contexts = string_to_tag_array($attributes['context']);
foreach ($contexts as $context) {
elgg_push_context($context);
}
}
if (isset($attributes['guid'])) {
$guid = $attributes['guid'];
unset($attributes['guid']);
$entity = get_entity($guid);
$attributes['entity'] = $entity;
if (elgg_instanceof($entity)) {
$type = $entity->getType();
$subtype = $entity->getSubtype();
if (elgg_view_exists("embed/ecml/{$type}/{$subtype}")) {
$ecml = elgg_view("embed/ecml/{$type}/{$subtype}", $attributes);
} else {
if ($type == 'object' && in_array($subtype, get_registered_entity_types('object'))) {
if (elgg_view_exists("embed/ecml/object")) {
$ecml = elgg_view("embed/ecml/object", $attributes);
} else {
$ecml = elgg_view("embed/ecml/default", $attributes);
}
}
}
}
if (empty($ecml)) {
$content = elgg_view('embed/ecml/error');
} else {
$content = $ecml;
}
} elseif (isset($attributes['src'])) {
$content = elgg_view("embed/ecml/url", $attributes);
}
elgg_pop_context();
if (!empty($contexts)) {
foreach ($contexts as $context) {
elgg_pop_context();
}
}
return $content;
}
开发者ID:hypejunction,项目名称:hypeembed,代码行数:65,代码来源:hooks.php
示例19: elgg_require_js
<?php
elgg_require_js('csv_exporter/admin');
// add tab menu
echo elgg_view_menu('csv_exporter', ['class' => 'elgg-menu-hz elgg-tabs', 'sort_by' => 'priority']);
// prepare type/subtype selector
$type_subtypes = get_registered_entity_types();
$type_subtype_options = [];
foreach ($type_subtypes as $type => $subtypes) {
if (!empty($subtypes)) {
foreach ($subtypes as $subtype) {
$type_subtype_options["{$type}:{$subtype}"] = elgg_echo("item:{$type}:{$subtype}");
}
} else {
$type_subtype_options[$type] = elgg_echo("item:{$type}");
}
}
natcasesort($type_subtype_options);
$type_subtype_options = array_merge(array_reverse($type_subtype_options), ['' => elgg_echo('csv_exporter:admin:type_subtype:choose')]);
$type_subtype_options = array_reverse($type_subtype_options);
$form_body = '';
$preview = '';
// type/subtype selector
$type_subtype = elgg_get_sticky_value('csv_exporter', 'type_subtype', get_input('type_subtype'));
$form_body .= '<div>';
$form_body .= elgg_format_element('label', ['for' => 'csv-exporter-type-subtype'], elgg_echo('csv_exporter:admin:type_subtype'));
$form_body .= elgg_view('input/select', ['name' => 'type_subtype', 'value' => $type_subtype, 'options_values' => $type_subtype_options, 'id' => 'csv-exporter-type-subtype', 'class' => 'mls']);
$form_body .= '</div>';
// additional fields
if (!empty($type_subtype)) {
// time options
开发者ID:coldtrick,项目名称:csv_exporter,代码行数:31,代码来源:csv_exporter.php
示例20: 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
*
* view_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
*/
function elgg_list_registered_entities($options)
{
$defaults = array('full_view' => TRUE, 'allowed_types' => TRUE, 'view_type_toggle' => FALSE, 'pagination' => TRUE, 'offset' => 0);
$options = array_merge($defaults, $options);
$typearray = array();
if ($object_types = get_registered_entity_types()) {
foreach ($object_types as $object_type => $subtype_array) {
if (in_array($object_type, $options['allowed_types']) || $options['allowed_types'] === TRUE) {
$typearray[$object_type] = array();
if (is_array($subtype_array) && count($subtype_array)) {
foreach ($subtype_array as $subtype) {
$typearray[$object_type][] = $subtype;
}
}
}
}
}
$options['type_subtype_pairs'] = $typearray;
$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['view_type_toggle'], $options['pagination']);
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:39,代码来源:entities.php
注:本文中的get_registered_entity_types函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论