Example #1
0
 /**
  * Return an instance of this class.
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Initialize the class
  * @since 2.0.1
  */
 public function __construct()
 {
     new AnsPress_Post_Status();
     new AnsPress_Rewrite();
     AP_History::get_instance();
     add_action('ap_processed_new_question', array($this, 'after_new_question'), 1, 2);
     add_action('ap_processed_new_answer', array($this, 'after_new_answer'), 1, 2);
     add_action('ap_processed_update_question', array($this, 'ap_after_update_question'), 1, 2);
     add_action('ap_processed_update_answer', array($this, 'ap_after_update_answer'), 1, 2);
     add_action('before_delete_post', array($this, 'before_delete'));
     add_action('wp_trash_post', array($this, 'trash_post_action'));
     add_action('untrash_post', array($this, 'untrash_ans_on_question_untrash'));
     add_action('comment_post', array($this, 'new_comment_approve'), 10, 2);
     add_action('comment_unapproved_to_approved', array($this, 'comment_approve'));
     add_action('comment_approved_to_unapproved', array($this, 'comment_unapproved'));
     add_action('trashed_comment', array($this, 'comment_trash'));
     add_action('delete_comment ', array($this, 'comment_trash'));
     add_action('ap_publish_comment', array($this, 'publish_comment'));
     add_action('ap_unpublish_comment', array($this, 'unpublish_comment'));
     add_filter('wp_get_nav_menu_items', array($this, 'update_menu_url'));
     add_filter('nav_menu_css_class', array($this, 'fix_nav_current_class'), 10, 2);
     add_filter('walker_nav_menu_start_el', array($this, 'walker_nav_menu_start_el'), 10, 4);
     add_action('wp_loaded', array($this, 'flush_rules'));
     add_filter('mce_buttons', array($this, 'editor_buttons'), 10, 2);
     ///add_filter( 'teeny_mce_plugins', array($this, 'editor_plugins'), 10, 2 );
     add_filter('wp_insert_post_data', array($this, 'wp_insert_post_data'), 10, 2);
     add_filter('ap_form_contents_filter', array($this, 'sanitize_description'));
     add_action('safe_style_css', array($this, 'safe_style_css'), 11);
     add_action('save_post', array($this, 'base_page_update'), 10, 2);
     add_action('ap_added_follower', array($this, 'ap_added_follower'), 10, 2);
     add_action('ap_removed_follower', array($this, 'ap_added_follower'), 10, 2);
     add_action('ap_vote_casted', array($this, 'update_user_vote_casted_count'), 10, 4);
     add_action('ap_vote_removed', array($this, 'update_user_vote_casted_count'), 10, 4);
     add_action('ap_added_follower', array($this, 'notify_user_about_follower'), 10, 2);
     add_action('ap_vote_casted', array($this, 'notify_upvote'), 10, 4);
 }
 /**
  * Include all public classes
  */
 public function site_include()
 {
     self::$instance->anspress_hooks = new AnsPress_Hooks($this);
     self::$instance->anspress_theme = new AnsPress_Theme($this);
     new AnsPress_Common_Pages($this);
     new AnsPress_Post_Status($this);
     new AnsPress_Rewrite($this);
     AP_History::get_instance();
 }