@@ -1265,13 +1318,12 @@ function do_settings_fields($page, $section) {
function add_settings_error( $setting, $code, $message, $type = 'error' ) {
global $wp_settings_errors;
- $new_error = array(
+ $wp_settings_errors[] = array(
'setting' => $setting,
- 'code' => $code,
+ 'code' => $code,
'message' => $message,
- 'type' => $type
+ 'type' => $type
);
- $wp_settings_errors[] = $new_error;
}
/**
@@ -1299,23 +1351,25 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
function get_settings_errors( $setting = '', $sanitize = false ) {
global $wp_settings_errors;
- // If $sanitize is true, manually re-run the sanitization for this option
- // This allows the $sanitize_callback from register_setting() to run, adding
- // any settings errors you want to show by default.
+ /*
+ * If $sanitize is true, manually re-run the sanitization for this option
+ * This allows the $sanitize_callback from register_setting() to run, adding
+ * any settings errors you want to show by default.
+ */
if ( $sanitize )
sanitize_option( $setting, get_option( $setting ) );
- // If settings were passed back from options.php then use them
+ // If settings were passed back from options.php then use them.
if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
$wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
delete_transient( 'settings_errors' );
}
- // Check global in case errors have been added on this pageload
+ // Check global in case errors have been added on this pageload.
if ( ! count( $wp_settings_errors ) )
return array();
- // Filter the results to those of a specific setting if one was set
+ // Filter the results to those of a specific setting if one was set.
if ( $setting ) {
$setting_errors = array();
foreach ( (array) $wp_settings_errors as $key => $details ) {
@@ -1430,8 +1484,9 @@ function the_post_password() {
* returned.
*
* @since 2.7.0
- * @param mixed $post Post id or object. If not supplied the global $post is used.
- * @return string The post title if set
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string The post title if set.
*/
function _draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post );
@@ -1950,7 +2005,7 @@ final class WP_Internal_Pointers {
self::print_js( 'wp360_revisions', '.misc-pub-section.misc-pub-revisions', array(
'content' => $content,
- 'position' => array( 'edge' => is_rtl() ? 'left' : 'right', 'align' => 'center', 'my' => is_rtl() ? 'left' : 'right-14px' ),
+ 'position' => array( 'edge' => is_rtl() ? 'left' : 'right', 'align' => 'center' ),
) );
}
@@ -1978,7 +2033,7 @@ final class WP_Internal_Pointers {
if ( 'themes' === get_current_screen()->id ) {
$selector = '.theme.active .customize';
- $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center', 'my' => is_rtl() ? 'right-13px' : '' );
+ $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' );
} else {
$selector = 'a[href="customize.php"]';
if ( is_rtl() ) {
@@ -2070,13 +2125,12 @@ function wp_star_rating( $args = array() ) {
'number' => 0,
);
$r = wp_parse_args( $args, $defaults );
- extract( $r, EXTR_SKIP );
// Non-english decimal places when the $rating is coming from a string
- $rating = str_replace( ',', '.', $rating );
+ $rating = str_replace( ',', '.', $r['rating'] );
// Convert Percentage to star rating, 0..5 in .5 increments
- if ( 'percent' == $type ) {
+ if ( 'percent' == $r['type'] ) {
$rating = round( $rating / 10, 0 ) / 2;
}
@@ -2085,16 +2139,17 @@ function wp_star_rating( $args = array() ) {
$half_stars = ceil( $rating - $full_stars );
$empty_stars = 5 - $full_stars - $half_stars;
- if ( $number ) {
+ if ( $r['number'] ) {
/* translators: 1: The rating, 2: The number of ratings */
- $title = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $number );
- $title = sprintf( $title, number_format_i18n( $rating, 1 ), number_format_i18n( $number ) );
+ $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
+ $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
} else {
/* translators: 1: The rating */
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
}
echo '
';
+ echo '
' . $title . '';
echo str_repeat( '
', $full_stars );
echo str_repeat( '
', $half_stars );
echo str_repeat( '
', $empty_stars);