예제 #1
0
파일: Question.php 프로젝트: Trideon/gigolo
 public function __construct()
 {
     parent::__construct('dwqa-question', array('plural' => __('Questions', 'dwqa'), 'singular' => __('Question', 'dwqa'), 'menu' => __('Questions', 'dwqa')));
     add_action('manage_dwqa-question_posts_custom_column', array($this, 'columns_content'), 10, 2);
     add_action('init', array($this, 'submit_question'), 11);
     // Ajax update question
     add_action('wp_ajax_dwqa-update-question', array($this, 'update'));
     // Update view count of question, if we change single question template into shortcode, this function will need to be rewrite
     add_action('wp_head', array($this, 'update_view'));
     //Ajax Get Questions Archive link
     add_action('wp_ajax_dwqa-get-questions-permalink', array($this, 'get_questions_permalink'));
     add_action('wp_ajax_nopriv_dwqa-get-questions-permalink', array($this, 'get_questions_permalink'));
     //Ajax stick question
     add_action('wp_ajax_dwqa-stick-question', array($this, 'stick_question'));
     add_action('restrict_manage_posts', array($this, 'admin_posts_filter_restrict_manage_posts'));
     add_action('wp_ajax_dwqa-delete-question', array($this, 'delete_question'));
     // Ajax Update question status
     add_action('wp_ajax_dwqa-update-question-status', array($this, 'update_status'));
     add_filter('parse_query', array($this, 'posts_filter'));
     add_action('wp', array($this, 'schedule_events'));
     add_action('dwqa_hourly_event', array($this, 'do_this_hourly'));
     add_action('before_delete_post', array($this, 'hook_on_remove_question'));
     //Prepare question content
     add_filter('dwqa_prepare_question_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_question_content', array($this, 'pre_content_filter'), 20);
     add_filter('dwqa_prepare_question_update_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_question_update_content', array($this, 'pre_content_filter'), 20);
 }
예제 #2
0
 public function __construct()
 {
     global $dwqa_general_settings;
     if (!$dwqa_general_settings) {
         $dwqa_general_settings = get_option('dwqa_options');
     }
     $slug = isset($dwqa_general_settings['question-rewrite']) ? $dwqa_general_settings['question-rewrite'] : 'question';
     parent::__construct('dwqa-question', array('plural' => __('Questions', 'dwqa'), 'singular' => __('Question', 'dwqa'), 'menu' => __('Questions', 'dwqa'), 'rewrite' => array('slug' => $slug, 'with_front' => false)));
     add_action('manage_dwqa-question_posts_custom_column', array($this, 'columns_content'), 10, 2);
     // Update view count of question, if we change single question template into shortcode, this function will need to be rewrite
     add_action('wp_head', array($this, 'update_view'));
     //Ajax Get Questions Archive link
     add_action('wp_ajax_dwqa-get-questions-permalink', array($this, 'get_questions_permalink'));
     add_action('wp_ajax_nopriv_dwqa-get-questions-permalink', array($this, 'get_questions_permalink'));
     //Ajax stick question
     add_action('wp_ajax_dwqa-stick-question', array($this, 'stick_question'));
     add_action('restrict_manage_posts', array($this, 'admin_posts_filter_restrict_manage_posts'));
     // Ajax Update question status
     add_filter('parse_query', array($this, 'posts_filter'));
     add_action('wp', array($this, 'schedule_events'));
     add_action('dwqa_hourly_event', array($this, 'do_this_hourly'));
     add_action('before_delete_post', array($this, 'hook_on_remove_question'));
     //Prepare question content
     add_filter('dwqa_prepare_question_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_question_content', array($this, 'pre_content_filter'), 20);
     add_filter('dwqa_prepare_update_question', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_update_question', array($this, 'pre_content_filter'), 20);
     add_action('dwqa-prepare-archive-posts', array($this, 'prepare_archive_posts'));
     add_action('dwqa-after-archive-posts', array($this, 'after_archive_posts'));
 }
예제 #3
0
파일: Answer.php 프로젝트: Trideon/gigolo
 public function __construct()
 {
     parent::__construct('dwqa-answer', array('plural' => __('Answers', 'dwqa'), 'singular' => __('Answer', 'dwqa'), 'menu' => __('Answers', 'dwqa')));
     add_action('manage_' . $this->get_slug() . '_posts_custom_column', array($this, 'columns_content'), 10, 2);
     add_action('post_row_actions', array($this, 'unset_old_actions'));
     // Ajax add answer
     add_action('wp_ajax_dwqa-add-answer', array($this, 'insert'));
     add_action('wp_ajax_nopriv_dwqa-add-answer', array($this, 'insert'));
     // Ajax remove Answer
     add_action('wp_ajax_dwqa-action-remove-answer', array($this, 'remove_answer'));
     // Ajax flag answer spam
     add_action('wp_ajax_dwqa-action-flag-answer', array($this, 'flag'));
     //Ajax vote best answer
     add_action('wp_ajax_dwqa-vote-best-answer', array($this, 'vote_best_answer'));
     add_action('wp_ajax_dwqa-unvote-best-answer', array($this, 'unvote_best_answer'));
     //Cache
     add_action('dwqa_add_answer', array($this, 'update_transient_when_add_answer'), 10, 2);
     add_action('dwqa_delete_answer', array($this, 'update_transient_when_remove_answer'), 10, 2);
     //Prepare answers for single questions
     add_action('the_posts', array($this, 'prepare_answers'), 10, 2);
     // Prepare answers content
     add_filter('dwqa_prepare_answer_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_answer_content', array($this, 'pre_content_filter'), 20);
 }
예제 #4
0
 public function __construct()
 {
     parent::__construct('dwqa-answer', array('plural' => __('Answers', 'dwqa'), 'singular' => __('Answer', 'dwqa'), 'menu' => __('Answers', 'dwqa')));
     add_action('manage_' . $this->get_slug() . '_posts_custom_column', array($this, 'columns_content'), 10, 2);
     add_action('post_row_actions', array($this, 'unset_old_actions'));
     //Cache
     add_action('dwqa_add_answer', array($this, 'update_transient_when_add_answer'), 10, 2);
     add_action('dwqa_delete_answer', array($this, 'update_transient_when_remove_answer'), 10, 2);
     // Prepare answers content
     add_filter('dwqa_prepare_answer_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_answer_content', array($this, 'pre_content_filter'), 20);
     // prepare edit content
     add_filter('dwqa_prepare_edit_answer_content', array($this, 'pre_content_kses'), 10);
     add_filter('dwqa_prepare_edit_answer_content', array($this, 'pre_content_filter'), 20);
 }