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

PHP trigger_elgg_event函数代码示例

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

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



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

示例1: perform_redirect

function perform_redirect()
{
    global $CONFIG;
    $username = get_loggedin_user()->username;
    $custom = get_plugin_setting("custom_redirect", "new_profile_redirector");
    if (!get_loggedin_user()->profile_updated && !empty($custom)) {
        $custom = str_replace("[wwwroot]", $CONFIG->wwwroot, $custom);
        $custom = str_replace("[username]", $username, $custom);
        get_loggedin_user()->profile_updated = 1;
        trigger_elgg_event('firstprofileupdate', 'user', $user);
        forward($custom);
    }
}
开发者ID:eokyere,项目名称:elgg,代码行数:13,代码来源:start.php


示例2: update_annotation

/**
 * Update an annotation.
 *
 * @param int $annotation_id
 * @param string $name
 * @param string $value
 * @param string $value_type
 * @param int $owner_guid
 * @param int $access_id
 */
function update_annotation($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
{
    global $CONFIG;
    $annotation_id = (int) $annotation_id;
    $name = trim($name);
    $value = trim($value);
    $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = get_loggedin_userid();
    }
    $access_id = (int) $access_id;
    $access = get_access_sql_suffix();
    // Add the metastring
    $value = add_metastring($value);
    if (!$value) {
        return false;
    }
    $name = add_metastring($name);
    if (!$name) {
        return false;
    }
    // If ok then add it
    $result = update_data("UPDATE {$CONFIG->dbprefix}annotations set value_id='{$value}', value_type='{$value_type}', access_id={$access_id}, owner_guid={$owner_guid} where id={$annotation_id} and name_id='{$name}' and {$access}");
    if ($result !== false) {
        $obj = get_annotation($annotation_id);
        if (trigger_elgg_event('update', 'annotation', $obj)) {
            return true;
        } else {
            delete_annotation($annotation_id);
        }
    }
    return $result;
}
开发者ID:eokyere,项目名称:elgg,代码行数:44,代码来源:annotations.php


示例3: version_upgrade

/**
 * Upgrades Elgg
 *
 */
