本文整理汇总了PHP中AppModel::isSpam方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::isSpam方法的具体用法?PHP AppModel::isSpam怎么用?PHP AppModel::isSpam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::isSpam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pingbackRegisterComment
/**
* Register pingback comment. Used by pingback server
*
* @param AppModel $model
* @param string $modelId
* @param array $options
* @param string $sourceUri
* @param string $targetUri
* @return boolean
*/
public function pingbackRegisterComment(&$model, $modelId, $sourceUri, $targetUri)
{
extract($this->settings[$model->alias]);
if ($model->{$commentAlias}->hasAny(array($commentAlias . '.foreign_key' => $modelId, 'author_url' => $sourceUri))) {
throw new XmlRpcResponseException(0, 'Pingback already registries in system.');
}
$sourceBody = $this->loadPageContent($sourceUri);
if (strpos($sourceBody, $targetUri) === false) {
throw new XmlRpcResponseException(0, 'Source link is not detected in target blog.');
}
$sourceBody = $this->cleanupPage($sourceBody);
$title = $this->fetchTitle($sourceBody);
$cite = $this->fetchPingbackCite($sourceBody, $sourceUri, $targetUri);
$isSpam = false;
$data = array('comment_type' => 'pingback', 'author_name' => $title . 'blog', 'author_url' => $sourceUri, 'title' => $title, 'foreign_key' => $modelId, 'model' => $model->alias, 'body' => $cite);
if ($model->{$commentAlias}->Behaviors->enabled('Antispamable')) {
$isSpam = $model->isSpam();
}
$data['is_spam'] = $isSpam ? 'spam' : 'clean';
$modelData = $model->find('first', array('conditions' => array('id' => $modelId), 'recursive' => -1));
if (!empty($modelData[$model->alias][$requireApproveModelField])) {
$data[$requireApproveCommentField] = 0;
}
$model->{$commentAlias}->create($data);
return $model->{$commentAlias}->save();
}