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

PHP get_metastring_id函数代码示例

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

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



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

示例1: filterObject

 public function filterObject($object)
 {
     global $CONFIG;
     $dbprefix = $CONFIG->dbprefix;
     $subtype = get_subtype_from_id($object->subtype);
     // do not index specific types of content
     if (in_array($subtype, array('messages', 'plugin', 'widget', 'custom_profile_field', 'custom_profile_field_category', 'reported_content', 'custom_group_field', 'custom_profile_type', 'gruop_widget', 'multi_dashboard'))) {
         return false;
     }
     $return = array();
     foreach (self::$entity_fields as $field) {
         $return[$field] = $object->{$field};
     }
     $return['title'] = $object->title;
     $return['description'] = elgg_strip_tags($object->description);
     // remove HTML
     $metastring_id = get_metastring_id('tags');
     if (!$metastring_id) {
         throw new Exception("No metastring id for tags found");
     }
     $metadata = get_data("SELECT md.access_id, v.string AS value FROM {$dbprefix}metadata md JOIN {$dbprefix}metastrings v ON md.value_id = v.id WHERE md.entity_guid = {$object->guid} AND md.name_id = {$metastring_id} AND md.enabled = 'yes'");
     if (count($metadata) > 0) {
         $return['tags'] = array();
         foreach ($metadata as $item) {
             if ($item->value) {
                 $return['tags'][] = $item->value;
             }
         }
     }
     return $return;
 }
开发者ID:rubenve,项目名称:elasticsearch,代码行数:31,代码来源:ESFilter.php


示例2: birthdays_get_upcoming_user_guids

function birthdays_get_upcoming_user_guids()
{
    $site = elgg_get_site_entity();
    $today = (int) date("z");
    $field = birthdays_get_configured_birthday_field();
    if (!$field) {
        return false;
    }
    if (date("w") == 1) {
        // Mondays
        $today -= 2;
    } elseif (date("w") == 2) {
        // Tuesdays
        $today -= 1;
    }
    $dbprefix = elgg_get_config('dbprefix');
    $field_id = (int) get_metastring_id($field);
    $sql = "SELECT\n\t\te.guid,\n\t\tDAYOFYEAR(DATE(msv.string)) AS birthday\n\t\tFROM {$dbprefix}entities e\n\t\tJOIN {$dbprefix}entity_relationships r ON r.guid_one = e.guid\n\t\tJOIN {$dbprefix}metadata m ON e.guid = m.entity_guid\n\t\tJOIN {$dbprefix}metastrings msv ON m.value_id = msv.id\n\t\tWHERE\n\t\te.type = 'user' AND\n\t\tr.relationship = 'member_of_site' AND\n\t\tr.guid_two = {$site->guid} AND\n\t\tm.name_id = {$field_id}\n\t\tHAVING birthday >= {$today}\n\t\tORDER BY birthday\n\t\tLIMIT 25";
    $users = get_data($sql);
    $return = array();
    foreach ($users as $user) {
        $return[] = $user->guid;
    }
    return $return;
}
开发者ID:Pleio,项目名称:birthdays,代码行数:25,代码来源:functions.php


示例3: get_tags

/**
 * Get an array of tags with weights for use with the output/tagcloud view.
 *
 * @param int $threshold Get the threshold of minimum number of each tags to bother with (ie only show tags where there are more than $threshold occurances)
 * @param int $limit Number of tags to return
 * @param string $metadata_name Optionally, the name of the field you want to grab for
 * @param string $entity_type Optionally, the entity type ('object' etc)
 * @param string $entity_subtype The entity subtype, optionally
 * @param int $owner_guid The GUID of the tags owner, optionally
 * @param int $site_guid Optionally, the site to restrict to (default is the current site)
 * @return array|false Array of objects with ->tag and ->total values, or false on failure
 */
