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

PHP trigger_plugin_hook函数代码示例

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

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



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

示例1: sitepages_init

/**
 * Start the site pages plugin.
 */
function sitepages_init()
{
    require_once dirname(__FILE__) . '/sitepages_functions.php';
    global $CONFIG;
    // register our subtype
    run_function_once('sitepages_runonce');
    // Register a page handler, so we can have nice URLs
    register_page_handler('sitepages', 'sitepages_page_handler');
    // Register a URL handler for external pages
    register_entity_url_handler('sitepages_url', 'object', 'sitepages');
    elgg_extend_view('footer/links', 'sitepages/footer_menu');
    elgg_extend_view('metatags', 'sitepages/metatags');
    // Replace the default index page if user has requested
    if (get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') {
        register_plugin_hook('index', 'system', 'sitepages_custom_index');
    }
    // parse views for keywords
    register_plugin_hook('display', 'view', 'sitepages_parse_view');
    // register the views we want to parse for the keyword replacement
    // right now this is just the custom front page, but we can
    // expand it to the other pages later.
    $CONFIG->sitepages_parse_views = array('sitepages/custom_frontpage');
    // an example of how to register and respond to the get_keywords trigger
    register_plugin_hook('get_keywords', 'sitepages', 'sitepages_keyword_hook');
    // grab the list of keywords and their views from plugins
    if ($keywords = trigger_plugin_hook('get_keywords', 'sitepages', NULL, array())) {
        $CONFIG->sitepages_keywords = $keywords;
    }
    register_action("sitepages/add", FALSE, $CONFIG->pluginspath . "sitepages/actions/add.php");
    register_action("sitepages/addfront", FALSE, $CONFIG->pluginspath . "sitepages/actions/addfront.php");
    register_action("sitepages/addmeta", FALSE, $CONFIG->pluginspath . "sitepages/actions/addmeta.php");
    register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php");
    register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php");
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:37,代码来源:start.php


示例2: garbagecollector_cron

/**
 * Cron job
 *
 */
function garbagecollector_cron($hook, $entity_type, $returnvalue, $params)
{
    global $CONFIG;
    echo elgg_echo('garbagecollector');
    // Garbage collect metastrings
    echo elgg_echo('garbagecollector:gc:metastrings');
    if (delete_orphaned_metastrings() !== false) {
        echo elgg_echo('garbagecollector:ok');
    } else {
        echo elgg_echo('garbagecollector:error');
    }
    echo "\n";
    // Now, because we are nice, trigger a plugin hook to let other plugins do some GC
    $rv = true;
    $period = get_plugin_setting('period', 'garbagecollector');
    trigger_plugin_hook('gc', 'system', array('period' => $period));
    // Now we optimize all tables
    $tables = get_db_tables();
    foreach ($tables as $table) {
        echo sprintf(elgg_echo('garbagecollector:optimize'), $table);
        if (optimize_table($table) !== false) {
            echo elgg_echo('garbagecollector:ok');
        } else {
            echo elgg_echo('garbagecollector:error');
        }
        echo "\n";
    }
    echo elgg_echo('garbagecollector:done');
}
开发者ID:eokyere,项目名称:elgg,代码行数:33,代码来源:start.php


示例3: profile_fields_setup

/**
 * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
 * add and delete fields.
 *
 * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
 * other plugins have initialised.
 */
function profile_fields_setup()
{
    global $CONFIG;
    $profile_defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'tags', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url', 'twitter' => 'text');
    // TODO: Have an admin interface for this
    $n = 0;
    $loaded_defaults = array();
    while ($translation = get_plugin_setting("admin_defined_profile_{$n}", 'profile')) {
        // Add a translation
        add_translation(get_current_language(), array("profile:admin_defined_profile_{$n}" => $translation));
        // Detect type
        $type = get_plugin_setting("admin_defined_profile_type_{$n}", 'profile');
        if (!$type) {
            $type = 'text';
        }
        // Set array
        $loaded_defaults["admin_defined_profile_{$n}"] = $type;
        $n++;
    }
    if (count($loaded_defaults)) {
        $CONFIG->profile_using_custom = true;
        $profile_defaults = $loaded_defaults;
    }
    $CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults);
    // register any tag metadata names
    foreach ($CONFIG->profile as $name => $type) {
        if ($type == 'tags') {
            elgg_register_tag_metadata_name($name);
            // register a tag name translation
            add_translation(get_current_language(), array("tag_names:{$name}" => elgg_echo("profile:{$name}")));
        }
    }
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:40,代码来源:start.php


示例4: homepage_cms_page_handler

function homepage_cms_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    $page_type = $page[0];
    $base_plugin_pages = elgg_get_plugins_path() . 'homepage_cms_ed/pages/homepage_cms';
    $hpc_params = array("type" => "object", "subtype" => "hpcroles");
    $allRoles = elgg_get_entities($hpc_params);
    if (!$allRoles) {
        //default condition (!$allRoles)
        trigger_plugin_hook('action', 'load', 'homepaage_cms_action_hook', array("hpc_role_check" => true));
    } else {
        //system_message('Total: '.count($allRoles));
        //var_dump($allRoles);
        //system_message((string)$allRoles[0]->guid);
        /*foreach($allRoles as $role){
        			//var_dump($role);
        			//system_message((string)$role->guid);
        		}*/
    }
    switch ($page_type) {
        case 'all':
            include "{$base_plugin_pages}/index.php";
            break;
    }
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:28,代码来源:start.php


示例5: elgg_geocode_location

/**
 * Encode a location into a latitude and longitude, caching the result.
 *
 * Works by triggering the 'geocode' 'location' plugin hook, and requires a geocoding module to be installed
 * activated in order to work.
 *
 * @param String $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    // Handle cases where we are passed an array (shouldn't be but can happen if location is a tag field)
    if (is_array($location)) {
        $location = implode(', ', $location);
    }
    $location = sanitise_string($location);
    // Look for cached version
    $cached_location = get_data_row("SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'");
    if ($cached_location) {
        return array('lat' => $cached_location->lat, 'long' => $cached_location->long);
    }
    // Trigger geocode event if not cached
    $return = false;
    $return = trigger_plugin_hook('geocode', 'location', array('location' => $location), $return);
    // If returned, cache and return value
    if ($return && is_array($return)) {
        $lat = (double) $return['lat'];
        $long = (double) $return['long'];
        // Put into cache at the end of the page since we don't really care that much
        execute_delayed_write_query("INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache (location, lat, `long`) VALUES ('{$location}', '{$lat}', '{$long}') ON DUPLICATE KEY UPDATE lat='{$lat}', `long`='{$long}'");
    }
    return $return;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:33,代码来源:location.php


示例6: offsetGet

 /**
  * Get a variable from either the session, or if its not in the session attempt to get it from
  * an api call.
  */
 function offsetGet($key)
 {
     if (!ElggSession::$__localcache) {
         ElggSession::$__localcache = array();
     }
     if (isset($_SESSION[$key])) {
         return $_SESSION[$key];
     }
     if (isset(ElggSession::$__localcache[$key])) {
         return ElggSession::$__localcache[$key];
     }
     $value = null;
     $value = trigger_plugin_hook('session:get', $key, null, $value);
     ElggSession::$__localcache[$key] = $value;
     return ElggSession::$__localcache[$key];
 }
开发者ID:jricher,项目名称:Elgg,代码行数:20,代码来源:sessions.php


示例7: elgg_geocode_location

/**
 * Encode a location into a latitude and longitude, caching the result.
 *
 * Works by triggering the 'geocode' 'location' plugin hook, and requires a geocoding module to be installed
 * activated in order to work.
 * 
 * @param String $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    $location = sanitise_string($location);
    // Look for cached version
    $cached_location = get_data_row("SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'");
    // Trigger geocode event
    $return = false;
    $return = trigger_plugin_hook('geocode', 'location', array('location' => $location, $return));
    // If returned, cache and return value
    if ($return && is_array($return)) {
        $lat = (int) $return['lat'];
        $long = (int) $return['long'];
        // Put into cache at the end of the page since we don't really care that much
        execute_delayed_write_query("INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache (lat, long) VALUES ({$lat}, {$long}) ON DUPLICATE KEY UPDATE lat={$lat} long={$long}");
    }
    return $return;
}
开发者ID:eokyere,项目名称:elgg,代码行数:26,代码来源:location.php


示例8: captcha_init

/**
 * Elgg captcha plugin
 * 
 * @package ElggCaptcha
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2010
 * @link http://elgg.com/
 */
function captcha_init()
{
    global $CONFIG;
    // Register page handler for captcha functionality
    register_page_handler('captcha', 'captcha_page_handler');
    // Extend CSS
    elgg_extend_view('css', 'captcha/css');
    // Number of background images
    $CONFIG->captcha_num_bg = 5;
    // Default length
    $CONFIG->captcha_length = 5;
    // Register a function that provides some default override actions
    register_plugin_hook('actionlist', 'captcha', 'captcha_actionlist_hook');
    // Register actions to intercept
    $actions = array();
    $actions = trigger_plugin_hook('actionlist', 'captcha', null, $actions);
    if ($actions && is_array($actions)) {
        foreach ($actions as $action) {
            register_plugin_hook("action", $action, "captcha_verify_action_hook");
        }
    }
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:start.php


示例9: forward

        } else {
            if (get_input('returntoreferer')) {
                forward($_SERVER['HTTP_REFERER']);
            } else {
                forward("pg/dashboard/");
            }
        }
    }
} else {
    $error_msg = elgg_echo('loginerror');
    // figure out why the login failed
    if (!empty($username) && !empty($password)) {
        // See if it exists and is disabled
        $access_status = access_get_show_hidden_status();
        access_show_hidden_entities(true);
        if (($user = get_user_by_username($username)) && !$user->validated) {
            // give plugins a chance to respond
            if (!trigger_plugin_hook('unvalidated_login_attempt', 'user', array('entity' => $user))) {
                // if plugins have not registered an action, the default action is to
                // trigger the validation event again and assume that the validation
                // event will display an appropriate message
                trigger_elgg_event('validate', 'user', $user);
            }
        } else {
            register_error(elgg_echo('loginerror'));
        }
        access_show_hidden_entities($access_status);
    } else {
        register_error(elgg_echo('loginerror'));
    }
}
开发者ID:jricher,项目名称:Elgg,代码行数:31,代码来源:login.php


