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


PHP elgg_get_config函数代码示例

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


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

示例1: prototyper_group_get_prototype_fields

/**
 * Returns prototyped fields
 *
 * @param string $hook   "prototype"
 * @param string $type   "groups/edit"
 * @param array  $return Fields
 * @param array  $params Hook params
 * @return array
 */
function prototyper_group_get_prototype_fields($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $params);
    $subtype = $entity->getSubtype() ?: 'default';
    $prototype = elgg_get_plugin_setting("prototype:{$subtype}", 'prototyper_group');
    if (!$prototype && $subtype != 'default') {
        $prototype = elgg_get_plugin_setting('prototype:default', 'prototyper_group');
    }
    if ($prototype) {
        $prototype_fields = unserialize($prototype);
        $return = array_merge($return, $prototype_fields);
    } else {
        $fields = elgg_get_config('group');
        $return['icon'] = ['type' => 'icon', 'data_type' => 'file', 'label' => [get_current_language() => elgg_echo('groups:icon')], 'help' => false];
        $return['description'] = ['type' => 'description', 'data_type' => 'attribute', 'label' => [get_current_language() => elgg_echo('groups:description')], 'help' => false];
        foreach ($fields as $shortname => $input_type) {
            $return[$shortname] = ['type' => $input_type, 'data_type' => 'metadata', 'label' => [get_current_language() => elgg_echo("groups:{$shortname}")], 'help' => false];
        }
    }
    // Not adding these above, as we want them to persist, even if they are deleted from the UI
    $return['name'] = ['type' => 'name', 'data_type' => 'attribute', 'class_name' => \hypeJunction\Prototyper\Groups\NameField::class, 'label' => [get_current_language() => elgg_echo('groups:name')], 'help' => false, 'priority' => 1];
    $return['membership'] = ['type' => 'membership', 'data_type' => 'metadata', 'id' => 'groups-membership', 'input_view' => 'input/groups/membership', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\MembershipField::class, 'label' => [get_current_language() => elgg_echo("groups:membership")], 'help' => false, 'priority' => 900];
    // treating this as metadata so that it gets handled after the entity has been saved once and group_acl has been created
    $return['vis'] = ['type' => 'access', 'data_type' => 'metadata', 'id' => 'groups-vis', 'input_view' => 'input/groups/visibility', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\VisibilityField::class, 'label' => [get_current_language() => elgg_echo("groups:visibility")], 'help' => false, 'priority' => 900];
    $return['content_access_mode'] = ['type' => 'content_access_mode', 'data_type' => 'metadata', 'id' => 'groups-content-access-mode', 'input_view' => 'input/groups/content_access_mode', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ContentAccessModeField::class, 'label' => [get_current_language() => elgg_echo("groups:content_access_mode")], 'help' => false, 'priority' => 900];
    $return['owner_guid'] = ['type' => 'select', 'data_type' => 'attribute', 'input_view' => 'input/groups/owner', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\OwnerField::class, 'label' => [get_current_language() => elgg_echo("groups:owner")], 'help' => false, 'priority' => 900];
    $return['tools'] = ['type' => 'checkboxes', 'data_type' => 'metadata', 'input_view' => 'input/groups/tools', 'output_view' => false, 'class_name' => hypeJunction\Prototyper\Groups\ToolsField::class, 'label' => false, 'help' => false, 'priority' => 900];
    return $return;
}
开发者ID:hypeJunction,项目名称:Elgg-prototyper_group,代码行数:38,代码来源:start.php

示例2: clean_unvalidate

/**
 * Clean unvalidated users cron hook
 */
