'link structure'); var $default_context = 7; // LP_CONTEXT_INDEX | LP_CONTEXT_ARCHIVES | LP_CONTEXT_CATEGORY; var $description = 'Add \'continue reading\' and \'comments\' links to the post content'; var $active = true; var $hooks = array('get_posts_loop'); var $link = '%s'; function PostExtra(&$frontend, $args, $dummy_run=false) { $this->LightPressPlugin($frontend, $args, $dummy_run); if (!$dummy_run && basename($_SERVER['PHP_SELF']) != 'index.php') $this->active = false; } function hide() { return; } function run($hook, &$post) { if (!isset($post['post_comments'])) // 'simple' mode, used mainly for feeds return; if (empty($post['post_more'])) { $text = sprintf('comment', $post['post_comments']); $anchor = "add_comment"; } else { $text = sprintf('continue reading', $post['post_comments']); $anchor = "more"; } $link = sprintf($this->link, $post['post_permalink'], $anchor, $text); $content =& $post['post_content']; if (substr($content, -4) == '

') { $content = substr($content, 0, -4) . " $link

"; } else { $content .= "$link"; } } } ?>