public static function init() { CMA_AnswerThread::init(); CMA_BuddyPress::init(); if (get_option('cma_afterActivation', 0) == 1) { add_action('admin_notices', array(get_class(), 'showProMessages')); } add_action('init', array('CMA_BaseController', 'bootstrap')); add_action('widgets_init', array('CMA_AnswerController', 'registerSidebars')); add_filter('bp_blogs_record_comment_post_types', array(get_class(), 'bp_record_my_custom_post_type_comments')); }
public static function init() { $licensingApi = new CMA_free_Cminds_Licensing_API('CM Answers', CMA_AnswerThread::ADMIN_MENU, 'CM Answers', CMA_PLUGIN_FILE, array('release-notes' => 'http://answers.cminds.com/release-notes/'), '', array('CM Answers')); CMA_AnswerThread::init(); CMA_BuddyPress::init(); if (get_option('cma_afterActivation', 0) == 1) { add_action('admin_notices', array(get_class(), 'showProMessages')); } add_action('init', array('CMA_BaseController', 'bootstrap')); add_filter('bp_blogs_record_comment_post_types', array(get_class(), 'bp_record_my_custom_post_type_comments')); }
?> <div class="ItemContent Discussion"> <a href="<?php echo esc_attr(get_permalink(get_the_ID())); ?> "><?php echo $thread->getTitle(); ?> </a> <div class="Meta"> <span class="Announcement"><?php echo $thread->getLastPosterName(); ?> </span> <span class="LastCommentDate"><?php printf(__('updated %s by %s', 'cm-answers'), CMA_AnswerThread::renderDaysAgo($thread->getUnixUpdated()), $thread->getLastPosterName()); ?> </span> </div> </div> </div> </div> </div> <?php } wp_reset_query(); wp_reset_postdata(); ?> </div> <div class="cma-pagination col-md-12" style="float: left;width: 100%;"><a href="http://kungfuphp.local/answers" style=" background: #58585A none repeat scroll 0 0; height: 38px;
public function getThread() { return CMA_AnswerThread::getInstance($this->getThreadId()); }
public static function addAdminSettings($params = array()) { if (self::_isPost()) { CMA_AnswerThread::setQuestionAutoApproved(isset($_POST['questions_auto_approve']) && $_POST['questions_auto_approve'] == 1); CMA_AnswerThread::setAnswerAutoApproved(isset($_POST['answers_auto_approve']) && $_POST['answers_auto_approve'] == 1); CMA_AnswerThread::setRatingAllowed(isset($_POST['ratings']) && $_POST['ratings'] == 1); CMA_AnswerThread::setNegativeRatingAllowed(isset($_POST['negative_ratings']) && $_POST['negative_ratings'] == 1); CMA_AnswerThread::setNewQuestionNotification(stripslashes($_POST['notification_new_questions'])); CMA_AnswerThread::setNewQuestionNotificationTitle(stripslashes($_POST['new_question_notification_title'])); CMA_AnswerThread::setNewQuestionNotificationContent($_POST['new_question_notification_content']); CMA_AnswerThread::setNotificationTitle(stripslashes($_POST['notification_title'])); CMA_AnswerThread::setNotificationContent(stripslashes($_POST['notification_content'])); CMA_AnswerThread::setVotesMode((int) $_POST['votes_mode']); CMA_AnswerThread::setSidebarEnabled(isset($_POST['sidebar_enable']) && $_POST['sidebar_enable'] == 1); CMA_AnswerThread::setSidebarMaxWidth((int) $_POST['sidebar_max_width']); if (!empty($_POST['questions_title'])) { update_option(CMA_AnswerThread::OPTION_QUESTIONS_TITLE, $_POST['questions_title']); } self::setAnswersMenu(isset($_POST['add_menu']) && $_POST['add_menu'] == 1); } $params['ratings'] = CMA_AnswerThread::isRatingAllowed(); $params['negativeRatings'] = CMA_AnswerThread::isNegativeRatingAllowed(); $params['questionAutoApproved'] = CMA_AnswerThread::isQuestionAutoApproved(); $params['answerAutoApproved'] = CMA_AnswerThread::isAnswerAutoApproved(); $params['notificationNewQuestions'] = CMA_AnswerThread::getNewQuestionNotification(); $params['newQuestionNotificationTitle'] = CMA_AnswerThread::getNewQuestionNotificationTitle(); $params['newQuestionNotificationContent'] = CMA_AnswerThread::getNewQuestionNotificationContent(); $params['notificationTitle'] = CMA_AnswerThread::getNotificationTitle(); $params['notificationContent'] = CMA_AnswerThread::getNotificationContent(); $params['votesMode'] = CMA_AnswerThread::getVotesMode(); $params['sidebarEnable'] = CMA_AnswerThread::isSidebarEnabled(); $params['sidebarMaxWidth'] = CMA_AnswerThread::getSidebarMaxWidth(); $params['addMenu'] = self::addAnswersMenu(); $params['questions_title'] = CMA_AnswerThread::getQuestionsTitle(); return $params; }
public static function notifyAllUsers() { global $wpdb; if (!empty($_GET['nonce']) and wp_verify_nonce($_GET['nonce'], CMA_BaseController::ADMIN_BP_NOTIFY)) { $usersIds = $wpdb->get_col("SELECT ID FROM {$wpdb->users}"); if (!empty($_GET['post_id']) and $thread = CMA_AnswerThread::getInstance($_GET['post_id'])) { $notification = array('item_id' => $thread->getId(), 'secondary_item_id' => 0, 'component_name' => 'cma_notifier', 'component_action' => self::ACTION_NOTIFICATION_THREAD, 'date_notified' => bp_core_current_time(), 'is_new' => 1, 'allow_duplicate' => true); foreach ($usersIds as $userId) { if ($thread->isVisible($userId)) { $notification['user_id'] = $userId; bp_notifications_add_notification($notification); } } } if (!empty($_GET['comment_id']) and $answer = CMA_Answer::getById($_GET['comment_id'])) { $notification = array('item_id' => $answer->getId(), 'secondary_item_id' => 0, 'component_name' => 'cma_notifier', 'component_action' => self::ACTION_NOTIFICATION_ANSWER, 'date_notified' => bp_core_current_time(), 'is_new' => 1, 'allow_duplicate' => true); foreach ($usersIds as $userId) { if ($answer->isVisible($userId)) { $notification['user_id'] = $userId; bp_notifications_add_notification($notification); } } } } wp_safe_redirect(CMA::getReferer()); exit; }