示例10: get_input

 */
$title = get_input('title');
$description = get_input('description');
$address = get_input('address');
$access = ACCESS_PRIVATE;
//this is private and only admins can see it
if ($title && $address) {
    $entity = new ElggObject();
    $entity->subtype = "reported_content";
    $entity->owner_guid = $_SESSION['user']->getGUID();
    $entity->title = $title;
    $entity->address = $address;
    $entity->description = $description;
    $entity->access_id = $access;
    if ($entity->save()) {
        if (!trigger_plugin_hook('reportedcontent:add', $reported->type, array('entity' => $reported), true)) {
            $entity->delete();
            register_error(elgg_echo('reportedcontent:failed'));
        } else {
            system_message(elgg_echo('reportedcontent:success'));
            $entity->state = "active";
        }
        forward($address);
    } else {
        register_error(elgg_echo('reportedcontent:failed'));
        forward($address);
    }
} else {
    register_error(elgg_echo('reportedcontent:failed'));
    forward($address);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:add.php


示例11: exportAsArray

function exportAsArray($guid)
{
    $guid = (int) $guid;
    // Initialise the array
    $to_be_serialised = array();
    // Trigger a hook to
    $to_be_serialised = trigger_plugin_hook("export", "all", array("guid" => $guid), $to_be_serialised);
    // Sanity check
    if (!is_array($to_be_serialised) || count($to_be_serialised) == 0) {
        throw new ExportException(sprintf(elgg_echo('ExportException:NoSuchEntity'), $guid));
    }
    return $to_be_serialised;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:13,代码来源:export.php


示例12: define

 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 */
// Load Elgg engine
define('externalpage', true);
require_once "../start.php";
global $CONFIG;
// Get basic parameters
$period = get_input('period');
if (!$period) {
    throw new CronException(sprintf(elgg_echo('CronException:unknownperiod'), $period));
}
// Get a list of parameters
$params = array();
$params['time'] = time();
foreach ($CONFIG->input as $k => $v) {
    $params[$k] = $v;
}
// Trigger hack
$std_out = "";
// Data to return to
$old_stdout = "";
ob_start();
$old_stdout = trigger_plugin_hook('cron', $period, $params, $old_stdout);
$std_out = ob_get_clean();
// Return event
echo $std_out . $old_stdout;
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:cron_handler.php


示例13: get_access_sql_suffix

}
// add access
$access_suffix .= get_access_sql_suffix("e");
// Add access controls
for ($mindex = 1; $mindex <= count($meta_array); $mindex++) {
    $access_suffix .= ' and ' . get_access_sql_suffix("m{$mindex}");
    // Add access controls
}
if (empty($select)) {
    $select = "distinct e.*";
}
// extend with hooks
$join = trigger_plugin_hook("extend_join", "profile_manager_member_search", null, $join);
$order = trigger_plugin_hook("extend_order", "profile_manager_member_search", null, $order);
$select = trigger_plugin_hook("extend_select", "profile_manager_member_search", null, $select);
$where_clause = trigger_plugin_hook("extend_where", "profile_manager_member_search", null, $where_clause);
// build query
$query = "from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid {$join} where " . $where_clause . $access_suffix;
// execute query and retrieve entities
$count = get_data_row("SELECT count(distinct e.guid) as total " . $query);
$count = $count->total;
if (!empty($order)) {
    $order = " order by " . $order;
}
$query = "SELECT " . $select . " " . $query . " " . $group_by . $order . " limit {$offset},{$limit}";
$entities = get_data($query, "entity_row_to_elggstar");
// present it
echo "<div class='contentWrapper'>";
echo "<h3 class='settings'>" . elgg_echo("profile_manager:members:searchresults:title") . "</h3>";
if ($count > 0) {
    $nav = elgg_view('profile_manager/members/pagination', array('function_name' => "navigate_members_search", 'offset' => $offset, 'count' => $count, 'limit' => $limit));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:search.php


示例14: elgg_echo

} else {
    if (empty($objecttype)) {
        $objecttype = 'object';
    }
    $itemtitle = 'item:' . $objecttype;
    if (!empty($subtype)) {
        $itemtitle .= ':' . $subtype;
    }
    $itemtitle = elgg_echo($itemtitle);
    $title = sprintf(elgg_echo('advancedsearchtitle'), $itemtitle, $tag);
}
global $CONFIG;
$tagSearch = false;
if (strpos(current_page_url(), $CONFIG->wwwroot . 'tag') > -1 || strpos(current_page_url(), $CONFIG->wwwroot . 'search/?tag') > -1) {
    $tagSearch = true;
}
if (!empty($tag)) {
    $body = "";
    $body .= elgg_view_title($title);
    // elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag));
    //the custom search doesn't work with tag searching
    if (!$tagSearch) {
        $body .= trigger_plugin_hook('search', '', $tag, "");
    }
    $body .= elgg_view('search/startblurb', array('tag' => $tag));
    $body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid_array, 10, false, false);
    $body = elgg_view_layout('two_column_left_sidebar', '', $body);
}
if ($tagSearch) {
    page_draw($title, $body);
}
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:index.php


