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


PHP elgg_view函数代码示例

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


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

示例1: jpatchwork_page_handler

function jpatchwork_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'sample';
    }
    elgg_set_context('jpatchwork');
    $page_type = $page[0];
    switch ($page_type) {
        case 'sample':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:sample_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/sample');
            elgg_set_viewtype('default');
            break;
        case 'frozenbubble':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:frozenbubble_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/frozenbubble');
            elgg_set_viewtype('default');
            break;
        default:
            return false;
    }
    // Format page
    $body = elgg_view('page/layouts/one_sidebar', array('content' => $area2));
    // Draw it
    echo elgg_view_page(elgg_echo('jpatchwork:title'), $body);
    return true;
}
开发者ID:iionly,项目名称:jpatchwork,代码行数:31,代码来源:start.php

示例2: profile_page_handler

/**
 * Profile page handler
 *
 * @param array $page Array of page elements, forwarded by the page handling mechanism
 */
function profile_page_handler($page)
{
    if (isset($page[0])) {
        $username = $page[0];
        $user = get_user_by_username($username);
        elgg_set_page_owner_guid($user->guid);
    }
    // short circuit if invalid or banned username
    if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
        register_error(elgg_echo('profile:notfound'));
        forward();
    }
    $action = NULL;
    if (isset($page[1])) {
        $action = $page[1];
    }
    if ($action == 'edit') {
        // use the core profile edit page
        $base_dir = elgg_get_root_path();
        require "{$base_dir}pages/profile/edit.php";
        return;
    }
    // main profile page
    $params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3);
    $content = elgg_view_layout('widgets', $params);
    $body = elgg_view_layout('one_column', array('content' => $content));
    echo elgg_view_page($title, $body);
}
开发者ID:rasul,项目名称:Elgg,代码行数:33,代码来源:start.php

示例3: legacy_urls_redirect

/**
 * Redirect the requestor to the new URL
 * Checks the plugin setting to determine the course of action:
 * a) Displays an error page with the new URL
 * b) Forwards to the new URL and displays an error message
 * c) Silently forwards to the new URL
 *
 * @param string $url Relative or absolute URL
 * @return mixed
 */
function legacy_urls_redirect($url)
{
    $method = elgg_get_plugin_setting('redirect_method', 'legacy_urls');
    // we only show landing page or queue warning if html generating page
    $viewtype = elgg_get_viewtype();
    if ($viewtype != 'default' && !elgg_does_viewtype_fallback($viewtype)) {
        $method = 'immediate';
    }
    switch ($method) {
        case 'landing':
            $content = elgg_view('legacy_urls/message', array('url' => $url));
            $body = elgg_view_layout('error', array('content' => $content));
            echo elgg_view_page('', $body, 'error');
            return true;
            break;
        case 'immediate_error':
            // drop through after setting error message
            register_error(elgg_echo('changebookmark'));
        case 'immediate':
        default:
            $url = elgg_normalize_url($url);
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: {$url}");
            exit;
            break;
    }
}
开发者ID:elgg,项目名称:elgg,代码行数:37,代码来源:start.php

示例4: blog_get_page_content_edit

/**
 * Returns HTML to edit a blog post.
 *
 * @param int $guid
 * @param int annotation id optional revision to edit
 * @return string html
 */
function blog_get_page_content_edit($guid, $revision = NULL)
{
    $vars = array();
    if ($guid) {
        $blog = get_entity((int) $guid);
        if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
            $vars['entity'] = $blog;
            if ($revision) {
                $revision = get_annotation((int) $revision);
                $vars['revision'] = $revision;
                if (!$revision || !($revision->entity_guid == $guid)) {
                    $content = elgg_echo('blog:error:revision_not_found');
                }
            }
            elgg_push_breadcrumb($blog->title, $blog->getURL());
            elgg_push_breadcrumb(elgg_echo('edit'));
            $content = elgg_view('blog/forms/edit', $vars);
            $sidebar = elgg_view('blog/sidebar_revisions', array('entity' => $blog));
            //$sidebar .= elgg_view('blog/sidebar_related');
        } else {
            $content = elgg_echo('blog:error:post_not_found');
        }
    } else {
        elgg_push_breadcrumb(elgg_echo('blog:new'));
        $content = elgg_view('blog/forms/edit', $vars);
        //$sidebar = elgg_view('blog/sidebar_related');
    }
    return array('content' => $content, 'sidebar' => $sidebar);
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:36,代码来源:blog_lib.php

