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


PHP detect_extender_valuetype函数代码示例

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


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

示例1: testAcceptRecognizedTypes

 public function testAcceptRecognizedTypes()
 {
     $this->assertSame('text', detect_extender_valuetype(123, 'text'));
     $this->assertSame('integer', detect_extender_valuetype(123, 'invalid'));
     $this->assertSame('integer', detect_extender_valuetype('hello', 'integer'));
     $this->assertSame('text', detect_extender_valuetype('hello', 'invalid'));
 }
开发者ID:elgg,项目名称:elgg,代码行数:7,代码来源:ElggExtenderTest.php

示例2: set

 /**
  * Set an attribute
  *
  * @param string $name
  * @param mixed $value
  * @param string $value_type
  * @return boolean
  */
 protected function set($name, $value, $value_type = "")
 {
     $this->attributes[$name] = $value;
     if ($name == 'value') {
         $this->attributes['value_type'] = detect_extender_valuetype($value, $value_type);
     }
     return true;
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:16,代码来源:extender.php

示例3: izap_update_metadata

/**
*function to update the metadata
*same as the update_metadata, only made metadata editable
*/
function izap_update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id)
{
    $id = (int) $id;
    if (!($md = elgg_get_metadata_from_id($id))) {
        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}");
    }
    $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = elgg_get_logged_in_user_guid();
    }
    $access_id = (int) $access_id;
    // Support boolean types (as integers)
    if (is_bool($value)) {
        if ($value) {
            $value = 1;
        } else {
            $value = 0;
        }
    }
    // Add the metastring
    $value = elgg_get_metastring_id($value);
    if (!$value) {
        return false;
    }
    $name = elgg_get_metastring_id($name);
    if (!$name) {
        return false;
    }
    // If ok then add it
    $db_prefix = elgg_get_config('dbprefix');
    $result = update_data("UPDATE {$db_prefix}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 = elgg_get_metadata_from_id($id);
        if (elgg_trigger_event('update', 'metadata', $obj)) {
            return true;
        } else {
            elgg_delete_metadata(array('metadata_id' => $id));
        }
    }
    return $result;
}
开发者ID:Daltonmedia,项目名称:izap_profile_visitors,代码行数:54,代码来源:izap_profile_visitors_lib.php

示例4: update

 /**
  * {@inheritdoc}
  */
 public function update($id, $name, $value, $value_type, $owner_guid, $access_id)
 {
     if (!isset($this->rows[$id])) {
         return false;
     }
     $row = $this->rows[$id];
     $row->name = $name;
     $row->value = $value;
     $row->value_type = detect_extender_valuetype($value, $this->db->sanitizeString(trim($value_type)));
     $row->owner_guid = $owner_guid;
     $row->access_id = $access_id;
     $this->rows[$id] = $row;
     $this->addQuerySpecs($row);
     return parent::update($id, $name, $value, $value_type, $owner_guid, $access_id);
 }
开发者ID:elgg,项目名称:elgg,代码行数:18,代码来源:MetadataTable.php

示例5: update_metadata

/**
 * Update a specific piece of metadata.
 *
 * @param int    $id         ID of the metadata to update
 * @param string $name       Metadata name
 * @param string $value      Metadata value
 * @param string $value_type Value type
 * @param int    $owner_guid Owner guid
 * @param int    $access_id  Access ID
 *
 * @return bool
 */
