diff --git Gruntfile.js Gruntfile.js
index 7d820e1075..0188625447 100644
|
|
module.exports = function(grunt) { |
1127 | 1127 | files: [ |
1128 | 1128 | SOURCE_DIR + '**', |
1129 | 1129 | '!' + SOURCE_DIR + 'js/**/*.js', |
| 1130 | '!' + SOURCE_DIR + 'wp-content/**', |
1130 | 1131 | // Ignore version control directories. |
1131 | 1132 | '!' + SOURCE_DIR + '**/.{svn,git}/**' |
1132 | 1133 | ], |
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index edc30cda2c..17c75bf950 100644
|
|
function wp_dashboard_rss_output( $widget_id ) { |
1094 | 1094 | * @return bool True on success, false on failure. |
1095 | 1095 | */ |
1096 | 1096 | function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) { |
| 1097 | /* |
| 1098 | always show the latest new item |
| 1099 | if the 2nd was published less than 7-10 days ago, show it too |
| 1100 | */ |
| 1101 | |
1097 | 1102 | $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>'; |
1098 | 1103 | $doing_ajax = wp_doing_ajax(); |
1099 | 1104 | |
… |
… |
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar |
1108 | 1113 | |
1109 | 1114 | $locale = get_user_locale(); |
1110 | 1115 | $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
| 1116 | |
1111 | 1117 | $output = get_transient( $cache_key ); |
1112 | 1118 | if ( false !== $output ) { |
1113 | 1119 | echo $output; |
… |
… |
function wp_print_community_events_templates() { |
1419 | 1425 | * |
1420 | 1426 | * @since 2.7.0 |
1421 | 1427 | * @since 4.8.0 Removed popular plugins feed. |
| 1428 | * @since todo 2nd news item conditionally displayed, if so then planet item removed |
1422 | 1429 | */ |
1423 | 1430 | function wp_dashboard_primary() { |
1424 | 1431 | $feeds = array( |
… |
… |
function wp_dashboard_primary() { |
1441 | 1448 | * @param string $url The widget's primary feed URL. |
1442 | 1449 | */ |
1443 | 1450 | 'url' => apply_filters( 'dashboard_primary_feed', __( 'https://wordpress.org/news/feed/' ) ), |
| 1451 | // save to constant to make DRY? |
1444 | 1452 | |
1445 | 1453 | /** |
1446 | 1454 | * Filters the primary link title for the 'WordPress Events and News' dashboard widget. |
… |
… |
function wp_dashboard_primary() { |
1450 | 1458 | * @param string $title Title attribute for the widget's primary link. |
1451 | 1459 | */ |
1452 | 1460 | 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), |
1453 | | 'items' => 1, |
| 1461 | 'items' => 1, // leave at one to test condition |
| 1462 | // 'items' => 2, |
1454 | 1463 | 'show_summary' => 0, |
1455 | 1464 | 'show_author' => 0, |
1456 | 1465 | 'show_date' => 0, |
… |
… |
function wp_dashboard_primary() { |
1511 | 1520 | * @param array $feeds Array of RSS feeds. |
1512 | 1521 | */ |
1513 | 1522 | function wp_dashboard_primary_output( $widget_id, $feeds ) { |
| 1523 | add_action( 'wp_feed_post_init', '_wp_dashboard_add_extra_news_item', 10, 2 ); |
| 1524 | // needs to be all time because of ajax? doesn't need to run when cached, just when savings |
| 1525 | |
1514 | 1526 | foreach ( $feeds as $type => $args ) { |
1515 | 1527 | $args['type'] = $type; |
1516 | 1528 | echo '<div class="rss-widget">'; |
| 1529 | // or maybe don't call this function, and instead call fetch_feed() yourself? |
1517 | 1530 | wp_widget_rss_output( $args['url'], $args ); |
1518 | 1531 | echo '</div>'; |
1519 | 1532 | } |
| 1533 | |
| 1534 | remove_action( 'wp_feed_post_init', '_wp_dashboard_add_extra_news_item', 10 ); |
| 1535 | } |
| 1536 | |
| 1537 | |
| 1538 | function _wp_dashboard_add_extra_news_item( $feed, $url ) { |
| 1539 | // if wrong url, return |
| 1540 | if ( __( 'https://wordpress.org/news/feed/' ) !== $url ) { |
| 1541 | return; |
| 1542 | } |
| 1543 | |
| 1544 | var_dump($feed);wp_die(); |
| 1545 | // just modify public data or raw_data? |
| 1546 | // or use accessor functions? |
| 1547 | |
| 1548 | // make sure passing by reference |
| 1549 | |
| 1550 | |
| 1551 | // if 2nd item has been displayed for 7+ days already, then remove it |
| 1552 | |
| 1553 | // but also need to need to edit the planet feed to make remove one of theirs, so would need some kind of global variable to track that |
| 1554 | // this architecture is so not straightforward, maybe refactor it instead |
| 1555 | // top level function should call model to get array of items, then modify it, then pass it to function to render it |
1520 | 1556 | } |
1521 | 1557 | |
1522 | 1558 | /** |
diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
index e0170f2705..5a74d7b894 100644
|
|
function upgrade_550() { |
2202 | 2202 | } |
2203 | 2203 | } |
2204 | 2204 | |
| 2205 | // need to flush cache during upgrade, otherwise will get errors b/c code expects 2 but there's only 1? |
| 2206 | // prob. just delete the transient |
| 2207 | $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
| 2208 | // need to do for all locales. so sql query to delete where LIKE ? |
| 2209 | // but object cache |
| 2210 | // maybe simpler to just have code check if there's a 2nd |
| 2211 | // or do all transients get cleared during upgrade anyway? |
| 2212 | |
2205 | 2213 | /** |
2206 | 2214 | * Executes network-level upgrade routines. |
2207 | 2215 | * |
diff --git src/wp-includes/feed.php src/wp-includes/feed.php
index 0b84cc10a5..646fa4cf28 100644
|
|
function fetch_feed( $url ) { |
821 | 821 | $feed->init(); |
822 | 822 | $feed->set_output_encoding( get_option( 'blog_charset' ) ); |
823 | 823 | |
| 824 | // add action here, so can modify the results? |
| 825 | |
| 826 | do_action_ref_array( 'wp_feed_post_init', array( &$feed, $url ) ); |
| 827 | |
824 | 828 | if ( $feed->error() ) { |
825 | 829 | return new WP_Error( 'simplepie-error', $feed->error() ); |
826 | 830 | } |
diff --git src/wp-includes/widgets.php src/wp-includes/widgets.php
index 0d176687fb..5d3069080f 100644
|
|
function wp_widget_rss_output( $rss, $args = array() ) { |
1528 | 1528 | return; |
1529 | 1529 | } |
1530 | 1530 | |
| 1531 | // could maybe assign get_items() to a var, and filter that. that might be cleanest. |
| 1532 | // although, if gonna add a filter, might as well do it higher up so it's useful to more people |
| 1533 | |
1531 | 1534 | echo '<ul>'; |
1532 | 1535 | foreach ( $rss->get_items( 0, $items ) as $item ) { |
1533 | 1536 | $link = $item->get_link(); |