示例15: get_input

<?php

$email = get_input('email');
$user = get_user_by_email($email);
if (is_array($user)) {
    $user = $user[0];
}
if ($user) {
    if ($user->validated) {
        if (send_new_password_request($user->guid)) {
            system_message(elgg_echo('user:password:resetreq:success'));
        } else {
            register_error(elgg_echo('user:password:resetreq:fail'));
        }
    } else {
        if (!trigger_plugin_hook('unvalidated_requestnewpassword', 'user', array('entity' => $user))) {
            // if plugins have not registered an action, the default action is to
            // trigger the validation event again and assume that the validation
            // event will display an appropriate message
            trigger_elgg_event('validate', 'user', $user);
        }
    }
} else {
    register_error(sprintf(elgg_echo('user:email:notfound'), $email));
}
forward();
开发者ID:CashElgg,项目名称:request_password,代码行数:26,代码来源:requestnewpassword.php


示例16: gatekeeper

<?php

/**
 * Aggregate action for saving settings
 *
 * @package Elgg
 * @subpackage Core
 * @link http://elgg.org/
 */
global $CONFIG;
gatekeeper();
trigger_plugin_hook('usersettings:save', 'user');
forward($_SERVER['HTTP_REFERER']);
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:13,代码来源:save.php


示例17: list_entities_by_relationship_count

    case "pop":
        $filter_content = list_entities_by_relationship_count('friend', true, '', '', 0, 10, false);
        break;
    case "active":
        $filter_content = elgg_view("members/online");
        break;
        // search based on name
    // search based on name
    case "search":
        set_context('search');
        $filter_content = list_user_search($tag);
        break;
        // search based on tags
    // search based on tags
    case "search_tags":
        $filter_content = trigger_plugin_hook('search', '', $tag, "");
        $filter_content .= list_entities_from_metadata("", $tag, "user", "", "", 10, false, false);
        break;
    case "newest":
    case 'default':
        $filter_content = elgg_list_entities(array('type' => 'user', 'offset' => $offset, 'full_view' => FALSE));
        break;
}
// create the members navigation/filtering
$members = get_number_users();
$members_nav = elgg_view("members/members_sort_menu", array("count" => $members, "filter" => $filter));
$content = $members_nav . $filter_content;
// title
$main_content = elgg_view_title(elgg_echo("members:members"));
$main_content .= elgg_view('page_elements/contentwrapper', array('body' => $content, 'subclass' => 'members'));
$body = elgg_view_layout("sidebar_boxes", $sidebar, $main_content);
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:index.php


