本文整理匯總了PHP中Annotation::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Annotation::delete方法的具體用法?PHP Annotation::delete怎麽用?PHP Annotation::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Annotation
的用法示例。
在下文中一共展示了Annotation::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _delete_annotation
/**
*
* @param Annotation $annotation
* @return Boolean
*/
private function _delete_annotation($annotation)
{
$annotation_id = $annotation->get_id();
$annotation_user = $annotation->get_user();
//test_msg('delete', $annotation_user->get_id());
if (is_null($annotation_user->get_id())) {
$data = show_error('No annotation.');
return $this->_display_jsonp($data, $callback);
}
$user = $this->user;
if ($user->equals($annotation_user) === FALSE) {
$data = show_error('Permission deny.');
return $this->_display_jsonp($data, $callback);
}
$action = "image_spot.delete";
kals_log($this->db, $action, $annotation_id);
set_ignore_authorize(true);
$annotation->delete();
context_complete();
set_ignore_authorize(false);
}
示例2: store_extended_properties
public static function store_extended_properties($id = false, &$prefs)
{
if ($id == false) {
$id = self::my_id();
}
$dict = array();
$defaults = self::$extended_properties;
foreach ($prefs as $k => $v) {
if ($v !== '' && isset($defaults[$k]) && $defaults[$k] != $v) {
switch ($k) {
case 'rules':
case 'message':
$dict[$k] = clean_text_with_tags($v, 0, false, 300);
break;
default:
$dict[$k] = mb_substr(clean_input_string($v), 0, 100);
}
}
}
$key = self::PREFERENCES_KEY . $id;
$a = new Annotation($key);
if (!empty($dict)) {
$json = json_encode($dict);
$a->text = $json;
return $a->store();
}
return $a->delete();
}
示例3: store_extended_properties
public static function store_extended_properties($id = false, &$prefs)
{
if ($id == false) {
$id = self::my_id();
}
$dict = array();
$defaults = array_merge(self::$extended_properties, self::$extra_extended_properties);
foreach ($prefs as $k => $v) {
if ($v !== '' && isset($defaults[$k]) && $defaults[$k] != $v) {
switch ($k) {
case 'rules':
case 'message':
$dict[$k] = clean_text_with_tags($v, 0, false, 3000);
break;
case 'post_html':
// TODO: validate the HTML
$dict[$k] = $v;
break;
default:
if (isset($defaults[$k]) && is_int($defaults[$k])) {
$dict[$k] = intval($v);
} else {
$dict[$k] = mb_substr(clean_input_string($v), 0, 140);
}
}
}
}
$key = self::PREFERENCES_KEY . $id;
$a = new Annotation($key);
if (!empty($dict)) {
$json = json_encode($dict);
$a->text = $json;
return $a->store();
}
return $a->delete();
}