function clean_unvalidate($vars)
{
    $days_till_first_reminder = elgg_get_plugin_setting("validation_reminder_first_message") * 1;
    $days_till_second_reminder = elgg_get_plugin_setting("validation_reminder_second_message") * 1;
    $days_till_removal = elgg_get_plugin_setting("validation_reminder_remove") * 1;
    $proviousAccessShowHiddenEntities = access_show_hidden_entities(true);
    $proviousIgnoreAccess = elgg_set_ignore_access(true);
    $dbprefix = elgg_get_config('dbprefix');
    // @var $users ElggUser[]
    $users = elgg_get_entities_from_metadata(['type' => 'user', 'limit' => false, 'metadata_name_value_pair' => array(array('name' => 'validated', 'value' => false))]);
    foreach ($users as $user) {
        $validate_reminder_start_date = $user->time_created;
        if (time() - $validate_reminder_start_date >= $days_till_removal * 24 * 60 * 60) {
            $user->delete();
            echo 'Account deleted';
        } else {
            if (time() - $validate_reminder_start_date >= $days_till_second_reminder * 24 * 60 * 60 && time() - $validate_reminder_start_date <= ($days_till_second_reminder + 1) * 24 * 60 * 60) {
                send_validation_reminder_mail($user, $days_till_removal, $days_till_second_reminder);
                echo 'Send second reminder send';
            } else {
                if (time() - $validate_reminder_start_date >= $days_till_first_reminder * 24 * 60 * 60 && time() - $validate_reminder_start_date <= ($days_till_first_reminder + 1) * 24 * 60 * 60) {
                    send_validation_reminder_mail($user, $days_till_removal, $days_till_first_reminder);
                    echo 'Send first reminder send';
                } else {
                    echo 'Waiting for validation';
                }
            }
        }
        echo ' for user: ' . $user->getGUID() . PHP_EOL . '<br>';
    }
    elgg_set_ignore_access($proviousIgnoreAccess);
    access_show_hidden_entities($proviousAccessShowHiddenEntities);
}
开发者ID:centillien,项目名称:validation_reminder,代码行数:36,代码来源:start.php

示例3: get_suggestions

/**
 *
 * Returns array of people containing entity, mutuals (friends), groups (shared) and priority
 * @param Int $guid
 * @param Int $friends_limit
 * @param Int $groups_limit
 * @return Array
 */
