本文整理汇总了PHP中wp_widget_rss_process函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_widget_rss_process函数的具体用法?PHP wp_widget_rss_process怎么用?PHP wp_widget_rss_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_widget_rss_process函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xpress_dashboard_rss_control
function xpress_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
if ( !$widget_options = get_option( 'xpress_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(strip_tags($rss->get_title()));
else
$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
}
update_option( 'xpress_dashboard_widget_options', $widget_options );
}
wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:26,代码来源:dashboard_feed.php
示例2: update
function update($new_instance, $old_instance)
{
$testurl = isset($new_instance['url']) && (!isset($old_instance['url']) || $new_instance['url'] != $old_instance['url']);
return wp_widget_rss_process($new_instance, $testurl);
}
开发者ID:ryanmerritt,项目名称:WordPress,代码行数:5,代码来源:default-widgets.php
示例3: wp_dashboard_rss_control
/**
* 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.
*
* @since 2.5.0
*
* @param string $widget_id
* @param array $form_inputs
*/
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] = wp_unslash($_POST['widget-rss'][$number]);
$widget_options[$widget_id] = wp_widget_rss_process($_POST['widget-rss'][$number]);
$widget_options[$widget_id]['number'] = $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);
}
开发者ID:riasnelli,项目名称:WordPress,代码行数:43,代码来源:dashboard.php
示例4: update
function update($new_instance, $old_instance) {
$testurl = $new_instance['url'] != $old_instance['url'];
return wp_widget_rss_process( $new_instance, $testurl );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:4,代码来源:default-widgets.php
示例5: wp_dashboard_rss_control
/**
* 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.
*
* @since unknown
*
* @param string widget_id
* @param array form_inputs
*/
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']) ) {
require_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss($widget_options[$widget_id]['url']);
$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->channel['title']));
}
update_option( 'dashboard_widget_options', $widget_options );
}
wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:35,代码来源:dashboard.php
示例6: wp_widget_rss_control
/**
* Display and process RSS widget control form.
*
* @since 2.2.0
*
* @param int $widget_args Widget number.
*/
function wp_widget_rss_control($widget_args)
{
global $wp_registered_widgets;
static $updated = false;
if (is_numeric($widget_args)) {
$widget_args = array('number' => $widget_args);
}
$widget_args = wp_parse_args($widget_args, array('number' => -1));
extract($widget_args, EXTR_SKIP);
$options = get_option('widget_rss');
if (!is_array($options)) {
$options = array();
}
$urls = array();
foreach ((array) $options as $option) {
if (isset($option['url'])) {
$urls[$option['url']] = true;
}
}
if (!$updated && 'POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['sidebar'])) {
$sidebar = (string) $_POST['sidebar'];
$sidebars_widgets = wp_get_sidebars_widgets();
if (isset($sidebars_widgets[$sidebar])) {
$this_sidebar =& $sidebars_widgets[$sidebar];
} else {
$this_sidebar = array();
}
foreach ((array) $this_sidebar as $_widget_id) {
if ('wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number'])) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
if (!in_array("rss-{$widget_number}", $_POST['widget-id'])) {
// the widget has been removed.
unset($options[$widget_number]);
}
}
}
foreach ((array) $_POST['widget-rss'] as $widget_number => $widget_rss) {
if (!isset($widget_rss['url']) && isset($options[$widget_number])) {
// user clicked cancel
continue;
}
$widget_rss = stripslashes_deep($widget_rss);
$url = sanitize_url(strip_tags($widget_rss['url']));
$options[$widget_number] = wp_widget_rss_process($widget_rss, !isset($urls[$url]));
}
update_option('widget_rss', $options);
$updated = true;
}
if (-1 == $number) {
$title = '';
$url = '';
$items = 10;
$error = false;
$number = '%i%';
$show_summary = 0;
$show_author = 0;
$show_date = 0;
} else {
extract((array) $options[$number]);
}
wp_widget_rss_form(compact('number', 'title', 'url', 'items', 'error', 'show_summary', 'show_author', 'show_date'));
}
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:69,代码来源:widgets.php
注:本文中的wp_widget_rss_process函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论