function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", $entity_subtype = "", $owner_guid = "", $site_guid = -1)
{
    global $CONFIG;
    $threshold = (int) $threshold;
    $limit = (int) $limit;
    if (!empty($metadata_name)) {
        $metadata_name = (int) get_metastring_id($metadata_name);
    } else {
        $metadata_name = 0;
    }
    $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
    $entity_type = sanitise_string($entity_type);
    if ($owner_guid != "") {
        if (is_array($owner_guid)) {
            foreach ($owner_guid as $key => $val) {
                $owner_guid[$key] = (int) $val;
            }
        } else {
            $owner_guid = (int) $owner_guid;
        }
    }
    if ($site_guid < 0) {
        $site_guid = $CONFIG->site_id;
    }
    //$access = get_access_list();
    $query = "SELECT msvalue.string as tag, count(msvalue.id) as total ";
    $query .= "FROM {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}metadata md on md.entity_guid = e.guid ";
    $query .= " join {$CONFIG->dbprefix}entity_subtypes subtype on subtype.id = e.subtype ";
    $query .= " join {$CONFIG->dbprefix}metastrings msvalue on msvalue.id = md.value_id ";
    $query .= " where msvalue.string != '' ";
    if ($metadata_name > 0) {
        $query .= " and md.name_id = {$metadata_name} ";
    }
    if ($site_guid > 0) {
        $query .= " and e.site_guid = {$site_guid} ";
    }
    if ($entity_subtype > 0) {
        $query .= " and e.subtype = {$entity_subtype} ";
    }
    if ($entity_type != "") {
        $query .= " and e.type = '{$entity_type}' ";
    }
    if (is_array($owner_guid)) {
        $query .= " and e.container_guid in (" . implode(",", $owner_guid) . ")";
    } else {
        if (is_int($owner_guid)) {
            $query .= " and e.container_guid = {$owner_guid} ";
        }
    }
    //$userid = get_loggedin_userid();
    //$query .= " and (e.access_id in {$access} or (e.access_id = " . ACCESS_PRIVATE . " and e.owner_guid = {$userid}))";
    $query .= ' and ' . get_access_sql_suffix("e");
    // Add access controls
    $query .= " group by msvalue.string having total > {$threshold} order by total desc limit {$limit} ";
    return get_data($query);
}
开发者ID:eokyere,项目名称:elgg,代码行数:68,代码来源:tags.php


示例4: uservalidationbyemail_get_unvalidated_users_sql_where

/**
 * Return a where clause to get entities
 *
 * "Unvalidated" means metadata of validated is not set or not truthy.
 * We can't use elgg_get_entities_from_metadata() because you can't say
 * "where the entity has metadata set OR it's not equal to 1".
 *
 * @return array
 */
