Beispiel #1
0
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap
  */
 public function __construct($ap)
 {
     $ap->add_action('init', $this, 'init_actions');
     $ap->add_filter('pre_user_query', $this, 'follower_query');
     $ap->add_filter('pre_user_query', $this, 'following_query');
     $ap->add_filter('pre_user_query', $this, 'user_sort_by_reputation');
     $ap->add_action('wp_ajax_ap_cover_upload', $this, 'cover_upload');
     $ap->add_action('wp_ajax_ap_avatar_upload', $this, 'avatar_upload');
     $ap->add_filter('avatar_defaults', $this, 'default_avatar');
     $ap->add_filter('get_avatar', $this, 'get_avatar', 10, 5);
     $ap->add_filter('ap_user_menu', $this, 'ap_user_menu_icons');
 }
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap Parent class object.
  */
 public function __construct($ap)
 {
     $ap->add_action('ap_new_subscriber', $this, 'subscriber_count', 1, 3);
     $ap->add_action('ap_removed_subscriber', $this, 'subscriber_count', 1, 3);
     $ap->add_action('ap_after_new_question', $this, 'after_new_question', 10, 2);
     $ap->add_action('ap_after_new_answer', $this, 'after_new_answer', 10, 2);
     $ap->add_action('ap_publish_comment', $this, 'after_new_comment');
     $ap->add_action('ap_unpublish_comment', $this, 'unpublish_comment');
     $ap->add_action('ap_before_delete_question', $this, 'delete_question');
     $ap->add_action('ap_before_delete_answer', $this, 'delete_answer');
 }
 /**
  * Initializes the plugin by setting localization, hooks, filters, and administrative functions.
  * @return instance
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof AnsPress) {
         self::$instance = new AnsPress();
         self::$instance->_setup_constants();
         add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
         add_action('bp_loaded', array(self::$instance, 'bp_include'));
         global $ap_classes;
         $ap_classes = array();
         self::$instance->includes();
         self::$instance->anspress_forms = new AnsPress_Process_Form();
         self::$instance->anspress_actions = new AnsPress_Actions();
         self::$instance->anspress_ajax = new AnsPress_Ajax();
         self::$instance->anspress_query_filter = new AnsPress_Query_Filter();
         self::$instance->anspress_theme = new AnsPress_Theme();
         self::$instance->anspress_cpt = new AnsPress_PostTypes();
         self::$instance->anspress_reputation = new AP_Reputation();
         self::$instance->anspress_users = new AnsPress_User();
         ///self::$instance->third_party                 = new AnsPress_3rd_party();
         /**
          * ACTION: anspress_loaded
          * Hooks for extension to load their codes after AnsPress is leaded
          */
         do_action('anspress_loaded');
     }
     return self::$instance;
 }
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap Parent class object.
  */
 public function __construct($ap)
 {
     $ap->add_action('ap_added_follower', $this, 'notify_user_about_follower', 10, 2);
     $ap->add_action('ap_vote_casted', $this, 'notify_upvote', 10, 4);
     $ap->add_action('ap_after_new_answer', $this, 'after_new_answer', 10, 2);
     $ap->add_action('ap_after_update_question', $this, 'after_update_question', 10, 2);
     $ap->add_action('ap_after_update_answer', $this, 'after_update_answer', 10, 2);
     $ap->add_action('ap_publish_comment', $this, 'publish_comment');
 }
Beispiel #5
0
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap
  */
 public function __construct($ap)
 {
     // Return if reputation is disabled.
     if (!ap_check_for_bad_words()) {
         return;
     }
     $ap->add_action('ap_before_inserting_question', $this, 'before_inserting_question', 10, 2);
     $ap->add_action('ap_before_updating_question', $this, 'before_inserting_question', 10, 2);
     $ap->add_action('ap_before_inserting_answer', $this, 'before_inserting_question', 10, 2);
     $ap->add_action('ap_before_updating_answer', $this, 'before_inserting_question', 10, 2);
     $ap->add_action('ap_before_inserting_comment', $this, 'before_inserting_question', 10, 2);
     $ap->add_action('ap_before_updating_comment', $this, 'before_inserting_question', 10, 2);
 }
 /**
  * Initializes the plugin by setting localization, hooks, filters, and administrative functions.
  *
  * @return instance
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof self) {
         self::$instance = new self();
         self::$instance->setup_constants();
         self::$instance->actions = array();
         self::$instance->filters = array();
         add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
         add_action('bp_loaded', array(self::$instance, 'bp_include'));
         global $ap_classes;
         $ap_classes = array();
         self::$instance->includes();
         self::$instance->ajax_hooks();
         self::$instance->site_include();
         self::$instance->anspress_forms = new AnsPress_Process_Form();
         self::$instance->anspress_query_filter = new AnsPress_Query_Filter();
         self::$instance->anspress_cpt = new AnsPress_PostTypes();
         self::$instance->anspress_reputation = new AP_Reputation();
         /*
          * ACTION: anspress_loaded
          * Hooks for extension to load their codes after AnsPress is leaded
          */
         do_action('anspress_loaded');
         self::$instance->setup_hooks();
     }
     return self::$instance;
 }
Beispiel #7
0
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap Parent class object.
  */
 public function __construct($ap)
 {
     $ap->add_action('ap_ajax_suggest_similar_questions', $this, 'suggest_similar_questions');
     $ap->add_action('ap_ajax_load_comment_form', $this, 'load_comment_form');
     $ap->add_action('ap_ajax_delete_comment', $this, 'delete_comment');
     $ap->add_action('ap_ajax_select_best_answer', $this, 'select_best_answer');
     $ap->add_action('ap_ajax_delete_post', $this, 'delete_post');
     $ap->add_action('ap_ajax_permanent_delete_post', $this, 'permanent_delete_post');
     $ap->add_action('ap_ajax_change_post_status', $this, 'change_post_status');
     $ap->add_action('ap_ajax_load_user_field_form', $this, 'load_user_field_form');
     $ap->add_action('ap_ajax_set_featured', $this, 'set_featured');
     $ap->add_action('ap_ajax_follow', $this, 'follow');
     $ap->add_action('ap_ajax_user_cover', $this, 'ap_user_card');
     $ap->add_action('ap_ajax_delete_notification', $this, 'delete_notification');
     $ap->add_action('ap_ajax_markread_notification', $this, 'markread_notification');
     $ap->add_action('ap_ajax_set_notifications_as_read', $this, 'set_notifications_as_read');
     $ap->add_action('ap_ajax_flag_post', $this, 'flag_post');
     $ap->add_action('ap_ajax_subscribe', $this, 'subscribe');
     $ap->add_action('ap_ajax_vote', $this, 'vote');
     $ap->add_action('ap_ajax_flag_comment', $this, 'flag_comment');
     $ap->add_action('ap_ajax_delete_activity', $this, 'delete_activity');
 }
Beispiel #8
0
 /**
  * Construct class
  * @param AnsPress $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');
     $ap->add_action('edit_comment', $this, 'edit_comment');
     $ap->add_action('ap_added_follower', $this, 'follower', 10, 2);
     // $ap->add_action( 'ap_vote_casted', $this, 'notify_upvote', 10, 4 );
     // $ap->add_action( 'ap_added_reputation', $this, 'ap_added_reputation', 10, 4 );
     $ap->add_action('transition_post_status', $this, 'change_activity_status', 10, 3);
 }
Beispiel #9
0
 /**
  * Initialize the plugin by setting localization and loading public scripts
  * and styles.
  * @param AnsPress $ap
  */
 public function __construct($ap)
 {
     $ap->add_action('template_redirect', $this, 'insert_views');
 }