示例5: outputPluginSettingsForm

 /**
  * @param ElggPlugin $plugin
  * @return string
  */
 public function outputPluginSettingsForm($plugin)
 {
     $translationPrefix = elgg_extract('translationPrefix', $this->options);
     $result = '<div>';
     foreach ($this->fields as $name => $field) {
         $result .= '<div class="mbm">';
         $result .= '<label>' . elgg_echo($translationPrefix . $name) . '</label> ';
         $description = elgg_extract('description', $field);
         if ($description) {
             $result .= '<div class="mbs">' . $description . '</div> ';
         }
         $params = $field;
         $type = elgg_extract('type', $field);
         $params['name'] = "params[{$name}]";
         if ($plugin) {
             $params['value'] = $plugin->{$name};
         }
         if (!isset($params['value']) || $params['value'] === null) {
             $params['value'] = elgg_extract('default', $field);
         }
         $result .= elgg_view('input/' . $type, $params);
         $result .= '</div>';
     }
     $result .= '</div>';
     return $result;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:30,代码来源:SrokapForm.php

示例6: twitter_api_pagehandler

/**
 * Serves pages for twitter.
 *
 * @param array $page
 * @return bool
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        return false;
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            elgg_gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            echo elgg_view('resources/twitter_api/interstitial');
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:elgg,项目名称:twitter_api,代码行数:40,代码来源:start.php

示例7: wizard_replace_profile_fields

/**
 * Replace profile field placeholders with input fields
 *
 * @param string $text the text to replace in
 *
 * @return false|string
 */
function wizard_replace_profile_fields($text)
{
    if (empty($text) || !is_string($text)) {
        return false;
    }
    $regex = '/{{profile_([a-z0-9_-]+)}}/i';
    $matches = [];
    preg_match_all($regex, $text, $matches);
    if (empty($matches)) {
        return $text;
    }
    $placeholders = $matches[0];
    $profile_names = $matches[1];
    foreach ($placeholders as $index => $placeholder) {
        if (strpos($text, $placeholder) === false) {
            // already replaced
            continue;
        }
        $input = elgg_view('input/profile_field', ['name' => $profile_names[$index]]);
        if (empty($input)) {
            elgg_log("Wizard unable to replace profile placeholder: {$placeholder}", 'WARNING');
        } else {
            elgg_log("Wizard replace profile placeholder: {$placeholder}");
        }
        $text = str_replace($placeholder, $input, $text);
    }
    return $text;
}
开发者ID:coldtrick,项目名称:wizard,代码行数:35,代码来源:functions.php

示例8: 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

示例9: interactionsMenuSetup

 /**
  * Setups entity interactions menu
  *
  * @param string $hook   "register"
  * @param string $type   "menu:interactions"
  * @param array  $menu   Menu
  * @param array  $params Hook parameters
  * @uses $params['entity'] An entity that we are interacting with
  * @uses $params['active_tab'] Currently active tab, default to 'comments'
  * @return array
  */
 public static function interactionsMenuSetup($hook, $type, $menu, $params)
 {
     $entity = elgg_extract('entity', $params, false);
     /* @var ElggEntity $entity */
     if (!elgg_instanceof($entity)) {
         return $menu;
     }
     $active_tab = elgg_extract('active_tab', $params);
     // Commenting
     $comments_count = $entity->countComments();
     $can_comment = $entity->canComment();
     if ($can_comment) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments', 'text' => $entity instanceof Comment ? elgg_echo('interactions:reply:create') : elgg_echo('interactions:comment:create'), 'href' => "stream/comments/{$entity->guid}", 'priority' => 200, 'data-trait' => 'comments', 'item_class' => 'interactions-action'));
     }
     if ($can_comment || $comments_count) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'comments', 'type' => 'comments', 'count' => $comments_count)), 'href' => "stream/comments/{$entity->guid}", 'selected' => $active_tab == 'comments', 'priority' => 100, 'data-trait' => 'comments', 'item_class' => 'interactions-tab'));
     }
     if (elgg_is_active_plugin('likes')) {
         // Liking and unliking
         $likes_count = $entity->countAnnotations('likes');
         $can_like = $entity->canAnnotate(0, 'likes');
         $does_like = elgg_annotation_exists($entity->guid, 'likes');
         if ($can_like) {
             $before_text = elgg_echo('interactions:likes:before');
             $after_text = elgg_echo('interactions:likes:after');
             $menu[] = ElggMenuItem::factory(array('name' => 'likes', 'text' => $does_like ? $after_text : $before_text, 'href' => "action/stream/like?guid={$entity->guid}", 'is_action' => true, 'priority' => 400, 'link_class' => 'interactions-state-toggler', 'item_class' => 'interactions-action', 'data-guid' => $entity->guid, 'data-trait' => 'likes', 'data-state' => $does_like ? 'after' : 'before'));
         }
         if ($can_like || $likes_count) {
             $menu[] = ElggMenuItem::factory(array('name' => 'likes:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'likes', 'type' => 'likes', 'count' => $likes_count)), 'href' => "stream/likes/{$entity->guid}", 'selected' => $active_tab == 'likes', 'data-trait' => 'likes', 'priority' => 300, 'item_class' => 'interactions-tab'));
         }
     }
     return $menu;
 }
开发者ID:hypejunction,项目名称:hypeinteractions,代码行数:44,代码来源:Menus.php

示例10: menus_api_view_menu

/**
 *
 * @param type $menu_name
 * @param array $params
 */
function menus_api_view_menu($menu_name, array $params = [])
{
    $params = menus_api_prepare_params($menu_name, $params);
    $menu = menus_api_get_menu($menu_name, $params);
    $params['menu'] = menus_api_prepare_menu($menu, $params);
    return elgg_view('navigation/menu/default', $params);
}
开发者ID:hypeJunction,项目名称:Elgg-menus_api,代码行数:12,代码来源:start.php

示例11: handleUploads

 /**
  * dropzone/upload action handler
  * @return array
  */
 public function handleUploads()
 {
     $subtype = get_input('subtype');
     if (!$subtype) {
         $subtype = elgg_get_plugin_setting('default_upload_subtype', 'hypeDropzone', 'file');
     }
     $uploads = $this->saveUploadedFiles('dropzone', ['owner_guid' => elgg_get_logged_in_user_guid(), 'container_guid' => get_input('container_guid') ?: ELGG_ENTITIES_ANY_VALUE, 'subtype' => $subtype, 'access_id' => ACCESS_PRIVATE, 'origin' => get_input('origin', 'dropzone')]);
     $output = array();
     foreach ($uploads as $upload) {
         $messages = array();
         $success = true;
         if ($upload->error) {
             $messages[] = $upload->error;
             $success = false;
             ${$guid} = false;
         } else {
             $file = $upload->file;
             $guid = $file->guid;
             $html = elgg_view('input/hidden', array('name' => get_input('input_name', 'guids[]'), 'value' => $file->guid));
         }
         $file_output = array('messages' => $messages, 'success' => $success, 'guid' => $guid, 'html' => $html);
         $output[] = elgg_trigger_plugin_hook('upload:after', 'dropzone', array('upload' => $upload), $file_output);
     }
     return $output;
 }
开发者ID:hypejunction,项目名称:hypedropzone,代码行数:29,代码来源:DropzoneService.php

示例12: formatEmbedView

 /**
  * Output an embedded view of a URL
  *
  * @param string $hook   'format:src'
  * @param string $type   'embed'
  * @param string $return HTML
  * @param array  $params Hook params
  * @return string
  */
 function formatEmbedView($hook, $type, $return, $params)
 {
     $src = elgg_extract('src', $params);
     unset($params['src']);
     $params['href'] = $src;
     return elgg_view('output/card', $params);
 }
开发者ID:n8b,项目名称:VMN,代码行数:16,代码来源:HookHandlers.php

示例13: notifications_page_handler

/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    elgg_gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    set_input('username', $page[1]);
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            echo elgg_view('resources/notifications/groups');
            break;
        case 'personal':
            echo elgg_view('resources/notifications/index');
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:elgg,项目名称:notifications,代码行数:31,代码来源:start.php

示例14: view_adm_permission

function view_adm_permission($entities, $vars = array(), $offset = 0, $limit = 10, $full_view = true, $listTypeToggle = true, $pagination = true)
{
    if (!is_int($offset)) {
        $offset = (int) get_input('offset', 0);
    }
    // list type can be passed as request parameter
    $listType = get_input('list_type', 'list');
    if (get_input('listtype')) {
        elgg_deprecated_notice("'listtype' has been deprecated by 'list_type' for lists", 1.8);
        $listType = get_input('listtype');
    }
    if (is_array($vars)) {
        // new function
        $defaults = array('items' => $entities, 'list_class' => 'elgg-list-entity', 'full_view' => true, 'pagination' => true, 'list_type' => $list_type, 'list_type_toggle' => false, 'offset' => $offset, 'limit' => null);
        $vars = array_merge($defaults, $vars);
    } else {
        // old function parameters
        elgg_deprecated_notice("Please update your use of elgg_view_entity_list()", 1.8);
        $vars = array('items' => $entities, 'count' => (int) $vars, 'offset' => $offset, 'limit' => (int) $limit, 'full_view' => $full_view, 'pagination' => $pagination, 'list_type' => $list_type, 'list_type_toggle' => $listTypeToggle, 'list_class' => 'elgg-list-entity');
    }
    if (!$vars["limit"] && !$vars["offset"]) {
        // no need for pagination if listing is unlimited
        $vars["pagination"] = false;
    }
    if ($vars['view_path_list']) {
        return elgg_view($vars['view_path_list'], $vars);
    }
    if ($vars['list_type'] != 'list') {
        return elgg_view('page/components/gallery', $vars);
    } else {
        return elgg_view('page/components/list', $vars);
    }
}
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:33,代码来源:list_users.php

示例15: messageboard_page_handler

/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            echo elgg_view('resources/messageboard/owner');
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            echo elgg_view('resources/messageboard/add');
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            echo elgg_view('resources/messageboard/owner');
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:elgg,项目名称:messageboard,代码行数:44,代码来源:start.php


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