Week in Core, August 16 – 23, 2016

Welcome back the latest issue of Week in CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., covering changes [38274-38345]. Here are the highlights:

  • 72 commits
  • 40 contributors
  • 100 tickets created
  • 9 tickets reopened
  • 96 tickets closed

Ticketticket Created for both bug reports and feature development on the bug tracker. numbers based on trac timeline for the period above. The following is a summary of commits, organized by component.

Code Changes

Administration

  • Allow for .nav-tab-wrapper class to be used on elements other than h3 to increase flexibility for custom settings pages. [38306] #37257

AJAX

  • add a new function, wp_doing_ajax(), which can replace… (wait for it…) DOING_AJAX checks via the constant. [38334] #25669

Bootstrap/Load

  • Include PluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. via require_once. [38282] #37707

Cache

  • in WP_Object_Cache, $cache_misses is public, but $cache_hits is private. They should both be public, because they’re useful for debugging purposes. [38335] #37726

Comments

  • in wp_handle_comment_submission(), $_wp_unfiltered_html_comment is passed as part of $comment_data, but is not used locally. [38313] #37771
  • in WP_Comment_Query::fill_descendants(), continue if there is an empty array in the loopLoop The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. https://codex.wordpress.org/The_Loop.. [38298] #37416
  • in WP_Comment_Query::fill_descendants(), compute count() in the first for expression so that it does not run on each iteration. [38297] #37416

Customize

  • Ensure a newly-added custom link nav menu item has the appropriate CSSCSS Cascading Style Sheets. class names. [38301] #37575

Database

  • WP_Network, WP_Network_Query, and WP_Site_Query call wpdb::_escape(), thus requiring it to be public. It previously had no access modifier. _ at the beginning of a method, believe it or not, does not enforce visibility constraints. [38314] #37771

Docs

  • Update jsdoc in customize-nav-menus.js to remove references to Menu CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your site’s appearance settings. plugin. Also fix @param for updateAssignedLocationsInSectionTitle. [38300] #37520
  • Update outdated phpdocPHPDoc (docblock, inline docs) for WP_Customize_Manager::validate_setting_values() to reflect changes in [37942]. [38299] #37247, #37759
  • Correct usage examples for wpdb::prepare(), which should not be called statically. [38289] #37744
  • Fix typo in load_plugin_textdomain() parameter description. [38284] #37318

Embeds

  • In get_oembed_endpoint_url(), avoid inadvertent stomping of the $format parameter passed to oembed_endpoint_url filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output.. [38321] #37751

External Libraries

  • Update minified version of jquery.masonry.js. Merge of [38276] and [38281] to the 4.6 branchbranch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch".. [38339] #37720, #37666
  • Update to Requests master (fb5b517) which corrects a logic inversion in the cURL transport checks. Merge of [38274] to the 4.6 branch. [38338] #37700
  • Fix jshint of Gruntfile.js. Introduced in [38276] [38281] #37720
  • Update Minified version of jquery.masonry.js [38276] #37720, #37666

General

  • remove variable set needlessly in wp_check_jsonp_callback(). [38308] #37771

HooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same.

  • Standardize naming of dynamic hooks to use interpolation vs concatenation. [38307] #37748

HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.

  • in WP_HTTP_Response, the @param declarations for $status and $headers were swapped. Let us correct this. [38315] #37771

I18Ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill.

  • Add translator comments for strings in wp-includes/functions.wp-scripts.php. [38345] #37803
  • Add translator comments for strings in wp-includes/functions.php. [38344] #37802
  • Add translator comments for strings in wp-includes/deprecated.php. [38343] #37797
  • Add translator comments for strings in wp-includes/class-walker-comment.php. [38342] #37796
  • Add translator comments for strings in wp-includes/author-template.php. [38341] #37795
  • Add translator comments for strings in wp-includes/admin-bar.php. [38340] #37794
  • Remove unnecessary context for two strings on “Add New User” screen. [38329] #37784
  • Remove unnecessary context in wp_post_revision_title_expanded(). [38327] #37781
  • Use a consistent context for “Add New” submenu strings in adminadmin (and super admin) bar (Toolbar). [38326] #37780
  • Allow for WordPress Plugin/Theme Directory URLs to be localized. [38325] #37501
  • Replace unnecessary context with translator comments in wp_post_revision_title() and wp_post_revision_title_expanded(). [38324] #37778
  • Replace unnecessary context with a translator comment for %s Sites string in network_step1(). [38323] #37777
  • Replace unnecessary context with a translator comment for %s KB string on Networknetwork (versus site, blog) Settings screen. [38322] #37496
  • Add translator comments for Edit Site: %s string in network admin. [38320] #37776

LocaleLocale A locale is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil). Other examples of locales include Canadian English and U.S. English.

Login

  • retrieve_password() does not need to import 2 globals that it does not use. [38304] #37699