function version_upgrade()
{
    $dbversion = (int) datalist_get('version');
    // Upgrade database
    db_upgrade($dbversion);
    system_message(elgg_echo('upgrade:db'));
    // Upgrade core
    if (upgrade_code($dbversion)) {
        system_message(elgg_echo('upgrade:core'));
    }
    // Now we trigger an event to give the option for plugins to do something
    $upgrade_details = stdClass;
    $upgrade_details->from = $dbversion;
    $upgrade_details->to = get_version();
    trigger_elgg_event('upgrade', 'upgrade', $upgrade_details);
    // Update the version
    datalist_set('version', get_version());
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:22,代码来源:version.php


示例4: request_user_validation

/**
 * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way.
 *
 * This function invalidates any existing validation value.
 *
 * @param int $user_guid User's GUID
 * @deprecated 1.8 Hook into the register, user plugin hook and request validation.
 */
function request_user_validation($user_guid)
{
    elgg_deprecated_notice("request_user_validation() is deprecated.\n\t\tPlugins should register for the 'register, user' plugin hook", 1.8);
    $user = get_entity($user_guid);
    if ($user && $user instanceof ElggUser) {
        // invalidate any existing validations
        set_user_validation_status($user_guid, false);
        // request validation
        trigger_elgg_event('validate', 'user', $user);
    }
}
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:19,代码来源:deprecated-1.8.php


示例5: delete_annotation

/**
 * Delete a given annotation.
 * 
 * @param $id int The id
 */
function delete_annotation($id)
{
    global $CONFIG;
    $id = (int) $id;
    $access = get_access_sql_suffix();
    $annotation = get_annotation($id);
    if (trigger_elgg_event('delete', 'annotation', $annotation)) {
        return delete_data("DELETE from {$CONFIG->dbprefix}annotations  where id={$id} and {$access}");
    }
    return false;
}
开发者ID:jricher,项目名称:Elgg,代码行数:16,代码来源:annotations.php


示例6: request_user_validation

/**
 * Trigger an event requesting that a user guid be validated somehow - either by email address or some other way.
 *
 * This event invalidates any existing values and returns
 * 
 * @param unknown_type $user_guid
 */
function request_user_validation($user_guid)
{
    $user = get_entity($user_guid);
    if ($user && $user instanceof ElggUser) {
        // invalidate any existing validations
        set_user_validation_status($user_guid, false);
        // request validation
        trigger_elgg_event('validate', 'user', $user);
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:17,代码来源:users.php


示例7: load_plugins

    $lightmode = true;
}
// Load plugins, if we're not in light mode
if ($installed && $db_installed && $sanitised && !$lightmode) {
    load_plugins();
    trigger_elgg_event('plugins_boot', 'system');
}
// Forward if we haven't been installed
if ((!$installed || !$db_installed) && !substr_count($_SERVER["PHP_SELF"], "install.php") && !substr_count($_SERVER["PHP_SELF"], "css.php") && !substr_count($_SERVER["PHP_SELF"], "action_handler.php")) {
    header("Location: install.php");
    exit;
}
// Trigger events
if (!substr_count($_SERVER["PHP_SELF"], "install.php") && !substr_count($_SERVER["PHP_SELF"], "setup.php") && !$lightmode && !(defined('upgrading') && upgrading == 'upgrading')) {
    // If default settings haven't been installed, forward to the default settings page
    trigger_elgg_event('init', 'system');
    //if (!datalist_get('default_settings')) {
    //forward("setup.php");
    //}
}
// System booted, return to normal view
set_input('view', $oldview);
if (empty($oldview)) {
    if (empty($CONFIG->view)) {
        $oldview = 'default';
    } else {
        $oldview = $CONFIG->view;
    }
}
if ($installed && $db_installed) {
    $lastupdate = datalist_get('simplecache_lastupdate');
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:start.php


示例8: logout

/**
 * Log the current user out
 *
 * @return true|false
 */
function logout()
{
    global $CONFIG;
    if (isset($_SESSION['user'])) {
        if (!trigger_elgg_event('logout', 'user', $_SESSION['user'])) {
            return false;
        }
        $_SESSION['user']->code = "";
        $_SESSION['user']->save();
    }
    unset($_SESSION['username']);
    unset($_SESSION['name']);
    unset($_SESSION['code']);
    unset($_SESSION['guid']);
    unset($_SESSION['id']);
    unset($_SESSION['user']);
    setcookie("elggperm", "", time() - 86400 * 30, "/");
    // pass along any messages
    $old_msg = $_SESSION['msg'];
    session_destroy();
    // starting a default session to store any post-logout messages.
    session_init(NULL, NULL, NULL);
    $_SESSION['msg'] = $old_msg;
    return TRUE;
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:30,代码来源:sessions.php


示例9: __elgg_shutdown_hook

/**
 * This function is a shutdown hook registered on startup which does nothing more than trigger a
 * shutdown event when the script is shutting down, but before database connections have been dropped etc.
 *
 */
function __elgg_shutdown_hook()
{
    global $START_MICROTIME;
    trigger_elgg_event('shutdown', 'system');
    $time = (double) (microtime(TRUE) - $START_MICROTIME);
    elgg_log("Page {$_SERVER['REQUEST_URI']} generated in {$time} seconds", 'DEBUG');
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:12,代码来源:elgglib.php


示例10: delete_metadata

/**
 * Delete an item of metadata, where the current user has access.
 *
 * @param $id int The item of metadata to delete.
 */
function delete_metadata($id)
{
    global $CONFIG;
    $id = (int) $id;
    $metadata = get_metadata($id);
    if ($metadata) {
        // Tidy up if memcache is enabled.
        static $metabyname_memcache;
        if (!$metabyname_memcache && is_memcache_available()) {
            $metabyname_memcache = new ElggMemcache('metabyname_memcache');
        }
        if ($metabyname_memcache) {
            $metabyname_memcache->delete("{$metadata->entity_guid}:{$metadata->name_id}");
        }
        if ($metadata->canEdit() && trigger_elgg_event('delete', 'metadata', $metadata)) {
            return delete_data("DELETE from {$CONFIG->dbprefix}metadata where id={$id}");
        }
    }
    return false;
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:25,代码来源:metadata.php


示例11: sprintf

if (count($not_uploaded) > 0) {
    if (count($uploaded_images) > 0) {
        $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '<br />';
    } else {
        $error = elgg_echo("tidypics:completeuploadfailure") . '<br />';
    }
    $num_failures = count($not_uploaded);
    for ($i = 0; $i < $num_failures; $i++) {
        $error .= "{$not_uploaded[$i]}: {$error_msgs[$i]} <br />";
    }
    register_error($error);
    if (count($uploaded_images) == 0) {
        forward(get_input('forward_url', $_SERVER['HTTP_REFERER']));
    } else {
        // some images did upload so we fall through
    }
} else {
    system_message(elgg_echo('tidypics:upl_success'));
}
if (count($uploaded_images) && $img_river_view == "1") {
    if (function_exists('add_to_river')) {
        add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID());
    }
}
// update image repo size
create_metadata($album->container_guid, "image_repo_size", $image_repo_size, 'integer', $album->container_guid);
// plugins can register to be told when a Tidypics album has had images added
trigger_elgg_event('upload', 'tp_album', $album);
//forward to multi-image edit page
$url = $CONFIG->wwwroot . 'mod/tidypics/pages/edit_multiple.php?files=' . implode('-', $uploaded_images);
forward($url);
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:31,代码来源:flickrImportPhotoset1.php


示例12: array

// get the images and save their file handlers into an array
// so we can do clean up if one fails.
$files = array();
foreach ($icon_sizes as $name => $size_info) {
    $resized = get_resized_image_from_uploaded_file('profileicon', $size_info['w'], $size_info['h'], $size_info['square']);
    if ($resized) {
        //@todo Make these actual entities.  See exts #348.
        $file = new ElggFile();
        $file->owner_guid = $profile_owner_guid;
        $file->setFilename("profile/{$profile_username}{$name}.jpg");
        $file->open('write');
        $file->write($resized);
        $file->close();
        $files[] = $file;
    } else {
        // cleanup on fail
        foreach ($files as $file) {
            $file->delete();
        }
        system_message(elgg_echo('profile:icon:notfound'));
        forward($_SERVER['HTTP_REFERER']);
    }
}
$profile_owner->icontime = time();
if (trigger_elgg_event('profileiconupdate', $profile_owner->type, $profile_owner)) {
    // pull this out into the river plugin.
    //add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid);
    system_message(elgg_echo("profile:icon:uploaded"));
}
//forward the user back to the upload page to crop
forward($_SERVER['HTTP_REFERER']);
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:iconupload.php


示例13: system_log_listener

/**
 * System log listener.
 * This function listens to all events in the system and logs anything appropriate.
 *
 * @param String $event
 * @param String $object_type
 * @param Loggable $object
 */
function system_log_listener($event, $object_type, $object)
{
    if ($object_type != 'systemlog' && $event != 'log') {
        trigger_elgg_event('log', 'systemlog', array('object' => $object, 'event' => $event));
    }
    return true;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:15,代码来源:system_log.php


示例14: delete_entity

/**
 * Delete a given entity.
 * 
 * @param int $guid
 * @param bool $recursive If true (default) then all entities which are owned or contained by $guid will also be deleted.
 * 						   Note: this bypasses ownership of sub items.
 */
function delete_entity($guid, $recursive = true)
{
    global $CONFIG;
    $guid = (int) $guid;
    if ($entity = get_entity($guid)) {
        if (trigger_elgg_event('delete', $entity->type, $entity)) {
            if ($entity->canEdit()) {
                // Delete contained owned and otherwise releated objects (depth first)
                if ($recursive) {
                    // Temporary token overriding access controls TODO: Do this better.
                    static $__RECURSIVE_DELETE_TOKEN;
                    $__RECURSIVE_DELETE_TOKEN = md5(get_loggedin_userid());
                    // Make it slightly harder to guess
                    $sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities WHERE container_guid={$guid} or owner_guid={$guid} or site_guid={$guid}", 'entity_row_to_elggstar');
                    if ($sub_entities) {
                        foreach ($sub_entities as $e) {
                            $e->delete();
                        }
                    }
                    $__RECURSIVE_DELETE_TOKEN = null;
                }
                // Now delete the entity itself
                $entity->clearMetadata();
                $entity->clearAnnotations();
                $entity->clearRelationships();
                remove_from_river_by_subject($guid);
                remove_from_river_by_object($guid);
                remove_all_private_settings($guid);
                $res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
                if ($res) {
                    $sub_table = "";
                    // Where appropriate delete the sub table
                    switch ($entity->type) {
                        case 'object':
                            $sub_table = $CONFIG->dbprefix . 'objects_entity';
                            break;
                        case 'user':
                            $sub_table = $CONFIG->dbprefix . 'users_entity';
                            break;
                        case 'group':
                            $sub_table = $CONFIG->dbprefix . 'groups_entity';
                            break;
                        case 'site':
                            $sub_table = $CONFIG->dbprefix . 'sites_entity';
                            break;
                    }
                    if ($sub_table) {
                        delete_data("DELETE from {$sub_table} where guid={$guid}");
                    }
                }
                return $res;
            }
        }
    }
    return false;
}
开发者ID:jricher,项目名称:Elgg,代码行数:63,代码来源:entities.php


示例15: leave_group

/**
 * Remove a user from a group.
 *
 * @param int $group_guid The group.
 * @param int $user_guid The user.
 */
function leave_group($group_guid, $user_guid)
{
    // event needs to be triggered while user is still member of group to have access to group acl
    trigger_elgg_event('leave', 'group', array('group' => get_entity($group_guid), 'user' => get_entity($user_guid)));
    $result = remove_entity_relationship($user_guid, 'member', $group_guid);
    return $result;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:13,代码来源:group.php


示例16: remove_entity_relationship

/**
 * Remove an arbitrary relationship between two entities.
 *
 * @param int $guid_one
 * @param string $relationship
 * @param int $guid_two
 */
function remove_entity_relationship($guid_one, $relationship, $guid_two)
{
    global $CONFIG;
    $guid_one = (int) $guid_one;
    $relationship = sanitise_string($relationship);
    $guid_two = (int) $guid_two;
    $obj = check_entity_relationship($guid_one, $relationship, $guid_two);
    if ($obj == false) {
        return false;
    }
    if (trigger_elgg_event('delete', $relationship, $obj)) {
        return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one={$guid_one} and relationship='{$relationship}' and guid_two={$guid_two}");
    } else {
        return false;
    }
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:23,代码来源:relationships.php


示例17: update_metadata

/**
 * Update an item of metadata.
 *
 * @param int $id
 * @param string $name
 * @param string $value
 * @param string $value_type
 * @param int $owner_guid
 * @param int $access_id
 */
function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id)
{
    global $CONFIG;
    $id = (int) $id;
    if (!($md = get_metadata($id))) {
        return false;
    }
    if (!$md->canEdit()) {
        return false;
    }
    // If memcached then we invalidate the cache for this entry
    static $metabyname_memcache;
    if (!$metabyname_memcache && is_memcache_available()) {
        $metabyname_memcache = new ElggMemcache('metabyname_memcache');
    }
    if ($metabyname_memcache) {
        $metabyname_memcache->delete("{$md->entity_guid}:{$md->name_id}");
    }
    //$name = sanitise_string(trim($name));
    //$value = sanitise_string(trim($value));
    $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = get_loggedin_userid();
    }
    $access_id = (int) $access_id;
    $access = get_access_sql_suffix();
    // Support boolean types (as integers)
    if (is_bool($value)) {
        if ($value) {
            $value = 1;
        } else {
            $value = 0;
        }
    }
    // Add the metastring
    $value = add_metastring($value);
    if (!$value) {
        return false;
    }
    $name = add_metastring($name);
    if (!$name) {
        return false;
    }
    // If ok then add it
    $result = update_data("UPDATE {$CONFIG->dbprefix}metadata set value_id='{$value}', value_type='{$value_type}', access_id={$access_id}, owner_guid={$owner_guid} where id={$id} and name_id='{$name}'");
    if ($result !== false) {
        $obj = get_metadata($id);
        if (trigger_elgg_event('update', 'metadata', $obj)) {
            return true;
        } else {
            delete_metadata($id);
        }
    }
    return $result;
}
开发者ID:eokyere,项目名称:elgg,代码行数:66,代码来源:metadata.php


示例18: check_first_login

function check_first_login($login_event, $user_type, $user)
{
    if ($user && $user->last_login == 0) {
        trigger_elgg_event('firstlogin', 'user', $user);
    }
}
开发者ID:eokyere,项目名称:elgg,代码行数:6,代码来源:start.php


示例19: time

        $filehandler->open("write");
        $filehandler->write($small);
        $filehandler->close();
        $filehandler->setFilename("profile/" . $_SESSION['user']->username . "tiny.jpg");
        $filehandler->open("write");
        $filehandler->write($tiny);
        $filehandler->close();
        $filehandler->setFilename("profile/" . $_SESSION['user']->username . "topbar.jpg");
        $filehandler->open("write");
        $filehandler->write($topbar);
        $filehandler->close();
        $filehandler->setFilename("profile/" . $_SESSION['user']->username . "master.jpg");
        $filehandler->open("write");
        $filehandler->write($master);
        $filehandler->close();
        $_SESSION['user']->icontime = time();
        system_message(elgg_echo("profile:icon:uploaded"));
        trigger_elgg_event('profileiconupdate', $_SESSION['user']->type, $_SESSION['user']);
        //add to river
        add_to_river('river/user/default/profileiconupdate', 'update', $_SESSION['user']->guid, $_SESSION['user']->guid);
    } else {
        system_message(elgg_echo("profile:icon:notfound"));
    }
} else {
    system_message(elgg_echo("profile:icon:notfound"));
}
//forward the user back to the upload page to crop
$url = "mod/profile/editicon.php";
if (isloggedin()) {
    forward($url);
}
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:iconupload.php


示例20: foreach

    }
}
// go through custom fields
if (sizeof($input) > 0) {
    foreach ($input as $shortname => $value) {
        remove_metadata($profile_owner->guid, $shortname);
        if (isset($accesslevel[$shortname])) {
            $access_id = (int) $accesslevel[$shortname];
        } else {
            // this should never be executed since the access level should always be set
            $access_id = ACCESS_DEFAULT;
        }
        if (is_array($value)) {
            $i = 0;
            foreach ($value as $interval) {
                $i++;
                $multiple = $i > 1 ? TRUE : FALSE;
                create_metadata($profile_owner->guid, $shortname, $interval, 'text', $profile_owner->guid, $access_id, $multiple);
            }
        } else {
            create_metadata($profile_owner->getGUID(), $shortname, $value, 'text', $profile_owner->getGUID(), $access_id);
        }
    }
    $profile_owner->save();
    // Notify of profile update
    trigger_elgg_event('profileupdate', $user->type, $user);
    //add to river
    add_to_river('river/user/default/profileupdate', 'update', $_SESSION['user']->guid, $_SESSION['user']->guid, get_default_access($_SESSION['user']));
    system_message(elgg_echo("profile:saved"));
}
forward($profile_owner->getUrl());
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:edit.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP trigger_error函数代码示例发布时间:2022-05-23
下一篇:
PHP trigger_change函数代码示例发布时间: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