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

PHP get_data_row函数代码示例

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

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



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

示例1: 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 plugin to be installed.
 *
 * @param string $location The location, e.g. "London", or "24 Foobar Street, Gotham City"
 * @return string|false
 */
function elgg_geocode_location($location)
{
    global $CONFIG;
    if (is_array($location)) {
        return false;
    }
    $location = sanitise_string($location);
    // Look for cached version
    $query = "SELECT * from {$CONFIG->dbprefix}geocode_cache WHERE location='{$location}'";
    $cached_location = get_data_row($query);
    if ($cached_location) {
        return array('lat' => $cached_location->lat, 'long' => $cached_location->long);
    }
    // Trigger geocode event if not cached
    $return = false;
    $return = elgg_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
        $query = "INSERT DELAYED INTO {$CONFIG->dbprefix}geocode_cache " . " (location, lat, `long`) VALUES ('{$location}', '{$lat}', '{$long}')" . " ON DUPLICATE KEY UPDATE lat='{$lat}', `long`='{$long}'";
        execute_delayed_write_query($query);
    }
    return $return;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:35,代码来源:location.php


示例2: get_api_user

/**
 * Find an API User's details based on the provided public api key.
 * These users are not users in the traditional sense.
 *
 * @param string $api_key   The API Key
 *
 * @return mixed stdClass representing the database row or false.
 */
function get_api_user($api_key)
{
    $dbprefix = elgg_get_config('dbprefix');
    $api_key = sanitise_string($api_key);
    $query = "SELECT * from {$dbprefix}api_users" . " where api_key='{$api_key}' and active=1";
    return get_data_row($query);
}
开发者ID:elgg,项目名称:elgg,代码行数:15,代码来源:api_user.php


示例3: getCollectionIdByName

 /**
  * Get access collection by its name from database
  * 
  * @param string $name Collection name
  * @return stdClass
  */
 public function getCollectionIdByName($name)
 {
     $name = sanitize_string($name);
     $query = "SELECT * FROM {$this->dbprefix}access_collections\n\t\t\t\t\tWHERE name = '{$name}'";
     $collection = get_data_row($query);
     return $collection ? $collection->id : 0;
 }
开发者ID:n8b,项目名称:VMN,代码行数:13,代码来源:AccessCollection.php


示例4: create_object_entity

/**
 * Create or update the extras table for a given object.
 * Call create_entity first.
 *
 * @param int    $guid        The guid of the entity you're creating (as obtained by create_entity)
 * @param string $title       The title of the object
 * @param string $description The object's description
 *
 * @return bool
 */
