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


PHP elgg_view_exists函数代码示例

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


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

示例1: stripe_page_handler

/**
 * Stripe related pages
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function stripe_page_handler($page, $handler)
{
    gatekeeper();
    $username = elgg_extract(0, $page, false);
    if ($username) {
        $user = get_user_by_username($username);
    }
    if (!elgg_instanceof($user) || !$user->canEdit()) {
        $user = elgg_get_logged_in_user_entity();
        forward("{$handler}/{$user->username}");
    }
    elgg_set_context('settings');
    elgg_set_page_owner_guid($user->guid);
    elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
    $context = elgg_extract(1, $page, 'cards');
    $action = elgg_extract(2, $page, 'all');
    $view = "stripe/pages/{$context}/{$action}";
    if (elgg_view_exists($view)) {
        $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
        $title = elgg_echo("stripe:{$context}:{$action}");
        $content = elgg_view($view, $params);
        $sidebar = elgg_view('stripe/sidebar', $params);
        $filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
    }
    if ($content) {
        if (elgg_is_xhr()) {
            echo $content;
        } else {
            $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
            echo elgg_view_page($title, $layout);
        }
        return true;
    }
    return false;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:42,代码来源:page_handlers.php

示例2: elgg_view_input

 /**
  * Renders a form field
  *
  * @param string $input_type Input type, used to generate an input view ("input/$input_type")
  * @param array  $vars       Fields and input vars.
  *                           Field vars contain both field and input params. 'label', 'help',
  *                           and 'field_class' params will not be passed on to the input view.
  *                           Others, including 'required' and 'id', will be available to the
  *                           input view. Both 'label' and 'help' params accept HTML, and
  *                           will be printed unescaped within their wrapper element.
  * @return string
  */
 function elgg_view_input($input_type, array $vars = array())
 {
     static $id_num;
     if (!elgg_view_exists("input/{$input_type}")) {
         return '';
     }
     if ($input_type == 'hidden') {
         return elgg_view("input/{$input_type}", $vars);
     }
     $id = elgg_extract('id', $vars);
     if (!$id) {
         $id_num++;
         $id = "elgg-field-{$id_num}";
         $vars['id'] = $id;
     }
     $vars['input_type'] = $input_type;
     $label = elgg_view('elements/forms/label', $vars);
     unset($vars['label']);
     $help = elgg_view('elements/forms/help', $vars);
     unset($vars['help']);
     $required = elgg_extract('required', $vars);
     $field_class = (array) elgg_extract('field_class', $vars, array());
     unset($vars['field_class']);
     $input = elgg_view("elements/forms/input", $vars);
     return elgg_view('elements/forms/field', array('label' => $label, 'help' => $help, 'required' => $required, 'id' => $id, 'input' => $input, 'class' => $field_class, 'input_type' => $input_type));
 }
开发者ID:hypejunction,项目名称:forms_api,代码行数:38,代码来源:start.php

示例3: crud_handle_list_page

/**
 * List crud objects in a group
 *
 * @param CrudTemplate $crud Crud template object
 * @param int $guid Group entity GUID
 */
