/** * * @param integer $value * @param integer $date * @param Pimcore_Model_WebResource_Interface $target * @param Object_Abstract $user */ public static function postRating($value, $comment, $title, $name, $target, $metadata = null, $spamCheck = null) { if (!$spamCheck) { $type = self::getTypeFromTarget($target); if (!empty($type)) { $comment = htmlentities(strip_tags($comment), ENT_COMPAT | ENT_HTML401, "UTF-8"); $title = htmlentities(strip_tags($title), ENT_COMPAT | ENT_HTML401, "UTF-8"); $name = htmlentities(strip_tags($name), ENT_COMPAT | ENT_HTML401, "UTF-8"); $comment = $comment == '' ? null : $comment; $title = $title == '' ? null : $title; $name = $name == '' ? null : $name; $rating = new RatingsComments(); $rating->setTarget($target); $rating->setRating(intval($value)); $rating->setDate(time()); $rating->setType($type); $rating->setComment($comment); $rating->setTitle($title); $rating->setName($name); $rating->setMetadata($metadata); if ($target instanceof Object_Abstract) { $rating->setClassname($target->getO_className()); } $rating->save(); } else { logger::log("Rating_Plugin: Could not post rating, unknown resource", Zend_Log::ERR); } } }