<?php /** * Graph data. * * @author dligthart * @version 0.2 * @package wp-stats-dashboard */ include_once realpath(dirname(__FILE__) . '/../../../../..') . '/wp-load.php'; // load wordpress context. if (isset($_REQUEST['_nonce'])) { // Get chart data. if (is_active_widget(false, false, 'wpsdminigraphwidget', true)) { // if users allows widget, the data is readable. echo wpsd_get_chart_data(); } }
/** * wpsd_get_chart_xy function. * * @access public * @return void */ function wpsd_get_chart_xy() { $data = wpsd_get_chart_data(); preg_match('#x_labels=(.*?)\\n#i', $data, $matches); $x_axis = explode(',', str_replace('&', '', $matches[1])); preg_match('#values=(.*?)\\n#i', $data, $matches); $y_axis = explode(',', str_replace('&', '', $matches[1])); return array($x_axis, $y_axis); }