* @package AnsPress */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } /** * Dashboard class. */ class AnsPress_Dashboard { /** * Init class. */ public static function init() { add_action( 'admin_footer', array( __CLASS__, 'admin_footer' ) ); add_meta_box( 'ap-mb-attn', '' . __( 'Require Attention', 'anspress-question-answer' ), array( __CLASS__, 'anspress_attn' ), 'anspress', 'column1', 'core' ); add_meta_box( 'anspress_feed', 'AnsPress Feed', array( __CLASS__, 'anspress_feed' ), 'anspress', 'column1', 'core' ); add_meta_box( 'ap-mb-qstats', '' . __( 'Questions', 'anspress-question-answer' ), array( __CLASS__, 'anspress_stats' ), 'anspress', 'column2', 'core' ); add_meta_box( 'ap-mb-latestq', __( 'Latest Questions', 'anspress-question-answer' ), array( __CLASS__, 'anspress_latestq' ), 'anspress', 'column2', 'core' ); add_meta_box( 'ap-mb-astats', '' . __( 'Answer', 'anspress-question-answer' ), array( __CLASS__, 'anspress_astats' ), 'anspress', 'column3', 'core' ); add_meta_box( 'ap-mb-latesta', __( 'Latest Answers', 'anspress-question-answer' ), array( __CLASS__, 'anspress_latesta' ), 'anspress', 'column3', 'core' ); } /** * Add javascript in dashboard footer. */ public static function admin_footer() { ?>
get_results( "SELECT date_format(post_date, '%d %a') as post_day, post_date, count(ID) as post_count from {$wpdb->posts} WHERE post_status IN('publish', 'private_post', 'moderate') AND post_type = 'question' AND post_date > (NOW() - INTERVAL 1 MONTH) GROUP BY post_day ORDER BY post_date ASC" ); // db call okay, cache okay. $days = array(); $counts = array(); foreach ( (array) $results as $r ) { $days[] = $r->post_day; $counts[] = $r->post_count; } ?> get_results( "SELECT date_format(post_date, '%d %a') as post_day, post_date, count(ID) as post_count from {$wpdb->posts} WHERE post_status IN('publish', 'private_post', 'moderate') AND post_type = 'answer' AND post_date > (NOW() - INTERVAL 1 MONTH) GROUP BY post_day ORDER BY post_date ASC" ); // db call okay, cache ok. $days = array(); $counts = array(); foreach ( (array) $results as $r ) { $days[] = $r->post_day; $counts[] = $r->post_count; } ?>'.__( 'Apparently, there are no updates to show!','anspress-question-answer' ).'
'; $rss->__destruct(); unset($rss ); return; } ?>