function get_suggestions($guid, $friends_of_friends_limit = 10, $groups_members_limit = 10)
{
    $dbprefix = elgg_get_config('dbprefix');
    $guid = sanitize_int($guid);
    $suggestions = array();
    if ($friends_of_friends_limit) {
        // get some friends of friends
        $options = array('selects' => array('COUNT(fof.guid_two) as priority'), 'type' => 'user', 'joins' => array("JOIN {$dbprefix}users_entity ue ON ue.guid = e.guid", "JOIN {$dbprefix}entity_relationships fr ON fr.guid_one = {$guid} AND fr.relationship = 'friend'", "JOIN {$dbprefix}entity_relationships fof ON fof.guid_one = fr.guid_two AND fof.relationship = 'friend'"), "wheres" => array("ue.banned = 'no'", "e.guid NOT IN (SELECT f.guid_two FROM {$dbprefix}entity_relationships f WHERE f.guid_one = {$guid} AND f.relationship = 'friend')", "fof.guid_two = e.guid", "e.guid != {$guid}"), 'group_by' => 'e.guid', 'order_by' => 'priority desc, ue.last_action desc', 'limit' => abs((int) $friends_of_friends_limit));
        $fof = elgg_get_entities($options);
        foreach ($fof as $f) {
            $priority = (int) $f->getVolatileData('select:priority');
            $suggestions[$f->guid] = array('entity' => $f, 'mutuals' => $priority, 'groups' => 0, 'priority' => $priority);
        }
    }
    if ($groups_members_limit) {
        // get some mutual group members
        $options = array('selects' => array('COUNT(mog.guid_two) as priority'), 'type' => 'user', 'joins' => array("JOIN {$dbprefix}users_entity ue ON ue.guid = e.guid", "JOIN {$dbprefix}entity_relationships g ON g.guid_one = {$guid} AND g.relationship = 'member'", "JOIN {$dbprefix}groups_entity ge ON ge.guid = g.guid_two", "JOIN {$dbprefix}entity_relationships mog ON mog.guid_two = g.guid_two AND mog.relationship = 'member'"), "wheres" => array("ue.banned = 'no'", "e.guid NOT IN (SELECT f.guid_two FROM {$dbprefix}entity_relationships f WHERE f.guid_one = {$guid} AND f.relationship = 'friend')", "mog.guid_one = e.guid", "e.guid != {$guid}"), 'group_by' => 'e.guid', 'order_by' => 'priority desc, ue.last_action desc', 'limit' => 3);
        // get members of groups
        $mog = elgg_get_entities($options);
        foreach ($mog as $m) {
            if (!isset($suggestions[$m->guid])) {
                $priority = (int) $m->getVolatileData('select:priority');
                $suggestions[$m->guid] = array('entity' => $m, 'mutuals' => 0, 'groups' => $priority, 'priority' => $priority);
            } else {
                $priority = (int) $m->getVolatileData('select:priority');
                $suggestions[$m->guid]['groups'] = $priority;
                $suggestions[$m->guid]['priority'] += $priority;
            }
        }
    }
    // sort by priority
    usort($suggestions, __NAMESPACE__ . '\\suggested_friends_sorter');
    return $suggestions;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:42,代码来源:functions.php

示例4: router

/**
 * hook called on route, all
 * check if $returnvalue['handler'] to see if we need to replace it
 * if the handler is an original handler, we want to foward it to the new url
 * 
 * @param type $hook
 * @param type $type
 * @param type $returnvalue
 * @param type $params
 * @return array
 */
function router($hook, $type, $returnvalue, $params)
{
    if (elgg_get_config('pagehandler_hijack')) {
        return $returnvalue;
    }
    $handlers = get_replacement_handlers();
    if (in_array($returnvalue['handler'], array_keys($handlers))) {
        // we have been given an old handler -> we should forward to the replacement
        // probably from an old link or something
        $currenturl = current_page_url();
        //get everything after the pagehandler
        $afterhandler = str_replace(elgg_get_site_url() . $returnvalue['handler'], "", $currenturl);
        $newurl = elgg_get_site_url() . $handlers[$returnvalue['handler']] . $afterhandler;
        // forward to the new url
        forward($newurl);
    }
    if (in_array($returnvalue['handler'], $handlers)) {
        // we need to do something about it
        // get the original handler
        $original = array_search($returnvalue['handler'], $handlers);
        if (!empty($original)) {
            // reset the context for non-hijack aware code
            elgg_set_context($original);
            // let the system load content for the original handler
            $returnvalue['handler'] = $original;
            $returnvalue['identifier'] = $original;
            // set a flag so we don't infinite loop ourselves in route hooks
            elgg_set_config('pagehandler_hijack', true);
            return elgg_trigger_plugin_hook('route', $original, null, $returnvalue);
        }
    }
}
开发者ID:n8b,项目名称:VMN,代码行数:43,代码来源:hooks.php

示例5: delete_event_handler

/**
 * Clean up operations on calendar delete
 *
 * @param string     $event  "delete"
 * @param string     $type   "object"
 * @param ElggEntity $entity Entity being deleted
 */
function delete_event_handler($event, $type, $entity)
{
    if ($entity instanceof Calendar) {
        // Do not allow users to delete publi calendars
        if ($entity->isPublicCalendar() && !elgg_is_admin_logged_in()) {
            register_error(elgg_echo('events:error:public_calendar_delete'));
            return false;
        }
        // Move all orphaned events to the public calendar
        $owner = $entity->getContainerEntity();
        $public_calendar = Calendar::getPublicCalendar($owner);
        if (!$public_calendar) {
            register_error(elgg_echo('events:error:no_public_for_orphans'));
            return false;
        }
        $dbprefix = elgg_get_config('dbprefix');
        $relationship_name = sanitize_string(Calendar::EVENT_CALENDAR_RELATIONSHIP);
        $calendar_subtype_id = (int) get_subtype_id('object', Calendar::SUBTYPE);
        // Get all events that do not appear on container's other calendars
        $events = new ElggBatch('elgg_get_entities_from_relationship', array('types' => 'object', 'subtypes' => Event::SUBTYPE, 'relationship' => Calendar::EVENT_CALENDAR_RELATIONSHIP, 'relationship_guid' => $entity->guid, 'inverse_relationship' => true, 'limit' => 0, 'wheres' => array("NOT EXISTS(SELECT * FROM {$dbprefix}entity_relationships er2\n\t\t\t\t\tJOIN {$dbprefix}entities e2 ON er2.guid_two = e2.guid\n\t\t\t\t\tWHERE er2.relationship = '{$relationship_name}'\n\t\t\t\t\t\tAND er2.guid_one = e.guid\n\t\t\t\t\t\tAND er2.guid_two != {$entity->guid}\n\t\t\t\t\t\tAND e2.container_guid = {$entity->container_guid}\n\t\t\t\t\t\tAND e2.type = 'object' AND e2.subtype = {$calendar_subtype_id})")));
        foreach ($events as $event) {
            /* @var Event $event */
            $public_calendar->addEvent($event);
        }
    }
    return true;
}
开发者ID:arckinteractive,项目名称:events_api,代码行数:34,代码来源:events.php

示例6: DeleteConsumerTool

function DeleteConsumerTool($consumer_tool)
{
    // Delete Tool from the DB
    $sql = "DELETE FROM " . elgg_get_config('dbprefix') . "lti_consumer ";
    $sql .= "WHERE consumer_guid = '" . $consumer_tool->guid . "'";
    return mysql_query($sql);
}
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:7,代码来源:delete.php

示例7: community_spam_profile_blacklist

/**
 * Filter profile fields by blacklist
 */
function community_spam_profile_blacklist()
{
    $blacklist = elgg_get_plugin_setting('profile_blacklist', 'community_spam_tools');
    $blacklist = explode(",", $blacklist);
    $blacklist = array_map('trim', $blacklist);
    foreach ($_REQUEST as $key => $value) {
        if (is_string($value)) {
            foreach ($blacklist as $word) {
                if (stripos($value, $word) !== false) {
                    ban_user(elgg_get_logged_in_user_guid(), "used '{$word}' on profile");
                    $user->automated_ban = true;
                    return false;
                }
            }
        }
    }
    // if the email address is a phrase, block
    $profile_fields = elgg_get_config('profile_fields');
    foreach ($profile_fields as $name => $type) {
        if ($type == 'email') {
            $value = get_input($name);
            if ($value && substr_count($value, ' ') > 1) {
                ban_user(elgg_get_logged_in_user_guid(), "Used multiple spaces in email field.");
                $user->automated_ban = true;
                return false;
            }
        }
    }
}
开发者ID:elgg,项目名称:community_spam_tools,代码行数:32,代码来源:start.php

示例8: addQuerySpecs

 /**
  * Add query specs for a relationship data row
  *
  * @param stdClass $row Data row
  * @return void
  */
 public function addQuerySpecs(stdClass $row)
 {
     $this->clearQuerySpecs($row->id);
     $dbprefix = elgg_get_config('dbprefix');
     // Insert a new relationship
     $sql = "\n\t\t\tINSERT INTO {$dbprefix}entity_relationships\n\t\t\t       (guid_one, relationship, guid_two, time_created)\n\t\t\tVALUES (:guid1, :relationship, :guid2, :time)\n\t\t\t\tON DUPLICATE KEY UPDATE time_created = :time\n\t\t";
     $this->query_specs[$row->id][] = $this->db->addQuerySpec(['sql' => $sql, 'params' => [':guid1' => $row->guid_one, ':guid2' => $row->guid_two, ':relationship' => $row->relationship, ':time' => $row->time_created], 'insert_id' => $row->id]);
     // Get relationship by its ID
     $sql = "\n\t\t\tSELECT * FROM {$dbprefix}entity_relationships\n\t\t\tWHERE id = :id\n\t\t";
     $this->query_specs[$row->id][] = $this->db->addQuerySpec(['sql' => $sql, 'params' => [':id' => (int) $row->id], 'results' => function () use($row) {
         if (isset($this->rows[$row->id])) {
             return [$this->rows[$row->id]];
         }
         return [];
     }]);
     // Delete relationship by its ID
     $sql = "\n\t\t\tDELETE FROM {$dbprefix}entity_relationships\n\t\t\tWHERE id = :id\n\t\t";
     $this->query_specs[$row->id][] = $this->db->addQuerySpec(['sql' => $sql, 'params' => [':id' => (int) $row->id], 'results' => function () use($row) {
         if (isset($this->rows[$row->id])) {
             $this->clearQuerySpecs($row->id);
             unset($this->rows[$row->id]);
             return [$row->id];
         }
         return [];
     }, 'times' => 1]);
     // Check relationship between two GUIDs
     $sql = "\n\t\t\tSELECT * FROM {$dbprefix}entity_relationships\n\t\t\tWHERE guid_one = :guid1\n\t\t\t  AND relationship = :relationship\n\t\t\t  AND guid_two = :guid2\n\t\t\tLIMIT 1\n\t\t";
     $this->query_specs[$row->id][] = $this->db->addQuerySpec(['sql' => $sql, 'params' => [':guid1' => (int) $row->guid_one, ':guid2' => (int) $row->guid_two, ':relationship' => $row->relationship], 'results' => function () use($row) {
         if (isset($this->rows[$row->id])) {
             return [$this->rows[$row->id]];
         }
         return [];
     }]);
 }
开发者ID:elgg,项目名称:elgg,代码行数:40,代码来源:RelationshipsTable.php

示例9: weekly_cron

/**
 * @TODO - is there a way we can target them directly instead of iterating through all?
 * 
 * @param type $h
 * @param type $t
 * @param type $r
 * @param type $p
 * @return type
 */
function weekly_cron($h, $t, $r, $p)
{
    $ia = elgg_set_ignore_access(true);
    // check for abandoned acls
    $dbprefix = elgg_get_config('dbprefix');
    // try to make this as light as possible
    $options = array('type' => 'object', 'subtype' => 'granular_access', 'limit' => false);
    $batch = new ElggBatch('elgg_get_entities', $options);
    foreach ($batch as $b) {
        $sql = "SELECT COUNT(guid) as total FROM {$dbprefix}entities WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        $sql = "SELECT COUNT(id) as total FROM {$dbprefix}metadata WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        $sql = "SELECT COUNT(id) as total FROM {$dbprefix}annotations WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        // this appears to be orphaned
        delete_access_collection($b->acl_id);
        $b->delete();
    }
    elgg_set_ignore_access($ia);
    return $r;
}
开发者ID:beck24,项目名称:granular_access,代码行数:40,代码来源:hooks.php

示例10: expages_page_handler

/**
 * External pages page handler
 *
 * @param array  $page    URL segements
 * @param string $handler Handler identifier
 * @return bool
 */
function expages_page_handler($page, $handler)
{
    if ($handler == 'expages') {
        expages_url_forwarder($page[1]);
    }
    $type = strtolower($handler);
    $title = elgg_echo("expages:{$type}");
    $header = elgg_view_title($title);
    $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1));
    if ($object) {
        $content .= elgg_view('output/longtext', array('value' => $object[0]->description));
    } else {
        $content .= elgg_echo("expages:notset");
    }
    $content = elgg_view('expages/wrapper', array('content' => $content));
    if (elgg_is_admin_logged_in()) {
        elgg_register_menu_item('title', array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/appearance/expages?type={$type}", 'link_class' => 'elgg-button elgg-button-action'));
    }
    if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
        $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
        echo elgg_view_page($title, $body);
    } else {
        elgg_load_css('elgg.walled_garden');
        $body = elgg_view_layout('walled_garden', array('content' => $header . $content));
        echo elgg_view_page($title, $body, 'walled_garden');
    }
    return true;
}
开发者ID:thehereward,项目名称:Elgg,代码行数:35,代码来源:start.php

