function gce_print_list($feed_ids, $title_text, $max_events, $sort_order, $grouped = false) { require_once 'inc/gce-parser.php'; $ids = explode('-', $feed_ids); //Create new GCE_Parser object, passing array of feed id(s) $list = new GCE_Parser($ids, $title_text, $max_events, $sort_order); $num_errors = $list->get_num_errors(); //If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the list if ($num_errors < count($ids)) { $markup = '<div class="gce-page-list">' . $list->get_list($grouped) . '</div>'; //If there was at least one error, return the list markup with error messages (for admins only) if ($num_errors > 0 && current_user_can('manage_options')) { return $list->error_messages() . $markup; } //Otherwise just return the list markup return $markup; } else { //If current user is an admin, display an error message explaining problem(s). Otherwise, display a 'nice' error messsage if (current_user_can('manage_options')) { return $list->error_messages(); } else { $options = get_option(GCE_GENERAL_OPTIONS_NAME); return wp_kses_post($options['error']); } } }
function gce_widget_content_list($feed_ids, $title_text, $max_events, $sort_order, $grouped = false) { require_once WP_PLUGIN_DIR . '/' . GCE_PLUGIN_NAME . '/inc/gce-parser.php'; $ids = explode('-', $feed_ids); //Create new GCE_Parser object, passing array of feed id(s) $list = new GCE_Parser($ids, $title_text, $max_events, $sort_order); $num_errors = $list->get_num_errors(); //If there are less errors than feeds parsed, at least one feed must have parsed successfully so continue to display the list if ($num_errors < count($ids)) { //If there was at least one error, and user is an admin, output error messages if ($num_errors > 0 && current_user_can('manage_options')) { echo $list->error_messages(); } echo $list->get_list($grouped); } else { //If current user is an admin, display an error message explaining problem(s). Otherwise, display a 'nice' error messsage if (current_user_can('manage_options')) { echo $list->error_messages(); } else { $options = get_option(GCE_GENERAL_OPTIONS_NAME); echo $options['error']; } } }