function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id)
{
    global $CONFIG;
    $id = (int) $id;
    if (!($md = elgg_get_metadata_from_id($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) {
        // @todo fix memcache (name_id is not a property of ElggMetadata)
        $metabyname_memcache->delete("{$md->entity_guid}:{$md->name_id}");
    }
    $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = elgg_get_logged_in_user_guid();
    }
    $access_id = (int) $access_id;
    // Support boolean types (as integers)
    if (is_bool($value)) {
        $value = (int) $value;
    }
    $value_id = elgg_get_metastring_id($value);
    if (!$value_id) {
        return false;
    }
    $name_id = elgg_get_metastring_id($name);
    if (!$name_id) {
        return false;
    }
    // If ok then add it
    $query = "UPDATE {$CONFIG->dbprefix}metadata" . " set name_id='{$name_id}', value_id='{$value_id}', value_type='{$value_type}', access_id={$access_id}," . " owner_guid={$owner_guid} where id={$id}";
    $result = update_data($query);
    if ($result !== false) {
        _elgg_get_metadata_cache()->save($md->entity_guid, $name, $value);
        // @todo this event tells you the metadata has been updated, but does not
        // let you do anything about it. What is needed is a plugin hook before
        // the update that passes old and new values.
        $obj = elgg_get_metadata_from_id($id);
        elgg_trigger_event('update', 'metadata', $obj);
    }
    return $result;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:62,代码来源:metadata.php

示例6: update_annotation

/**
 * Update an annotation.
 *
 * @param int    $annotation_id Annotation ID
 * @param string $name          Name of annotation
 * @param string $value         Value of annotation
 * @param string $value_type    Type of value
 * @param int    $owner_guid    Owner of annotation
 * @param int    $access_id     Access level of annotation
 *
 * @return bool
 */
function update_annotation($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
{
    global $CONFIG;
    $annotation_id = (int) $annotation_id;
    $annotation = elgg_get_annotation_from_id($annotation_id);
    if (!$annotation) {
        return false;
    }
    if (!$annotation->canEdit()) {
        return false;
    }
    $name = trim($name);
    $value_type = detect_extender_valuetype($value, $value_type);
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = elgg_get_logged_in_user_guid();
    }
    $access_id = (int) $access_id;
    $value_id = elgg_get_metastring_id($value);
    if (!$value_id) {
        return false;
    }
    $name_id = elgg_get_metastring_id($name);
    if (!$name_id) {
        return false;
    }
    $result = update_data("UPDATE {$CONFIG->dbprefix}annotations\n\t\tSET name_id = {$name_id}, value_id = {$value_id}, value_type = '{$value_type}',\n\t\taccess_id = {$access_id}, owner_guid = {$owner_guid}\n\t\tWHERE id = {$annotation_id}");
    if ($result !== false) {
        // @todo add plugin hook that sends old and new annotation information before db access
        $obj = elgg_get_annotation_from_id($annotation_id);
        elgg_trigger_event('update', 'annotation', $obj);
    }
    return $result;
}
开发者ID:sephiroth88,项目名称:Elgg,代码行数:46,代码来源:annotations.php

示例7: update

 /**
  * Update an annotation.
  *
  * @param int    $annotation_id Annotation ID
  * @param string $name          Name of annotation
  * @param string $value         Value of annotation
  * @param string $value_type    Type of value
  * @param int    $owner_guid    Owner of annotation
  * @param int    $access_id     Access level of annotation
  *
  * @return bool
  */
 function update($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
 {
     $annotation_id = (int) $annotation_id;
     $annotation = $this->get($annotation_id);
     if (!$annotation) {
         return false;
     }
     if (!$annotation->canEdit()) {
         return false;
     }
     $name = trim($name);
     $value_type = detect_extender_valuetype($value, $value_type);
     $owner_guid = (int) $owner_guid;
     if ($owner_guid == 0) {
         $owner_guid = _elgg_services()->session->getLoggedInUserGuid();
     }
     $access_id = (int) $access_id;
     $value_id = elgg_get_metastring_id($value);
     if (!$value_id) {
         return false;
     }
     $name_id = elgg_get_metastring_id($name);
     if (!$name_id) {
         return false;
     }
     $result = _elgg_services()->db->updateData("UPDATE {$this->CONFIG->dbprefix}annotations\n\t\t\tSET name_id = {$name_id}, value_id = {$value_id}, value_type = '{$value_type}',\n\t\t\taccess_id = {$access_id}, owner_guid = {$owner_guid}\n\t\t\tWHERE id = {$annotation_id}");
     if ($result !== false) {
         // @todo add plugin hook that sends old and new annotation information before db access
         $obj = $this->get($annotation_id);
         _elgg_services()->events->trigger('update', 'annotation', $obj);
     }
     return $result;
 }
开发者ID:nirajkaushal,项目名称:Elgg,代码行数:45,代码来源:Annotations.php

示例8: setValue

 /**
  * Set the value of the extender
  * 
  * @param mixed  $value      The value being set
  * @param string $value_type The type of the : 'integer' or 'text'
  * @return void
  * @since 1.9
  */
 public function setValue($value, $value_type = '')
 {
     $this->attributes['value'] = $value;
     $this->attributes['value_type'] = detect_extender_valuetype($value, $value_type);
 }
开发者ID:cyrixhero,项目名称:Elgg,代码行数:13,代码来源:ElggExtender.php

示例9: 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:jricher,项目名称:Elgg,代码行数:44,代码来源:annotations.php

示例10: update

 /**
  * Update an annotation.
  *
  * @param int    $annotation_id Annotation ID
  * @param string $name          Name of annotation
  * @param string $value         Value of annotation
  * @param string $value_type    Type of value
  * @param int    $owner_guid    Owner of annotation
  * @param int    $access_id     Access level of annotation
  *
  * @return bool
  */
 function update($annotation_id, $name, $value, $value_type, $owner_guid, $access_id)
 {
     $annotation_id = (int) $annotation_id;
     $annotation = $this->get($annotation_id);
     if (!$annotation) {
         return false;
     }
     if (!$annotation->canEdit()) {
         return false;
     }
     $name = trim($name);
     $value_type = detect_extender_valuetype($value, $value_type);
     $owner_guid = (int) $owner_guid;
     if ($owner_guid == 0) {
         $owner_guid = $this->session->getLoggedInUserGuid();
     }
     $access_id = (int) $access_id;
     $sql = "UPDATE {$this->db->prefix}annotations\n\t\t\t(name, value, value_type, access_id, owner_guid)\n\t\t\tVALUES\n\t\t\t(:name, :value, :value_type, :access_id, :owner_guid)\n\t\t\tWHERE id = :annotation_id";
     $result = $this->db->updateData($sql, false, [':name' => $name, ':value' => $value, ':value_type' => $value_type, ':access_id' => $access_id, ':owner_guid' => $owner_guid, ':annotation_id' => $annotation_id]);
     if ($result !== false) {
         // @todo add plugin hook that sends old and new annotation information before db access
         $obj = $this->get($annotation_id);
         $this->events->trigger('update', 'annotation', $obj);
     }
     return $result;
 }
开发者ID:elgg,项目名称:elgg,代码行数:38,代码来源:Annotations.php

示例11: update_annotation

/**
 * Update an annotation.
 *
 * @param int    $annotation_id Annotation ID
 * @param string $name          Name of annotation
 * @param string $value         Value of annotation
 * @param string $value_type    Type of value
 * @param int    $owner_guid    Owner of annotation
 * @param int    $access_id     Access level of annotation
 *
 * @return bool
 */
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 = elgg_get_logged_in_user_guid();
    }
    $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\n\t\tset name_id='{$name}', value_id='{$value}', value_type='{$value_type}', access_id={$access_id}, owner_guid={$owner_guid}\n\t\twhere id={$annotation_id} and {$access}");
    if ($result !== false) {
        $obj = elgg_get_annotation_from_id($annotation_id);
        if (elgg_trigger_event('update', 'annotation', $obj)) {
            return true;
        } else {
            // @todo add plugin hook that sends old and new annotation information before db access
            elgg_delete_annotation_by_id($annotation_id);
        }
    }
    return $result;
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:47,代码来源:annotations.php

示例12: update_metadata

/**
 * Update a specific piece of metadata.
 *
 * @param int    $id         ID of the metadata to update
 * @param string $name       Metadata name
 * @param string $value      Metadata value
 * @param string $value_type Value type
 * @param int    $owner_guid Owner guid
 * @param int    $access_id  Access ID
 *
 * @return bool
 */
function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_id)
{
    global $CONFIG;
    $id = (int) $id;
    if (!($md = elgg_get_metadata_from_id($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}");
    }
    $value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
    $owner_guid = (int) $owner_guid;
    if ($owner_guid == 0) {
        $owner_guid = elgg_get_logged_in_user_guid();
    }
    $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
    $query = "UPDATE {$CONFIG->dbprefix}metadata" . " set name_id='{$name}', value_id='{$value}', value_type='{$value_type}', access_id={$access_id}," . " owner_guid={$owner_guid} where id={$id}";
    $result = update_data($query);
    if ($result !== false) {
        $obj = elgg_get_metadata_from_id($id);
        if (elgg_trigger_event('update', 'metadata', $obj)) {
            return true;
        } else {
            elgg_delete_metadata_by_id($id);
        }
    }
    return $result;
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:67,代码来源:metadata.php

示例13: update

 /**
  * Update a specific piece of metadata.
  *
  * @param int    $id         ID of the metadata to update
  * @param string $name       Metadata name
  * @param string $value      Metadata value
  * @param string $value_type Value type
  * @param int    $owner_guid Owner guid
  * @param int    $access_id  Access ID
  *
  * @return bool
  */
 function update($id, $name, $value, $value_type, $owner_guid, $access_id)
 {
     $id = (int) $id;
     if (!($md = $this->get($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) {
         // @todo fix memcache (name_id is not a property of \ElggMetadata)
         $metabyname_memcache->delete("{$md->entity_guid}:{$md->name_id}");
     }
     $value_type = detect_extender_valuetype($value, $this->db->sanitizeString(trim($value_type)));
     $owner_guid = (int) $owner_guid;
     if ($owner_guid == 0) {
         $owner_guid = $this->session->getLoggedInUserGuid();
     }
     $access_id = (int) $access_id;
     // Support boolean types (as integers)
     if (is_bool($value)) {
         $value = (int) $value;
     }
     $value_id = $this->metastringsTable->getId($value);
     if (!$value_id) {
         return false;
     }
     $name_id = $this->metastringsTable->getId($name);
     if (!$name_id) {
         return false;
     }
     // If ok then add it
     $query = "UPDATE {$this->table}" . " set name_id='{$name_id}', value_id='{$value_id}', value_type='{$value_type}', access_id={$access_id}," . " owner_guid={$owner_guid} where id={$id}";
     $result = $this->db->updateData($query);
     if ($result !== false) {
         $this->cache->save($md->entity_guid, $name, $value);
         // @todo this event tells you the metadata has been updated, but does not
         // let you do anything about it. What is needed is a plugin hook before
         // the update that passes old and new values.
         $obj = $this->get($id);
         $this->events->trigger('update', 'metadata', $obj);
     }
     return $result;
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:61,代码来源:MetadataTable.php

示例14: update

 /**
  * Update a specific piece of metadata.
  *
  * @param int    $id         ID of the metadata to update
  * @param string $name       Metadata name
  * @param string $value      Metadata value
  * @param string $value_type Value type
  * @param int    $owner_guid Owner guid
  * @param int    $access_id  Access ID
  *
  * @return bool
  */
 function update($id, $name, $value, $value_type, $owner_guid, $access_id)
 {
     $id = (int) $id;
     if (!($md = $this->get($id))) {
         return false;
     }
     if (!$md->canEdit()) {
         return false;
     }
     $value_type = detect_extender_valuetype($value, $this->db->sanitizeString(trim($value_type)));
     $owner_guid = (int) $owner_guid;
     if ($owner_guid == 0) {
         $owner_guid = $this->session->getLoggedInUserGuid();
     }
     $access_id = (int) $access_id;
     // Support boolean types (as integers)
     if (is_bool($value)) {
         $value = (int) $value;
     }
     // If ok then add it
     $query = "UPDATE {$this->table}\n\t\t\tSET name = :name,\n\t\t\t    value = :value,\n\t\t\t\tvalue_type = :value_type,\n\t\t\t\taccess_id = :access_id,\n\t\t\t    owner_guid = :owner_guid\n\t\t\tWHERE id = :id";
     $result = $this->db->updateData($query, false, [':name' => $name, ':value' => $value, ':value_type' => $value_type, ':access_id' => $access_id, ':owner_guid' => $owner_guid, ':id' => $id]);
     if ($result !== false) {
         $this->cache->clear($md->entity_guid);
         // @todo this event tells you the metadata has been updated, but does not
         // let you do anything about it. What is needed is a plugin hook before
         // the update that passes old and new values.
         $obj = $this->get($id);
         $this->events->trigger('update', 'metadata', $obj);
     }
     return $result;
 }
开发者ID:elgg,项目名称:elgg,代码行数:44,代码来源:MetadataTable.php


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