示例11: search_by_proximity_hook

function search_by_proximity_hook($hook, $type, $return, $params)
{
    $query = $params['query'];
    $coords = elgg_geocode_location($query);
    if (!$coords) {
        return $return;
    }
    $registered_entities = elgg_get_config('registered_entities');
    $options = array('types' => array('object', 'user', 'group'), 'subtypes' => array_merge($registered_entities['object'], $registered_entities['user'], $registered_entities['group']), 'limit' => get_input('limit', 20), 'offset' => get_input('proximity_offset', 0), 'offset_key' => 'proximity_offset', 'count' => true);
    $options = add_order_by_proximity_clauses($options, $coords['lat'], $coords['long']);
    $options = add_distance_constraint_clauses($options, $coords['lat'], $coords['long'], SEARCH_RADIUS);
    $count = elgg_get_entities($options);
    if ($count) {
        $options['count'] = false;
        $entities = elgg_get_entities($options);
    }
    if ($entities) {
        foreach ($entities as $entity) {
            $name = search_get_highlighted_relevant_substrings(isset($entity->name) ? $entity->name : $entity->title, $query);
            $entity->setVolatileData('search_matched_title', $name);
            $location = search_get_highlighted_relevant_substrings($entity->getLocation(), $query);
            $entity->setVolatileData('search_matched_location', $location);
            $distance = get_distance($entity->getLatitude(), $entity->getLongitude(), $coords['lat'], $coords['long']);
            // distance in metres
            $distance = round($distance / 1000, 2);
            // distance in km
            $distance_str = elgg_echo('geo:search:proximity', array($query, $distance));
            $entity->setVolatileData('search_proximity', $distance_str);
        }
    }
    return array('entities' => $entities, 'count' => $count);
}
开发者ID:hypejunction,项目名称:hypegeo,代码行数:32,代码来源:hooks.php