function uservalidationbyemail_get_unvalidated_users_sql_where()
{
    global $CONFIG;
    $validated_id = get_metastring_id('validated');
    $one_id = get_metastring_id(1);
    // thanks to daveb@freenode for the SQL tips!
    $wheres = array();
    $wheres[] = "e.enabled='no'";
    $wheres[] = "NOT EXISTS (\n\t\t\tSELECT 1 FROM {$CONFIG->dbprefix}metadata md\n\t\t\tWHERE md.entity_guid = e.guid\n\t\t\t\tAND md.name_id = {$validated_id}\n\t\t\t\tAND md.value_id = {$one_id})";
    return $wheres;
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:20,代码来源:functions.php


示例5: testGetMetastringById

 public function testGetMetastringById()
 {
     foreach (array('metaUnitTest', 'metaunittest', 'METAUNITTEST') as $string) {
         $this->create_metastring($string);
     }
     // lookup metastring id
     $cs_ids = get_metastring_id('metaUnitTest', TRUE);
     $this->assertEqual($cs_ids, $this->metastrings['metaUnitTest']);
     // lookup all metastrings, ignoring case
     $cs_ids = get_metastring_id('metaUnitTest', FALSE);
     $this->assertEqual(count($cs_ids), 3);
     $this->assertEqual(count($cs_ids), count($this->metastrings));
     foreach ($cs_ids as $string) {
         $this->assertTrue(in_array($string, $this->metastrings));
     }
 }
开发者ID:rcolomoc,项目名称:Master-Red-Social,代码行数:16,代码来源:metadata.php


示例6: filterObject

 public function filterObject($object)
 {
     global $CONFIG;
     $dbprefix = $CONFIG->dbprefix;
     $subtype = get_subtype_from_id($object->subtype);
     // do not index specific types of content
     if (in_array($subtype, array('messages', 'plugin', 'widget', 'custom_profile_field', 'custom_profile_field_category', 'reported_content', 'custom_group_field', 'custom_profile_type', 'gruop_widget', 'multi_dashboard'))) {
         return false;
     }
     $return = array();
     foreach (self::$entity_fields as $field) {
         $return[$field] = $object->{$field};
     }
     $return['title'] = html_entity_decode($object->title);
     $return['description'] = html_entity_decode(elgg_strip_tags($object->description));
     // remove HTML
     $metastring_id = get_metastring_id('tags');
     if (!$metastring_id) {
         throw new Exception("No metastring id for tags found");
     }
     $metadata = get_data("SELECT md.access_id, v.string AS value FROM {$dbprefix}metadata md JOIN {$dbprefix}metastrings v ON md.value_id = v.id WHERE md.entity_guid = {$object->guid} AND md.name_id = {$metastring_id} AND md.enabled = 'yes'");
     if (count($metadata) > 0) {
         $return['tags'] = array();
         foreach ($metadata as $item) {
             if ($item->value) {
                 $return['tags'][] = $item->value;
             }
         }
     }
     if (in_array($subtype, array('question', 'cafe', 'news', 'blog'))) {
         if ($subtype == "question") {
             $comment_subtype = "answer";
         } else {
             $comment_subtype = "comment";
         }
         $options = array("type" => "object", "subtype" => $comment_subtype, "container_guid" => $object->guid, "site_guids" => null, "limit" => false);
         $return['comments'] = array();
         foreach (elgg_get_entities($options) as $comment) {
             $return['comments'][] = html_entity_decode(elgg_strip_tags($comment->description));
         }
     }
     return $return;
 }
开发者ID:pleio,项目名称:elasticsearch,代码行数:43,代码来源:ESFilter.php


示例7: testGetMetastringById

 public function testGetMetastringById()
 {
     foreach (array('metaUnitTest', 'metaunittest', 'METAUNITTEST') as $string) {
         // since there is no guarantee that metastrings are garbage collected
         // between unit test runs, we delete before testing
         $this->delete_metastrings($string);
         $this->create_metastring($string);
     }
     // lookup metastring id
     $cs_ids = get_metastring_id('metaUnitTest', TRUE);
     $this->assertEqual($cs_ids, $this->metastrings['metaUnitTest']);
     // lookup all metastrings, ignoring case
     $cs_ids = get_metastring_id('metaUnitTest', FALSE);
     $this->assertEqual(count($cs_ids), 3);
     $this->assertEqual(count($cs_ids), count($this->metastrings));
     foreach ($cs_ids as $string) {
         $this->assertTrue(in_array($string, $this->metastrings));
     }
 }
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:19,代码来源:metadata.php


示例8: deyan_get_unread_messages

/**
 * Gets the unread messages
 *
 * @return array
 */
function deyan_get_unread_messages() {
	$user_guid = elgg_get_logged_in_user_guid();
	$db_prefix = elgg_get_config('dbprefix');

	// denormalize the md to speed things up.
	// seriously, 10 joins if you don't.
	$strings = array('toId', $user_guid, 'readYet', 0, 'msg', 1);
	$map = array();
	foreach ($strings as $string) {
		$id = get_metastring_id($string);
		$map[$string] = $id;
	}

	$options = array(
//		'metadata_name_value_pairs' => array(
//			'toId' => elgg_get_logged_in_user_guid(),
//			'readYet' => 0,
//			'msg' => 1
//		),
		'joins' => array(
			"JOIN {$db_prefix}metadata msg_toId on e.guid = msg_toId.entity_guid",
			"JOIN {$db_prefix}metadata msg_readYet on e.guid = msg_readYet.entity_guid",
			"JOIN {$db_prefix}metadata msg_msg on e.guid = msg_msg.entity_guid",
		),
		'wheres' => array(
			"msg_toId.name_id='{$map['toId']}' AND msg_toId.value_id='{$map[$user_guid]}'",
			"msg_readYet.name_id='{$map['readYet']}' AND msg_readYet.value_id='{$map[0]}'",
			"msg_msg.name_id='{$map['msg']}' AND msg_msg.value_id='{$map[1]}'",
		),
		'owner_guid' => $user_guid,
		'full_view' => false,
		'limit' => 0
	);

	$messages = elgg_list_entities_from_metadata($options);

	return $messages;
}
开发者ID:redvabel,项目名称:Deyan-Shell,代码行数:43,代码来源:deyan.php


示例9: get_input

<?php

/**
 * Action for combining two plugin projects
 */
global $CONFIG;
$old_guid = (int) get_input('old_guid');
$new_guid = (int) get_input('new_guid');
$old_project = get_entity($old_guid);
$new_project = get_entity($new_guid);
if (!$old_project instanceof PluginProject || !$new_project instanceof PluginProject) {
    register_error('The GUIDs must be for 2 plugin projects');
    forward(REFERER);
}
$old_name = $old_project->title;
// move releases for the old project to the new project
$params = array('types' => 'object', 'subtypes' => 'plugin_release', 'container_guids' => $old_project->guid, 'limit' => 0);
$releases = elgg_get_entities($params);
foreach ($releases as $release) {
    $release->container_guid = $new_project->guid;
    $release->save();
}
// move download count to new project
$annotation_name = get_metastring_id('download', TRUE);
if ($annotation_name) {
    $query = "UPDATE {$CONFIG->dbprefix}annotations\n\t\tSET entity_guid={$new_project->guid}\n\t\tWHERE entity_guid={$old_project->guid} AND name_id={$annotation_name}";
    update_data($query);
}
$old_project->delete();
system_message("{$old_name} has been combined into the project {$new_project->title}");
forward(REFERER);
开发者ID:nohup,项目名称:community_plugins,代码行数:31,代码来源:combine.php


示例10: elgg_is_admin_user

/**
 * Check if the given user has full access.
 *
 * @todo: Will always return full access if the user is an admin.
 *
 * @param int $user_guid The user to check
 *
 * @return bool
 * @since 1.7.1
 */
function elgg_is_admin_user($user_guid)
{
    global $CONFIG;
    // cannot use magic metadata here because of recursion
    // must support the old way of getting admin from metadata
    // in order to run the upgrade to move it into the users table.
    $version = (int) datalist_get('version');
    if ($version < 2010040201) {
        $admin = get_metastring_id('admin');
        $yes = get_metastring_id('yes');
        $one = get_metastring_id('1');
        $query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as e,\n\t\t\t{$CONFIG->dbprefix}metadata as md\n\t\t\tWHERE (\n\t\t\t\tmd.name_id = '{$admin}'\n\t\t\t\tAND md.value_id IN ('{$yes}', '{$one}')\n\t\t\t\tAND e.guid = md.entity_guid\n\t\t\t\tAND e.guid = {$user_guid}\n\t\t\t\tAND e.banned = 'no'\n\t\t\t)";
    } else {
        $query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as e\n\t\t\tWHERE (\n\t\t\t\te.guid = {$user_guid}\n\t\t\t\tAND e.admin = 'yes'\n\t\t\t)";
    }
    // normalizing the results from get_data()
    // See #1242
    $info = get_data($query);
    if (!(is_array($info) && count($info) < 1 || $info === FALSE)) {
        return TRUE;
    }
    return FALSE;
}
开发者ID:rasul,项目名称:Elgg,代码行数:33,代码来源:sessions.php


示例11: get_entities_by_views_counter

/**
 * Return an array of entities ordered by the number of views
 * 
 * @param $options
 */
function get_entities_by_views_counter($options)
{
    global $CONFIG;
    // Select the sum of the views counter returned by the JOIN
    $select = 'sum(ms.string) as views_counter';
    if (is_array($options['selects'])) {
        $options['selects'][] = $select;
    } else {
        if ($options['selects']) {
            $options['selects'] = array($options['selects'], $select);
        } else {
            $options['selects'] = array($select);
        }
    }
    // Get the annotations "views_counter" for each entity
    $metastring_id = get_metastring_id('views_counter');
    $join = ' LEFT JOIN ' . $CONFIG->dbprefix . 'annotations a ON ((a.entity_guid=e.guid)AND(a.name_id=' . $metastring_id . '))';
    if (is_array($options['joins'])) {
        $options['joins'][] = $join;
    } else {
        if ($options['joins']) {
            $options['joins'] = array($options['joins'], $join);
        } else {
            $options['joins'] = array($join);
        }
    }
    // JOIN the value of the annotations. The value of each views counter...
    $options['joins'][] = ' LEFT JOIN ' . $CONFIG->dbprefix . 'metastrings ms ON ((a.entity_guid=e.guid)AND(a.name_id=' . $metastring_id . ')AND(a.value_id=ms.id))';
    // Check if the user does not want to list by best average any value different of: 'desc'
    if ($options['order_by'] != 'asc') {
        $options['order_by'] = ' views_counter desc, e.time_created desc';
    } else {
        $options['order_by'] = ' views_counter asc, e.time_created desc';
    }
    // Group the result of JOIN annotations by entity because each entity may have infinite annotations "generic_rate"
    $options['group_by'] .= ' e.guid ';
    // Let the elgg_get_entities() function make do work for us :)
    $entities = elgg_get_entities($options);
    return $entities;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:45,代码来源:views_counter.php


示例12: messages_count_unread

/**
 * Count the unread messages in a user's inbox
 *
 * @return int
 */
function messages_count_unread()
{
    $user_guid = elgg_get_logged_in_user_guid();
    $db_prefix = elgg_get_config('dbprefix');
    // denormalize the md to speed things up.
    // seriously, 10 joins if you don't.
    $strings = array('toId', $user_guid, 'readYet', 0, 'msg', 1);
    $map = array();
    foreach ($strings as $string) {
        $id = get_metastring_id($string);
        $map[$string] = $id;
    }
    $options = array('joins' => array("JOIN {$db_prefix}metadata msg_toId on e.guid = msg_toId.entity_guid", "JOIN {$db_prefix}metadata msg_readYet on e.guid = msg_readYet.entity_guid", "JOIN {$db_prefix}metadata msg_msg on e.guid = msg_msg.entity_guid"), 'wheres' => array("msg_toId.name_id='{$map['toId']}' AND msg_toId.value_id='{$map[$user_guid]}'", "msg_readYet.name_id='{$map['readYet']}' AND msg_readYet.value_id='{$map[0]}'", "msg_msg.name_id='{$map['msg']}' AND msg_msg.value_id='{$map[1]}'"), 'owner_guid' => $user_guid, 'count' => true);
    return elgg_get_entities_from_metadata($options);
}
开发者ID:nogsus,项目名称:Elgg,代码行数:20,代码来源:start.php


示例13: add_metastring

/**
 * Add a metastring.
 * It returns the id of the tag, whether by creating it or updating it.
 *
 * @param string $string         The value (whatever that is) to be stored
 * @param bool   $case_sensitive Do we want to make the query case sensitive?
 *
 * @return mixed Integer tag or false.
 */
function add_metastring($string, $case_sensitive = true)
{
    global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
    $sanstring = sanitise_string($string);
    $id = get_metastring_id($string, $case_sensitive);
    if ($id) {
        return $id;
    }
    $result = insert_data("INSERT into {$CONFIG->dbprefix}metastrings (string) values ('{$sanstring}')");
    if ($result) {
        $METASTRINGS_CACHE[$result] = $string;
        if (isset($METASTRINGS_DEADNAME_CACHE[$string])) {
            unset($METASTRINGS_DEADNAME_CACHE[$string]);
        }
    }
    return $result;
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:26,代码来源:metastrings.php


示例14: get_entities_from_relationships_and_meta

/**
 * Gets the number of entities by a the number of entities related to them in a particular way also constrained by
 * metadata
 *
 * @param string $relationship The relationship eg "friends_of"
 * @param int $relationship_guid The guid of the entity to use query
 * @param bool $inverse_relationship Reverse the normal function of the query to instead say "give me all entities for whome $relationship_guid is a $relationship of" (default: true)
 * @param String $meta_name The metadata name
 * @param String $meta_value The metadata value
 * @param string $type The type of entity (default: all)
 * @param string $subtype The entity subtype (default: all)
 * @param int $owner_guid The owner of the entities (default: none)
 * @param int $limit
 * @param int $offset
 * @param boolean $count Set to true if you want to count the number of entities instead (default false)
 * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
 * @return array|int|false An array of entities, or the number of entities, or false on failure
 */
function get_entities_from_relationships_and_meta($relationship, $relationship_guid, $inverse_relationship = false, $meta_name = "", $meta_value = "", $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_guid = 0)
{
    global $CONFIG;
    $relationship = sanitise_string($relationship);
    $inverse_relationship = (bool) $inverse_relationship;
    $relationship_guid = (int) $relationship_guid;
    $type = sanitise_string($type);
    if ($subtype and !($subtype = get_subtype_id($type, $subtype))) {
        return false;
    }
    $owner_guid = (int) $owner_guid;
    $order_by = sanitise_string($order_by);
    $limit = (int) $limit;
    $offset = (int) $offset;
    $site_guid = (int) $site_guid;
    if ($site_guid == 0) {
        $site_guid = $CONFIG->site_guid;
    }
    $meta_n = get_metastring_id($meta_name);
    $meta_v = get_metastring_id($meta_value);
    //$access = get_access_list();
    $where = array();
    if ($relationship != "") {
        $where[] = "r.relationship='{$relationship}'";
    }
    $on = "e.guid = r.guid_one";
    if (!$inverse_relationship) {
        $on = "e.guid = r.guid_two";
    }
    if ($type != "") {
        $where[] = "e.type='{$type}'";
    }
    if ($subtype) {
        $where[] = "e.subtype={$subtype}";
    }
    if ($owner_guid != "") {
        $where[] = "e.container_guid='{$owner_guid}'";
    }
    if ($site_guid > 0) {
        $where[] = "e.site_guid = {$site_guid}";
    }
    if ($relationship_guid) {
        $where[] = $inverse_relationship ? "r.guid_two='{$relationship_guid}'" : "r.guid_one='{$relationship_guid}'";
    }
    $metajoin = "";
    if ($meta_name !== "" || $meta_value !== "") {
        $metajoin = " JOIN {$CONFIG->dbprefix}metadata m on e.guid=m.entity_guid";
        if ($meta_name !== "") {
            $where[] = "m.name_id='{$meta_n}'";
        }
        if ($meta_value !== "") {
            $where[] = "m.value_id='{$meta_v}'";
        }
    }
    if ($count) {
        $query = "SELECT count(distinct e.guid) as total ";
    } else {
        $query = "SELECT distinct e.*, count(e.guid) as total ";
    }
    $query .= " from {$CONFIG->dbprefix}entity_relationships r JOIN {$CONFIG->dbprefix}entities e on {$on} {$metajoin} where ";
    if (!empty($where)) {
        foreach ($where as $w) {
            $query .= " {$w} and ";
        }
    }
    $query .= get_access_sql_suffix("e");
    // Add access controls
    if ($meta_name !== "" || $meta_value !== "") {
        $query .= ' and ' . get_access_sql_suffix("m");
    }
    // Add access controls
    if (!$count) {
        $query .= " group by e.guid ";
        $query .= " order by total desc limit {$offset}, {$limit}";
        // Add order and limit
        return get_data($query, "entity_row_to_elggstar");
    } else {
        if ($count = get_data_row($query)) {
            return $count->total;
        }
    }
    return false;
//.........这里部分代码省略.........
开发者ID:jricher,项目名称:Elgg,代码行数:101,代码来源:relationships.php


示例15: elgg_get_site_url

" value="<?php 
    echo $faq->guid;
    ?>
" /></div></td>
			<?php 
}
?>
			<td width="100%">
				<?php 
if (!empty($hitcount)) {
    ?>
					<a href="<?php 
    elgg_get_site_url();
    ?>
faq/list?categoryId=<?php 
    echo get_metastring_id($faq->category);
    ?>
"><?php 
    echo $faq->category;
    ?>
</a>&nbsp;>
				<?php 
}
?>
				<a href="javascript:void(0);" id="qID<?php 
echo $faq->guid;
?>
" onClick="$('#aID<?php 
echo $faq->guid;
?>
').toggle();"><?php 
开发者ID:HundredHandsAlliance,项目名称:Elgg_1.8_faq,代码行数:31,代码来源:faq.php


示例16: get_entities_from_metadata_by_value

 function get_entities_from_metadata_by_value($meta_array, $entity_type = "", $entity_subtype = "", $count = false, $owner_guid = 0, $container_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0)
 {
     global $CONFIG;
     // ORDER BY
     if ($order_by == "") {
         $order_by = "e.time_created desc";
     }
     $order_by = sanitise_string($order_by);
     $where = array();
     // Filetr by metadata
     $mindex = 1;
     // Starting index of joined metadata/metastring tables
     $join_meta = "";
     $query_access = "";
     foreach ($meta_array as $meta) {
         $join_meta .= "JOIN {$CONFIG->dbprefix}metadata m{$mindex} on e.guid = m{$mindex}.entity_guid ";
         $join_meta .= "JOIN {$CONFIG->dbprefix}metastrings v{$mindex} on v{$mindex}.id = m{$mindex}.value_id ";
         $meta_n = get_metastring_id($meta['name']);
         $where[] = "m{$mindex}.name_id='{$meta_n}'";
         if (strtolower($meta['operand']) == "like") {
             // "LIKE" search
             $where[] = "v{$mindex}.string LIKE ('" . $meta['value'] . "') ";
         } elseif (strtolower($meta['operand']) == "in") {
             // TO DO - "IN" search
         } elseif ($meta['operand'] != '') {
             // Simple operand search
             $where[] = "v{$mindex}.string" . $meta['operand'] . "'" . $meta['value'] . "'";
         }
         $query_access .= ' and ' . get_access_sql_suffix("m{$mindex}");
         // Add access controls
         $mindex++;
     }
     $limit = (int) $limit;
     $offset = (int) $offset;
     if (is_array($owner_guid) && count($owner_guid)) {
         foreach ($owner_guid as $key => $guid) {
             $owner_guid[$key] = (int) $guid;
         }
     } else {
         $owner_guid = (int) $owner_guid;
     }
     if (is_array($container_guid) && count($container_guid)) {
         foreach ($container_guid as $key => $guid) {
             $container_guid[$key] = (int) $guid;
         }
     } else {
         $container_guid = (int) $container_guid;
     }
     $site_guid = (int) $site_guid;
     if ($site_guid == 0) {
         $site_guid = $CONFIG->site_guid;
     }
     $entity_type = sanitise_string($entity_type);
     if ($entity_type != "") {
         $where[] = "e.type='{$entity_type}'";
     }
     $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
     if ($entity_subtype) {
         $where[] = "e.subtype={$entity_subtype}";
     }
     if ($site_guid > 0) {
         $where[] = "e.site_guid = {$site_guid}";
     }
     if (is_array($owner_guid)) {
         $where[] = "e.owner_guid in (" . implode(",", $owner_guid) . ")";
     } else {
         if ($owner_guid > 0) {
             $where[] = "e.owner_guid = {$owner_guid}";
         }
     }
     if (is_array($container_guid)) {
         $where[] = "e.container_guid in (" . implode(",", $container_guid) . ")";
     } else {
         if ($container_guid > 0) {
             $where[] = "e.container_guid = {$container_guid}";
         }
     }
     if (!$count) {
         $query = "SELECT distinct e.* ";
     } else {
         $query = "SELECT count(distinct e.guid) as total ";
     }
     $query .= "FROM {$CONFIG->dbprefix}entities e ";
     $query .= $join_meta;
     $query .= "  WHERE ";
     foreach ($where as $w) {
         $query .= " {$w} and ";
     }
     $query .= get_access_sql_suffix("e");
     // Add access controls
     $query .= $query_access;
     if (!$count) {
         $query .= " order by {$order_by} limit {$offset}, {$limit}";
         // Add order and limit
         return get_data($query, "entity_row_to_elggstar");
     } else {
         $row = get_data_row($query);
         //echo $query.mysql_error().__FILE__.__LINE__;
         if ($row) {
             return $row->total;
//.........这里部分代码省略.........
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:101,代码来源:model.php


示例17: foreach

    }
}
// meta_data_exact_search_criteria
if (!empty($meta_data_exact_search_criteria)) {
    foreach ($meta_data_exact_search_criteria as $field_name => $field_value) {
        if (!empty($field_value)) {
            $meta_name_id = get_metastring_id(sanitise_string($field_name));
            $meta_array[$meta_name_id] = "= '" . sanitise_string($field_value) . "'";
        }
    }
}
// meta_data_between_search_criteria
if (!empty($meta_data_between_search_criteria)) {
    foreach ($meta_data_between_search_criteria as $field_name => $field_value) {
        if (!empty($field_value) && (!empty($field_value['FROM']) || !empty($field_value['TO']))) {
            $meta_name_id = get_metastring_id(sanitise_string($field_name));
            $from = sanitise_string($field_value['FROM']);
            $to = sanitise_string($field_value['TO']);
            if (!empty($from) && !empty($to)) {
                $record_filter = "BETWEEN " . $from . " AND " . $to;
            } elseif (!empty($from)) {
                $record_filter = ">= " . $from;
            } else {
                $record_filter = "<= " . $to;
            }
            $meta_array[$meta_name_id] = $record_filter;
        }
    }
}
$mindex = 1;
$join = "";
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:search.php


示例18: access_get_show_hidden_status

<?php

$ha = access_get_show_hidden_status();
access_show_hidden_entities(true);
$name_id = get_metastring_id('msgHash');
if (!$name_id) {
    $name_id = add_metastring('msgHash');
}
$dbprefix = elgg_get_config('dbprefix');
$messages = elgg_get_entities(array('types' => 'object', 'subtypes' => array('messages'), 'wheres' => array("NOT EXISTS (SELECT 1 FROM {$dbprefix}metadata md WHERE md.entity_guid = e.guid\n            AND md.name_id = {$name_id})"), 'order_by' => 'e.guid ASC', 'count' => true));
access_show_hidden_entities($ha);
if ($messages) {
    echo elgg_view('framework/inbox/admin/import', array('count' => $messages));
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:14,代码来源:settings.php


示例19: get_metastring_id

<?php

/**
 * Pull admin metadata setting into users_entity table column
 */
$siteadmin = get_metastring_id('siteadmin');
$admin = get_metastring_id('admin');
$yes = get_metastring_id('yes');
$one = get_metastring_id('1');
$qs = array();
$qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity DISABLE KEYS";
$qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity\n\tADD admin ENUM('yes', 'no') NOT NULL DEFAULT 'no' AFTER `banned`";
$qs[] = "UPDATE {$CONFIG->dbprefix}users_entity SET admin = 'yes' where guid IN (select x.guid FROM(\nSELECT * FROM {$CONFIG->dbprefix}users_entity as e,\n\t{$CONFIG->dbprefix}metadata as md\n\tWHERE (\n\t\tmd.name_id IN ('{$admin}', '{$siteadmin}')\n\t\tAND md.value_id IN ('{$yes}', '{$one}')\n\t\tAND e.guid = md.entity_guid\n\t\tAND e.banned = 'no'\n\t)) as x)";
$qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity ADD KEY admin (admin)";
$qs[] = "ALTER TABLE {$CONFIG->dbprefix}users_entity ENABLE KEYS";
$qs[] = "DELETE FROM {$CONFIG->dbprefix}metadata\n\tWHERE (\n\t\tname_id IN ('{$admin}', '{$siteadmin}')\n\t\tAND value_id IN ('{$yes}', '{$one}')\n\t)";
foreach ($qs as $q) {
    update_data($q);
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:19,代码来源:2010040201.php


示例20: ucfirst

            if ($oldCat == "newCat" && !empty($newCat)) {
                $cat = ucfirst(strtolower($newCat));
            } else {
                $cat = ucfirst(strtolower($oldCat));
            }
            if (!empty($cat)) {
                $faq->question = $question;
                $faq->answer = $answer;
                $faq->category = $cat;
                $faq->access_id = $access;
                $faq->owner_guid = elgg_get_config('site_guid');
                $faq->container_guid = elgg_get_config('site_guid');
                if ($faq->save()) {
                    system_message(elgg_echo("faq:edit:success"));
                } else {
                    register_error(elgg_echo("faq:edit:error:save"));
                }
            } else {
                register_error(elgg_echo("faq:edit:error:invalid_category"));
            }
        } else {
            register_error(elgg_echo("faq:edit:error:invalid_input"));
        }
    } else {
        register_error(elgg_echo("faq:edit:error:invalid_object"));
    }
} else {
    register_error(elgg_echo("faq:edit:error:invalid_input"));
}
forward(elgg_get_site_url() . "faq/list?categoryId=" . get_metastring_id($faq->category));
开发者ID:HundredHandsAlliance,项目名称:Elgg_1.8_faq,代码行数:30,代码来源:edit.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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