/** * Register hooks for our plugin. * * Create the objects required for our plugin and register all hooks using the plugin loader. * * @since 1.0.0 * @access private */ private function define_hooks() { // Create objects from classes. $plugin_admin = new Autoremove_Attachments_Admin(); // Register admin hooks. $this->loader->add_action('before_delete_post', $plugin_admin, 'remove_attachments'); $this->loader->add_action('plugins_loaded', $plugin_admin, 'maybe_update'); $this->loader->add_action('wpmu_new_blog', $plugin_admin, 'maybe_activate', 10, 6); }
/** * Initialize the class * @param AnsPress $ap parent class. */ public function __construct($ap) { $this->ap = $ap; $this->ap->add_action('init', $this, 'init_actions'); $this->ap->add_filter('post_class', $this, 'question_answer_post_class'); $this->ap->add_filter('body_class', $this, 'body_class'); $this->ap->add_filter('comments_template', $this, 'comment_template'); $this->ap->add_action('after_setup_theme', $this, 'includes'); $this->ap->add_filter('wpseo_title', $this, 'wpseo_title', 10, 2); $this->ap->add_filter('wp_head', $this, 'feed_link', 9); $this->ap->add_filter('wpseo_canonical', $this, 'wpseo_canonical'); $this->ap->add_action('ap_before', $this, 'ap_before_html_body'); $this->ap->add_action('wp', $this, 'remove_head_items', 10); $this->ap->add_action('wp_head', $this, 'wp_head', 11); }
/** * Initialize the class * @param object $ap Parent class object. * @since 2.0.1 */ public function __construct($ap) { $this->ap = $ap; $this->ap->add_action('ap_processed_new_question', $this, 'after_new_question', 1, 2); $this->ap->add_action('ap_processed_new_answer', $this, 'after_new_answer', 1, 2); $this->ap->add_action('ap_processed_update_question', $this, 'ap_after_update_question', 1, 2); $this->ap->add_action('ap_processed_update_answer', $this, 'ap_after_update_answer', 1, 2); $this->ap->add_action('before_delete_post', $this, 'before_delete'); $this->ap->add_action('wp_trash_post', $this, 'trash_post_action'); $this->ap->add_action('untrash_post', $this, 'untrash_ans_on_question_untrash'); $this->ap->add_action('comment_post', $this, 'new_comment_approve', 10, 2); $this->ap->add_action('comment_unapproved_to_approved', $this, 'comment_approve'); $this->ap->add_action('comment_approved_to_unapproved', $this, 'comment_unapproved'); $this->ap->add_action('trashed_comment', $this, 'comment_trash'); $this->ap->add_action('delete_comment ', $this, 'comment_trash'); $this->ap->add_action('ap_publish_comment', $this, 'publish_comment'); $this->ap->add_action('ap_unpublish_comment', $this, 'unpublish_comment'); $this->ap->add_filter('wp_get_nav_menu_items', $this, 'update_menu_url'); $this->ap->add_filter('nav_menu_css_class', $this, 'fix_nav_current_class', 10, 2); $this->ap->add_filter('walker_nav_menu_start_el', $this, 'walker_nav_menu_start_el', 10, 4); $this->ap->add_action('wp_loaded', $this, 'flush_rules'); $this->ap->add_filter('mce_buttons', $this, 'editor_buttons', 10, 2); $this->ap->add_filter('wp_insert_post_data', $this, 'wp_insert_post_data', 10, 2); $this->ap->add_filter('ap_form_contents_filter', $this, 'sanitize_description'); $this->ap->add_action('safe_style_css', $this, 'safe_style_css', 11); $this->ap->add_action('save_post', $this, 'base_page_update', 10, 2); $this->ap->add_action('ap_added_follower', $this, 'ap_added_follower', 10, 2); $this->ap->add_action('ap_removed_follower', $this, 'ap_added_follower', 10, 2); $this->ap->add_action('ap_vote_casted', $this, 'update_user_vote_casted_count', 10, 4); $this->ap->add_action('ap_vote_removed', $this, 'update_user_vote_casted_count', 10, 4); $this->ap->add_action('ap_added_follower', $this, 'notify_user_about_follower', 10, 2); $this->ap->add_action('ap_vote_casted', $this, 'notify_upvote', 10, 4); $this->ap->add_action('the_post', $this, 'ap_append_vote_count'); }
/** * Construct class * @param object $ap Parent class. */ public function __construct($ap) { $ap->add_action('ap_after_new_question', $this, 'new_question'); $ap->add_action('ap_after_new_answer', $this, 'new_answer'); $ap->add_action('ap_after_update_question', $this, 'edit_question'); $ap->add_action('ap_after_update_answer', $this, 'edit_answer'); $ap->add_action('ap_publish_comment', $this, 'new_comment'); $ap->add_action('ap_select_answer', $this, 'select_answer', 10, 3); $ap->add_action('ap_unselect_answer', $this, 'unselect_answer', 10, 3); $ap->add_action('ap_trash_answer', $this, 'trash_post'); $ap->add_action('ap_untrash_answer', $this, 'untrash_post'); $ap->add_action('ap_before_delete_answer', $this, 'delete_post'); $ap->add_action('ap_trash_question', $this, 'trash_post'); $ap->add_action('ap_trash_question', $this, 'untrash_post'); $ap->add_action('ap_before_delete_question', $this, 'delete_post'); $ap->add_action('trashed_comment', $this, 'trash_comment'); $ap->add_action('comment_trash_to_approved', $this, 'comment_approved'); $ap->add_action('delete_comment', $this, 'delete_comment'); }
/** * Initialize the class * @param object $ap Parent class object. */ public function __construct($ap) { $this->ap = $ap; $this->ap->add_action('init', $this, 'register_common_pages'); }