init( $sh ); } function init( $sh ) { $this->sh = $sh; add_action("simple_history/dropin/sidebar/sidebar_html", array( $this, "on_sidebar_html" ), 5 ); add_action( 'simple_history/enqueue_admin_scripts', array( $this, 'on_admin_enqueue_scripts') ); add_action( "simple_history/admin_footer", array($this, "on_admin_footer") ); } public function on_admin_enqueue_scripts() { wp_enqueue_script( "simple_history_chart.js", SIMPLE_HISTORY_DIR_URL . "js/Chart.js", array( "jquery" ), SIMPLE_HISTORY_VERSION, true ); } function on_admin_footer() { ?> sh->get_num_events_per_day_last_n_days( $num_days ); // Period = all dates, so empty ones don't get lost $period_start_date = DateTime::createFromFormat('U', strtotime("-$num_days days")); $period_end_date = DateTime::createFromFormat('U', time()); $interval = DateInterval::createFromDateString('1 day'); $period = new DatePeriod($period_start_date, $interval, $period_end_date->add( date_interval_create_from_date_string('1 days') ) ); ?>
%1$s events have been logged the last %2$s days.', "simple-history"), $this->sh->get_num_events_last_n_days( $num_days ), number_format_i18n( $num_days ) ); ?>
getTimestamp() ); $str_date_ymd = date("Y-m-d", $dt->getTimestamp() ); // Get data for this day, if exist // Day in object is in format '2014-09-07' $yearDate = $dt->format( "Y-m-d" ); $day_data = wp_filter_object_list( $num_events_per_day_for_period, array("yearDate" => $yearDate) ); $arr_labels[] = $str_date; $arr_labels_to_datetime[] = array( "label" => $str_date, "date" => $str_date_ymd ); if ( $day_data ) { $day_data = reset( $day_data ); $arr_dataset_data[] = $day_data->count; } else { $arr_dataset_data[] = 0; } } ?>