commit bc26bcf51484c8cb903de34dbc2ce6a9910a3fae Author: Al Nikolov Date: Fri Oct 10 17:49:34 2014 +0300 Fixes incompatibility issue with Locale Signed-off-by: Al Nikolov diff --git a/antispam.module b/antispam.module index 1a9a2a1..a382412 100644 --- a/antispam.module +++ b/antispam.module @@ -887,8 +887,9 @@ function antispam_node_validate($node, $form, &$form_state) { $num_condition++; } if ($antispambot_rules['body'] && !empty($node->body)) { - $query->condition('e.body_value', $node->body[$node->language][0]['value']); - $debug_info['Content'] = $node->body[$node->language][0]['value']; + $content = field_get_items('node', $node, 'body')[0]['value']; + $query->condition('e.body_value', $content); + $debug_info['Content'] = $content; $num_condition++; } @@ -1004,8 +1005,9 @@ function antispam_comment_presave($comment) { $join_type = 'INNER'; } $query->addJoin($join_type, 'field_data_comment_body', 'c', 's.content_type = c.entity_type AND s.content_id = c.entity_id'); - $rules_conditions->condition('c.comment_body_value', $comment->comment_body[$comment->language][0]['value']); - $debug_info['Content'] = $comment->comment_body[$comment->language][0]['value']; + $content = field_get_items('comment', $comment, 'comment_body')[0]['value']; + $rules_conditions->condition('c.comment_body_value', $content); + $debug_info['Content'] = $content; $num_condition++; } @@ -2110,7 +2112,7 @@ function antispam_prepare_comment_data($content_type, $content, $provider) { $comment_data['permalink'] = url('node/' . $content->nid, array('fragment' => 'comment-' . $content->cid)); $comment_data['comment-author-email'] = $content->mail; $comment_data['comment-author-url'] = $content->homepage; - $comment_data['comment-content'] = render($content->comment_body[$content->language][0]['value']); + $comment_data['comment-content'] = render(field_get_items('comment', $content, 'comment_body')[0]['value']); // Date when the original article was created. $node_created = db_query("SELECT created FROM {node} WHERE nid=:nid", array(':nid' => $content->nid))->fetchField(); $comment_data['article-date'] = date("Y/m/d", $node_created); @@ -2120,7 +2122,7 @@ function antispam_prepare_comment_data($content_type, $content, $provider) { $comment_data['permalink'] = url('node/' . $content->nid); $comment_data['comment-author_email'] = (isset($user->mail) ? $user->mail : ''); $comment_data['comment-author_url'] = ''; - $comment_data['comment-content'] = render($content->body[$content->language][0]['value']); + $comment_data['comment-content'] = render(field_get_items('node', $content, 'body')[0]['value']); $comment_data['article-date'] = date("Y/m/d"); // now $comment_data['comment-type'] = 'other'; } @@ -2164,13 +2166,13 @@ function antispam_prepare_comment_data($content_type, $content, $provider) { $comment_data['permalink'] = url('node/' . $content->nid, array('fragment' => 'comment-' . $content->cid)); $comment_data['comment_author_email'] = $content->mail; $comment_data['comment_author_url'] = $content->homepage; - $comment_data['comment_content'] = render($content->comment_body[$content->language][0]['value']); + $comment_data['comment_content'] = render(field_get_items('comment', $content, 'comment_body')[0]['value']); } elseif ($content_type == 'node') { $comment_data['permalink'] = url('node/' . $content->nid); $comment_data['comment_author_email'] = (isset($user->mail) ? $user->mail : ''); $comment_data['comment_author_url'] = ''; - $comment_data['comment_content'] = render($content->body[$content->language][0]['value']); + $comment_data['comment_content'] = render(field_get_items('node', $content, 'body')[0]['value']); } else { $comment_data['permalink'] = '';