function crud_handle_list_page($crud, $guid)
{
    elgg_set_page_owner_guid($guid);
    $crud_type = $crud->crud_type;
    $parent = get_entity($guid);
    if ($parent instanceof ElggGroup) {
        $group = $parent;
        $parent = NULL;
    } else {
        $group = get_entity($parent->container_guid);
    }
    if (!$group) {
        register_error(elgg_echo('groups:notfound'));
        forward();
    }
    group_gatekeeper();
    elgg_push_breadcrumb($group->name);
    elgg_register_title_button();
    if (elgg_view_exists("forms/{$crud->module}/{$crud_type}_general")) {
        elgg_register_title_button($crud->crud_type, 'edit_general');
    }
    $title = elgg_echo("item:object:{$crud_type}");
    $params = array('title' => $title, 'content' => $crud->getListTabContent(), 'footer' => elgg_view("{$crud->module}/{$crud_type}_general", array('entity' => $group)), 'filter' => $crud->getListTabFilter());
    $params['sidebar'] .= elgg_view('crud/tagcloud_block', array('subtypes' => $crud->crud_type, 'owner_guid' => elgg_get_page_owner_guid()));
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:33,代码来源:crud.php

示例4: elgg_get_excerpt

/**
 * Returns an excerpt.
 * Will return up to n chars stopping at the nearest space.
 * If no spaces are found (like in Japanese) will crop off at the
 * n char mark. Adds ... if any text was chopped.
 *
 * @param string $text      The full text to excerpt
 * @param int    $num_chars Return a string up to $num_chars long
 *
 * @return string
 * @since 1.7.2
 */
function elgg_get_excerpt($text, $num_chars = 250)
{
    $view = 'output/excerpt';
    $vars = ['text' => $text, 'num_chars' => $num_chars];
    $viewtype = elgg_view_exists($view) ? '' : 'default';
    return _elgg_view_under_viewtype($view, $vars, $viewtype);
}
开发者ID:elgg,项目名称:elgg,代码行数:19,代码来源:output.php

示例5: register_custom_field_types

/**
 * Registes all custom field types
 */
function register_custom_field_types()
{
    // registering profile field types
    $profile_options = array("show_on_register" => true, "mandatory" => true, "user_editable" => true, "output_as_tags" => true, "admin_only" => true, "count_for_completeness" => true);
    $location_options = $profile_options;
    unset($location_options["output_as_tags"]);
    $pm_datepicker_options = $profile_options;
    unset($pm_datepicker_options["output_as_tags"]);
    $pulldown_options = $profile_options;
    $pulldown_options["blank_available"] = true;
    $radio_options = $profile_options;
    $radio_options["blank_available"] = true;
    $file_options = array("user_editable" => true, "admin_only" => true);
    $pm_rating_options = $profile_options;
    unset($pm_rating_options["output_as_tags"]);
    add_custom_field_type("custom_profile_field_types", 'text', elgg_echo('profile:field:text'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'longtext', elgg_echo('profile:field:longtext'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'tags', elgg_echo('profile:field:tags'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'location', elgg_echo('profile:field:location'), $location_options);
    add_custom_field_type("custom_profile_field_types", 'url', elgg_echo('profile:field:url'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'email', elgg_echo('profile:field:email'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'date', elgg_echo('profile:field:date'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'calendar', elgg_echo('calendar'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'pm_datepicker', elgg_echo('profile_manager:admin:options:pm_datepicker'), $pm_datepicker_options);
    add_custom_field_type("custom_profile_field_types", 'dropdown', elgg_echo('profile_manager:admin:options:pulldown'), $pulldown_options);
    add_custom_field_type("custom_profile_field_types", 'radio', elgg_echo('profile_manager:admin:options:radio'), $radio_options);
    add_custom_field_type("custom_profile_field_types", 'multiselect', elgg_echo('profile_manager:admin:options:multiselect'), $profile_options);
    add_custom_field_type("custom_profile_field_types", 'pm_rating', elgg_echo('profile_manager:admin:options:pm_rating'), $pm_rating_options);
    //add_custom_field_type("custom_profile_field_types", 'pm_file', elgg_echo('profile_manager:admin:options:file'), $file_options);
    if (elgg_view_exists("output/datepicker") && elgg_view_exists("input/datepicker")) {
        $datepicker_options = $profile_options;
        unset($datepicker_options["output_as_tags"]);
        add_custom_field_type("custom_profile_field_types", 'datepicker', elgg_echo('profile_manager:admin:options:datepicker'), $datepicker_options);
    } else {
        elgg_register_plugin_hook_handler('display', 'view', 'profile_manager_display_view_hook');
    }
    // registering group field types
    $group_options = array("output_as_tags" => true, "admin_only" => true);
    $datepicker_options = $group_options;
    unset($datepicker_options["output_as_tags"]);
    $pulldown_options = $group_options;
    $pulldown_options["blank_available"] = true;
    $radio_options = $group_options;
    $radio_options["blank_available"] = true;
    add_custom_field_type("custom_group_field_types", 'text', elgg_echo('profile:field:text'), $group_options);
    add_custom_field_type("custom_group_field_types", 'longtext', elgg_echo('profile:field:longtext'), $group_options);
    add_custom_field_type("custom_group_field_types", 'tags', elgg_echo('profile:field:tags'), $group_options);
    add_custom_field_type("custom_group_field_types", 'url', elgg_echo('profile:field:url'), $group_options);
    add_custom_field_type("custom_group_field_types", 'email', elgg_echo('profile:field:email'), $group_options);
    add_custom_field_type("custom_group_field_types", 'date', elgg_echo('profile:field:date'), $group_options);
    add_custom_field_type("custom_group_field_types", 'calendar', elgg_echo('calendar'), $group_options);
    add_custom_field_type("custom_group_field_types", 'datepicker', elgg_echo('profile_manager:admin:options:datepicker'), $datepicker_options);
    add_custom_field_type("custom_group_field_types", 'dropdown', elgg_echo('profile_manager:admin:options:pulldown'), $pulldown_options);
    add_custom_field_type("custom_group_field_types", 'radio', elgg_echo('profile_manager:admin:options:radio'), $radio_options);
    add_custom_field_type("custom_group_field_types", 'multiselect', elgg_echo('profile_manager:admin:options:multiselect'), $group_options);
}
开发者ID:remy40,项目名称:gvrs,代码行数:59,代码来源:functions.php

示例6: add_to_river

/**
 * Adds an item to the river.
 *
 * @param string $view          The view that will handle the river item (must exist)
 * @param string $action_type   An arbitrary string to define the action (eg 'comment', 'create')
 * @param int    $subject_guid  The GUID of the entity doing the action
 * @param int    $object_guid   The GUID of the entity being acted upon
 * @param int    $access_id     The access ID of the river item (default: same as the object)
 * @param int    $posted        The UNIX epoch timestamp of the river item (default: now)
 * @param int    $annotation_id The annotation ID associated with this river entry
 *
 * @return int/bool River ID or false on failure
 */
function add_to_river($view, $action_type, $subject_guid, $object_guid, $access_id = "", $posted = 0, $annotation_id = 0)
{
    global $CONFIG;
    // use default viewtype for when called from web services api
    if (!elgg_view_exists($view, 'default')) {
        return false;
    }
    if (!($subject = get_entity($subject_guid))) {
        return false;
    }
    if (!($object = get_entity($object_guid))) {
        return false;
    }
    if (empty($action_type)) {
        return false;
    }
    if ($posted == 0) {
        $posted = time();
    }
    if ($access_id === "") {
        $access_id = $object->access_id;
    }
    $type = $object->getType();
    $subtype = $object->getSubtype();
    $view = sanitise_string($view);
    $action_type = sanitise_string($action_type);
    $subject_guid = sanitise_int($subject_guid);
    $object_guid = sanitise_int($object_guid);
    $access_id = sanitise_int($access_id);
    $posted = sanitise_int($posted);
    $annotation_id = sanitise_int($annotation_id);
    $values = array('type' => $type, 'subtype' => $subtype, 'action_type' => $action_type, 'access_id' => $access_id, 'view' => $view, 'subject_guid' => $subject_guid, 'object_guid' => $object_guid, 'annotation_id' => $annotation_id, 'posted' => $posted);
    // return false to stop insert
    $values = elgg_trigger_plugin_hook('creating', 'river', null, $values);
    if ($values == false) {
        // inserting did not fail - it was just prevented
        return true;
    }
    extract($values);
    // Attempt to save river item; return success status
    $id = insert_data("insert into {$CONFIG->dbprefix}river " . " set type = '{$type}', " . " subtype = '{$subtype}', " . " action_type = '{$action_type}', " . " access_id = {$access_id}, " . " view = '{$view}', " . " subject_guid = {$subject_guid}, " . " object_guid = {$object_guid}, " . " annotation_id = {$annotation_id}, " . " posted = {$posted}");
    // update the entities which had the action carried out on it
    // @todo shouldn't this be down elsewhere? Like when an annotation is saved?
    if ($id) {
        update_entity_last_action($object_guid, $posted);
        $river_items = elgg_get_river(array('id' => $id));
        if ($river_items) {
            elgg_trigger_event('created', 'river', $river_items[0]);
        }
        return $id;
    } else {
        return false;
    }
}
开发者ID:rcolomoc,项目名称:Master-Red-Social,代码行数:67,代码来源:river.php

示例7: embed_page_handler

/**
 * Page handler for embeds
 * 
 * @param array $page
 */
function embed_page_handler($page)
{
    $params = array('output' => '', 'status' => 0, 'system_messages' => array('error' => array(), 'success' => array()));
    $container_guid = get_input('container_guid');
    if ($container_guid && get_entity($container_guid)) {
        elgg_set_page_owner_guid($container_guid);
    }
    switch ($page[0]) {
        default:
        case 'tab':
            $default_tab = elgg_is_active_plugin('file') ? 'file' : 'content_items';
            $embed_tab = elgg_extract(1, $page, $default_tab);
            $title = elgg_echo("embed:embed");
            $filter = elgg_view('embed/filter', array('filter_context' => $embed_tab));
            $view = "embed/tab/{$embed_tab}";
            if (elgg_view_exists($view)) {
                $content = elgg_view($view);
            } else {
                $embed_tab = elgg_get_config('embed_tab');
                if ($embed_tab instanceof \ElggMenuItem) {
                    $view = $embed_tab->getData('view');
                    $options = $embed_tab->getData('options');
                    if ($view) {
                        $content = elgg_view($view);
                    } else {
                        if ($options) {
                            $content = elgg_view('embed/get_list', array('options' => $options));
                        }
                    }
                }
            }
            if (empty($content)) {
                $content = elgg_autop(elgg_echo('embed:section:invalid'));
            }
            $params['output'] = elgg_view_layout('one_column', array('title' => $title, 'content' => $filter . $content, 'class' => 'embed-wrapper'));
            break;
    }
    $system_messages = system_messages(NULL, "");
    if (isset($system_messages['success'])) {
        $params['system_messages']['success'] = $system_messages['success'];
    }
    if (isset($system_messages['error'])) {
        $params['system_messages']['error'] = $system_messages['error'];
        $params['status'] = -1;
    }
    // We do not want to serve this page via non-xhr requests
    if (!elgg_is_xhr()) {
        register_error(elgg_echo('embed:error:non_xhr_request'));
        return false;
    }
    echo json_encode($params);
    exit;
}
开发者ID:hypejunction,项目名称:hypeembed,代码行数:58,代码来源:page_handlers.php

示例8: evan_view_entity

/**
 * This function allows you to handle various visualizations of entities very easily.
 *
 * For example, `evan_view_entity('link', $blog)` will look for views in the following order: 
 * <ol>
 * <li>object/blog/link
 * <li>object/default/link
 * <li>entity/link
 * </ol>
 * 
 * This allows you to avoid filling your views with so many if/else statements like this:
 *
 * https://github.com/Elgg/Elgg/blob/f122c12ab35f26d5b77a18cc263fc199eb2a7b01/mod/blog/views/default/object/blog.php
 *
 * @param string $view     The subview to use to visualize this this entity.
 * @param Entity $entity   The entity to visualize.
 * @param array  $vars     Extra variables to pass to the view.
 * @param string $viewtype Set this to force the viewtype.
 *
 * @return string The generated view.
 */
function evan_view_entity($view, Entity $entity, array $vars = array(), $viewtype = 'default')
{
    $type = $entity->getType();
    $subtype = $entity->getSubtype();
    $vars['entity'] = $entity;
    if (elgg_view_exists("{$type}/{$subtype}/{$view}")) {
        return elgg_view("{$type}/{$subtype}/{$view}", $vars, $viewtype);
    } elseif (elgg_view_exists("{$type}/default/{$view}")) {
        return elgg_view("{$type}/default/{$view}", $vars, $viewtype);
    } else {
        return elgg_view("entity/{$view}", $vars, $viewtype);
    }
}
开发者ID:ewinslow,项目名称:elgg-evan,代码行数:34,代码来源:start.php

示例9: elasticsearch_get_view

function elasticsearch_get_view($object)
{
    if ($object->type == "annotation") {
        $subtype = $object->name;
    } else {
        $subtype = get_subtype_from_id($object->subtype);
    }
    if (elgg_view_exists('search/' . $object->type . '/' . $subtype)) {
        return 'search/' . $object->type . '/' . $subtype;
    } else {
        if (elgg_view_exists('search/' . $object->type)) {
            return 'search/' . $object->type;
        }
    }
    return 'search/entity';
}
开发者ID:pleio,项目名称:elasticsearch,代码行数:16,代码来源:functions.php

示例10: add_to_river

/**
 * Adds an item to the river.
 *
 * @param string $view          The view that will handle the river item (must exist)
 * @param string $action_type   An arbitrary string to define the action (eg 'comment', 'create')
 * @param int    $subject_guid  The GUID of the entity doing the action
 * @param int    $object_guid   The GUID of the entity being acted upon
 * @param int    $access_id     The access ID of the river item (default: same as the object)
 * @param int    $posted        The UNIX epoch timestamp of the river item (default: now)
 * @param int    $annotation_id The annotation ID associated with this river entry
 *
 * @return bool Depending on success
 */
function add_to_river($view, $action_type, $subject_guid, $object_guid, $access_id = "", $posted = 0, $annotation_id = 0)
{
    // use default viewtype for when called from REST api
    if (!elgg_view_exists($view, 'default')) {
        return false;
    }
    if (!($subject = get_entity($subject_guid))) {
        return false;
    }
    if (!($object = get_entity($object_guid))) {
        return false;
    }
    if (empty($action_type)) {
        return false;
    }
    if ($posted == 0) {
        $posted = time();
    }
    if ($access_id === "") {
        $access_id = $object->access_id;
    }
    $annotation_id = (int) $annotation_id;
    $type = $object->getType();
    $subtype = $object->getSubtype();
    $action_type = sanitise_string($action_type);
    $params = array('type' => $type, 'subtype' => $subtype, 'action_type' => $action_type, 'access_id' => $access_id, 'view' => $view, 'subject_guid' => $subject_guid, 'object_guid' => $object_guid, 'annotation_id' => $annotation_id, 'posted' => $posted);
    // return false to stop insert
    $params = elgg_trigger_plugin_hook('add', 'river', null, $params);
    if ($params == false) {
        // inserting did not fail - it was just prevented
        return true;
    }
    extract($params);
    // Load config
    global $CONFIG;
    // Attempt to save river item; return success status
    $insert_data = insert_data("insert into {$CONFIG->dbprefix}river " . " set type = '{$type}', " . " subtype = '{$subtype}', " . " action_type = '{$action_type}', " . " access_id = {$access_id}, " . " view = '{$view}', " . " subject_guid = {$subject_guid}, " . " object_guid = {$object_guid}, " . " annotation_id = {$annotation_id}, " . " posted = {$posted}");
    //update the entities which had the action carried out on it
    if ($insert_data) {
        update_entity_last_action($object_guid, $posted);
        return $insert_data;
    }
}
开发者ID:rasul,项目名称:Elgg,代码行数:56,代码来源:river.php

示例11: hj_framework_view_list

function hj_framework_view_list($list_id, $getter_options = array(), $list_options = array(), $viewer_options = array(), $getter = 'elgg_get_entities')
{
    $default_list_options = array('list_type' => 'list', 'list_class' => null, 'item_class' => null, 'base_url' => current_page_url(), 'num_pages' => 5, 'pagination' => true, 'limit_key' => "__lim_{$list_id}", 'offset_key' => "__off_{$list_id}", 'order_by_key' => "__ord_{$list_id}", 'direction_key' => "__dir_{$list_id}", 'reverse_list' => false);
    $list_options = array_merge($default_list_options, $list_options);
    if (!isset($getter_options['limit'])) {
        $getter_options['limit'] = get_input($list_options['limit_key'], 10);
    }
    if (!isset($getter_options['offset'])) {
        $getter_options['offset'] = get_input($list_options['offset_key'], 0);
    }
    $porder_by = get_input($list_options['order_by_key'], '');
    $pdirection = get_input($list_options['direction_key'], 'DESC');
    $getter_options = hj_framework_get_order_by_clause($porder_by, $pdirection, $getter_options);
    if (isset($list_options['filter_callback']) && is_callable($list_options['filter_callback'])) {
        $getter_options = call_user_func_array($list_options['filter_callback'], array($list_id, $getter_options));
    }
    $getter_options = elgg_trigger_plugin_hook('custom_sql_clause', 'framework:lists', array('list_id' => $list_id, 'list_options' => $list_options, 'viewer_options' => $viewer_options), $getter_options);
    $getter_options['count'] = true;
    $count = $getter($getter_options);
    //error_log(print_r($getter_options, true));
    $getter_options['count'] = false;
    $entities = $getter($getter_options);
    if ($list_options['reverse_list']) {
        $entities = array_reverse($entities);
    }
    $params = array('list_id' => $list_id, 'entities' => $entities, 'count' => $count, 'list_options' => $list_options, 'getter_options' => $getter_options, 'viewer_options' => $viewer_options, 'getter' => $getter);
    if (elgg_view_exists("page/components/grids/{$list_options['list_type']}")) {
        $list = elgg_view("page/components/grids/{$list_options['list_type']}", $params, false, false, 'default');
    } else {
        $list = elgg_view("page/components/grids/list", $params, false, false, 'default');
    }
    if (elgg_is_xhr() && get_input('view') == 'xhr') {
        if (elgg_view_exists("page/components/grids/{$list_options['list_type']}")) {
            $json_list = elgg_view("page/components/grids/{$list_options['list_type']}", $params, false, false, 'xhr');
        } else {
            $json_list = elgg_view("page/components/grids/list", $params, false, false, 'xhr');
        }
        global $XHR_GLOBAL;
        $XHR_GLOBAL['lists'][$list_id] = $json_list;
    }
    return elgg_view('page/components/grids/wrapper', array('body' => $list));
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:42,代码来源:lists.php

示例12: group_membership_router

/**
 * Route groups membership pages
 *
 * @param string $hook   "route"
 * @param string $type   "groups"
 * @param array  $return Identifier and segments
 * @param array  $params Hook params
 * @return array
 */
function group_membership_router($hook, $type, $return, $params)
{
    if (!is_array($return)) {
        return;
    }
    // Initial page identifier might be different from /groups
    // i.e. subtype specific handler e.g. /schools
    $initial_identifier = elgg_extract('identifier', $params);
    $identifier = elgg_extract('identifier', $return);
    $segments = elgg_extract('segments', $return);
    if ($identifier !== 'groups') {
        return;
    }
    $page = array_shift($segments);
    if (!$page) {
        $page = 'all';
    }
    // we want to pass the original identifier to the resource view
    // doing this via route hook in order to keep the page handler intact
    $resource_params = array('identifier' => $initial_identifier ?: 'groups', 'segments' => $segments);
    switch ($page) {
        case 'members':
            $guid = array_shift($segments);
            $sort = array_shift($segments);
            $resource_params['guid'] = $guid;
            $resource_params['sort'] = $sort;
            if (!elgg_is_active_plugin('user_sort') && elgg_view_exists("resources/groups/members/{$sort}")) {
                echo elgg_view_resource("groups/members/{$sort}", $resource_params);
            } else {
                echo elgg_view_resource('groups/members', $resource_params);
            }
            return false;
        case 'requests':
        case 'invited':
        case 'invite':
            $guid = array_shift($segments);
            $resource_params['guid'] = $guid;
            echo elgg_view_resource("groups/{$page}", $resource_params);
            return false;
    }
}
开发者ID:hypeJunction,项目名称:Elgg-group_membership,代码行数:50,代码来源:start.php

示例13: ui_icons_files_set_icon_url

/**
 * Replaces file type icons
 *
 * @param string $hook   "entity:icon:url"
 * @param string $type   "object"
 * @param string $return Icon URL
 * @param array  $params Hook params
 * @return string
 */
function ui_icons_files_set_icon_url($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $params);
    $size = elgg_extract('size', $params);
    if (!$entity instanceof \ElggFile || $entity->getSubtype() != 'file') {
        return;
    }
    $mimetype = $entity->mimetype ?: $entity->detectMimeType();
    if (!$mimetype) {
        $mimetype = 'application/otcet-stream';
    }
    if (0 === strpos($mimetype, 'image/') && $entity->icontime && $return) {
        return $return;
    }
    $extension = pathinfo($entity->getFilenameOnFilestore(), PATHINFO_EXTENSION);
    $filetype = ui_icons_files_map_type($mimetype, $extension);
    $view = "icon/object/file/{$filetype}.svg";
    if (!elgg_view_exists($view)) {
        $view = "icon/default.svg";
    }
    return elgg_get_simplecache_url($view);
}
开发者ID:hypeJunction,项目名称:Elgg-ui_icons_files,代码行数:31,代码来源:start.php

示例14: elgg_tokeninput_export_metadata

/**
 * Get exportable metadata values
 *
 * @param ElggMetadata $metadata
 * @return array
 */
function elgg_tokeninput_export_metadata($metadata)
{
    if ($metadata instanceof ElggMetadata) {
        $type = $metadata->getType();
        $subtype = $metadata->getSubtype();
        $tag = $metadata->value;
        $id = $metadata->id;
    } else {
        if (is_string($metadata)) {
            $type = 'tag';
            $subtype = null;
            $tag = $metadata;
            $id = null;
        } else {
            return array();
        }
    }
    $export = array('label' => $tag, 'value' => $tag, 'type' => $type, 'subtype' => $subtype, 'html_result' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('tag' => $tag, 'metadata_id' => $id, 'for' => 'result')) : null, 'html_token' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('tag' => $tag, 'metadata_id' => $id, 'for' => 'token')) : null);
    $export = elgg_trigger_plugin_hook('tokeninput:entity:export', $type, array('tag' => $tag, 'metadata_id' => $id), $export);
    array_walk_recursive($export, function (&$value) {
        $value = is_string($value) ? html_entity_decode($value, ENT_QUOTES, 'UTF-8') : $value;
    });
    return $export;
}
开发者ID:n8b,项目名称:VMN,代码行数:30,代码来源:tokeninput.php

示例15: newsletter_view_embed_content

/**
 * Display conten in the correct layout for embedding in Newsletter
 *
 * @param ElggEntity $entity the entity to embed
 * @param array      $vars   optional variables to pass to the embed view
 *
 * @return bool|string
 */
function newsletter_view_embed_content(ElggEntity $entity, $vars = array())
{
    if (empty($entity) || !elgg_instanceof($entity)) {
        return false;
    }
    if (!is_array($vars)) {
        $vars = array();
    }
    $vars["entity"] = $entity;
    $type = $entity->getType();
    $subtype = $entity->getSubtype();
    if (!empty($subtype) && elgg_view_exists("newsletter/embed/" . $type . "/" . $subtype)) {
        return elgg_view("newsletter/embed/" . $type . "/" . $subtype, $vars);
    } elseif (elgg_view_exists("newsletter/embed/" . $type . "/default")) {
        return elgg_view("newsletter/embed/" . $type . "/default", $vars);
    } elseif (elgg_view_exists("newsletter/embed/default")) {
        return elgg_view("newsletter/embed/default", $vars);
    }
    return false;
}
开发者ID:pleio,项目名称:newsletter,代码行数:28,代码来源:functions.php


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