/** * Includes and instantiates the various P2 components. */ function P2() { // Fetch options $this->options = get_option($this->option_name); if (false === $this->options) { $this->options = array(); } // Include the P2 components $includes = array('compat', 'terms-in-comments', 'js-locale', 'mentions', 'search', 'js', 'options-page', 'widgets/recent-tags', 'widgets/recent-comments', 'list-creator'); require_once P2_INC_PATH . "/template-tags.php"; // Logged-out/unprivileged users use the add_feed() + ::ajax_read() API rather than the /admin-ajax.php API // current_user_can( 'read' ) should be equivalent to is_user_member_of_blog() if (defined('DOING_AJAX') && DOING_AJAX && (p2_user_can_post() || current_user_can('read'))) { $includes[] = 'ajax'; } foreach ($includes as $name) { require_once P2_INC_PATH . "/{$name}.php"; } // Add the default P2 components $this->add('mentions', 'P2_Mentions'); $this->add('search', 'P2_Search'); $this->add('post-list-creator', 'P2_Post_List_Creator'); $this->add('comment-list-creator', 'P2_Comment_List_Creator'); // Bind actions add_action('init', array(&$this, 'init')); add_action('admin_init', array(&$this, 'maybe_upgrade_db'), 5); }
<?php /** * @package WordPress * @subpackage P2 */ ?> <?php get_header(); ?> <div class="sleeve_main"> <?php if ( p2_user_can_post() && !is_archive() ) : ?> <?php locate_template( array( 'post-form.php' ), true ); ?> <?php endif; ?> <div class="padder"> <div id="main"> <h2 class="recent-updates"> <?php if ( is_home() or is_front_page() ) : ?> <?php _e( 'Recent Updates' , 'p2' ); ?> <?php if ( p2_get_page_number() > 1 ) printf( __( 'Page %s', 'p2' ), p2_get_page_number() ); ?> <?php elseif ( is_author() ) : ?> <?php printf( _x( 'Updates from %s', 'Author name', 'p2' ), p2_get_archive_author() ); ?> <a class="rss" href="<?php p2_author_feed_link(); ?>">RSS</a> <?php elseif ( is_tax( 'mentions' ) ) : ?> <?php printf( _x( 'Posts Mentioning %s', 'Author name', 'p2' ), p2_get_mention_name() ); ?> <a class="rss" href="<?php p2_author_feed_link(); ?>">RSS</a> <?php else : ?>
<?php /** * Author template * * @package WordPress * @subpackage P2 */ get_header(); ?> <div class="sleeve_main"> <?php if (p2_user_can_post() && !is_archive()) { ?> <?php locate_template(array('post-form.php'), true); ?> <?php } ?> <div id="main"> <?php if (have_posts()) { ?> <h2> <?php printf(_x('Updates from %s', 'Author name', 'p2'), p2_get_archive_author()); ?>
<?php get_header(); // prologue_new_post_noajax(); Moved to template_redirect hook ?> <div class="sleeve_main"> <?php if (p2_user_can_post()) { ?> <?php locate_template(array('post-form.php'), true); ?> <?php } ?> <div id="main"> <h2> <?php if (is_home() or is_front_page()) { ?> <?php _e('Recent Updates', 'p2'); ?> <?php if (p2_get_page_number() > 1) { printf(__('Page %s', 'p2'), p2_get_page_number()); }