/** * Function to get an RSS feed. * * @access public * @return The feed string */ function sk_feed($max = 20) { global $wpdb; $options = get_option('sk_options'); $title = $options['title']; if (strlen($title) == 0) { $title = "Schreikasten"; } $link = get_bloginfo('url'); if (defined('SK_CHAT')) { $link = SK_CHAT; } $website = get_option('blogname'); $offset = get_option('gmt_offset'); if ($offset == 0) { $offset = "+0000"; } else { $ceil = ceil($offset); $sign = $ceil / abs($ceil); $offset = abs($offset) * 100 + 1; $offset = str_replace('51', '30', $offset); $offset = str_replace('01', '00', $offset); $offset = $sign * $offset; $offset = sprintf('%+05d', $offset); } $table_name = $wpdb->prefix . "schreikasten"; $sql = "SELECT id, alias, text, email, DATE_FORMAT(date, '%a, %d %b %Y %T {$offset}') as date_rss, user_id, email, status FROM {$table_name} WHERE status=" . SK_HAM . " ORDER BY id desc LIMIT {$max}"; $comments = $wpdb->get_results($sql); $items = array(); foreach ($comments as $comment) { $for = ""; //If we can reply a message, create the reply system if (sk_canReply()) { if ($comment->email != "") { $for .= "<a style='text-decoration: none;' href='{$link}?sk_for={$comment->id}#sk_top' onclick='javascript:for_set(" . $comment->id . ", \"" . $comment->alias . "\");'> " . __("[reply]", "sk") . "</a>"; } else { $for .= __("[no sender]", "sk"); } $for = "<br/>{$for}"; } $comment_text = sk_format_text("{$comment->text}{$for}"); $item = array("link" => "{$link}?sk_id={$comment->id}#sk-comment-id{$comment->id}", "title" => sprintf(__("Comment by %s", 'sk'), $comment->alias), "description" => $comment_text, "pubDate" => $comment->date_rss); array_push($items, $item); } $channel = array("title" => sprintf(__('Shouts in %s', 'sk'), $website), "description" => sprintf(__('List of messages in %s', 'sk'), $title), "link" => $link, "items" => $items); $feed = new SimpleRSSFeedCreator($channel); return $feed->get_feed(); }
?> </div><div><p><img src='../wp-content/plugins/schreikasten/img/<?php $img = 'ham.png'; if ($comment->status == SK_SPAM) { $img = 'spam.png'; } if ($comment->status == SK_BLACK) { $img = 'black.png'; } if ($comment->status == SK_MOOT) { $img = 'moot.png'; } echo $img; ?> '> <?php echo sk_format_text($comment->text); ?> </p><?php $act_message = ""; $ham_message = strtolower(_n('Approved', 'Approved', 1, 'sk')); $black_message = strtolower(_n('Rejected', 'Rejected', 1, 'sk')); $act_message = $black_message; $status_message = __('This comment is marked as %s.\\nAre you sure you want to mark it as %s?', 'sk'); ?> <div class="row-actions"> <span class='edit'><a href="<?php echo add_query_arg(array('paged' => $page, 'text' => $text, 'mode' => 'edit', 'id' => $comment->id)); ?> " class='edit'><?php _e('Edit comment', 'sk'); ?>