Esempio n. 1
0
 /**
  * Displays metabox content
  *
  * @param object $post
  *
  * @return void
  */
 public function display($post)
 {
     $reports = appthemes_get_post_reports($post->ID);
     $reports = $reports->reports;
     if (empty($reports)) {
         echo '<p id="no-reports">' . __('No reports yet.', APP_TD) . '</p>';
     } else {
         $table = new APP_Reports_Table_Admin($post->ID, $reports);
         echo $table->show();
     }
 }
Esempio n. 2
0
 /**
  * Sends notification to admin
  *
  * @param object $report
  *
  * @return void
  */
 public static function notify_admin($report)
 {
     $options = appthemes_load_reports_options();
     if (!$options->get(array('reports', 'send_email'))) {
         return;
     }
     // notify only once per post about report
     $reports = appthemes_get_post_reports($report->get_post_ID());
     if (count($reports->reports) > 1) {
         return;
     }
     $emails = apply_filters('comment_notification_recipients', array(), $report->get_id());
     $subject = apply_filters('comment_notification_subject', '', $report->get_id());
     $notify_message = apply_filters('comment_notification_text', '', $report->get_id());
     foreach ($emails as $email) {
         appthemes_send_email($email, $subject, $notify_message);
     }
 }
Esempio n. 3
0
/**
 * Retrieves the total reports for a post
 *
 * @param int $post_id The post ID
 * @param array $args (optional) WP_Comment_Query args to be used to fetch the report collection
 * @param type $cached (optional) If set to TRUE will fetch the meta value stored in the DB
 *
 * @return type
 */
function appthemes_get_post_total_reports($post_id, $args = array(), $cached = false)
{
    $reports = appthemes_get_post_reports($post_id, $args);
    return $reports->get_total_reports($cached);
}