Mail

  • If post-by-email functionality is disabled, wp-mail.php should return a 403 Forbidden status code instead if 500 Internal Server Error. [38332] #37572
  • Don’t set Sender field when setting From. Merges [38286] to the 4.6 branch. [38287] #37736
  • Don’t set Sender field when setting From. [38286] #37736

Media

  • remove function_exists() call for ini_get() in _load_image_to_edit_path(). [38333] #37681
  • remove unnecessary variable assignment in gallery_shortcode(). [38309] #37771
  • add a function, wp_get_additional_image_sizes(), that wraps the retrieval of the global $_wp_additional_image_sizes. Removes 6 global imports. [38303] #37699
  • fix unit testunit test Code written to test a small piece of code or functionality within a larger application. Everything from themes to WordPress core have a series of unit tests. Also see regression. after [38296].
  • use wp_get_attachment_metadata() instead of get_post_meta() where appropriate. [38296] #36246
  • wp_get_attachment_link() fails to output text for non-images if the attachment post doesn’t have a title and $text (argument #5) was not passed to the func. In this case, use the filename. [38295] #5, #37343
  • when calling pathinfo(), also pass a PATHINFO_* constant to avoid array notices for unset keys. [38294] #37608
  • Add some docs to media-gallery.js RIP. [38293] #37717

Multisitemultisite Used to describe a WordPress installation with a network of multiple blogs, grouped by sites. This installation type has shared users tables, and creates separate database tables for each blog (wp_posts becomes wp_0_posts). See also network, blog, site

  • Fix copy/paste issue in id attribute for a dismissible message on Sites screen. [38305] #37764

Nav Menus

  • remove unnecessary variable assignment in wp_nav_menu_item_post_type_meta_box(). [38311] #37771

Query

  • use correct description in the docblockdocblock (phpdoc, xref, inline docs) for $number in WP_Comment_Query, WP_Network_Query, and WP_Site_Query. [38336] #37621
  • Non-scalar and negative values for ‘p’ should always result in a 404. [38288] #33372
  • use composition for $db in WP_Date_Query, removes need to import global $wpdb in multiple methods. [38280] #37699
  • use composition for $db in WP_Query, removes need to import global $wpdb in multiple methods. [38279] #37699
  • add a protected field, $db, (composition, as it were) to WP_*_Query classes to hold the value for the database abstraction, instead of importing the global $wpdb into every method that uses it. Reduces the number of global imports by 32. [38275] #37699

REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/.

  • remove unnecessary variable assignments in rest_handle_options_request(). [38310] #37771

TaxonomyTaxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies.

  • in get_terms(), do not assume that legacy args are being passed when the only params are top-level meta_* values. Add keys in WP_Term_Query::__construct(). Adds unit tests. [38337] #37568
  • remove unnecessary break in WP_Term::__get(). [38312] #37771
  • In is_object_in_term(), return error object rather than caching it. [38277] #32044, #36814, #37721
  • Allow attachment taxonomies to be fetched as objects. [38292] #37368

Tests

  • Fix incorrect variable name from [38330]. [38331] #37630
  • Attachment create() method should match signature of other create() methods. Legacy argument format continues to be accepted. [38330] #37630
  • Move some utility classes to their own files. [38285] #37523
  • skip checking the value in Tests_User:test_user_properties for db. Casting to array is not the most elegant thing here, and various versions of PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher key protected/private fields differently when objects are cast. [38278] #37699
  • Introduce tests for get_attachment_taxonomies(). [38291] #37368
  • Introduce tests for get_object_taxonomies(). [38290] #37368
  • Add wordpress-importer tests demonstrating slashed data behavior. [38283] #21007

TinyMCE

  • make sure the temporary id is removed when using the default image dialog and inserting an external image. [38328] #37467

Users

  • after [38317], use a @property annotation, instead of a public field. [38319] #37771
  • $user_level has been publicly-accessed on instances of WP_User since version 2.0, but is has never been declared. [38317] #37771

Widgets

  • $option_name and $alt_option_name have been used as members ever since WP_Widget became an object in 2.8, but never declared. [38318] #37771

Props

Thanks to @afercia, @Akeif, @azaozz, @bcole808, @boonebgorges, @Clorith, @codemovementpk, @danhgilmore, @danielbachhuber, @dd32, @deremohan, @dlh, @DrewAPicture, @flixos90, @fomenkoandrey, @Frank, @gma992, @henrywright, @iandunn, @imath, @JaworskiMatt, @jipmoors, @Jonnyauk, @jorbin, @JorritSchippers, @Klein, @kouratoras, @Mte90, @Presskopp, @ramiy, @rpayne7264, @sebastianpisula, @SergeyBiryukov, @swissspidy, @tivnet, @TJNowell, @tomdxw, @vishalkakadiya, @westonruter, and @wonderboymusic for their contributions!

#4-6, #week-in-core