~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/includes/misc.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
        $got_rewrite = apache_mod_loaded('mod_rewrite', true);
18
18
 
19
19
        /**
20
 
         * Filter whether Apache and mod_rewrite are present.
 
20
         * Filters whether Apache and mod_rewrite are present.
21
21
         *
22
22
         * This filter was previously used to force URL rewriting for other servers,
23
 
         * like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead.
 
23
         * like nginx. Use the {@see 'got_url_rewrite'} filter in got_url_rewrite() instead.
24
24
         *
25
25
         * @since 2.5.0
26
26
         *
46
46
        $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
47
47
 
48
48
        /**
49
 
         * Filter whether URL rewriting is available.
 
49
         * Filters whether URL rewriting is available.
50
50
         *
51
51
         * @since 3.7.0
52
52
         *
369
369
        sort( $functions );
370
370
 
371
371
        /**
372
 
         * Filter the list of functions and classes to be ignored from the documentation lookup.
 
372
         * Filters the list of functions and classes to be ignored from the documentation lookup.
373
373
         *
374
374
         * @since 2.8.0
375
375
         *
438
438
                        default:
439
439
 
440
440
                                /**
441
 
                                 * Filter a screen option value before it is set.
 
441
                                 * Filters a screen option value before it is set.
442
442
                                 *
443
443
                                 * The filter can also be used to modify non-standard [items]_per_page
444
444
                                 * settings. See the parent function for a full list of standard options.
881
881
                } elseif ( empty( $saved ) ) {
882
882
                        $response['wp_autosave'] = array( 'success' => false, 'message' => __( 'Error while saving.' ) );
883
883
                } else {
884
 
                        /* translators: draft saved date format, see http://php.net/date */
 
884
                        /* translators: draft saved date format, see https://secure.php.net/date */
885
885
                        $draft_saved_date_format = __( 'g:i:s a' );
886
886
                        /* translators: %s: date and time */
887
887
                        $response['wp_autosave'] = array( 'success' => true, 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ) );
892
892
}
893
893
 
894
894
/**
895
 
 * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
896
 
 * as they disregard the autocomplete setting on the editor textarea. That can break the editor
897
 
 * when the user navigates to it with the browser's Back button. See #28037
898
 
 *
899
 
 * @since 4.0.0
900
 
 *
901
 
 * @global bool $is_safari
902
 
 * @global bool $is_chrome
903
 
 */
904
 
function post_form_autocomplete_off() {
905
 
        global $is_safari, $is_chrome;
906
 
 
907
 
        if ( $is_safari || $is_chrome ) {
908
 
                echo ' autocomplete="off"';
909
 
        }
910
 
}
911
 
 
912
 
/**
913
895
 * Remove single-use URL parameters and create canonical link based on new URL.
914
896
 *
915
897
 * Remove specific query string parameters from a URL, create the canonical link,
936
918
        </script>
937
919
<?php
938
920
}
 
921
 
 
922
/**
 
923
 * Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
 
924
 *
 
925
 * Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache,
 
926
 * so the post title and editor content are the last saved versions. Ideally this script should run first in the head.
 
927
 *
 
928
 * @since 4.6.0
 
929
 */
 
930
function wp_page_reload_on_back_button_js() {
 
931
        ?>
 
932
        <script>
 
933
                if ( typeof performance !== 'undefined' && performance.navigation && performance.navigation.type === 2 ) {
 
934
                        document.location.reload( true );
 
935
                }
 
936
        </script>
 
937
        <?php
 
938
}