function &to_akismet() { $false = false; if (!$this->hasData()) { return $false; } if (!defined('AKISMET_KEY')) { return $false; } /* if ( !defined( 'AKISMET_KEY')) { print( 'wheres my key?'); exit; } */ $comment_data = $this->getData(); $comment_data['user_agent'] = $comment_data['agent']; $comment_data['user_ip'] = $comment_data['author_IP']; $comment_data['website'] = $comment_data['author_url']; $comment_data['body'] = $comment_data['comment']; $comment_data['permalink'] = isset($comment_data['article_id']) && $comment_data['article_id'] ? AMP_url_update(AMP_SITE_URL . '/' . AMP_CONTENT_URL_ARTICLE, array('id' => $comment_data['article_id'])) : false; if (!$comment_data['permalink']) { $comment_data['permalink'] = isset($comment_data['userdata_id']) && $comment_data['userdata_id'] ? AMP_url_update(AMP_SITE_URL . '/' . AMP_CONTENT_URL_FORM_DISPLAY, array('uid' => $comment_data['userdata_id'])) : false; } $akismet_comment = array_elements_by_key(array('author', 'email', 'website', 'body', 'permalink'), $comment_data); require_once 'akismet/akismet.class.php'; $akismet = new Akismet(AMP_SITE_URL, AKISMET_KEY, $akismet_comment); if ($akismet->isError(AKISMET_SERVER_NOT_FOUND)) { trigger_error('Akismet: Server Not Found'); return $false; } if ($akismet->isError(AKISMET_RESPONSE_FAILED)) { trigger_error('Akismet: Response Failed'); return $false; } if ($akismet->isError(AKISMET_INVALID_KEY)) { trigger_error('Akismet: Invalid Key'); return $false; } return $akismet; }
function render_galleries($data, $column) { if (!isset($data['name'])) { return false; } $gallery_ids = AMP_lookup('galleries_by_image', $data['name']); if (!$gallery_ids) { return false; } $renderer = AMP_get_renderer(); $galleries = array_elements_by_key($gallery_ids, AMP_lookup('galleries')); $gallery_image_ids = array_flip($gallery_ids); $links = array(); asort($galleries); foreach ($galleries as $id => $name) { $links[] = $renderer->link(AMP_url_update(AMP_SYSTEM_URL_GALLERY_IMAGE, array('id' => $gallery_image_ids[$id])), AMP_trimText($name, 30, $tags = false), array('title' => $name)); } return 'Linked Galleries: ' . $renderer->UL($links, array('class' => 'linked_items')); }