function create_object_entity($guid, $title, $description)
{
    global $CONFIG;
    $guid = (int) $guid;
    $title = sanitise_string($title);
    $description = sanitise_string($description);
    $row = get_entity_as_row($guid);
    if ($row) {
        // Core entities row exists and we have access to it
        $query = "SELECT guid from {$CONFIG->dbprefix}objects_entity where guid = {$guid}";
        if ($exists = get_data_row($query)) {
            $query = "UPDATE {$CONFIG->dbprefix}objects_entity\n\t\t\t\tset title='{$title}', description='{$description}' where guid={$guid}";
            $result = update_data($query);
            if ($result != false) {
                // Update succeeded, continue
                $entity = get_entity($guid);
                elgg_trigger_event('update', $entity->type, $entity);
                return $guid;
            }
        } else {
            // Update failed, attempt an insert.
            $query = "INSERT into {$CONFIG->dbprefix}objects_entity\n\t\t\t\t(guid, title, description) values ({$guid}, '{$title}','{$description}')";
            $result = insert_data($query);
            if ($result !== false) {
                $entity = get_entity($guid);
                if (elgg_trigger_event('create', $entity->type, $entity)) {
                    return $guid;
                } else {
                    $entity->delete();
                }
            }
        }
    }
    return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:45,代码来源:objects.php


示例5: get_api_user

/**
 * Find an API User's details based on the provided public api key.
 * These users are not users in the traditional sense.
 *
 * @param int    $site_guid The GUID of the site.
 * @param string $api_key   The API Key
 *
 * @return mixed stdClass representing the database row or false.
 */
function get_api_user($site_guid, $api_key)
{
    global $CONFIG;
    $api_key = sanitise_string($api_key);
    $site_guid = (int) $site_guid;
    $query = "SELECT * from {$CONFIG->dbprefix}api_users" . " where api_key='{$api_key}' and site_guid={$site_guid} and active=1";
    return get_data_row($query);
}
开发者ID:ibou77,项目名称:elgg,代码行数:17,代码来源:api_user.php


示例6: get

 /**
  * Find an API User's details based on the provided public api key.
  * These users are not users in the traditional sense.
  *
  * @param string $api_key Pulic API key
  * @return \hypeJunction\Graph\ApiUser|false
  */
 public function get($api_key)
 {
     $api_key = sanitise_string($api_key);
     $row = get_data_row("SELECT * FROM {$this->dbprefix}api_users\n\t\t\t\t\t\t\t\tWHERE api_key='{$api_key}' AND site_guid={$this->site_guid} AND active=1");
     if (!$row) {
         return false;
     }
     return new ApiUser($row);
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:16,代码来源:KeysService.php


示例7: get_site_by_url

/**
 * Return the site via a url.
 *
 * @param string $url The URL of a site
 *
 * @return mixed
 */
function get_site_by_url($url)
{
    global $CONFIG;
    $url = sanitise_string($url);
    $row = get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where url='{$url}'");
    if ($row) {
        return get_entity($row->guid);
    }
    return false;
}
开发者ID:ibou77,项目名称:elgg,代码行数:17,代码来源:sites.php


示例8: testCanGetDataRow

 public function testCanGetDataRow()
 {
     $row1 = get_data_row("\n\t\t\tSELECT *\n\t\t\tFROM {$this->prefix}users_entity\n\t\t\tWHERE username = '" . sanitize_string($this->user->username) . "'\n\t\t");
     $row2 = get_data_row("\n\t\t\tSELECT *\n\t\t\tFROM {$this->prefix}users_entity\n\t\t\tWHERE username = ?\n\t\t", null, [$this->user->username]);
     $row3 = get_data_row("\n\t\t\tSELECT *\n\t\t\tFROM {$this->prefix}users_entity\n\t\t\tWHERE username = :username\n\t\t", null, [':username' => $this->user->username]);
     $this->assertIsA($row1, 'stdClass');
     $this->assertEqual($row1->username, $this->user->username);
     $this->assertEqual($row1, $row2);
     $this->assertEqual($row1, $row3);
 }
开发者ID:elgg,项目名称:elgg,代码行数:10,代码来源:ElggDataFunctionsTest.php


示例9: load

 /**
  * Load a key
  *
  * @param string $key    Name
  * @param int    $offset Offset
  * @param int    $limit  Limit
  *
  * @return string
  */
 public function load($key, $offset = 0, $limit = null)
 {
     $dbprefix = elgg_get_config('dbprefix');
     $key = sanitise_string($key);
     $row = get_data_row("SELECT * from {$dbprefix}hmac_cache where hmac='{$key}'");
     if ($row) {
         return $row->hmac;
     }
     return false;
 }
开发者ID:elgg,项目名称:elgg,代码行数:19,代码来源:ElggHMACCache.php


示例10: load

 /**
  * Load a key
  *
  * @param string $key    Name
  * @param int    $offset Offset
  * @param int    $limit  Limit
  *
  * @return string
  */
 public function load($key, $offset = 0, $limit = null)
 {
     global $CONFIG;
     $key = sanitise_string($key);
     $row = get_data_row("SELECT * from {$CONFIG->dbprefix}hmac_cache where hmac='{$key}'");
     if ($row) {
         return $row->hmac;
     }
     return false;
 }
开发者ID:ibou77,项目名称:elgg,代码行数:19,代码来源:ElggHMACCache.php


示例11: load

 /**
  * Loads a token from the DB
  * 
  * @param string $token Token
  * @return UserToken|false
  */
 public static function load($token)
 {
     $dbprefix = elgg_get_config('dbprefix');
     $token = sanitize_string($token);
     $row = get_data_row("SELECT * FROM {$dbprefix}users_apisessions WHERE token='{$token}'");
     if (!$row) {
         return false;
     }
     return new UserToken($row);
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:16,代码来源:UserToken.php


示例12: validate_user_token

/**
 * Validate a token against a given site.
 *
 * A token registered with one site can not be used from a
 * different apikey(site), so be aware of this during development.
 *
 * @param string $token The Token.
 *
 * @return mixed The user id attached to the token if not expired or false.
 */
function validate_user_token($token)
{
    $dbprefix = elgg_get_config('dbprefix');
    $token = sanitise_string($token);
    $time = time();
    $user = get_data_row("SELECT * from {$dbprefix}users_apisessions\n\t\twhere token='{$token}' and {$time} < expires");
    if ($user) {
        return $user->user_guid;
    }
    return false;
}
开发者ID:elgg,项目名称:elgg,代码行数:21,代码来源:tokens.php


示例13: get_number_users

/**
 * Return the number of users registered in the system.
 *
 * @param bool $show_deactivated
 * @return int
 */
function get_number_users($show_deactivated = false)
{
    global $CONFIG;
    $access = "";
    if (!$show_deactivated) {
        $access = "and " . get_access_sql_suffix();
    }
    $result = get_data_row("SELECT count(*) as count from {$CONFIG->dbprefix}entities where type='user' {$access}");
    if ($result) {
        return $result->count;
    }
    return false;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:19,代码来源:statistics.php


示例14: get

 /**
  * Get scraped data
  * 
  * @param string $url URL
  * @return array|void
  * @throws \InvalidArgumentException
  */
 public function get($url)
 {
     if (!filter_var($url, FILTER_VALIDATE_URL)) {
         throw new \InvalidArgumentException(__METHOD__ . ' expects a valid URL');
     }
     $data = $this->cache->get(sha1($url));
     if ($data) {
         return $data;
     }
     $dbprefix = elgg_get_config('dbprefix');
     $row = get_data_row("\n\t\t\tSELECT * FROM {$dbprefix}scraper_data\n\t\t\tWHERE url = :url\n\t\t", null, [':url' => $url]);
     return $row ? unserialize($row->data) : null;
 }
开发者ID:hypejunction,项目名称:hypescraper,代码行数:20,代码来源:ScraperService.php


示例15: validateToken

 /**
  * Check that token exists and is valid
  *
  * @param string $token
  * @return boolean
  */
 public function validateToken($token)
 {
     $token = $this->db->sanitizeString($token);
     $time = time();
     $dbprefix = $this->db->getTablePrefix();
     $site_guid = $this->config->site_guid;
     $user = get_data_row("SELECT * from {$dbprefix}users_apisessions\n\t\t\twhere token='{$token}' and site_guid={$site_guid} and {$time} < expires");
     if ($user) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:roybirger,项目名称:elgg-live_notifier,代码行数:19,代码来源:Tokens.php


示例16: getACL

 /**
  * returns the ACL of the site
  *
  * Needs a custom query because of deadloop problems with get_private_setting
  *
  * @return int
  */
 public function getACL()
 {
     if (!isset($this->subsite_acl_cache)) {
         $this->subsite_acl_cache = false;
         $query = "SELECT value";
         $query .= " FROM " . get_config("dbprefix") . "private_settings";
         $query .= " WHERE name = 'subsite_acl'";
         $query .= " AND entity_guid = " . $this->getGUID();
         if ($setting = get_data_row($query)) {
             $this->subsite_acl_cache = $setting->value;
         }
     }
     return $this->subsite_acl_cache;
 }
开发者ID:pleio,项目名称:subsite_manager,代码行数:21,代码来源:Subsite.php


示例17: get_number_users

/**
 * Return the number of users registered in the system.
 *
 * @param bool $show_deactivated Count not enabled users?
 *
 * @return int
 */
function get_number_users($show_deactivated = false)
{
    global $CONFIG;
    $access = "";
    if (!$show_deactivated) {
        $access = "and " . _elgg_get_access_where_sql(array('table_alias' => ''));
    }
    $query = "SELECT count(*) as count\n\t\tfrom {$CONFIG->dbprefix}entities where type='user' {$access}";
    $result = get_data_row($query);
    if ($result) {
        return $result->count;
    }
    return false;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:21,代码来源:statistics.php


示例18: testCanGetData

 public function testCanGetData()
 {
     $data = [['id' => 1, 'foo' => 'bar1'], ['id' => 2, 'foo' => 'bar2'], ['id' => 3, 'foo' => 'bar1']];
     _elgg_services()->db->addQuerySpec(['sql' => 'SELECT FROM A WHERE foo = :foo', 'params' => [':foo' => 'bar1'], 'results' => function () use($data) {
         $results = [];
         foreach ($data as $elem) {
             if ($elem['foo'] == 'bar1') {
                 $results[] = (object) $elem;
             }
         }
         return $results;
     }]);
     $this->assertEquals([$data[0], $data[2]], get_data('SELECT FROM A WHERE foo = :foo', [$this, 'rowToArray'], [':foo' => 'bar1']));
     $this->assertEquals($data[0], get_data_row('SELECT FROM A WHERE foo = :foo', [$this, 'rowToArray'], [':foo' => 'bar1']));
 }
开发者ID:elgg,项目名称:elgg,代码行数:15,代码来源:DatabaseTest.php


示例19: validate_user_token

/**
 * Validate a token against a given site.
 *
 * A token registered with one site can not be used from a
 * different apikey(site), so be aware of this during development.
 *
 * @param string $token     The Token.
 * @param int    $site_guid The ID of the site (default is current site)
 *
 * @return mixed The user id attached to the token if not expired or false.
 */
function validate_user_token($token, $site_guid)
{
    global $CONFIG;
    if (!isset($site_guid)) {
        $site_guid = $CONFIG->site_id;
    }
    $site_guid = (int) $site_guid;
    $token = sanitise_string($token);
    $time = time();
    $user = get_data_row("SELECT * from {$CONFIG->dbprefix}users_apisessions\n\t\twhere token='{$token}' and site_guid={$site_guid} and {$time} < expires");
    if ($user) {
        return $user->user_guid;
    }
    return false;
}
开发者ID:tjcaverly,项目名称:Elgg,代码行数:26,代码来源:tokens.php


示例20: create_group_entity

/**
 * Create or update the entities table for a given group.
 * Call create_entity first.
 *
 * @param int    $guid        GUID
 * @param string $name        Name
 * @param string $description Description
 *
 * @return bool
 */
function create_group_entity($guid, $name, $description)
{
    global $CONFIG;
    $guid = (int) $guid;
    $name = sanitise_string($name);
    $description = sanitise_string($description);
    $row = get_entity_as_row($guid);
    if ($row) {
        // Exists and you have access to it
        $exists = get_data_row("SELECT guid from {$CONFIG->dbprefix}groups_entity WHERE guid = {$guid}");
        if ($exists) {
        } else {
        }
    }
    return false;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:26,代码来源:group.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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