* @copyright Copyright(c) 2012-2015, Jean Galea * @link http://www.wprssaggregator.com * @license http://www.gnu.org/licenses/gpl.html */ /* //allow redirection, even if my theme starts to send output to the browser add_action( 'admin_init', 'wprss_do_output_buffer' ); function wprss_do_output_buffer() { //ob_start(); }*/ /** * Returns the debugging operations array * * @since 3.4.6 */ function wprss_get_debug_operations() { $operations = apply_filters( 'wprss_debug_operations', array( 'update-feeds' => array( 'nonce' => 'wprss-update-feed-items', 'run' => 'wprss_fetch_insert_all_feed_items', 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=1', 'render' => 'wprss_debug_update_feeds', ), 'reimport-feeds' => array( 'nonce' => 'wprss-delete-import-feed-items', 'run' => 'wprss_feed_reset', 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=2', 'render' => 'wprss_debug_reimport_feeds', ), ) ); $operations['render-error-log'] = apply_filters( 'wprss_render_error_log_operation', array( 'nonce' => null, 'run' => null, 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging', 'render' => 'wprss_debug_render_error_log' ) ); $operations['download-error-log'] = apply_filters( 'wprss_debug_download_error_log_operation', array( 'nonce' => 'wprss-download-error-log', 'run' => 'wprss_download_log', 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging', 'render' => 'wprss_debug_download_log_button' ) ); $operations['clear-error-log'] = apply_filters( 'wprss_debug_error_log_operation', array( 'nonce' => 'wprss-clear-error-log', 'run' => 'wprss_clear_log', 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=3', 'render' => 'wprss_debug_clear_log_button' ) ); $operations ['restore-settings'] = apply_filters( 'wprss_debug_restore_settings_operation', array( 'nonce' => 'wprss-restore-settings', 'run' => 'wprss_restore_settings', 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=4', 'render' => 'wprss_debug_restore_settings', 'pos' => 'bottom' ) ); return $operations; } add_action( 'admin_init', 'wprss_debug_operations' ); /** * Performs debug operations, depending on the POST request. * * @since 3.3 */ function wprss_debug_operations(){ // Define the debugging operations $debug_operations = wprss_get_debug_operations(); // Check which of the operations needs to be run foreach ( $debug_operations as $id => $operation ) { // If page loading after having clicked 'Update all fields' if ( isset( $_POST[ $id ] ) && check_admin_referer( $operation['nonce'] ) ) { call_user_func( $operation['run'] ); wp_redirect( $operation['redirect'] ); break; } } } /** * Build the Update Feeds section * * @since 3.4.6 */ function wprss_debug_update_feeds() { ?>


Note: This might take more than a few seconds if you have many feed sources.', WPRSS_TEXT_DOMAIN ); ?>

Note: This is a server-intensive process and should only be used when instructed to by support staff.', WPRSS_TEXT_DOMAIN ); ?>

Note: This cannot be undone. Once the settings have been reset, your old settings cannot be restored.', WPRSS_TEXT_DOMAIN ); ?>

'debug_feeds_updating', '2' => 'debug_feeds_reimporting', '3' => 'debug_cleared_log', '4' => 'debug_settings_reset', ) ); ?>

getAdminHelper(); foreach ( $debug_messages as $id => $noticeId) { if ( $message == $id ) { $noticeId = $helper->resolveValueOutput($noticeId); $component = wprss()->getAdminAjaxNotices(); $collection = $component->getNoticeCollection(); try { $noticeObj = $component->getNotice($noticeId); if (!$noticeObj instanceof Aventura\Wprss\Core\DataObject) { throw new Exception( sprintf( __('Expected notice to be a DataObject instance: %s given.', WPRSS_TEXT_DOMAIN), is_object($noticeObj)? get_class($noticeObj) : gettype($noticeObj) ) ); } } catch (ServiceNotFoundException $ex) { $content = trim(strip_tags($noticeId, '

')); $noticeObj = $helper->createNotice(array( 'content' => $content, 'dismiss_mode' => NoticeInterface::DISMISS_MODE_FRONTEND, )); } $noticeData = $noticeObj->getData(); echo $collection->render_notice($collection->normalize_notice_data($noticeData)); break; } } } do_action( 'wprss_debugging_before' ); $bottom = array(); $debug_operations = wprss_get_debug_operations(); foreach( $debug_operations as $id => $data ) { if ( !isset( $data['render'] ) ) continue; $pos = isset( $data['pos'] ) ? $data['pos'] : 'normal'; if ( $pos == 'normal' ) { call_user_func( $data['render'] ); } elseif( $pos == 'bottom' ) { $bottom[$id] = $data; } } do_action( 'wprss_debugging_after' ); wprss_system_info(); if ( count($bottom) > 0 ) { foreach( $bottom as $id => $data ) { if ( !isset( $data['render'] ) ) continue; call_user_func( $data['render'] ); } } ?>