示例18: set_plugin_setting

/**
 * Set a setting for a plugin.
 *
 * @param string $name The name - note, can't be "title".
 * @param mixed $value The value.
 * @param string $plugin_name Optional plugin name, if not specified then it is detected from where you are calling from.
 */
function set_plugin_setting($name, $value, $plugin_name = "")
{
    if (!$plugin_name) {
        $plugin_name = get_plugin_name();
    }
    $plugin = find_plugin_settings($plugin_name);
    if (!$plugin) {
        $plugin = new ElggPlugin();
    }
    if ($name != 'title') {
        // Hook to validate setting
        $value = trigger_plugin_hook('plugin:setting', 'plugin', array('plugin' => $plugin_name, 'name' => $name, 'value' => $value), $value);
        $plugin->title = $plugin_name;
        $plugin->access_id = ACCESS_PUBLIC;
        $plugin->save();
        $plugin->{$name} = $value;
        return $plugin->getGUID();
    }
    return false;
}
开发者ID:eokyere,项目名称:elgg,代码行数:27,代码来源:plugins.php


示例19: define

/**
 * Elgg index page for web-based applications
 * 
 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 */
/**
 * Start the Elgg engine
 */
define('externalpage', true);
require_once dirname(__FILE__) . "/engine/start.php";
if (!trigger_plugin_hook('index', 'system', null, false)) {
    /**
     * Check to see if user is logged in, if not display login form
     **/
    if (isloggedin()) {
        forward('pg/dashboard/');
    }
    //Load the front page
    global $CONFIG;
    $title = elgg_view_title(elgg_echo('content:latest'));
    set_context('search');
    $content = list_registered_entities(0, 10, true, false, array('object', 'group'));
    set_context('main');
    global $autofeed;
    $autofeed = false;
    $content = elgg_view_layout('two_column_left_sidebar', '', $title . $content, elgg_view("account/forms/login"));
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:index.php


示例20: theme_haarlem_intranet_livesearch_route_handler

/**
 * Listen to /livesearc for special mentions search
 *
 * @param string $hook         the name of the hook
 * @param string $type         the type of the hook
 * @param array  $return_value current return value
 * @param array  $params       supplied params
 *
 * @return array
 */
function theme_haarlem_intranet_livesearch_route_handler($hook, $type, $return_value, $params)
{
    $query = get_input('q', get_input('term'));
    if (empty($query)) {
        return $return_value;
    }
    $match_on = get_input('match_on');
    if (empty($match_on)) {
        return $return_value;
    }
    if (is_array($match_on) && count($match_on) > 1) {
        return $return_value;
    }
    if (is_array($match_on)) {
        $match_on = $match_on[0];
    }
    $overrule_cases = array('mentions', 'member_of_site');
    if (!in_array($match_on, $overrule_cases)) {
        return $return_value;
    }
    // backup search advanced mulitsite search setting
    $mulitsite = elgg_extract('search_advanced:multisite', $_SESSION);
    $_SESSION['search_advanced:multisite'] = false;
    $params = array('type' => 'user', 'limit' => 10, 'query' => sanitise_string($query));
    $users = trigger_plugin_hook('search', 'user', $params, array());
    if (empty($users) || !is_array($users)) {
        header("Content-Type: application/json");
        echo json_encode(array());
        return false;
    }
    $count = elgg_extract('count', $users);
    if (empty($count)) {
        header("Content-Type: application/json");
        echo json_encode(array());
        return false;
    }
    $users = elgg_extract('entities', $users);
    $results = array();
    foreach ($users as $user) {
        $output = elgg_view_list_item($user, array('use_hover' => false, 'class' => 'elgg-autocomplete-item'));
        $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false));
        $result = array('type' => 'user', 'name' => $user->name, 'desc' => $user->username, 'guid' => $user->guid, 'label' => $output, 'value' => $user->username, 'icon' => $icon, 'url' => $user->getURL());
        $results[$user->name . rand(1, 100)] = $result;
    }
    ksort($results);
    header("Content-Type: application/json");
    echo json_encode(array_values($results));
    // reset search advanced mulitsite search setting
    $_SESSION['search_advanced:multisite'] = $mulitsite;
    return false;
}
开发者ID:Twizanex,项目名称:theme_haarlem_intranet,代码行数:61,代码来源:hooks.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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