private function group_post_types() { $post_types = PeepSoBlogPosts::get_post_types(); $message = __('Enable the post types you want to be handled by this integration.', 'peepsoblogposts') . '<br/>' . __('Only post types presently registered are visible.', 'peepsoblogposts') . '<br/>' . __('You can override the <i>action text</i> for each post type with custom wording.', 'peepsoblogposts'); $this->set_field('post_types_message', $message, 'message'); foreach ($post_types as $post_type) { $key = 'blogposts_activity_type_' . $post_type; $key_text = $key . '_text'; $this->set_field($post_type . '_separator', $post_type, 'separator'); $this->set_field($key, 'Enable', 'yesno_switch'); $this->args('default', PeepSo::get_option('blogposts_activity_type_post_text_default')); $this->set_field($key_text, 'Action text', 'text'); } $this->set_group('blogposts_activity_post_types', __('Activity Stream Integration - Post types', 'peepsoblogposts')); }
/** * 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); } }