function __construct() { parent::__construct(); $this->add_action('after_setup_theme', 'admin_setup'); $ajax_classes = apply_filters('et_ajax_classes', array('QA_Ajax', 'ET_UserAjax')); if (isset($_REQUEST['page'])) { $this->add_action('admin_print_footer_scripts', 'override_template_setting', 200); } foreach ((array) $ajax_classes as $class) { if (class_exists($class)) { new $class(); } } $this->add_ajax('ae-reset-option', 'reset_option'); /** * set default options */ $options = AE_Options::get_instance(); if (!$options->init) { $options->reset($this->get_default_options()); } // default badges array $default_badges = array('pos_badges' => array('create_question' => 2, 'post_answer' => 2, 'q_vote_up' => 5, 'a_vote_up' => 10, 'a_accepted' => 15), 'neg_badges' => array('q_vote_down' => -2, 'a_vote_down' => -2, 'vote_down' => -2), 'privileges' => array('create_post' => 1, 'vote_up' => 20, 'add_comment' => 200, 'vote_down' => 500, 'edit_qa' => 1200, 'create_tag' => 1500, 'edit_question' => 2000, 'edit_answer' => 40000), 'init' => 1); /** * set default badge options */ $options = QA_BadgeOptions::get_instance(); if (!$options->init) { $options->reset($default_badges); } }
/** * Init */ public function __construct() { parent::__construct(); new QA_FrontPost(); // set timeout for send mail to user's following question $time_send_mail = apply_filters('qa_time_send_mail', 120); if (ae_get_option('qa_send_following_mail')) { wp_schedule_single_event(time() + $time_send_mail, 'qa_send_following_mail'); } else { wp_clear_scheduled_hook('qa_send_following_mail'); } $this->add_filter('query_vars', 'query_vars'); $this->add_filter('mce_external_plugins', 'tinymce_add_plugins'); $this->add_filter('request', 'filter_request_feed'); $this->add_action('init', 'frontend_init'); $this->add_action('wp_footer', 'scripts_in_footer', 100); $this->add_action('pre_get_posts', 'custom_query'); $this->add_filter('comment_post_redirect', 'qa_comment_redirect'); }