Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_dashboard_rss_control [ WordPress Function ]

wp_dashboard_rss_control ( $widget_id, $form_inputs = array() )
Parameters:
  • (string) $widget_id
  • (array) $form_inputs
Defined at:



The RSS dashboard widget control.

Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data from RSS-type widgets.

Source


<?php
function wp_dashboard_rss_control$widget_id$form_inputs = array() ) {
    if ( !
$widget_options get_option'dashboard_widget_options' ) )
        
$widget_options = array();

    if ( !isset(
$widget_options[$widget_id]) )
        
$widget_options[$widget_id] = array();

    
$number 1// Hack to use wp_widget_rss_form()
    
$widget_options[$widget_id]['number'] = $number;

    if ( 
'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
        
$_POST['widget-rss'][$number] = stripslashes_deep$_POST['widget-rss'][$number] );
        
$widget_options[$widget_id] = wp_widget_rss_process$_POST['widget-rss'][$number] );
        
// title is optional. If black, fill it if possible
        
if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
            
$rss fetch_feed($widget_options[$widget_id]['url']);
            if ( 
is_wp_error($rss) ) {
                
$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
            } else {
                
$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
                
$rss->__destruct();
                unset(
$rss);
            }
        }
        
update_option'dashboard_widget_options'$widget_options );
        
$cache_key 'dash_' md5$widget_id );
        
delete_transient$cache_key );
    }

    
wp_widget_rss_form$widget_options[$widget_id], $form_inputs );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics