/** * register hooks * * @return void */ public function init() { // Register classes and templates with PeepSo Core PeepSo::add_autoload_directory(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR); if (1 == PeepSo::get_option('blogposts_profile_template_overrides', 0)) { PeepSoTemplate::add_template_directory(PeepSo::get_peepso_dir() . 'peepso-blogposts'); } PeepSoTemplate::add_template_directory(plugin_dir_path(__FILE__)); if (is_admin()) { add_action('admin_init', array(&$this, 'check_peepso')); // Add PeepSo Config tab add_filter('peepso_admin_config_tabs', array(&$this, 'admin_config_tabs')); } else { // Enqueue frontend JS & CSS add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); // Activity Stream item - User X "wrote a Z" text add_filter('peepso_activity_stream_action', array(&$this, 'activity_stream_action'), 10, 2); // Activity Item parser - include the embed add_filter('the_content', array(&$this, 'the_content'), 1, 2); // "Blog Posts" profile section if (PeepSo::get_option('blogposts_profile_enable', 0)) { // "User Profile" PeepSo Core widget add_filter('peepso_widget_me_links', array(&$this, 'peepso_widget_me_links')); // Profile segment menu item add_filter('peepso_profile_segment_menu_links', array(&$this, 'peepso_profile_segment_menu_links')); // Profile segment renderer add_action('peepso_profile_segment_blogposts', array(&$this, 'peepso_profile_segment_blogposts')); // Profile segment page title add_filter('peepso_page_title_profile_segment', array(&$this, 'peepso_page_title_profile_segment')); // @todo what is this add_filter('peepso_rewrite_profile_pages', array(&$this, 'peepso_rewrite_profile_pages')); } } // Register actions for each post type $post_types = PeepSoBlogPosts::get_post_types(); foreach ($post_types as $post_type) { add_action('publish_' . $post_type, array(&$this, 'publish_post'), 1, 2); } }