示例12: hj_forum_filter_forum_list

/**
 * Custom clauses for forum keyword search
 */
function hj_forum_filter_forum_list($hook, $type, $options, $params)
{
    if (!is_array($options['subtypes'])) {
        if (isset($options['subtype'])) {
            $options['subtypes'] = array($options['subtype']);
            unset($options['subtype']);
        } elseif (isset($options['subtypes'])) {
            $options['subtypes'] = array($options['subtypes']);
        } else {
            return $options;
        }
    }
    if (!in_array('hjforum', $options['subtypes']) && !in_array('hjforumtopic', $options['subtypes'])) {
        return $options;
    }
    $query = get_input("__q", false);
    if (!$query || empty($query)) {
        return $options;
    }
    $query = sanitise_string(urldecode($query));
    $dbprefix = elgg_get_config('dbprefix');
    $options['joins'][] = "JOIN {$dbprefix}objects_entity oe_q ON e.guid = oe_q.guid";
    $options['wheres'][] = "MATCH(oe_q.title, oe_q.description) AGAINST ('{$query}')";
    return $options;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:28,代码来源:hooks.php

示例13: getCachedData

 /**
  * Checks if cached menu html is available and returns the html if it is available
  *
  * @return boolean|string
  */
 public function getCachedData()
 {
     if (!elgg_get_config('system_cache_enabled')) {
         return false;
     }
     return elgg_load_system_cache($this->getCacheName()) ?: false;
 }
开发者ID:coldtrick,项目名称:menu_builder,代码行数:12,代码来源:Menu.php

示例14: bulk_user_admin_get_users

/**
 * Get users with a few more options
 *
 * domain => Match the last part of the email address
 * only_banned => Only return banned users
 * enqueued => include|exclude|only users enqueued to be deleted (default = exclude, other values = doesn't matter)
 *
 * @param array $sent Options
 */
function bulk_user_admin_get_users(array $sent)
{
    $db_prefix = elgg_get_config('dbprefix');
    $defaults = ['type' => 'user', 'domain' => false, 'only_banned' => false, 'enqueued' => 'exclude'];
    $options = array_merge($defaults, $sent);
    if (!is_array($options['wheres'])) {
        $options['wheres'] = [];
    }
    if (!is_array($options['joins'])) {
        $options['joins'] = [];
    }
    // sometimes ue is joined, sometimes it's not...
    // use our own join to make sure.
    $options['joins'][] = "JOIN {$db_prefix}users_entity bua_ue on e.guid = bua_ue.guid";
    if ($options['domain']) {
        $options['wheres'][] = "bua_ue.email LIKE '%@%{$options['domain']}'";
    }
    if ($options['only_banned']) {
        $options['wheres'][] = "bua_ue.banned = 'yes'";
    }
    switch ($options['enqueued']) {
        case 'include':
            // no-op
            break;
        case 'only':
            $options['metadata_name'] = \BulkUserAdmin\DeleteService::PENDING_DELETE_MD;
            break;
        case 'exclude':
        default:
            $options['wheres'][] = bulk_user_admin_get_sql_where_not_enqueued();
            break;
    }
    return elgg_get_entities_from_metadata($options);
}
开发者ID:juho-jaakkola,项目名称:Bulk-User-Admin,代码行数:43,代码来源:start.php

示例15: testCanGetEntitiesByAnnotationCreationTime

 public function testCanGetEntitiesByAnnotationCreationTime()
 {
     $prefix = elgg_get_config('dbprefix');
     $users = elgg_get_entities(array('type' => 'user', 'limit' => 1));
     // create some test annotations
     $subtypes = $this->getRandomValidSubtypes(array('object'), 1);
     $subtype = $subtypes[0];
     $annotation_name = 'test_annotation_name_' . rand();
     // our targets
     $valid1 = new \ElggObject();
     $valid1->subtype = $subtype;
     $valid1->save();
     $id1 = $valid1->annotate($annotation_name, 1, ACCESS_PUBLIC, $users[0]->guid);
     // this one earlier
     $yesterday = time() - 86400;
     update_data("\n\t\t\tUPDATE {$prefix}annotations\n\t\t\tSET time_created = {$yesterday}\n\t\t\tWHERE id = {$id1}\n\t\t");
     $valid2 = new \ElggObject();
     $valid2->subtype = $subtype;
     $valid2->save();
     $valid2->annotate($annotation_name, 1, ACCESS_PUBLIC, $users[0]->guid);
     $options = array('annotation_owner_guid' => $users[0]->guid, 'annotation_created_time_lower' => time() - 3600, 'annotation_name' => $annotation_name);
     $entities = elgg_get_entities_from_annotations($options);
     $this->assertEqual(1, count($entities));
     $this->assertEqual($valid2->guid, $entities[0]->guid);
     $options = array('annotation_owner_guid' => $users[0]->guid, 'annotation_created_time_upper' => time() - 3600, 'annotation_name' => $annotation_name);
     $entities = elgg_get_entities_from_annotations($options);
     $this->assertEqual(1, count($entities));
     $this->assertEqual($valid1->guid, $entities[0]->guid);
     $valid1->delete();
     $valid2->delete();
 }
开发者ID:elgg,项目名称:elgg,代码行数:31,代码来源:ElggCoreGetEntitiesFromAnnotationsTest.php


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