stump-cli 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +3 -16
- data/Rakefile +2 -0
- data/bin/stump-cli +58 -0
- data/lib/stump-cli/version.rb +3 -0
- data/lib/stump.rb +5 -0
- data/lib/wp/Movefile-example +62 -0
- data/lib/wp/README.md +25 -0
- data/lib/wp/index.php +17 -0
- data/lib/wp/license.txt +385 -0
- data/lib/wp/readme.html +96 -0
- data/lib/wp/wp-activate.php +131 -0
- data/lib/wp/wp-admin/about.php +193 -0
- data/lib/wp/wp-admin/admin-ajax.php +98 -0
- data/lib/wp/wp-admin/admin-footer.php +99 -0
- data/lib/wp/wp-admin/admin-functions.php +15 -0
- data/lib/wp/wp-admin/admin-header.php +243 -0
- data/lib/wp/wp-admin/admin-post.php +71 -0
- data/lib/wp/wp-admin/admin.php +347 -0
- data/lib/wp/wp-admin/async-upload.php +114 -0
- data/lib/wp/wp-admin/comment.php +299 -0
- data/lib/wp/wp-admin/credits.php +192 -0
- data/lib/wp/wp-admin/css/about-rtl.css +446 -0
- data/lib/wp/wp-admin/css/about.css +446 -0
- data/lib/wp/wp-admin/css/admin-menu-rtl.css +917 -0
- data/lib/wp/wp-admin/css/admin-menu.css +917 -0
- data/lib/wp/wp-admin/css/color-picker-rtl.css +127 -0
- data/lib/wp/wp-admin/css/color-picker-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/color-picker.css +127 -0
- data/lib/wp/wp-admin/css/color-picker.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/_admin.scss +525 -0
- data/lib/wp/wp-admin/css/colors/_mixins.scss +43 -0
- data/lib/wp/wp-admin/css/colors/_variables.scss +58 -0
- data/lib/wp/wp-admin/css/colors/blue/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/blue/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/blue/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/blue/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/blue/colors.scss +11 -0
- data/lib/wp/wp-admin/css/colors/coffee/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/coffee/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/coffee/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/coffee/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/coffee/colors.scss +7 -0
- data/lib/wp/wp-admin/css/colors/ectoplasm/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/ectoplasm/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/ectoplasm/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/ectoplasm/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/ectoplasm/colors.scss +8 -0
- data/lib/wp/wp-admin/css/colors/light/colors-rtl.css +349 -0
- data/lib/wp/wp-admin/css/colors/light/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/light/colors.css +349 -0
- data/lib/wp/wp-admin/css/colors/light/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/light/colors.scss +38 -0
- data/lib/wp/wp-admin/css/colors/midnight/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/midnight/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/midnight/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/midnight/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/midnight/colors.scss +5 -0
- data/lib/wp/wp-admin/css/colors/ocean/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/ocean/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/ocean/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/ocean/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/ocean/colors.scss +8 -0
- data/lib/wp/wp-admin/css/colors/sunrise/colors-rtl.css +341 -0
- data/lib/wp/wp-admin/css/colors/sunrise/colors-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/sunrise/colors.css +341 -0
- data/lib/wp/wp-admin/css/colors/sunrise/colors.min.css +1 -0
- data/lib/wp/wp-admin/css/colors/sunrise/colors.scss +6 -0
- data/lib/wp/wp-admin/css/common-rtl.css +3212 -0
- data/lib/wp/wp-admin/css/common.css +3212 -0
- data/lib/wp/wp-admin/css/customize-controls-rtl.css +889 -0
- data/lib/wp/wp-admin/css/customize-controls-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/customize-controls.css +889 -0
- data/lib/wp/wp-admin/css/customize-controls.min.css +1 -0
- data/lib/wp/wp-admin/css/customize-widgets-rtl.css +603 -0
- data/lib/wp/wp-admin/css/customize-widgets-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/customize-widgets.css +603 -0
- data/lib/wp/wp-admin/css/customize-widgets.min.css +1 -0
- data/lib/wp/wp-admin/css/dashboard-rtl.css +1116 -0
- data/lib/wp/wp-admin/css/dashboard.css +1116 -0
- data/lib/wp/wp-admin/css/deprecated-media-rtl.css +371 -0
- data/lib/wp/wp-admin/css/deprecated-media-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/deprecated-media.css +371 -0
- data/lib/wp/wp-admin/css/deprecated-media.min.css +1 -0
- data/lib/wp/wp-admin/css/edit-rtl.css +1501 -0
- data/lib/wp/wp-admin/css/edit.css +1501 -0
- data/lib/wp/wp-admin/css/farbtastic-rtl.css +41 -0
- data/lib/wp/wp-admin/css/farbtastic.css +41 -0
- data/lib/wp/wp-admin/css/forms-rtl.css +992 -0
- data/lib/wp/wp-admin/css/forms.css +992 -0
- data/lib/wp/wp-admin/css/ie-rtl.css +785 -0
- data/lib/wp/wp-admin/css/ie-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/ie.css +785 -0
- data/lib/wp/wp-admin/css/ie.min.css +1 -0
- data/lib/wp/wp-admin/css/install-rtl.css +389 -0
- data/lib/wp/wp-admin/css/install-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/install.css +389 -0
- data/lib/wp/wp-admin/css/install.min.css +1 -0
- data/lib/wp/wp-admin/css/l10n-rtl.css +101 -0
- data/lib/wp/wp-admin/css/l10n.css +101 -0
- data/lib/wp/wp-admin/css/list-tables-rtl.css +1875 -0
- data/lib/wp/wp-admin/css/list-tables.css +1875 -0
- data/lib/wp/wp-admin/css/login-rtl.css +269 -0
- data/lib/wp/wp-admin/css/login-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/login.css +269 -0
- data/lib/wp/wp-admin/css/login.min.css +1 -0
- data/lib/wp/wp-admin/css/media-rtl.css +1196 -0
- data/lib/wp/wp-admin/css/media.css +1196 -0
- data/lib/wp/wp-admin/css/nav-menus-rtl.css +857 -0
- data/lib/wp/wp-admin/css/nav-menus.css +857 -0
- data/lib/wp/wp-admin/css/press-this-rtl.css +458 -0
- data/lib/wp/wp-admin/css/press-this.css +458 -0
- data/lib/wp/wp-admin/css/revisions-rtl.css +574 -0
- data/lib/wp/wp-admin/css/revisions.css +574 -0
- data/lib/wp/wp-admin/css/themes-rtl.css +1732 -0
- data/lib/wp/wp-admin/css/themes.css +1732 -0
- data/lib/wp/wp-admin/css/widgets-rtl.css +577 -0
- data/lib/wp/wp-admin/css/widgets.css +577 -0
- data/lib/wp/wp-admin/css/wp-admin-rtl.css +14 -0
- data/lib/wp/wp-admin/css/wp-admin-rtl.min.css +1 -0
- data/lib/wp/wp-admin/css/wp-admin.css +14 -0
- data/lib/wp/wp-admin/css/wp-admin.min.css +1 -0
- data/lib/wp/wp-admin/custom-background.php +482 -0
- data/lib/wp/wp-admin/custom-header.php +1366 -0
- data/lib/wp/wp-admin/customize.php +278 -0
- data/lib/wp/wp-admin/edit-comments.php +254 -0
- data/lib/wp/wp-admin/edit-form-advanced.php +636 -0
- data/lib/wp/wp-admin/edit-form-comment.php +160 -0
- data/lib/wp/wp-admin/edit-link-form.php +150 -0
- data/lib/wp/wp-admin/edit-tag-form.php +204 -0
- data/lib/wp/wp-admin/edit-tags.php +591 -0
- data/lib/wp/wp-admin/edit.php +330 -0
- data/lib/wp/wp-admin/export.php +243 -0
- data/lib/wp/wp-admin/freedoms.php +57 -0
- data/lib/wp/wp-admin/images/align-center-2x.png +0 -0
- data/lib/wp/wp-admin/images/align-center.png +0 -0
- data/lib/wp/wp-admin/images/align-left-2x.png +0 -0
- data/lib/wp/wp-admin/images/align-left.png +0 -0
- data/lib/wp/wp-admin/images/align-none-2x.png +0 -0
- data/lib/wp/wp-admin/images/align-none.png +0 -0
- data/lib/wp/wp-admin/images/align-right-2x.png +0 -0
- data/lib/wp/wp-admin/images/align-right.png +0 -0
- data/lib/wp/wp-admin/images/arrows-2x.png +0 -0
- data/lib/wp/wp-admin/images/arrows.png +0 -0
- data/lib/wp/wp-admin/images/bubble_bg-2x.gif +0 -0
- data/lib/wp/wp-admin/images/bubble_bg.gif +0 -0
- data/lib/wp/wp-admin/images/comment-grey-bubble-2x.png +0 -0
- data/lib/wp/wp-admin/images/comment-grey-bubble.png +0 -0
- data/lib/wp/wp-admin/images/date-button-2x.gif +0 -0
- data/lib/wp/wp-admin/images/date-button.gif +0 -0
- data/lib/wp/wp-admin/images/generic.png +0 -0
- data/lib/wp/wp-admin/images/icons32-2x.png +0 -0
- data/lib/wp/wp-admin/images/icons32-vs-2x.png +0 -0
- data/lib/wp/wp-admin/images/icons32-vs.png +0 -0
- data/lib/wp/wp-admin/images/icons32.png +0 -0
- data/lib/wp/wp-admin/images/imgedit-icons-2x.png +0 -0
- data/lib/wp/wp-admin/images/imgedit-icons.png +0 -0
- data/lib/wp/wp-admin/images/list-2x.png +0 -0
- data/lib/wp/wp-admin/images/list.png +0 -0
- data/lib/wp/wp-admin/images/loading.gif +0 -0
- data/lib/wp/wp-admin/images/marker.png +0 -0
- data/lib/wp/wp-admin/images/mask.png +0 -0
- data/lib/wp/wp-admin/images/media-button-2x.png +0 -0
- data/lib/wp/wp-admin/images/media-button-image.gif +0 -0
- data/lib/wp/wp-admin/images/media-button-music.gif +0 -0
- data/lib/wp/wp-admin/images/media-button-other.gif +0 -0
- data/lib/wp/wp-admin/images/media-button-video.gif +0 -0
- data/lib/wp/wp-admin/images/media-button.png +0 -0
- data/lib/wp/wp-admin/images/menu-2x.png +0 -0
- data/lib/wp/wp-admin/images/menu-vs-2x.png +0 -0
- data/lib/wp/wp-admin/images/menu-vs.png +0 -0
- data/lib/wp/wp-admin/images/menu.png +0 -0
- data/lib/wp/wp-admin/images/no.png +0 -0
- data/lib/wp/wp-admin/images/post-formats-vs.png +0 -0
- data/lib/wp/wp-admin/images/post-formats.png +0 -0
- data/lib/wp/wp-admin/images/post-formats32-vs.png +0 -0
- data/lib/wp/wp-admin/images/post-formats32.png +0 -0
- data/lib/wp/wp-admin/images/resize-2x.gif +0 -0
- data/lib/wp/wp-admin/images/resize-rtl-2x.gif +0 -0
- data/lib/wp/wp-admin/images/resize-rtl.gif +0 -0
- data/lib/wp/wp-admin/images/resize.gif +0 -0
- data/lib/wp/wp-admin/images/se.png +0 -0
- data/lib/wp/wp-admin/images/sort-2x.gif +0 -0
- data/lib/wp/wp-admin/images/sort.gif +0 -0
- data/lib/wp/wp-admin/images/spinner-2x.gif +0 -0
- data/lib/wp/wp-admin/images/spinner.gif +0 -0
- data/lib/wp/wp-admin/images/stars-2x.png +0 -0
- data/lib/wp/wp-admin/images/stars.png +0 -0
- data/lib/wp/wp-admin/images/w-logo-blue.png +0 -0
- data/lib/wp/wp-admin/images/w-logo-white.png +0 -0
- data/lib/wp/wp-admin/images/wheel.png +0 -0
- data/lib/wp/wp-admin/images/wordpress-logo-white.svg +1 -0
- data/lib/wp/wp-admin/images/wordpress-logo.png +0 -0
- data/lib/wp/wp-admin/images/wordpress-logo.svg +1 -0
- data/lib/wp/wp-admin/images/wpspin_light-2x.gif +0 -0
- data/lib/wp/wp-admin/images/wpspin_light.gif +0 -0
- data/lib/wp/wp-admin/images/xit-2x.gif +0 -0
- data/lib/wp/wp-admin/images/xit.gif +0 -0
- data/lib/wp/wp-admin/images/yes.png +0 -0
- data/lib/wp/wp-admin/import.php +132 -0
- data/lib/wp/wp-admin/includes/admin.php +74 -0
- data/lib/wp/wp-admin/includes/ajax-actions.php +2762 -0
- data/lib/wp/wp-admin/includes/bookmark.php +305 -0
- data/lib/wp/wp-admin/includes/class-ftp-pure.php +190 -0
- data/lib/wp/wp-admin/includes/class-ftp-sockets.php +250 -0
- data/lib/wp/wp-admin/includes/class-ftp.php +907 -0
- data/lib/wp/wp-admin/includes/class-pclzip.php +5687 -0
- data/lib/wp/wp-admin/includes/class-wp-comments-list-table.php +637 -0
- data/lib/wp/wp-admin/includes/class-wp-filesystem-base.php +815 -0
- data/lib/wp/wp-admin/includes/class-wp-filesystem-direct.php +384 -0
- data/lib/wp/wp-admin/includes/class-wp-filesystem-ftpext.php +415 -0
- data/lib/wp/wp-admin/includes/class-wp-filesystem-ftpsockets.php +352 -0
- data/lib/wp/wp-admin/includes/class-wp-filesystem-ssh2.php +392 -0
- data/lib/wp/wp-admin/includes/class-wp-importer.php +302 -0
- data/lib/wp/wp-admin/includes/class-wp-links-list-table.php +207 -0
- data/lib/wp/wp-admin/includes/class-wp-list-table.php +1080 -0
- data/lib/wp/wp-admin/includes/class-wp-media-list-table.php +574 -0
- data/lib/wp/wp-admin/includes/class-wp-ms-sites-list-table.php +402 -0
- data/lib/wp/wp-admin/includes/class-wp-ms-themes-list-table.php +459 -0
- data/lib/wp/wp-admin/includes/class-wp-ms-users-list-table.php +303 -0
- data/lib/wp/wp-admin/includes/class-wp-plugin-install-list-table.php +490 -0
- data/lib/wp/wp-admin/includes/class-wp-plugins-list-table.php +605 -0
- data/lib/wp/wp-admin/includes/class-wp-posts-list-table.php +1306 -0
- data/lib/wp/wp-admin/includes/class-wp-terms-list-table.php +466 -0
- data/lib/wp/wp-admin/includes/class-wp-theme-install-list-table.php +431 -0
- data/lib/wp/wp-admin/includes/class-wp-themes-list-table.php +279 -0
- data/lib/wp/wp-admin/includes/class-wp-upgrader-skins.php +767 -0
- data/lib/wp/wp-admin/includes/class-wp-upgrader.php +2676 -0
- data/lib/wp/wp-admin/includes/class-wp-users-list-table.php +459 -0
- data/lib/wp/wp-admin/includes/comment.php +171 -0
- data/lib/wp/wp-admin/includes/continents-cities.php +493 -0
- data/lib/wp/wp-admin/includes/dashboard.php +1333 -0
- data/lib/wp/wp-admin/includes/deprecated.php +1190 -0
- data/lib/wp/wp-admin/includes/export.php +508 -0
- data/lib/wp/wp-admin/includes/file.php +1152 -0
- data/lib/wp/wp-admin/includes/image-edit.php +828 -0
- data/lib/wp/wp-admin/includes/image.php +598 -0
- data/lib/wp/wp-admin/includes/import.php +206 -0
- data/lib/wp/wp-admin/includes/list-table.php +113 -0
- data/lib/wp/wp-admin/includes/media.php +3012 -0
- data/lib/wp/wp-admin/includes/menu.php +322 -0
- data/lib/wp/wp-admin/includes/meta-boxes.php +1119 -0
- data/lib/wp/wp-admin/includes/misc.php +845 -0
- data/lib/wp/wp-admin/includes/ms-deprecated.php +78 -0
- data/lib/wp/wp-admin/includes/ms.php +814 -0
- data/lib/wp/wp-admin/includes/nav-menu.php +1328 -0
- data/lib/wp/wp-admin/includes/plugin-install.php +550 -0
- data/lib/wp/wp-admin/includes/plugin.php +1899 -0
- data/lib/wp/wp-admin/includes/post.php +1661 -0
- data/lib/wp/wp-admin/includes/revision.php +228 -0
- data/lib/wp/wp-admin/includes/schema.php +1038 -0
- data/lib/wp/wp-admin/includes/screen.php +1179 -0
- data/lib/wp/wp-admin/includes/taxonomy.php +284 -0
- data/lib/wp/wp-admin/includes/template.php +2157 -0
- data/lib/wp/wp-admin/includes/theme-install.php +205 -0
- data/lib/wp/wp-admin/includes/theme.php +474 -0
- data/lib/wp/wp-admin/includes/translation-install.php +240 -0
- data/lib/wp/wp-admin/includes/update-core.php +1186 -0
- data/lib/wp/wp-admin/includes/update.php +432 -0
- data/lib/wp/wp-admin/includes/upgrade.php +2218 -0
- data/lib/wp/wp-admin/includes/user.php +442 -0
- data/lib/wp/wp-admin/includes/widgets.php +245 -0
- data/lib/wp/wp-admin/index.php +131 -0
- data/lib/wp/wp-admin/install-helper.php +199 -0
- data/lib/wp/wp-admin/install.php +305 -0
- data/lib/wp/wp-admin/js/accordion.js +143 -0
- data/lib/wp/wp-admin/js/accordion.min.js +1 -0
- data/lib/wp/wp-admin/js/color-picker.js +155 -0
- data/lib/wp/wp-admin/js/color-picker.min.js +1 -0
- data/lib/wp/wp-admin/js/comment.js +50 -0
- data/lib/wp/wp-admin/js/comment.min.js +1 -0
- data/lib/wp/wp-admin/js/common.js +804 -0
- data/lib/wp/wp-admin/js/common.min.js +1 -0
- data/lib/wp/wp-admin/js/custom-background.js +75 -0
- data/lib/wp/wp-admin/js/custom-background.min.js +1 -0
- data/lib/wp/wp-admin/js/custom-header.js +61 -0
- data/lib/wp/wp-admin/js/customize-controls.js +1305 -0
- data/lib/wp/wp-admin/js/customize-controls.min.js +1 -0
- data/lib/wp/wp-admin/js/customize-widgets.js +1882 -0
- data/lib/wp/wp-admin/js/customize-widgets.min.js +1 -0
- data/lib/wp/wp-admin/js/dashboard.js +190 -0
- data/lib/wp/wp-admin/js/dashboard.min.js +1 -0
- data/lib/wp/wp-admin/js/edit-comments.js +625 -0
- data/lib/wp/wp-admin/js/edit-comments.min.js +1 -0
- data/lib/wp/wp-admin/js/editor-expand.js +705 -0
- data/lib/wp/wp-admin/js/editor-expand.min.js +1 -0
- data/lib/wp/wp-admin/js/editor.js +324 -0
- data/lib/wp/wp-admin/js/editor.min.js +1 -0
- data/lib/wp/wp-admin/js/farbtastic.js +276 -0
- data/lib/wp/wp-admin/js/gallery.js +237 -0
- data/lib/wp/wp-admin/js/gallery.min.js +1 -0
- data/lib/wp/wp-admin/js/image-edit.js +633 -0
- data/lib/wp/wp-admin/js/image-edit.min.js +1 -0
- data/lib/wp/wp-admin/js/inline-edit-post.js +359 -0
- data/lib/wp/wp-admin/js/inline-edit-post.min.js +1 -0
- data/lib/wp/wp-admin/js/inline-edit-tax.js +142 -0
- data/lib/wp/wp-admin/js/inline-edit-tax.min.js +1 -0
- data/lib/wp/wp-admin/js/iris.min.js +4 -0
- data/lib/wp/wp-admin/js/language-chooser.js +26 -0
- data/lib/wp/wp-admin/js/language-chooser.min.js +1 -0
- data/lib/wp/wp-admin/js/link.js +69 -0
- data/lib/wp/wp-admin/js/link.min.js +1 -0
- data/lib/wp/wp-admin/js/media-gallery.js +26 -0
- data/lib/wp/wp-admin/js/media-gallery.min.js +1 -0
- data/lib/wp/wp-admin/js/media-upload.js +69 -0
- data/lib/wp/wp-admin/js/media-upload.min.js +1 -0
- data/lib/wp/wp-admin/js/media.js +111 -0
- data/lib/wp/wp-admin/js/media.min.js +1 -0
- data/lib/wp/wp-admin/js/nav-menu.js +1205 -0
- data/lib/wp/wp-admin/js/nav-menu.min.js +1 -0
- data/lib/wp/wp-admin/js/password-strength-meter.js +75 -0
- data/lib/wp/wp-admin/js/password-strength-meter.min.js +1 -0
- data/lib/wp/wp-admin/js/plugin-install.js +76 -0
- data/lib/wp/wp-admin/js/plugin-install.min.js +1 -0
- data/lib/wp/wp-admin/js/post.js +1094 -0
- data/lib/wp/wp-admin/js/post.min.js +1 -0
- data/lib/wp/wp-admin/js/postbox.js +199 -0
- data/lib/wp/wp-admin/js/postbox.min.js +1 -0
- data/lib/wp/wp-admin/js/revisions.js +1110 -0
- data/lib/wp/wp-admin/js/revisions.min.js +1 -0
- data/lib/wp/wp-admin/js/set-post-thumbnail.js +24 -0
- data/lib/wp/wp-admin/js/set-post-thumbnail.min.js +1 -0
- data/lib/wp/wp-admin/js/svg-painter.js +240 -0
- data/lib/wp/wp-admin/js/svg-painter.min.js +1 -0
- data/lib/wp/wp-admin/js/tags.js +72 -0
- data/lib/wp/wp-admin/js/tags.min.js +1 -0
- data/lib/wp/wp-admin/js/theme.js +1691 -0
- data/lib/wp/wp-admin/js/theme.min.js +1 -0
- data/lib/wp/wp-admin/js/updates.js +65 -0
- data/lib/wp/wp-admin/js/updates.min.js +1 -0
- data/lib/wp/wp-admin/js/user-profile.js +127 -0
- data/lib/wp/wp-admin/js/user-profile.min.js +1 -0
- data/lib/wp/wp-admin/js/user-suggest.js +30 -0
- data/lib/wp/wp-admin/js/user-suggest.min.js +1 -0
- data/lib/wp/wp-admin/js/widgets.js +494 -0
- data/lib/wp/wp-admin/js/widgets.min.js +1 -0
- data/lib/wp/wp-admin/js/word-count.js +44 -0
- data/lib/wp/wp-admin/js/word-count.min.js +1 -0
- data/lib/wp/wp-admin/js/wp-fullscreen.js +704 -0
- data/lib/wp/wp-admin/js/wp-fullscreen.min.js +1 -0
- data/lib/wp/wp-admin/js/xfn.js +17 -0
- data/lib/wp/wp-admin/js/xfn.min.js +1 -0
- data/lib/wp/wp-admin/link-add.php +29 -0
- data/lib/wp/wp-admin/link-manager.php +99 -0
- data/lib/wp/wp-admin/link-parse-opml.php +84 -0
- data/lib/wp/wp-admin/link.php +117 -0
- data/lib/wp/wp-admin/load-scripts.php +162 -0
- data/lib/wp/wp-admin/load-styles.php +153 -0
- data/lib/wp/wp-admin/maint/repair.php +124 -0
- data/lib/wp/wp-admin/media-new.php +84 -0
- data/lib/wp/wp-admin/media-upload.php +100 -0
- data/lib/wp/wp-admin/media.php +146 -0
- data/lib/wp/wp-admin/menu-header.php +227 -0
- data/lib/wp/wp-admin/menu.php +255 -0
- data/lib/wp/wp-admin/moderation.php +12 -0
- data/lib/wp/wp-admin/ms-admin.php +13 -0
- data/lib/wp/wp-admin/ms-delete-site.php +91 -0
- data/lib/wp/wp-admin/ms-edit.php +13 -0
- data/lib/wp/wp-admin/ms-options.php +12 -0
- data/lib/wp/wp-admin/ms-sites.php +13 -0
- data/lib/wp/wp-admin/ms-themes.php +13 -0
- data/lib/wp/wp-admin/ms-upgrade-network.php +13 -0
- data/lib/wp/wp-admin/ms-users.php +13 -0
- data/lib/wp/wp-admin/my-sites.php +145 -0
- data/lib/wp/wp-admin/nav-menus.php +798 -0
- data/lib/wp/wp-admin/network.php +561 -0
- data/lib/wp/wp-admin/network/about.php +16 -0
- data/lib/wp/wp-admin/network/admin.php +32 -0
- data/lib/wp/wp-admin/network/credits.php +16 -0
- data/lib/wp/wp-admin/network/edit.php +42 -0
- data/lib/wp/wp-admin/network/freedoms.php +16 -0
- data/lib/wp/wp-admin/network/index.php +79 -0
- data/lib/wp/wp-admin/network/menu.php +63 -0
- data/lib/wp/wp-admin/network/plugin-editor.php +16 -0
- data/lib/wp/wp-admin/network/plugin-install.php +19 -0
- data/lib/wp/wp-admin/network/plugins.php +16 -0
- data/lib/wp/wp-admin/network/profile.php +16 -0
- data/lib/wp/wp-admin/network/settings.php +347 -0
- data/lib/wp/wp-admin/network/setup.php +16 -0
- data/lib/wp/wp-admin/network/site-info.php +178 -0
- data/lib/wp/wp-admin/network/site-new.php +153 -0
- data/lib/wp/wp-admin/network/site-settings.php +173 -0
- data/lib/wp/wp-admin/network/site-themes.php +185 -0
- data/lib/wp/wp-admin/network/site-users.php +319 -0
- data/lib/wp/wp-admin/network/sites.php +275 -0
- data/lib/wp/wp-admin/network/theme-editor.php +16 -0
- data/lib/wp/wp-admin/network/theme-install.php +19 -0
- data/lib/wp/wp-admin/network/themes.php +291 -0
- data/lib/wp/wp-admin/network/update-core.php +16 -0
- data/lib/wp/wp-admin/network/update.php +19 -0
- data/lib/wp/wp-admin/network/upgrade.php +120 -0
- data/lib/wp/wp-admin/network/user-edit.php +16 -0
- data/lib/wp/wp-admin/network/user-new.php +106 -0
- data/lib/wp/wp-admin/network/users.php +296 -0
- data/lib/wp/wp-admin/options-discussion.php +273 -0
- data/lib/wp/wp-admin/options-general.php +355 -0
- data/lib/wp/wp-admin/options-head.php +18 -0
- data/lib/wp/wp-admin/options-media.php +136 -0
- data/lib/wp/wp-admin/options-permalink.php +289 -0
- data/lib/wp/wp-admin/options-reading.php +184 -0
- data/lib/wp/wp-admin/options-writing.php +194 -0
- data/lib/wp/wp-admin/options.php +265 -0
- data/lib/wp/wp-admin/plugin-editor.php +279 -0
- data/lib/wp/wp-admin/plugin-install.php +134 -0
- data/lib/wp/wp-admin/plugins.php +474 -0
- data/lib/wp/wp-admin/post-new.php +74 -0
- data/lib/wp/wp-admin/post.php +318 -0
- data/lib/wp/wp-admin/press-this.php +691 -0
- data/lib/wp/wp-admin/profile.php +18 -0
- data/lib/wp/wp-admin/revision.php +221 -0
- data/lib/wp/wp-admin/setup-config.php +345 -0
- data/lib/wp/wp-admin/theme-editor.php +243 -0
- data/lib/wp/wp-admin/theme-install.php +278 -0
- data/lib/wp/wp-admin/themes.php +374 -0
- data/lib/wp/wp-admin/tools.php +75 -0
- data/lib/wp/wp-admin/update-core.php +653 -0
- data/lib/wp/wp-admin/update.php +272 -0
- data/lib/wp/wp-admin/upgrade-functions.php +12 -0
- data/lib/wp/wp-admin/upgrade.php +116 -0
- data/lib/wp/wp-admin/upload.php +292 -0
- data/lib/wp/wp-admin/user-edit.php +557 -0
- data/lib/wp/wp-admin/user-new.php +439 -0
- data/lib/wp/wp-admin/user/about.php +13 -0
- data/lib/wp/wp-admin/user/admin.php +32 -0
- data/lib/wp/wp-admin/user/credits.php +13 -0
- data/lib/wp/wp-admin/user/freedoms.php +13 -0
- data/lib/wp/wp-admin/user/index.php +12 -0
- data/lib/wp/wp-admin/user/menu.php +22 -0
- data/lib/wp/wp-admin/user/profile.php +12 -0
- data/lib/wp/wp-admin/user/user-edit.php +12 -0
- data/lib/wp/wp-admin/users.php +460 -0
- data/lib/wp/wp-admin/widgets.php +442 -0
- data/lib/wp/wp-blog-header.php +18 -0
- data/lib/wp/wp-comments-post.php +164 -0
- data/lib/wp/wp-config-sample.php +80 -0
- data/lib/wp/wp-content/index.php +2 -0
- data/lib/wp/wp-content/plugins/hello.php +82 -0
- data/lib/wp/wp-content/plugins/index.php +2 -0
- data/lib/wp/wp-content/themes/index.php +2 -0
- data/lib/wp/wp-content/themes/stump/.editorconfig +11 -0
- data/lib/wp/wp-content/themes/stump/.jshintrc +16 -0
- data/lib/wp/wp-content/themes/stump/404.php +13 -0
- data/lib/wp/wp-content/themes/stump/CHANGELOG.md +333 -0
- data/lib/wp/wp-content/themes/stump/CONTRIBUTING.md +121 -0
- data/lib/wp/wp-content/themes/stump/Gruntfile.js +151 -0
- data/lib/wp/wp-content/themes/stump/LICENSE.md +19 -0
- data/lib/wp/wp-content/themes/stump/assets/coffee/build/.gitkeep +0 -0
- data/lib/wp/wp-content/themes/stump/assets/coffee/build/site.js +6 -0
- data/lib/wp/wp-content/themes/stump/assets/css/editor-style.css +548 -0
- data/lib/wp/wp-content/themes/stump/assets/css/main.min.css +4 -0
- data/lib/wp/wp-content/themes/stump/assets/css/main.min.css.map +7 -0
- data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/wp/wp-content/themes/stump/assets/img/.gitignore +0 -0
- data/lib/wp/wp-content/themes/stump/assets/js/_main.js +63 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/affix.js +137 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/alert.js +88 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/button.js +107 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/carousel.js +205 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/collapse.js +170 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/dropdown.js +147 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/modal.js +243 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/popover.js +110 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/scrollspy.js +153 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/tab.js +125 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/tooltip.js +399 -0
- data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/transition.js +48 -0
- data/lib/wp/wp-content/themes/stump/assets/js/scripts.min.js +1 -0
- data/lib/wp/wp-content/themes/stump/assets/js/vendor/jquery-1.11.0.min.js +4 -0
- data/lib/wp/wp-content/themes/stump/assets/js/vendor/modernizr-2.7.0.min.js +4 -0
- data/lib/wp/wp-content/themes/stump/assets/sass/app.scss +9 -0
- data/lib/wp/wp-content/themes/stump/assets/sass/core/_variables.scss +1 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_alerts.scss +67 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_badges.scss +55 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_bootstrap.scss +49 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_breadcrumbs.scss +26 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_button-groups.scss +226 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_buttons.scss +159 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_carousel.scss +232 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_close.scss +35 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_code.scss +63 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_component-animations.scss +29 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_dropdowns.scss +213 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_forms.scss +436 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_glyphicons.scss +233 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_grid.scss +84 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_input-groups.scss +162 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_jumbotron.scss +44 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_labels.scss +64 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_list-group.scss +110 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_media.scss +56 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_mixins.scss +947 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_modals.scss +139 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_navbar.scss +620 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_navs.scss +242 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_normalize.scss +423 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_pager.scss +55 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_pagination.scss +88 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_panels.scss +241 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_popovers.scss +133 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_print.scss +101 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_progress-bars.scss +80 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_responsive-utilities.scss +74 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_scaffolding.scss +134 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_tables.scss +233 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_theme.scss +247 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_thumbnails.scss +38 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_tooltip.scss +95 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_type.scss +284 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_utilities.scss +56 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_variables.scss +833 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_wells.scss +29 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/_bourbon-deprecated-upcoming.scss +13 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/_bourbon.scss +59 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_button.scss +273 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_clearfix.scss +29 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_font-family.scss +5 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_hide-text.scss +5 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_html5-input-types.scss +56 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_position.scss +42 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_prefixer.scss +49 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_retina-image.scss +32 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_size.scss +44 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_timing-functions.scss +32 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_triangle.scss +45 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_animation.scss +52 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_appearance.scss +3 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_backface-visibility.scss +6 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_background-image.scss +48 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_background.scss +103 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_border-image.scss +55 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_border-radius.scss +22 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_box-sizing.scss +4 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_columns.scss +47 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_flex-box.scss +52 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_font-face.scss +23 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_image-rendering.scss +13 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_inline-block.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_keyframes.scss +43 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_linear-gradient.scss +41 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_perspective.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_placeholder.scss +29 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_radial-gradient.scss +44 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_transform.scss +15 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_transition.scss +34 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_user-select.scss +3 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_compact.scss +11 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_flex-grid.scss +39 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_grid-width.scss +13 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_linear-gradient.scss +13 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_modular-scale.scss +40 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_px-to-em.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_radial-gradient.scss +23 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_tint-shade.scss +9 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_transition-property-name.scss +22 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_deprecated-webkit-gradient.scss +39 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_render-gradients.scss +26 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan.sass +11 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_grid.sass +161 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_mixins.sass +63 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_utilities.sass +24 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_variables.sass +42 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/_neat-helpers.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/_neat.scss +21 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_new-breakpoint.scss +16 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_private.scss +107 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_px-to-em.scss +3 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_fill-parent.scss +7 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_grid.scss +5 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_media.scss +51 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_omega.scss +79 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_outer-container.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_pad.scss +8 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_private.scss +50 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_reset.scss +12 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_row.scss +17 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_shift.scss +9 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_span-columns.scss +38 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_to-deprecate.scss +57 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_visual-grid.scss +41 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/settings/_grid.scss +7 -0
- data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/settings/_visual-grid.scss +5 -0
- data/lib/wp/wp-content/themes/stump/base.php +36 -0
- data/lib/wp/wp-content/themes/stump/functions.php +19 -0
- data/lib/wp/wp-content/themes/stump/index.php +21 -0
- data/lib/wp/wp-content/themes/stump/lang/ar.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ar.po +270 -0
- data/lib/wp/wp-content/themes/stump/lang/bg_BG.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/bg_BG.po +338 -0
- data/lib/wp/wp-content/themes/stump/lang/ca.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ca.po +517 -0
- data/lib/wp/wp-content/themes/stump/lang/da_DK.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/da_DK.po +305 -0
- data/lib/wp/wp-content/themes/stump/lang/de_DE.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/de_DE.po +271 -0
- data/lib/wp/wp-content/themes/stump/lang/el.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/el.po +319 -0
- data/lib/wp/wp-content/themes/stump/lang/es_ES.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/es_ES.po +270 -0
- data/lib/wp/wp-content/themes/stump/lang/et.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/et.po +262 -0
- data/lib/wp/wp-content/themes/stump/lang/fa_IR.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/fa_IR.po +273 -0
- data/lib/wp/wp-content/themes/stump/lang/fi_FI.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/fi_FI.po +367 -0
- data/lib/wp/wp-content/themes/stump/lang/fr_FR.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/fr_FR.po +336 -0
- data/lib/wp/wp-content/themes/stump/lang/he_IL.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/he_IL.po +336 -0
- data/lib/wp/wp-content/themes/stump/lang/hu_HU.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/hu_HU.po +271 -0
- data/lib/wp/wp-content/themes/stump/lang/id_ID.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/id_ID.po +278 -0
- data/lib/wp/wp-content/themes/stump/lang/it_IT.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/it_IT.po +269 -0
- data/lib/wp/wp-content/themes/stump/lang/ja.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ja.po +267 -0
- data/lib/wp/wp-content/themes/stump/lang/ko_KR.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ko_KR.po +282 -0
- data/lib/wp/wp-content/themes/stump/lang/mk_MK.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/mk_MK.po +297 -0
- data/lib/wp/wp-content/themes/stump/lang/ms_MY.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ms_MY.po +342 -0
- data/lib/wp/wp-content/themes/stump/lang/nb_NO.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/nb_NO.po +517 -0
- data/lib/wp/wp-content/themes/stump/lang/nl_NL.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/nl_NL.po +261 -0
- data/lib/wp/wp-content/themes/stump/lang/nn_NO.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/nn_NO.po +517 -0
- data/lib/wp/wp-content/themes/stump/lang/pl_PL.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/pl_PL.po +283 -0
- data/lib/wp/wp-content/themes/stump/lang/pt_BR.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/pt_BR.po +394 -0
- data/lib/wp/wp-content/themes/stump/lang/ro_RO.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ro_RO.po +271 -0
- data/lib/wp/wp-content/themes/stump/lang/roots.pot +244 -0
- data/lib/wp/wp-content/themes/stump/lang/ru_RU.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/ru_RU.po +255 -0
- data/lib/wp/wp-content/themes/stump/lang/sk_SK.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/sk_SK.po +267 -0
- data/lib/wp/wp-content/themes/stump/lang/sr_RS.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/sr_RS.pot +261 -0
- data/lib/wp/wp-content/themes/stump/lang/sv_SE.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/sv_SE.po +323 -0
- data/lib/wp/wp-content/themes/stump/lang/tr_TR.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/tr_TR.po +405 -0
- data/lib/wp/wp-content/themes/stump/lang/vi_VN.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/vi_VN.po +516 -0
- data/lib/wp/wp-content/themes/stump/lang/zh_CN.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/zh_CN.po +329 -0
- data/lib/wp/wp-content/themes/stump/lang/zh_TW.mo +0 -0
- data/lib/wp/wp-content/themes/stump/lang/zh_TW.po +261 -0
- data/lib/wp/wp-content/themes/stump/lib/activation.php +215 -0
- data/lib/wp/wp-content/themes/stump/lib/cleanup.php +261 -0
- data/lib/wp/wp-content/themes/stump/lib/comments.php +52 -0
- data/lib/wp/wp-content/themes/stump/lib/config.php +79 -0
- data/lib/wp/wp-content/themes/stump/lib/custom.php +4 -0
- data/lib/wp/wp-content/themes/stump/lib/gallery.php +130 -0
- data/lib/wp/wp-content/themes/stump/lib/init.php +25 -0
- data/lib/wp/wp-content/themes/stump/lib/nav.php +93 -0
- data/lib/wp/wp-content/themes/stump/lib/relative-urls.php +50 -0
- data/lib/wp/wp-content/themes/stump/lib/scripts.php +67 -0
- data/lib/wp/wp-content/themes/stump/lib/sidebar.php +43 -0
- data/lib/wp/wp-content/themes/stump/lib/titles.php +37 -0
- data/lib/wp/wp-content/themes/stump/lib/utils.php +14 -0
- data/lib/wp/wp-content/themes/stump/lib/widgets.php +133 -0
- data/lib/wp/wp-content/themes/stump/lib/wrapper.php +49 -0
- data/lib/wp/wp-content/themes/stump/package.json +32 -0
- data/lib/wp/wp-content/themes/stump/page.php +2 -0
- data/lib/wp/wp-content/themes/stump/screenshot.png +0 -0
- data/lib/wp/wp-content/themes/stump/single.php +1 -0
- data/lib/wp/wp-content/themes/stump/style.css +11 -0
- data/lib/wp/wp-content/themes/stump/template-custom.php +8 -0
- data/lib/wp/wp-content/themes/stump/templates/comment.php +14 -0
- data/lib/wp/wp-content/themes/stump/templates/comments.php +80 -0
- data/lib/wp/wp-content/themes/stump/templates/content-page.php +4 -0
- data/lib/wp/wp-content/themes/stump/templates/content-single.php +15 -0
- data/lib/wp/wp-content/themes/stump/templates/content.php +9 -0
- data/lib/wp/wp-content/themes/stump/templates/entry-meta.php +2 -0
- data/lib/wp/wp-content/themes/stump/templates/footer.php +8 -0
- data/lib/wp/wp-content/themes/stump/templates/head.php +12 -0
- data/lib/wp/wp-content/themes/stump/templates/header-top-navbar.php +21 -0
- data/lib/wp/wp-content/themes/stump/templates/header.php +14 -0
- data/lib/wp/wp-content/themes/stump/templates/page-header.php +5 -0
- data/lib/wp/wp-content/themes/stump/templates/searchform.php +9 -0
- data/lib/wp/wp-content/themes/stump/templates/sidebar.php +1 -0
- data/lib/wp/wp-content/themes/twentyfourteen/404.php +32 -0
- data/lib/wp/wp-content/themes/twentyfourteen/archive.php +74 -0
- data/lib/wp/wp-content/themes/twentyfourteen/author.php +74 -0
- data/lib/wp/wp-content/themes/twentyfourteen/category.php +58 -0
- data/lib/wp/wp-content/themes/twentyfourteen/comments.php +66 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-aside.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-audio.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-featured-post.php +34 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-gallery.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-image.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-link.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-none.php +31 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-page.php +31 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-quote.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content-video.php +57 -0
- data/lib/wp/wp-content/themes/twentyfourteen/content.php +66 -0
- data/lib/wp/wp-content/themes/twentyfourteen/css/editor-style.css +717 -0
- data/lib/wp/wp-content/themes/twentyfourteen/css/ie.css +1335 -0
- data/lib/wp/wp-content/themes/twentyfourteen/featured-content.php +39 -0
- data/lib/wp/wp-content/themes/twentyfourteen/footer.php +28 -0
- data/lib/wp/wp-content/themes/twentyfourteen/functions.php +519 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/COPYING.txt +9 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/Genericons-Regular.otf +0 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/LICENSE.txt +339 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/README.txt +123 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/example.html +464 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.eot +0 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.svg +135 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.ttf +0 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.woff +0 -0
- data/lib/wp/wp-content/themes/twentyfourteen/genericons/genericons.css +197 -0
- data/lib/wp/wp-content/themes/twentyfourteen/header.php +65 -0
- data/lib/wp/wp-content/themes/twentyfourteen/image.php +79 -0
- data/lib/wp/wp-content/themes/twentyfourteen/images/pattern-dark.svg +16 -0
- data/lib/wp/wp-content/themes/twentyfourteen/images/pattern-light.svg +6 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/back-compat.php +63 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/custom-header.php +147 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/customizer.php +114 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/featured-content.php +531 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/template-tags.php +203 -0
- data/lib/wp/wp-content/themes/twentyfourteen/inc/widgets.php +269 -0
- data/lib/wp/wp-content/themes/twentyfourteen/index.php +61 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/customizer.js +38 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/featured-content-admin.js +9 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/functions.js +134 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/html5.js +8 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js +21 -0
- data/lib/wp/wp-content/themes/twentyfourteen/js/slider.js +598 -0
- data/lib/wp/wp-content/themes/twentyfourteen/languages/twentyfourteen.pot +467 -0
- data/lib/wp/wp-content/themes/twentyfourteen/page-templates/contributors.php +52 -0
- data/lib/wp/wp-content/themes/twentyfourteen/page-templates/full-width.php +42 -0
- data/lib/wp/wp-content/themes/twentyfourteen/page.php +48 -0
- data/lib/wp/wp-content/themes/twentyfourteen/rtl.css +854 -0
- data/lib/wp/wp-content/themes/twentyfourteen/screenshot.png +0 -0
- data/lib/wp/wp-content/themes/twentyfourteen/search.php +49 -0
- data/lib/wp/wp-content/themes/twentyfourteen/sidebar-content.php +16 -0
- data/lib/wp/wp-content/themes/twentyfourteen/sidebar-footer.php +19 -0
- data/lib/wp/wp-content/themes/twentyfourteen/sidebar.php +29 -0
- data/lib/wp/wp-content/themes/twentyfourteen/single.php +40 -0
- data/lib/wp/wp-content/themes/twentyfourteen/style.css +4321 -0
- data/lib/wp/wp-content/themes/twentyfourteen/tag.php +60 -0
- data/lib/wp/wp-content/themes/twentyfourteen/taxonomy-post_format.php +85 -0
- data/lib/wp/wp-cron.php +115 -0
- data/lib/wp/wp-includes/ID3/getid3.lib.php +1376 -0
- data/lib/wp/wp-includes/ID3/getid3.php +1796 -0
- data/lib/wp/wp-includes/ID3/license.commercial.txt +27 -0
- data/lib/wp/wp-includes/ID3/license.txt +29 -0
- data/lib/wp/wp-includes/ID3/module.audio-video.asf.php +2013 -0
- data/lib/wp/wp-includes/ID3/module.audio-video.flv.php +745 -0
- data/lib/wp/wp-includes/ID3/module.audio-video.matroska.php +1751 -0
- data/lib/wp/wp-includes/ID3/module.audio-video.quicktime.php +2246 -0
- data/lib/wp/wp-includes/ID3/module.audio-video.riff.php +2586 -0
- data/lib/wp/wp-includes/ID3/module.audio.ac3.php +474 -0
- data/lib/wp/wp-includes/ID3/module.audio.dts.php +291 -0
- data/lib/wp/wp-includes/ID3/module.audio.flac.php +443 -0
- data/lib/wp/wp-includes/ID3/module.audio.mp3.php +2012 -0
- data/lib/wp/wp-includes/ID3/module.audio.ogg.php +756 -0
- data/lib/wp/wp-includes/ID3/module.tag.apetag.php +371 -0
- data/lib/wp/wp-includes/ID3/module.tag.id3v1.php +360 -0
- data/lib/wp/wp-includes/ID3/module.tag.id3v2.php +3424 -0
- data/lib/wp/wp-includes/ID3/module.tag.lyrics3.php +294 -0
- data/lib/wp/wp-includes/ID3/readme.txt +604 -0
- data/lib/wp/wp-includes/SimplePie/Author.php +157 -0
- data/lib/wp/wp-includes/SimplePie/Cache.php +133 -0
- data/lib/wp/wp-includes/SimplePie/Cache/Base.php +114 -0
- data/lib/wp/wp-includes/SimplePie/Cache/DB.php +137 -0
- data/lib/wp/wp-includes/SimplePie/Cache/File.php +173 -0
- data/lib/wp/wp-includes/SimplePie/Cache/Memcache.php +183 -0
- data/lib/wp/wp-includes/SimplePie/Cache/MySQL.php +438 -0
- data/lib/wp/wp-includes/SimplePie/Caption.php +210 -0
- data/lib/wp/wp-includes/SimplePie/Category.php +157 -0
- data/lib/wp/wp-includes/SimplePie/Content/Type/Sniffer.php +332 -0
- data/lib/wp/wp-includes/SimplePie/Copyright.php +130 -0
- data/lib/wp/wp-includes/SimplePie/Core.php +57 -0
- data/lib/wp/wp-includes/SimplePie/Credit.php +156 -0
- data/lib/wp/wp-includes/SimplePie/Decode/HTML/Entities.php +617 -0
- data/lib/wp/wp-includes/SimplePie/Enclosure.php +1380 -0
- data/lib/wp/wp-includes/SimplePie/Exception.php +52 -0
- data/lib/wp/wp-includes/SimplePie/File.php +292 -0
- data/lib/wp/wp-includes/SimplePie/HTTP/Parser.php +500 -0
- data/lib/wp/wp-includes/SimplePie/IRI.php +1238 -0
- data/lib/wp/wp-includes/SimplePie/Item.php +2964 -0
- data/lib/wp/wp-includes/SimplePie/Locator.php +372 -0
- data/lib/wp/wp-includes/SimplePie/Misc.php +2247 -0
- data/lib/wp/wp-includes/SimplePie/Net/IPv6.php +276 -0
- data/lib/wp/wp-includes/SimplePie/Parse/Date.php +983 -0
- data/lib/wp/wp-includes/SimplePie/Parser.php +407 -0
- data/lib/wp/wp-includes/SimplePie/Rating.php +129 -0
- data/lib/wp/wp-includes/SimplePie/Registry.php +225 -0
- data/lib/wp/wp-includes/SimplePie/Restriction.php +155 -0
- data/lib/wp/wp-includes/SimplePie/Sanitize.php +554 -0
- data/lib/wp/wp-includes/SimplePie/Source.php +611 -0
- data/lib/wp/wp-includes/SimplePie/XML/Declaration/Parser.php +362 -0
- data/lib/wp/wp-includes/SimplePie/gzdecode.php +371 -0
- data/lib/wp/wp-includes/Text/Diff.php +450 -0
- data/lib/wp/wp-includes/Text/Diff/Engine/native.php +436 -0
- data/lib/wp/wp-includes/Text/Diff/Engine/shell.php +162 -0
- data/lib/wp/wp-includes/Text/Diff/Engine/string.php +248 -0
- data/lib/wp/wp-includes/Text/Diff/Engine/xdiff.php +64 -0
- data/lib/wp/wp-includes/Text/Diff/Renderer.php +235 -0
- data/lib/wp/wp-includes/Text/Diff/Renderer/inline.php +206 -0
- data/lib/wp/wp-includes/admin-bar.php +870 -0
- data/lib/wp/wp-includes/atomlib.php +352 -0
- data/lib/wp/wp-includes/author-template.php +471 -0
- data/lib/wp/wp-includes/bookmark-template.php +298 -0
- data/lib/wp/wp-includes/bookmark.php +416 -0
- data/lib/wp/wp-includes/cache.php +704 -0
- data/lib/wp/wp-includes/canonical.php +586 -0
- data/lib/wp/wp-includes/capabilities.php +1539 -0
- data/lib/wp/wp-includes/category-template.php +1407 -0
- data/lib/wp/wp-includes/category.php +343 -0
- data/lib/wp/wp-includes/certificates/ca-bundle.crt +3785 -0
- data/lib/wp/wp-includes/class-IXR.php +1100 -0
- data/lib/wp/wp-includes/class-feed.php +140 -0
- data/lib/wp/wp-includes/class-http.php +2245 -0
- data/lib/wp/wp-includes/class-json.php +936 -0
- data/lib/wp/wp-includes/class-oembed.php +579 -0
- data/lib/wp/wp-includes/class-phpass.php +260 -0
- data/lib/wp/wp-includes/class-phpmailer.php +3265 -0
- data/lib/wp/wp-includes/class-pop3.php +652 -0
- data/lib/wp/wp-includes/class-simplepie.php +3119 -0
- data/lib/wp/wp-includes/class-smtp.php +943 -0
- data/lib/wp/wp-includes/class-snoopy.php +1256 -0
- data/lib/wp/wp-includes/class-wp-admin-bar.php +517 -0
- data/lib/wp/wp-includes/class-wp-ajax-response.php +199 -0
- data/lib/wp/wp-includes/class-wp-customize-control.php +1124 -0
- data/lib/wp/wp-includes/class-wp-customize-manager.php +1272 -0
- data/lib/wp/wp-includes/class-wp-customize-panel.php +200 -0
- data/lib/wp/wp-includes/class-wp-customize-section.php +196 -0
- data/lib/wp/wp-includes/class-wp-customize-setting.php +554 -0
- data/lib/wp/wp-includes/class-wp-customize-widgets.php +1556 -0
- data/lib/wp/wp-includes/class-wp-editor.php +1435 -0
- data/lib/wp/wp-includes/class-wp-embed.php +373 -0
- data/lib/wp/wp-includes/class-wp-error.php +276 -0
- data/lib/wp/wp-includes/class-wp-http-ixr-client.php +97 -0
- data/lib/wp/wp-includes/class-wp-image-editor-gd.php +459 -0
- data/lib/wp/wp-includes/class-wp-image-editor-imagick.php +512 -0
- data/lib/wp/wp-includes/class-wp-image-editor.php +475 -0
- data/lib/wp/wp-includes/class-wp-theme.php +1235 -0
- data/lib/wp/wp-includes/class-wp-walker.php +471 -0
- data/lib/wp/wp-includes/class-wp-xmlrpc-server.php +5984 -0
- data/lib/wp/wp-includes/class-wp.php +782 -0
- data/lib/wp/wp-includes/class.wp-dependencies.php +509 -0
- data/lib/wp/wp-includes/class.wp-scripts.php +247 -0
- data/lib/wp/wp-includes/class.wp-styles.php +210 -0
- data/lib/wp/wp-includes/comment-template.php +2286 -0
- data/lib/wp/wp-includes/comment.php +2606 -0
- data/lib/wp/wp-includes/compat.php +125 -0
- data/lib/wp/wp-includes/cron.php +469 -0
- data/lib/wp/wp-includes/css/admin-bar-rtl.css +1099 -0
- data/lib/wp/wp-includes/css/admin-bar-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/admin-bar.css +1099 -0
- data/lib/wp/wp-includes/css/admin-bar.min.css +1 -0
- data/lib/wp/wp-includes/css/buttons-rtl.css +364 -0
- data/lib/wp/wp-includes/css/buttons-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/buttons.css +364 -0
- data/lib/wp/wp-includes/css/buttons.min.css +1 -0
- data/lib/wp/wp-includes/css/dashicons.css +893 -0
- data/lib/wp/wp-includes/css/dashicons.min.css +1 -0
- data/lib/wp/wp-includes/css/editor-rtl.css +1993 -0
- data/lib/wp/wp-includes/css/editor-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/editor.css +1993 -0
- data/lib/wp/wp-includes/css/editor.min.css +1 -0
- data/lib/wp/wp-includes/css/jquery-ui-dialog-rtl.css +343 -0
- data/lib/wp/wp-includes/css/jquery-ui-dialog-rtl.min.css +19 -0
- data/lib/wp/wp-includes/css/jquery-ui-dialog.css +343 -0
- data/lib/wp/wp-includes/css/jquery-ui-dialog.min.css +19 -0
- data/lib/wp/wp-includes/css/media-views-rtl.css +2568 -0
- data/lib/wp/wp-includes/css/media-views-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/media-views.css +2568 -0
- data/lib/wp/wp-includes/css/media-views.min.css +1 -0
- data/lib/wp/wp-includes/css/wp-auth-check-rtl.css +100 -0
- data/lib/wp/wp-includes/css/wp-auth-check-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/wp-auth-check.css +100 -0
- data/lib/wp/wp-includes/css/wp-auth-check.min.css +1 -0
- data/lib/wp/wp-includes/css/wp-pointer-rtl.css +212 -0
- data/lib/wp/wp-includes/css/wp-pointer-rtl.min.css +1 -0
- data/lib/wp/wp-includes/css/wp-pointer.css +212 -0
- data/lib/wp/wp-includes/css/wp-pointer.min.css +1 -0
- data/lib/wp/wp-includes/date.php +475 -0
- data/lib/wp/wp-includes/default-constants.php +323 -0
- data/lib/wp/wp-includes/default-filters.php +307 -0
- data/lib/wp/wp-includes/default-widgets.php +1423 -0
- data/lib/wp/wp-includes/deprecated.php +3501 -0
- data/lib/wp/wp-includes/feed-atom-comments.php +115 -0
- data/lib/wp/wp-includes/feed-atom.php +87 -0
- data/lib/wp/wp-includes/feed-rdf.php +81 -0
- data/lib/wp/wp-includes/feed-rss.php +46 -0
- data/lib/wp/wp-includes/feed-rss2-comments.php +97 -0
- data/lib/wp/wp-includes/feed-rss2.php +115 -0
- data/lib/wp/wp-includes/feed.php +659 -0
- data/lib/wp/wp-includes/fonts/dashicons.eot +0 -0
- data/lib/wp/wp-includes/fonts/dashicons.svg +250 -0
- data/lib/wp/wp-includes/fonts/dashicons.ttf +0 -0
- data/lib/wp/wp-includes/fonts/dashicons.woff +0 -0
- data/lib/wp/wp-includes/formatting.php +4006 -0
- data/lib/wp/wp-includes/functions.php +4631 -0
- data/lib/wp/wp-includes/functions.wp-scripts.php +258 -0
- data/lib/wp/wp-includes/functions.wp-styles.php +245 -0
- data/lib/wp/wp-includes/general-template.php +2982 -0
- data/lib/wp/wp-includes/http.php +551 -0
- data/lib/wp/wp-includes/images/admin-bar-sprite-2x.png +0 -0
- data/lib/wp/wp-includes/images/admin-bar-sprite.png +0 -0
- data/lib/wp/wp-includes/images/arrow-pointer-blue-2x.png +0 -0
- data/lib/wp/wp-includes/images/arrow-pointer-blue.png +0 -0
- data/lib/wp/wp-includes/images/blank.gif +0 -0
- data/lib/wp/wp-includes/images/crystal/archive.png +0 -0
- data/lib/wp/wp-includes/images/crystal/audio.png +0 -0
- data/lib/wp/wp-includes/images/crystal/code.png +0 -0
- data/lib/wp/wp-includes/images/crystal/default.png +0 -0
- data/lib/wp/wp-includes/images/crystal/document.png +0 -0
- data/lib/wp/wp-includes/images/crystal/interactive.png +0 -0
- data/lib/wp/wp-includes/images/crystal/license.txt +9 -0
- data/lib/wp/wp-includes/images/crystal/spreadsheet.png +0 -0
- data/lib/wp/wp-includes/images/crystal/text.png +0 -0
- data/lib/wp/wp-includes/images/crystal/video.png +0 -0
- data/lib/wp/wp-includes/images/down_arrow-2x.gif +0 -0
- data/lib/wp/wp-includes/images/down_arrow.gif +0 -0
- data/lib/wp/wp-includes/images/icon-pointer-flag-2x.png +0 -0
- data/lib/wp/wp-includes/images/icon-pointer-flag.png +0 -0
- data/lib/wp/wp-includes/images/media/archive.png +0 -0
- data/lib/wp/wp-includes/images/media/audio.png +0 -0
- data/lib/wp/wp-includes/images/media/code.png +0 -0
- data/lib/wp/wp-includes/images/media/default.png +0 -0
- data/lib/wp/wp-includes/images/media/document.png +0 -0
- data/lib/wp/wp-includes/images/media/interactive.png +0 -0
- data/lib/wp/wp-includes/images/media/spreadsheet.png +0 -0
- data/lib/wp/wp-includes/images/media/text.png +0 -0
- data/lib/wp/wp-includes/images/media/video.png +0 -0
- data/lib/wp/wp-includes/images/rss-2x.png +0 -0
- data/lib/wp/wp-includes/images/rss.png +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_arrow.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_biggrin.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_confused.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_cool.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_cry.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_eek.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_evil.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_exclaim.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_idea.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_lol.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_mad.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_mrgreen.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_neutral.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_question.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_razz.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_redface.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_rolleyes.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_sad.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_smile.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_surprised.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_twisted.gif +0 -0
- data/lib/wp/wp-includes/images/smilies/icon_wink.gif +0 -0
- data/lib/wp/wp-includes/images/spinner-2x.gif +0 -0
- data/lib/wp/wp-includes/images/spinner.gif +0 -0
- data/lib/wp/wp-includes/images/toggle-arrow-2x.png +0 -0
- data/lib/wp/wp-includes/images/toggle-arrow.png +0 -0
- data/lib/wp/wp-includes/images/uploader-icons-2x.png +0 -0
- data/lib/wp/wp-includes/images/uploader-icons.png +0 -0
- data/lib/wp/wp-includes/images/wlw/wp-comments.png +0 -0
- data/lib/wp/wp-includes/images/wlw/wp-icon.png +0 -0
- data/lib/wp/wp-includes/images/wlw/wp-watermark.png +0 -0
- data/lib/wp/wp-includes/images/wpicons-2x.png +0 -0
- data/lib/wp/wp-includes/images/wpicons.png +0 -0
- data/lib/wp/wp-includes/images/wpspin-2x.gif +0 -0
- data/lib/wp/wp-includes/images/wpspin.gif +0 -0
- data/lib/wp/wp-includes/images/xit-2x.gif +0 -0
- data/lib/wp/wp-includes/images/xit.gif +0 -0
- data/lib/wp/wp-includes/js/admin-bar.js +365 -0
- data/lib/wp/wp-includes/js/admin-bar.min.js +1 -0
- data/lib/wp/wp-includes/js/autosave.js +589 -0
- data/lib/wp/wp-includes/js/autosave.min.js +1 -0
- data/lib/wp/wp-includes/js/backbone.min.js +1 -0
- data/lib/wp/wp-includes/js/colorpicker.js +707 -0
- data/lib/wp/wp-includes/js/colorpicker.min.js +1 -0
- data/lib/wp/wp-includes/js/comment-reply.js +47 -0
- data/lib/wp/wp-includes/js/comment-reply.min.js +1 -0
- data/lib/wp/wp-includes/js/crop/cropper.css +165 -0
- data/lib/wp/wp-includes/js/crop/cropper.js +516 -0
- data/lib/wp/wp-includes/js/crop/marqueeHoriz.gif +0 -0
- data/lib/wp/wp-includes/js/crop/marqueeVert.gif +0 -0
- data/lib/wp/wp-includes/js/customize-base.js +617 -0
- data/lib/wp/wp-includes/js/customize-base.min.js +1 -0
- data/lib/wp/wp-includes/js/customize-loader.js +246 -0
- data/lib/wp/wp-includes/js/customize-loader.min.js +1 -0
- data/lib/wp/wp-includes/js/customize-models.js +247 -0
- data/lib/wp/wp-includes/js/customize-models.min.js +1 -0
- data/lib/wp/wp-includes/js/customize-preview-widgets.js +129 -0
- data/lib/wp/wp-includes/js/customize-preview-widgets.min.js +1 -0
- data/lib/wp/wp-includes/js/customize-preview.js +154 -0
- data/lib/wp/wp-includes/js/customize-preview.min.js +1 -0
- data/lib/wp/wp-includes/js/customize-views.js +231 -0
- data/lib/wp/wp-includes/js/customize-views.min.js +1 -0
- data/lib/wp/wp-includes/js/heartbeat.js +738 -0
- data/lib/wp/wp-includes/js/heartbeat.min.js +1 -0
- data/lib/wp/wp-includes/js/hoverIntent.js +115 -0
- data/lib/wp/wp-includes/js/hoverIntent.min.js +1 -0
- data/lib/wp/wp-includes/js/imgareaselect/border-anim-h.gif +0 -0
- data/lib/wp/wp-includes/js/imgareaselect/border-anim-v.gif +0 -0
- data/lib/wp/wp-includes/js/imgareaselect/imgareaselect.css +41 -0
- data/lib/wp/wp-includes/js/imgareaselect/jquery.imgareaselect.js +1205 -0
- data/lib/wp/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js +1 -0
- data/lib/wp/wp-includes/js/jcrop/Jcrop.gif +0 -0
- data/lib/wp/wp-includes/js/jcrop/jquery.Jcrop.min.css +29 -0
- data/lib/wp/wp-includes/js/jcrop/jquery.Jcrop.min.js +22 -0
- data/lib/wp/wp-includes/js/jquery/jquery-migrate.js +521 -0
- data/lib/wp/wp-includes/js/jquery/jquery-migrate.min.js +2 -0
- data/lib/wp/wp-includes/js/jquery/jquery.color.min.js +2 -0
- data/lib/wp/wp-includes/js/jquery/jquery.form.js +1193 -0
- data/lib/wp/wp-includes/js/jquery/jquery.form.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/jquery.hotkeys.js +134 -0
- data/lib/wp/wp-includes/js/jquery/jquery.hotkeys.min.js +1 -0
- data/lib/wp/wp-includes/js/jquery/jquery.js +5 -0
- data/lib/wp/wp-includes/js/jquery/jquery.masonry.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/jquery.query.js +11 -0
- data/lib/wp/wp-includes/js/jquery/jquery.schedule.js +36 -0
- data/lib/wp/wp-includes/js/jquery/jquery.serialize-object.js +31 -0
- data/lib/wp/wp-includes/js/jquery/jquery.table-hotkeys.js +99 -0
- data/lib/wp/wp-includes/js/jquery/jquery.table-hotkeys.min.js +1 -0
- data/lib/wp/wp-includes/js/jquery/jquery.ui.touch-punch.js +11 -0
- data/lib/wp/wp-includes/js/jquery/suggest.js +316 -0
- data/lib/wp/wp-includes/js/jquery/suggest.min.js +1 -0
- data/lib/wp/wp-includes/js/jquery/ui/accordion.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/autocomplete.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/button.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/core.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/datepicker.min.js +12 -0
- data/lib/wp/wp-includes/js/jquery/ui/dialog.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/draggable.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/droppable.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-blind.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-bounce.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-clip.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-drop.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-explode.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-fade.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-fold.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-highlight.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-puff.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-pulsate.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-scale.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-shake.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-size.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-slide.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect-transfer.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/effect.min.js +21 -0
- data/lib/wp/wp-includes/js/jquery/ui/menu.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/mouse.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/position.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/progressbar.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/resizable.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/selectable.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/selectmenu.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/slider.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/sortable.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/spinner.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/tabs.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/tooltip.min.js +11 -0
- data/lib/wp/wp-includes/js/jquery/ui/widget.min.js +11 -0
- data/lib/wp/wp-includes/js/json2.js +480 -0
- data/lib/wp/wp-includes/js/json2.min.js +1 -0
- data/lib/wp/wp-includes/js/masonry.min.js +1 -0
- data/lib/wp/wp-includes/js/mce-view.js +829 -0
- data/lib/wp/wp-includes/js/mce-view.min.js +1 -0
- data/lib/wp/wp-includes/js/media-audiovideo.js +831 -0
- data/lib/wp/wp-includes/js/media-audiovideo.min.js +1 -0
- data/lib/wp/wp-includes/js/media-editor.js +1114 -0
- data/lib/wp/wp-includes/js/media-editor.min.js +1 -0
- data/lib/wp/wp-includes/js/media-grid.js +732 -0
- data/lib/wp/wp-includes/js/media-grid.min.js +1 -0
- data/lib/wp/wp-includes/js/media-models.js +1362 -0
- data/lib/wp/wp-includes/js/media-models.min.js +1 -0
- data/lib/wp/wp-includes/js/media-views.js +7484 -0
- data/lib/wp/wp-includes/js/media-views.min.js +3 -0
- data/lib/wp/wp-includes/js/mediaelement/background.png +0 -0
- data/lib/wp/wp-includes/js/mediaelement/bigplay.png +0 -0
- data/lib/wp/wp-includes/js/mediaelement/bigplay.svg +1 -0
- data/lib/wp/wp-includes/js/mediaelement/controls.png +0 -0
- data/lib/wp/wp-includes/js/mediaelement/controls.svg +1 -0
- data/lib/wp/wp-includes/js/mediaelement/flashmediaelement.swf +0 -0
- data/lib/wp/wp-includes/js/mediaelement/loading.gif +0 -0
- data/lib/wp/wp-includes/js/mediaelement/mediaelement-and-player.min.js +181 -0
- data/lib/wp/wp-includes/js/mediaelement/mediaelementplayer.min.css +1 -0
- data/lib/wp/wp-includes/js/mediaelement/silverlightmediaelement.xap +0 -0
- data/lib/wp/wp-includes/js/mediaelement/wp-mediaelement.css +274 -0
- data/lib/wp/wp-includes/js/mediaelement/wp-mediaelement.js +34 -0
- data/lib/wp/wp-includes/js/mediaelement/wp-playlist.js +175 -0
- data/lib/wp/wp-includes/js/plupload/handlers.js +488 -0
- data/lib/wp/wp-includes/js/plupload/handlers.min.js +1 -0
- data/lib/wp/wp-includes/js/plupload/license.txt +339 -0
- data/lib/wp/wp-includes/js/plupload/plupload.flash.swf +0 -0
- data/lib/wp/wp-includes/js/plupload/plupload.full.min.js +28 -0
- data/lib/wp/wp-includes/js/plupload/plupload.silverlight.xap +0 -0
- data/lib/wp/wp-includes/js/plupload/wp-plupload.js +376 -0
- data/lib/wp/wp-includes/js/plupload/wp-plupload.min.js +1 -0
- data/lib/wp/wp-includes/js/quicktags.js +652 -0
- data/lib/wp/wp-includes/js/quicktags.min.js +1 -0
- data/lib/wp/wp-includes/js/shortcode.js +356 -0
- data/lib/wp/wp-includes/js/shortcode.min.js +1 -0
- data/lib/wp/wp-includes/js/swfobject.js +4 -0
- data/lib/wp/wp-includes/js/swfupload/handlers.js +376 -0
- data/lib/wp/wp-includes/js/swfupload/handlers.min.js +1 -0
- data/lib/wp/wp-includes/js/swfupload/license.txt +32 -0
- data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.cookies.js +53 -0
- data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.queue.js +98 -0
- data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.speed.js +342 -0
- data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.swfobject.js +105 -0
- data/lib/wp/wp-includes/js/swfupload/swfupload.js +980 -0
- data/lib/wp/wp-includes/js/swfupload/swfupload.swf +0 -0
- data/lib/wp/wp-includes/js/thickbox/loadingAnimation.gif +0 -0
- data/lib/wp/wp-includes/js/thickbox/macFFBgHack.png +0 -0
- data/lib/wp/wp-includes/js/thickbox/thickbox.css +138 -0
- data/lib/wp/wp-includes/js/thickbox/thickbox.js +314 -0
- data/lib/wp/wp-includes/js/tinymce/langs/wp-langs-en.js +519 -0
- data/lib/wp/wp-includes/js/tinymce/license.txt +504 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/charmap/plugin.js +370 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/colorpicker/plugin.js +112 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css +212 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/plugin.js +304 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/directionality/plugin.js +64 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/fullscreen/plugin.js +136 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/hr/plugin.js +30 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/hr/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/image/plugin.js +450 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/image/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/lists/plugin.js +786 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/lists/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/media/plugin.js +774 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/media/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/paste/plugin.js +1553 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/paste/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.js +125 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/textcolor/plugin.js +272 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wordpress/plugin.js +513 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js +207 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js +92 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +1035 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpeditimage/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js +78 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpgallery/plugin.js +130 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpgallery/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wplink/plugin.js +63 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wplink/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpview/plugin.js +694 -0
- data/lib/wp/wp-includes/js/tinymce/plugins/wpview/plugin.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/content.min.css +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/readme.md +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.svg +62 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg +63 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/object.gif +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/lightgray/skin.min.css +1 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/audio.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/dashicon-edit.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/embedded.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/gallery-2x.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/gallery.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/more-2x.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/more.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/pagebreak-2x.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/pagebreak.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/playlist-audio.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/playlist-video.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/video.png +0 -0
- data/lib/wp/wp-includes/js/tinymce/skins/wordpress/wp-content.css +618 -0
- data/lib/wp/wp-includes/js/tinymce/themes/modern/theme.js +617 -0
- data/lib/wp/wp-includes/js/tinymce/themes/modern/theme.min.js +1 -0
- data/lib/wp/wp-includes/js/tinymce/tiny_mce_popup.js +539 -0
- data/lib/wp/wp-includes/js/tinymce/tinymce.min.js +11 -0
- data/lib/wp/wp-includes/js/tinymce/utils/editable_selects.js +70 -0
- data/lib/wp/wp-includes/js/tinymce/utils/form_utils.js +210 -0
- data/lib/wp/wp-includes/js/tinymce/utils/mctabs.js +164 -0
- data/lib/wp/wp-includes/js/tinymce/utils/validate.js +252 -0
- data/lib/wp/wp-includes/js/tinymce/wp-mce-help.php +145 -0
- data/lib/wp/wp-includes/js/tinymce/wp-tinymce.js.gz +0 -0
- data/lib/wp/wp-includes/js/tinymce/wp-tinymce.php +39 -0
- data/lib/wp/wp-includes/js/tw-sack.js +193 -0
- data/lib/wp/wp-includes/js/tw-sack.min.js +1 -0
- data/lib/wp/wp-includes/js/underscore.min.js +1 -0
- data/lib/wp/wp-includes/js/utils.js +197 -0
- data/lib/wp/wp-includes/js/utils.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-ajax-response.js +64 -0
- data/lib/wp/wp-includes/js/wp-ajax-response.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-auth-check.js +112 -0
- data/lib/wp/wp-includes/js/wp-auth-check.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-backbone.js +386 -0
- data/lib/wp/wp-includes/js/wp-backbone.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-list-revisions.js +24 -0
- data/lib/wp/wp-includes/js/wp-list-revisions.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-lists.js +469 -0
- data/lib/wp/wp-includes/js/wp-lists.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-pointer.js +282 -0
- data/lib/wp/wp-includes/js/wp-pointer.min.js +1 -0
- data/lib/wp/wp-includes/js/wp-util.js +106 -0
- data/lib/wp/wp-includes/js/wp-util.min.js +1 -0
- data/lib/wp/wp-includes/js/wpdialog.js +19 -0
- data/lib/wp/wp-includes/js/wpdialog.min.js +1 -0
- data/lib/wp/wp-includes/js/wplink.js +615 -0
- data/lib/wp/wp-includes/js/wplink.min.js +1 -0
- data/lib/wp/wp-includes/js/zxcvbn-async.js +18 -0
- data/lib/wp/wp-includes/js/zxcvbn-async.min.js +1 -0
- data/lib/wp/wp-includes/js/zxcvbn.min.js +47 -0
- data/lib/wp/wp-includes/kses.php +1526 -0
- data/lib/wp/wp-includes/l10n.php +908 -0
- data/lib/wp/wp-includes/link-template.php +3141 -0
- data/lib/wp/wp-includes/load.php +828 -0
- data/lib/wp/wp-includes/locale.php +368 -0
- data/lib/wp/wp-includes/media-template.php +1235 -0
- data/lib/wp/wp-includes/media.php +3329 -0
- data/lib/wp/wp-includes/meta.php +1221 -0
- data/lib/wp/wp-includes/ms-blogs.php +939 -0
- data/lib/wp/wp-includes/ms-default-constants.php +153 -0
- data/lib/wp/wp-includes/ms-default-filters.php +82 -0
- data/lib/wp/wp-includes/ms-deprecated.php +347 -0
- data/lib/wp/wp-includes/ms-files.php +82 -0
- data/lib/wp/wp-includes/ms-functions.php +2476 -0
- data/lib/wp/wp-includes/ms-load.php +458 -0
- data/lib/wp/wp-includes/ms-settings.php +213 -0
- data/lib/wp/wp-includes/nav-menu-template.php +678 -0
- data/lib/wp/wp-includes/nav-menu.php +895 -0
- data/lib/wp/wp-includes/option.php +1440 -0
- data/lib/wp/wp-includes/pluggable-deprecated.php +192 -0
- data/lib/wp/wp-includes/pluggable.php +2283 -0
- data/lib/wp/wp-includes/plugin.php +920 -0
- data/lib/wp/wp-includes/pomo/entry.php +78 -0
- data/lib/wp/wp-includes/pomo/mo.php +262 -0
- data/lib/wp/wp-includes/pomo/po.php +384 -0
- data/lib/wp/wp-includes/pomo/streams.php +209 -0
- data/lib/wp/wp-includes/pomo/translations.php +275 -0
- data/lib/wp/wp-includes/post-formats.php +243 -0
- data/lib/wp/wp-includes/post-template.php +1766 -0
- data/lib/wp/wp-includes/post-thumbnail-template.php +142 -0
- data/lib/wp/wp-includes/post.php +5842 -0
- data/lib/wp/wp-includes/query.php +4666 -0
- data/lib/wp/wp-includes/registration-functions.php +7 -0
- data/lib/wp/wp-includes/registration.php +7 -0
- data/lib/wp/wp-includes/revision.php +657 -0
- data/lib/wp/wp-includes/rewrite.php +2180 -0
- data/lib/wp/wp-includes/rss-functions.php +9 -0
- data/lib/wp/wp-includes/rss.php +936 -0
- data/lib/wp/wp-includes/script-loader.php +1045 -0
- data/lib/wp/wp-includes/session.php +430 -0
- data/lib/wp/wp-includes/shortcodes.php +410 -0
- data/lib/wp/wp-includes/taxonomy.php +4006 -0
- data/lib/wp/wp-includes/template-loader.php +76 -0
- data/lib/wp/wp-includes/template.php +505 -0
- data/lib/wp/wp-includes/theme-compat/comments-popup.php +128 -0
- data/lib/wp/wp-includes/theme-compat/comments.php +101 -0
- data/lib/wp/wp-includes/theme-compat/footer.php +30 -0
- data/lib/wp/wp-includes/theme-compat/header.php +49 -0
- data/lib/wp/wp-includes/theme-compat/sidebar.php +83 -0
- data/lib/wp/wp-includes/theme.php +2014 -0
- data/lib/wp/wp-includes/update.php +674 -0
- data/lib/wp/wp-includes/user.php +2292 -0
- data/lib/wp/wp-includes/vars.php +144 -0
- data/lib/wp/wp-includes/version.php +35 -0
- data/lib/wp/wp-includes/widgets.php +1514 -0
- data/lib/wp/wp-includes/wlwmanifest.xml +43 -0
- data/lib/wp/wp-includes/wp-db.php +2190 -0
- data/lib/wp/wp-includes/wp-diff.php +523 -0
- data/lib/wp/wp-links-opml.php +80 -0
- data/lib/wp/wp-load.php +73 -0
- data/lib/wp/wp-login.php +952 -0
- data/lib/wp/wp-mail.php +260 -0
- data/lib/wp/wp-settings.php +374 -0
- data/lib/wp/wp-signup.php +749 -0
- data/lib/wp/wp-trackback.php +127 -0
- data/lib/wp/xmlrpc.php +101 -0
- data/stump-cli.gemspec +26 -0
- metadata +1332 -4
@@ -0,0 +1,4631 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Main WordPress API
|
4
|
+
*
|
5
|
+
* @package WordPress
|
6
|
+
*/
|
7
|
+
|
8
|
+
require( ABSPATH . WPINC . '/option.php' );
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Convert given date string into a different format.
|
12
|
+
*
|
13
|
+
* $format should be either a PHP date format string, e.g. 'U' for a Unix
|
14
|
+
* timestamp, or 'G' for a Unix timestamp assuming that $date is GMT.
|
15
|
+
*
|
16
|
+
* If $translate is true then the given date and format string will
|
17
|
+
* be passed to date_i18n() for translation.
|
18
|
+
*
|
19
|
+
* @since 0.71
|
20
|
+
*
|
21
|
+
* @param string $format Format of the date to return.
|
22
|
+
* @param string $date Date string to convert.
|
23
|
+
* @param bool $translate Whether the return date should be translated. Default true.
|
24
|
+
* @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
|
25
|
+
*/
|
26
|
+
function mysql2date( $format, $date, $translate = true ) {
|
27
|
+
if ( empty( $date ) )
|
28
|
+
return false;
|
29
|
+
|
30
|
+
if ( 'G' == $format )
|
31
|
+
return strtotime( $date . ' +0000' );
|
32
|
+
|
33
|
+
$i = strtotime( $date );
|
34
|
+
|
35
|
+
if ( 'U' == $format )
|
36
|
+
return $i;
|
37
|
+
|
38
|
+
if ( $translate )
|
39
|
+
return date_i18n( $format, $i );
|
40
|
+
else
|
41
|
+
return date( $format, $i );
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Retrieve the current time based on specified type.
|
46
|
+
*
|
47
|
+
* The 'mysql' type will return the time in the format for MySQL DATETIME field.
|
48
|
+
* The 'timestamp' type will return the current timestamp.
|
49
|
+
* Other strings will be interpreted as PHP date formats (e.g. 'Y-m-d').
|
50
|
+
*
|
51
|
+
* If $gmt is set to either '1' or 'true', then both types will use GMT time.
|
52
|
+
* if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.
|
53
|
+
*
|
54
|
+
* @since 1.0.0
|
55
|
+
*
|
56
|
+
* @param string $type Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date
|
57
|
+
* format string (e.g. 'Y-m-d').
|
58
|
+
* @param int|bool $gmt Optional. Whether to use GMT timezone. Default false.
|
59
|
+
* @return int|string Integer if $type is 'timestamp', string otherwise.
|
60
|
+
*/
|
61
|
+
function current_time( $type, $gmt = 0 ) {
|
62
|
+
switch ( $type ) {
|
63
|
+
case 'mysql':
|
64
|
+
return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
|
65
|
+
case 'timestamp':
|
66
|
+
return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
|
67
|
+
default:
|
68
|
+
return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Retrieve the date in localized format, based on timestamp.
|
74
|
+
*
|
75
|
+
* If the locale specifies the locale month and weekday, then the locale will
|
76
|
+
* take over the format for the date. If it isn't, then the date format string
|
77
|
+
* will be used instead.
|
78
|
+
*
|
79
|
+
* @since 0.71
|
80
|
+
*
|
81
|
+
* @param string $dateformatstring Format to display the date.
|
82
|
+
* @param bool|int $unixtimestamp Optional. Unix timestamp. Default false.
|
83
|
+
* @param bool $gmt Optional. Whether to use GMT timezone. Default false.
|
84
|
+
*
|
85
|
+
* @return string The date, translated if locale specifies it.
|
86
|
+
*/
|
87
|
+
function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
|
88
|
+
global $wp_locale;
|
89
|
+
$i = $unixtimestamp;
|
90
|
+
|
91
|
+
if ( false === $i ) {
|
92
|
+
if ( ! $gmt )
|
93
|
+
$i = current_time( 'timestamp' );
|
94
|
+
else
|
95
|
+
$i = time();
|
96
|
+
// we should not let date() interfere with our
|
97
|
+
// specially computed timestamp
|
98
|
+
$gmt = true;
|
99
|
+
}
|
100
|
+
|
101
|
+
/*
|
102
|
+
* Store original value for language with untypical grammars.
|
103
|
+
* See https://core.trac.wordpress.org/ticket/9396
|
104
|
+
*/
|
105
|
+
$req_format = $dateformatstring;
|
106
|
+
|
107
|
+
$datefunc = $gmt? 'gmdate' : 'date';
|
108
|
+
|
109
|
+
if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
|
110
|
+
$datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );
|
111
|
+
$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
|
112
|
+
$dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );
|
113
|
+
$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
|
114
|
+
$datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );
|
115
|
+
$datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) );
|
116
|
+
$dateformatstring = ' '.$dateformatstring;
|
117
|
+
$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
|
118
|
+
$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
|
119
|
+
$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
|
120
|
+
$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
|
121
|
+
$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
|
122
|
+
$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
|
123
|
+
|
124
|
+
$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
|
125
|
+
}
|
126
|
+
$timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
|
127
|
+
$timezone_formats_re = implode( '|', $timezone_formats );
|
128
|
+
if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
|
129
|
+
$timezone_string = get_option( 'timezone_string' );
|
130
|
+
if ( $timezone_string ) {
|
131
|
+
$timezone_object = timezone_open( $timezone_string );
|
132
|
+
$date_object = date_create( null, $timezone_object );
|
133
|
+
foreach( $timezone_formats as $timezone_format ) {
|
134
|
+
if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
|
135
|
+
$formatted = date_format( $date_object, $timezone_format );
|
136
|
+
$dateformatstring = ' '.$dateformatstring;
|
137
|
+
$dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
|
138
|
+
$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
$j = @$datefunc( $dateformatstring, $i );
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Filter the date formatted based on the locale.
|
147
|
+
*
|
148
|
+
* @since 2.8.0
|
149
|
+
*
|
150
|
+
* @param string $j Formatted date string.
|
151
|
+
* @param string $req_format Format to display the date.
|
152
|
+
* @param int $i Unix timestamp.
|
153
|
+
* @param bool $gmt Whether to convert to GMT for time. Default false.
|
154
|
+
*/
|
155
|
+
$j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );
|
156
|
+
return $j;
|
157
|
+
}
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Convert integer number to format based on the locale.
|
161
|
+
*
|
162
|
+
* @since 2.3.0
|
163
|
+
*
|
164
|
+
* @param int $number The number to convert based on locale.
|
165
|
+
* @param int $decimals Optional. Precision of the number of decimal places. Default 0.
|
166
|
+
* @return string Converted number in string format.
|
167
|
+
*/
|
168
|
+
function number_format_i18n( $number, $decimals = 0 ) {
|
169
|
+
global $wp_locale;
|
170
|
+
$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Filter the number formatted based on the locale.
|
174
|
+
*
|
175
|
+
* @since 2.8.0
|
176
|
+
*
|
177
|
+
* @param string $formatted Converted number in string format.
|
178
|
+
*/
|
179
|
+
return apply_filters( 'number_format_i18n', $formatted );
|
180
|
+
}
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Convert number of bytes largest unit bytes will fit into.
|
184
|
+
*
|
185
|
+
* It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts
|
186
|
+
* number of bytes to human readable number by taking the number of that unit
|
187
|
+
* that the bytes will go into it. Supports TB value.
|
188
|
+
*
|
189
|
+
* Please note that integers in PHP are limited to 32 bits, unless they are on
|
190
|
+
* 64 bit architecture, then they have 64 bit size. If you need to place the
|
191
|
+
* larger size then what PHP integer type will hold, then use a string. It will
|
192
|
+
* be converted to a double, which should always have 64 bit length.
|
193
|
+
*
|
194
|
+
* Technically the correct unit names for powers of 1024 are KiB, MiB etc.
|
195
|
+
*
|
196
|
+
* @since 2.3.0
|
197
|
+
*
|
198
|
+
* @param int|string $bytes Number of bytes. Note max integer size for integers.
|
199
|
+
* @param int $decimals Optional. Precision of number of decimal places. Default 0.
|
200
|
+
* @return bool|string False on failure. Number string on success.
|
201
|
+
*/
|
202
|
+
function size_format( $bytes, $decimals = 0 ) {
|
203
|
+
$quant = array(
|
204
|
+
// ========================= Origin ====
|
205
|
+
'TB' => 1099511627776, // pow( 1024, 4)
|
206
|
+
'GB' => 1073741824, // pow( 1024, 3)
|
207
|
+
'MB' => 1048576, // pow( 1024, 2)
|
208
|
+
'kB' => 1024, // pow( 1024, 1)
|
209
|
+
'B ' => 1, // pow( 1024, 0)
|
210
|
+
);
|
211
|
+
foreach ( $quant as $unit => $mag )
|
212
|
+
if ( doubleval($bytes) >= $mag )
|
213
|
+
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
|
214
|
+
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Get the week start and end from the datetime or date string from MySQL.
|
220
|
+
*
|
221
|
+
* @since 0.71
|
222
|
+
*
|
223
|
+
* @param string $mysqlstring Date or datetime field type from MySQL.
|
224
|
+
* @param int|string $start_of_week Optional. Start of the week as an integer. Default empty string.
|
225
|
+
* @return array Keys are 'start' and 'end'.
|
226
|
+
*/
|
227
|
+
function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
|
228
|
+
// MySQL string year.
|
229
|
+
$my = substr( $mysqlstring, 0, 4 );
|
230
|
+
|
231
|
+
// MySQL string month.
|
232
|
+
$mm = substr( $mysqlstring, 8, 2 );
|
233
|
+
|
234
|
+
// MySQL string day.
|
235
|
+
$md = substr( $mysqlstring, 5, 2 );
|
236
|
+
|
237
|
+
// The timestamp for MySQL string day.
|
238
|
+
$day = mktime( 0, 0, 0, $md, $mm, $my );
|
239
|
+
|
240
|
+
// The day of the week from the timestamp.
|
241
|
+
$weekday = date( 'w', $day );
|
242
|
+
|
243
|
+
if ( !is_numeric($start_of_week) )
|
244
|
+
$start_of_week = get_option( 'start_of_week' );
|
245
|
+
|
246
|
+
if ( $weekday < $start_of_week )
|
247
|
+
$weekday += 7;
|
248
|
+
|
249
|
+
// The most recent week start day on or before $day.
|
250
|
+
$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
|
251
|
+
|
252
|
+
// $start + 7 days - 1 second.
|
253
|
+
$end = $start + 7 * DAY_IN_SECONDS - 1;
|
254
|
+
return compact( 'start', 'end' );
|
255
|
+
}
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Unserialize value only if it was serialized.
|
259
|
+
*
|
260
|
+
* @since 2.0.0
|
261
|
+
*
|
262
|
+
* @param string $original Maybe unserialized original, if is needed.
|
263
|
+
* @return mixed Unserialized data can be any type.
|
264
|
+
*/
|
265
|
+
function maybe_unserialize( $original ) {
|
266
|
+
if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
|
267
|
+
return @unserialize( $original );
|
268
|
+
return $original;
|
269
|
+
}
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Check value to find if it was serialized.
|
273
|
+
*
|
274
|
+
* If $data is not an string, then returned value will always be false.
|
275
|
+
* Serialized data is always a string.
|
276
|
+
*
|
277
|
+
* @since 2.0.5
|
278
|
+
*
|
279
|
+
* @param string $data Value to check to see if was serialized.
|
280
|
+
* @param bool $strict Optional. Whether to be strict about the end of the string. Default true.
|
281
|
+
* @return bool False if not serialized and true if it was.
|
282
|
+
*/
|
283
|
+
function is_serialized( $data, $strict = true ) {
|
284
|
+
// if it isn't a string, it isn't serialized.
|
285
|
+
if ( ! is_string( $data ) ) {
|
286
|
+
return false;
|
287
|
+
}
|
288
|
+
$data = trim( $data );
|
289
|
+
if ( 'N;' == $data ) {
|
290
|
+
return true;
|
291
|
+
}
|
292
|
+
if ( strlen( $data ) < 4 ) {
|
293
|
+
return false;
|
294
|
+
}
|
295
|
+
if ( ':' !== $data[1] ) {
|
296
|
+
return false;
|
297
|
+
}
|
298
|
+
if ( $strict ) {
|
299
|
+
$lastc = substr( $data, -1 );
|
300
|
+
if ( ';' !== $lastc && '}' !== $lastc ) {
|
301
|
+
return false;
|
302
|
+
}
|
303
|
+
} else {
|
304
|
+
$semicolon = strpos( $data, ';' );
|
305
|
+
$brace = strpos( $data, '}' );
|
306
|
+
// Either ; or } must exist.
|
307
|
+
if ( false === $semicolon && false === $brace )
|
308
|
+
return false;
|
309
|
+
// But neither must be in the first X characters.
|
310
|
+
if ( false !== $semicolon && $semicolon < 3 )
|
311
|
+
return false;
|
312
|
+
if ( false !== $brace && $brace < 4 )
|
313
|
+
return false;
|
314
|
+
}
|
315
|
+
$token = $data[0];
|
316
|
+
switch ( $token ) {
|
317
|
+
case 's' :
|
318
|
+
if ( $strict ) {
|
319
|
+
if ( '"' !== substr( $data, -2, 1 ) ) {
|
320
|
+
return false;
|
321
|
+
}
|
322
|
+
} elseif ( false === strpos( $data, '"' ) ) {
|
323
|
+
return false;
|
324
|
+
}
|
325
|
+
// or else fall through
|
326
|
+
case 'a' :
|
327
|
+
case 'O' :
|
328
|
+
return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
|
329
|
+
case 'b' :
|
330
|
+
case 'i' :
|
331
|
+
case 'd' :
|
332
|
+
$end = $strict ? '$' : '';
|
333
|
+
return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
|
334
|
+
}
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Check whether serialized data is of string type.
|
340
|
+
*
|
341
|
+
* @since 2.0.5
|
342
|
+
*
|
343
|
+
* @param string $data Serialized data.
|
344
|
+
* @return bool False if not a serialized string, true if it is.
|
345
|
+
*/
|
346
|
+
function is_serialized_string( $data ) {
|
347
|
+
// if it isn't a string, it isn't a serialized string.
|
348
|
+
if ( ! is_string( $data ) ) {
|
349
|
+
return false;
|
350
|
+
}
|
351
|
+
$data = trim( $data );
|
352
|
+
if ( strlen( $data ) < 4 ) {
|
353
|
+
return false;
|
354
|
+
} elseif ( ':' !== $data[1] ) {
|
355
|
+
return false;
|
356
|
+
} elseif ( ';' !== substr( $data, -1 ) ) {
|
357
|
+
return false;
|
358
|
+
} elseif ( $data[0] !== 's' ) {
|
359
|
+
return false;
|
360
|
+
} elseif ( '"' !== substr( $data, -2, 1 ) ) {
|
361
|
+
return false;
|
362
|
+
} else {
|
363
|
+
return true;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
/**
|
368
|
+
* Serialize data, if needed.
|
369
|
+
*
|
370
|
+
* @since 2.0.5
|
371
|
+
*
|
372
|
+
* @param string|array|object $data Data that might be serialized.
|
373
|
+
* @return mixed A scalar data
|
374
|
+
*/
|
375
|
+
function maybe_serialize( $data ) {
|
376
|
+
if ( is_array( $data ) || is_object( $data ) )
|
377
|
+
return serialize( $data );
|
378
|
+
|
379
|
+
// Double serialization is required for backward compatibility.
|
380
|
+
// See https://core.trac.wordpress.org/ticket/12930
|
381
|
+
if ( is_serialized( $data, false ) )
|
382
|
+
return serialize( $data );
|
383
|
+
|
384
|
+
return $data;
|
385
|
+
}
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Retrieve post title from XMLRPC XML.
|
389
|
+
*
|
390
|
+
* If the title element is not part of the XML, then the default post title from
|
391
|
+
* the $post_default_title will be used instead.
|
392
|
+
*
|
393
|
+
* @since 0.71
|
394
|
+
*
|
395
|
+
* @global string $post_default_title Default XML-RPC post title.
|
396
|
+
*
|
397
|
+
* @param string $content XMLRPC XML Request content
|
398
|
+
* @return string Post title
|
399
|
+
*/
|
400
|
+
function xmlrpc_getposttitle( $content ) {
|
401
|
+
global $post_default_title;
|
402
|
+
if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
|
403
|
+
$post_title = $matchtitle[1];
|
404
|
+
} else {
|
405
|
+
$post_title = $post_default_title;
|
406
|
+
}
|
407
|
+
return $post_title;
|
408
|
+
}
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Retrieve the post category or categories from XMLRPC XML.
|
412
|
+
*
|
413
|
+
* If the category element is not found, then the default post category will be
|
414
|
+
* used. The return type then would be what $post_default_category. If the
|
415
|
+
* category is found, then it will always be an array.
|
416
|
+
*
|
417
|
+
* @since 0.71
|
418
|
+
*
|
419
|
+
* @global string $post_default_category Default XML-RPC post category.
|
420
|
+
*
|
421
|
+
* @param string $content XMLRPC XML Request content
|
422
|
+
* @return string|array List of categories or category name.
|
423
|
+
*/
|
424
|
+
function xmlrpc_getpostcategory( $content ) {
|
425
|
+
global $post_default_category;
|
426
|
+
if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
|
427
|
+
$post_category = trim( $matchcat[1], ',' );
|
428
|
+
$post_category = explode( ',', $post_category );
|
429
|
+
} else {
|
430
|
+
$post_category = $post_default_category;
|
431
|
+
}
|
432
|
+
return $post_category;
|
433
|
+
}
|
434
|
+
|
435
|
+
/**
|
436
|
+
* XMLRPC XML content without title and category elements.
|
437
|
+
*
|
438
|
+
* @since 0.71
|
439
|
+
*
|
440
|
+
* @param string $content XML-RPC XML Request content.
|
441
|
+
* @return string XMLRPC XML Request content without title and category elements.
|
442
|
+
*/
|
443
|
+
function xmlrpc_removepostdata( $content ) {
|
444
|
+
$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
|
445
|
+
$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
|
446
|
+
$content = trim( $content );
|
447
|
+
return $content;
|
448
|
+
}
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Use RegEx to extract URLs from arbitrary content.
|
452
|
+
*
|
453
|
+
* @since 3.7.0
|
454
|
+
*
|
455
|
+
* @param string $content Content to extract URLs from.
|
456
|
+
* @return array URLs found in passed string.
|
457
|
+
*/
|
458
|
+
function wp_extract_urls( $content ) {
|
459
|
+
preg_match_all(
|
460
|
+
"#([\"']?)("
|
461
|
+
. "(?:([\w-]+:)?//?)"
|
462
|
+
. "[^\s()<>]+"
|
463
|
+
. "[.]"
|
464
|
+
. "(?:"
|
465
|
+
. "\([\w\d]+\)|"
|
466
|
+
. "(?:"
|
467
|
+
. "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|"
|
468
|
+
. "(?:[:]\d+)?/?"
|
469
|
+
. ")+"
|
470
|
+
. ")"
|
471
|
+
. ")\\1#",
|
472
|
+
$content,
|
473
|
+
$post_links
|
474
|
+
);
|
475
|
+
|
476
|
+
$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );
|
477
|
+
|
478
|
+
return array_values( $post_links );
|
479
|
+
}
|
480
|
+
|
481
|
+
/**
|
482
|
+
* Check content for video and audio links to add as enclosures.
|
483
|
+
*
|
484
|
+
* Will not add enclosures that have already been added and will
|
485
|
+
* remove enclosures that are no longer in the post. This is called as
|
486
|
+
* pingbacks and trackbacks.
|
487
|
+
*
|
488
|
+
* @since 1.5.0
|
489
|
+
*
|
490
|
+
* @see $wpdb
|
491
|
+
*
|
492
|
+
* @param string $content Post Content.
|
493
|
+
* @param int $post_ID Post ID.
|
494
|
+
*/
|
495
|
+
function do_enclose( $content, $post_ID ) {
|
496
|
+
global $wpdb;
|
497
|
+
|
498
|
+
//TODO: Tidy this ghetto code up and make the debug code optional
|
499
|
+
include_once( ABSPATH . WPINC . '/class-IXR.php' );
|
500
|
+
|
501
|
+
$post_links = array();
|
502
|
+
|
503
|
+
$pung = get_enclosed( $post_ID );
|
504
|
+
|
505
|
+
$post_links_temp = wp_extract_urls( $content );
|
506
|
+
|
507
|
+
foreach ( $pung as $link_test ) {
|
508
|
+
if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
|
509
|
+
$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
|
510
|
+
foreach ( $mids as $mid )
|
511
|
+
delete_metadata_by_mid( 'post', $mid );
|
512
|
+
}
|
513
|
+
}
|
514
|
+
|
515
|
+
foreach ( (array) $post_links_temp as $link_test ) {
|
516
|
+
if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
|
517
|
+
$test = @parse_url( $link_test );
|
518
|
+
if ( false === $test )
|
519
|
+
continue;
|
520
|
+
if ( isset( $test['query'] ) )
|
521
|
+
$post_links[] = $link_test;
|
522
|
+
elseif ( isset($test['path']) && ( $test['path'] != '/' ) && ($test['path'] != '' ) )
|
523
|
+
$post_links[] = $link_test;
|
524
|
+
}
|
525
|
+
}
|
526
|
+
|
527
|
+
foreach ( (array) $post_links as $url ) {
|
528
|
+
if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
|
529
|
+
|
530
|
+
if ( $headers = wp_get_http_headers( $url) ) {
|
531
|
+
$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
|
532
|
+
$type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
|
533
|
+
$allowed_types = array( 'video', 'audio' );
|
534
|
+
|
535
|
+
// Check to see if we can figure out the mime type from
|
536
|
+
// the extension
|
537
|
+
$url_parts = @parse_url( $url );
|
538
|
+
if ( false !== $url_parts ) {
|
539
|
+
$extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
|
540
|
+
if ( !empty( $extension ) ) {
|
541
|
+
foreach ( wp_get_mime_types() as $exts => $mime ) {
|
542
|
+
if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
|
543
|
+
$type = $mime;
|
544
|
+
break;
|
545
|
+
}
|
546
|
+
}
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
|
551
|
+
add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
}
|
557
|
+
|
558
|
+
/**
|
559
|
+
* Perform a HTTP HEAD or GET request.
|
560
|
+
*
|
561
|
+
* If $file_path is a writable filename, this will do a GET request and write
|
562
|
+
* the file to that path.
|
563
|
+
*
|
564
|
+
* @since 2.5.0
|
565
|
+
*
|
566
|
+
* @param string $url URL to fetch.
|
567
|
+
* @param string|bool $file_path Optional. File path to write request to. Default false.
|
568
|
+
* @param int $red Optional. The number of Redirects followed, Upon 5 being hit,
|
569
|
+
* returns false. Default 1.
|
570
|
+
* @return bool|string False on failure and string of headers if HEAD request.
|
571
|
+
*/
|
572
|
+
function wp_get_http( $url, $file_path = false, $red = 1 ) {
|
573
|
+
@set_time_limit( 60 );
|
574
|
+
|
575
|
+
if ( $red > 5 )
|
576
|
+
return false;
|
577
|
+
|
578
|
+
$options = array();
|
579
|
+
$options['redirection'] = 5;
|
580
|
+
|
581
|
+
if ( false == $file_path )
|
582
|
+
$options['method'] = 'HEAD';
|
583
|
+
else
|
584
|
+
$options['method'] = 'GET';
|
585
|
+
|
586
|
+
$response = wp_safe_remote_request( $url, $options );
|
587
|
+
|
588
|
+
if ( is_wp_error( $response ) )
|
589
|
+
return false;
|
590
|
+
|
591
|
+
$headers = wp_remote_retrieve_headers( $response );
|
592
|
+
$headers['response'] = wp_remote_retrieve_response_code( $response );
|
593
|
+
|
594
|
+
// WP_HTTP no longer follows redirects for HEAD requests.
|
595
|
+
if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
|
596
|
+
return wp_get_http( $headers['location'], $file_path, ++$red );
|
597
|
+
}
|
598
|
+
|
599
|
+
if ( false == $file_path )
|
600
|
+
return $headers;
|
601
|
+
|
602
|
+
// GET request - write it to the supplied filename
|
603
|
+
$out_fp = fopen($file_path, 'w');
|
604
|
+
if ( !$out_fp )
|
605
|
+
return $headers;
|
606
|
+
|
607
|
+
fwrite( $out_fp, wp_remote_retrieve_body( $response ) );
|
608
|
+
fclose($out_fp);
|
609
|
+
clearstatcache();
|
610
|
+
|
611
|
+
return $headers;
|
612
|
+
}
|
613
|
+
|
614
|
+
/**
|
615
|
+
* Retrieve HTTP Headers from URL.
|
616
|
+
*
|
617
|
+
* @since 1.5.1
|
618
|
+
*
|
619
|
+
* @param string $url URL to retrieve HTTP headers from.
|
620
|
+
* @param bool $deprecated Not Used.
|
621
|
+
* @return bool|string False on failure, headers on success.
|
622
|
+
*/
|
623
|
+
function wp_get_http_headers( $url, $deprecated = false ) {
|
624
|
+
if ( !empty( $deprecated ) )
|
625
|
+
_deprecated_argument( __FUNCTION__, '2.7' );
|
626
|
+
|
627
|
+
$response = wp_safe_remote_head( $url );
|
628
|
+
|
629
|
+
if ( is_wp_error( $response ) )
|
630
|
+
return false;
|
631
|
+
|
632
|
+
return wp_remote_retrieve_headers( $response );
|
633
|
+
}
|
634
|
+
|
635
|
+
/**
|
636
|
+
* Whether the publish date of the current post in the loop is different from the
|
637
|
+
* publish date of the previous post in the loop.
|
638
|
+
*
|
639
|
+
* @since 0.71
|
640
|
+
*
|
641
|
+
* @global string $currentday The day of the current post in the loop.
|
642
|
+
* @global string $previousday The day of the previous post in the loop.
|
643
|
+
*
|
644
|
+
* @return int|bool 1|true when new day, 0|false if not a new day.
|
645
|
+
*/
|
646
|
+
function is_new_day() {
|
647
|
+
global $currentday, $previousday;
|
648
|
+
if ( $currentday != $previousday )
|
649
|
+
return 1;
|
650
|
+
else
|
651
|
+
return 0;
|
652
|
+
}
|
653
|
+
|
654
|
+
/**
|
655
|
+
* Build URL query based on an associative and, or indexed array.
|
656
|
+
*
|
657
|
+
* This is a convenient function for easily building url queries. It sets the
|
658
|
+
* separator to '&' and uses _http_build_query() function.
|
659
|
+
*
|
660
|
+
* @since 2.3.0
|
661
|
+
*
|
662
|
+
* @see _http_build_query() Used to build the query
|
663
|
+
* @see http://us2.php.net/manual/en/function.http-build-query.php for more on what
|
664
|
+
* http_build_query() does.
|
665
|
+
*
|
666
|
+
* @param array $data URL-encode key/value pairs.
|
667
|
+
* @return string URL-encoded string.
|
668
|
+
*/
|
669
|
+
function build_query( $data ) {
|
670
|
+
return _http_build_query( $data, null, '&', '', false );
|
671
|
+
}
|
672
|
+
|
673
|
+
/**
|
674
|
+
* From php.net (modified by Mark Jaquith to behave like the native PHP5 function).
|
675
|
+
*
|
676
|
+
* @since 3.2.0
|
677
|
+
* @access private
|
678
|
+
*
|
679
|
+
* @see http://us1.php.net/manual/en/function.http-build-query.php
|
680
|
+
*
|
681
|
+
* @param array|object $data An array or object of data. Converted to array.
|
682
|
+
* @param string $prefix Optional. Numeric index. If set, start parameter numbering with it.
|
683
|
+
* Default null.
|
684
|
+
* @param string $sep Optional. Argument separator; defaults to 'arg_separator.output'.
|
685
|
+
* Default null.
|
686
|
+
* @param string $key Optional. Used to prefix key name. Default empty.
|
687
|
+
* @param bool $urlencode Optional. Whether to use urlencode() in the result. Default true.
|
688
|
+
*
|
689
|
+
* @return string The query string.
|
690
|
+
*/
|
691
|
+
function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) {
|
692
|
+
$ret = array();
|
693
|
+
|
694
|
+
foreach ( (array) $data as $k => $v ) {
|
695
|
+
if ( $urlencode)
|
696
|
+
$k = urlencode($k);
|
697
|
+
if ( is_int($k) && $prefix != null )
|
698
|
+
$k = $prefix.$k;
|
699
|
+
if ( !empty($key) )
|
700
|
+
$k = $key . '%5B' . $k . '%5D';
|
701
|
+
if ( $v === null )
|
702
|
+
continue;
|
703
|
+
elseif ( $v === FALSE )
|
704
|
+
$v = '0';
|
705
|
+
|
706
|
+
if ( is_array($v) || is_object($v) )
|
707
|
+
array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
|
708
|
+
elseif ( $urlencode )
|
709
|
+
array_push($ret, $k.'='.urlencode($v));
|
710
|
+
else
|
711
|
+
array_push($ret, $k.'='.$v);
|
712
|
+
}
|
713
|
+
|
714
|
+
if ( null === $sep )
|
715
|
+
$sep = ini_get('arg_separator.output');
|
716
|
+
|
717
|
+
return implode($sep, $ret);
|
718
|
+
}
|
719
|
+
|
720
|
+
/**
|
721
|
+
* Retrieve a modified URL query string.
|
722
|
+
*
|
723
|
+
* You can rebuild the URL and append a new query variable to the URL query by
|
724
|
+
* using this function. You can also retrieve the full URL with query data.
|
725
|
+
*
|
726
|
+
* Adding a single key & value or an associative array. Setting a key value to
|
727
|
+
* an empty string removes the key. Omitting oldquery_or_uri uses the $_SERVER
|
728
|
+
* value. Additional values provided are expected to be encoded appropriately
|
729
|
+
* with urlencode() or rawurlencode().
|
730
|
+
*
|
731
|
+
* @since 1.5.0
|
732
|
+
*
|
733
|
+
* @param string|array $param1 Either newkey or an associative_array.
|
734
|
+
* @param string $param2 Either newvalue or oldquery or URI.
|
735
|
+
* @param string $param3 Optional. Old query or URI.
|
736
|
+
* @return string New URL query string.
|
737
|
+
*/
|
738
|
+
function add_query_arg() {
|
739
|
+
$args = func_get_args();
|
740
|
+
if ( is_array( $args[0] ) ) {
|
741
|
+
if ( count( $args ) < 2 || false === $args[1] )
|
742
|
+
$uri = $_SERVER['REQUEST_URI'];
|
743
|
+
else
|
744
|
+
$uri = $args[1];
|
745
|
+
} else {
|
746
|
+
if ( count( $args ) < 3 || false === $args[2] )
|
747
|
+
$uri = $_SERVER['REQUEST_URI'];
|
748
|
+
else
|
749
|
+
$uri = $args[2];
|
750
|
+
}
|
751
|
+
|
752
|
+
if ( $frag = strstr( $uri, '#' ) )
|
753
|
+
$uri = substr( $uri, 0, -strlen( $frag ) );
|
754
|
+
else
|
755
|
+
$frag = '';
|
756
|
+
|
757
|
+
if ( 0 === stripos( $uri, 'http://' ) ) {
|
758
|
+
$protocol = 'http://';
|
759
|
+
$uri = substr( $uri, 7 );
|
760
|
+
} elseif ( 0 === stripos( $uri, 'https://' ) ) {
|
761
|
+
$protocol = 'https://';
|
762
|
+
$uri = substr( $uri, 8 );
|
763
|
+
} else {
|
764
|
+
$protocol = '';
|
765
|
+
}
|
766
|
+
|
767
|
+
if ( strpos( $uri, '?' ) !== false ) {
|
768
|
+
list( $base, $query ) = explode( '?', $uri, 2 );
|
769
|
+
$base .= '?';
|
770
|
+
} elseif ( $protocol || strpos( $uri, '=' ) === false ) {
|
771
|
+
$base = $uri . '?';
|
772
|
+
$query = '';
|
773
|
+
} else {
|
774
|
+
$base = '';
|
775
|
+
$query = $uri;
|
776
|
+
}
|
777
|
+
|
778
|
+
wp_parse_str( $query, $qs );
|
779
|
+
$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
|
780
|
+
if ( is_array( $args[0] ) ) {
|
781
|
+
$kayvees = $args[0];
|
782
|
+
$qs = array_merge( $qs, $kayvees );
|
783
|
+
} else {
|
784
|
+
$qs[ $args[0] ] = $args[1];
|
785
|
+
}
|
786
|
+
|
787
|
+
foreach ( $qs as $k => $v ) {
|
788
|
+
if ( $v === false )
|
789
|
+
unset( $qs[$k] );
|
790
|
+
}
|
791
|
+
|
792
|
+
$ret = build_query( $qs );
|
793
|
+
$ret = trim( $ret, '?' );
|
794
|
+
$ret = preg_replace( '#=(&|$)#', '$1', $ret );
|
795
|
+
$ret = $protocol . $base . $ret . $frag;
|
796
|
+
$ret = rtrim( $ret, '?' );
|
797
|
+
return $ret;
|
798
|
+
}
|
799
|
+
|
800
|
+
/**
|
801
|
+
* Removes an item or list from the query string.
|
802
|
+
*
|
803
|
+
* @since 1.5.0
|
804
|
+
*
|
805
|
+
* @param string|array $key Query key or keys to remove.
|
806
|
+
* @param bool $query Optional. When false uses the $_SERVER value. Default false.
|
807
|
+
* @return string New URL query string.
|
808
|
+
*/
|
809
|
+
function remove_query_arg( $key, $query = false ) {
|
810
|
+
if ( is_array( $key ) ) { // removing multiple keys
|
811
|
+
foreach ( $key as $k )
|
812
|
+
$query = add_query_arg( $k, false, $query );
|
813
|
+
return $query;
|
814
|
+
}
|
815
|
+
return add_query_arg( $key, false, $query );
|
816
|
+
}
|
817
|
+
|
818
|
+
/**
|
819
|
+
* Walks the array while sanitizing the contents.
|
820
|
+
*
|
821
|
+
* @since 0.71
|
822
|
+
*
|
823
|
+
* @param array $array Array to walk while sanitizing contents.
|
824
|
+
* @return array Sanitized $array.
|
825
|
+
*/
|
826
|
+
function add_magic_quotes( $array ) {
|
827
|
+
foreach ( (array) $array as $k => $v ) {
|
828
|
+
if ( is_array( $v ) ) {
|
829
|
+
$array[$k] = add_magic_quotes( $v );
|
830
|
+
} else {
|
831
|
+
$array[$k] = addslashes( $v );
|
832
|
+
}
|
833
|
+
}
|
834
|
+
return $array;
|
835
|
+
}
|
836
|
+
|
837
|
+
/**
|
838
|
+
* HTTP request for URI to retrieve content.
|
839
|
+
*
|
840
|
+
* @since 1.5.1
|
841
|
+
*
|
842
|
+
* @see wp_safe_remote_get()
|
843
|
+
*
|
844
|
+
* @param string $uri URI/URL of web page to retrieve.
|
845
|
+
* @return bool|string HTTP content. False on failure.
|
846
|
+
*/
|
847
|
+
function wp_remote_fopen( $uri ) {
|
848
|
+
$parsed_url = @parse_url( $uri );
|
849
|
+
|
850
|
+
if ( !$parsed_url || !is_array( $parsed_url ) )
|
851
|
+
return false;
|
852
|
+
|
853
|
+
$options = array();
|
854
|
+
$options['timeout'] = 10;
|
855
|
+
|
856
|
+
$response = wp_safe_remote_get( $uri, $options );
|
857
|
+
|
858
|
+
if ( is_wp_error( $response ) )
|
859
|
+
return false;
|
860
|
+
|
861
|
+
return wp_remote_retrieve_body( $response );
|
862
|
+
}
|
863
|
+
|
864
|
+
/**
|
865
|
+
* Set up the WordPress query.
|
866
|
+
*
|
867
|
+
* @since 2.0.0
|
868
|
+
*
|
869
|
+
* @param string $query_vars Default WP_Query arguments.
|
870
|
+
*/
|
871
|
+
function wp( $query_vars = '' ) {
|
872
|
+
global $wp, $wp_query, $wp_the_query;
|
873
|
+
$wp->main( $query_vars );
|
874
|
+
|
875
|
+
if ( !isset($wp_the_query) )
|
876
|
+
$wp_the_query = $wp_query;
|
877
|
+
}
|
878
|
+
|
879
|
+
/**
|
880
|
+
* Retrieve the description for the HTTP status.
|
881
|
+
*
|
882
|
+
* @since 2.3.0
|
883
|
+
*
|
884
|
+
* @param int $code HTTP status code.
|
885
|
+
* @return string Empty string if not found, or description if found.
|
886
|
+
*/
|
887
|
+
function get_status_header_desc( $code ) {
|
888
|
+
global $wp_header_to_desc;
|
889
|
+
|
890
|
+
$code = absint( $code );
|
891
|
+
|
892
|
+
if ( !isset( $wp_header_to_desc ) ) {
|
893
|
+
$wp_header_to_desc = array(
|
894
|
+
100 => 'Continue',
|
895
|
+
101 => 'Switching Protocols',
|
896
|
+
102 => 'Processing',
|
897
|
+
|
898
|
+
200 => 'OK',
|
899
|
+
201 => 'Created',
|
900
|
+
202 => 'Accepted',
|
901
|
+
203 => 'Non-Authoritative Information',
|
902
|
+
204 => 'No Content',
|
903
|
+
205 => 'Reset Content',
|
904
|
+
206 => 'Partial Content',
|
905
|
+
207 => 'Multi-Status',
|
906
|
+
226 => 'IM Used',
|
907
|
+
|
908
|
+
300 => 'Multiple Choices',
|
909
|
+
301 => 'Moved Permanently',
|
910
|
+
302 => 'Found',
|
911
|
+
303 => 'See Other',
|
912
|
+
304 => 'Not Modified',
|
913
|
+
305 => 'Use Proxy',
|
914
|
+
306 => 'Reserved',
|
915
|
+
307 => 'Temporary Redirect',
|
916
|
+
|
917
|
+
400 => 'Bad Request',
|
918
|
+
401 => 'Unauthorized',
|
919
|
+
402 => 'Payment Required',
|
920
|
+
403 => 'Forbidden',
|
921
|
+
404 => 'Not Found',
|
922
|
+
405 => 'Method Not Allowed',
|
923
|
+
406 => 'Not Acceptable',
|
924
|
+
407 => 'Proxy Authentication Required',
|
925
|
+
408 => 'Request Timeout',
|
926
|
+
409 => 'Conflict',
|
927
|
+
410 => 'Gone',
|
928
|
+
411 => 'Length Required',
|
929
|
+
412 => 'Precondition Failed',
|
930
|
+
413 => 'Request Entity Too Large',
|
931
|
+
414 => 'Request-URI Too Long',
|
932
|
+
415 => 'Unsupported Media Type',
|
933
|
+
416 => 'Requested Range Not Satisfiable',
|
934
|
+
417 => 'Expectation Failed',
|
935
|
+
418 => 'I\'m a teapot',
|
936
|
+
422 => 'Unprocessable Entity',
|
937
|
+
423 => 'Locked',
|
938
|
+
424 => 'Failed Dependency',
|
939
|
+
426 => 'Upgrade Required',
|
940
|
+
428 => 'Precondition Required',
|
941
|
+
429 => 'Too Many Requests',
|
942
|
+
431 => 'Request Header Fields Too Large',
|
943
|
+
|
944
|
+
500 => 'Internal Server Error',
|
945
|
+
501 => 'Not Implemented',
|
946
|
+
502 => 'Bad Gateway',
|
947
|
+
503 => 'Service Unavailable',
|
948
|
+
504 => 'Gateway Timeout',
|
949
|
+
505 => 'HTTP Version Not Supported',
|
950
|
+
506 => 'Variant Also Negotiates',
|
951
|
+
507 => 'Insufficient Storage',
|
952
|
+
510 => 'Not Extended',
|
953
|
+
511 => 'Network Authentication Required',
|
954
|
+
);
|
955
|
+
}
|
956
|
+
|
957
|
+
if ( isset( $wp_header_to_desc[$code] ) )
|
958
|
+
return $wp_header_to_desc[$code];
|
959
|
+
else
|
960
|
+
return '';
|
961
|
+
}
|
962
|
+
|
963
|
+
/**
|
964
|
+
* Set HTTP status header.
|
965
|
+
*
|
966
|
+
* @since 2.0.0
|
967
|
+
*
|
968
|
+
* @see get_status_header_desc()
|
969
|
+
*
|
970
|
+
* @param int $code HTTP status code.
|
971
|
+
*/
|
972
|
+
function status_header( $code ) {
|
973
|
+
$description = get_status_header_desc( $code );
|
974
|
+
|
975
|
+
if ( empty( $description ) )
|
976
|
+
return;
|
977
|
+
|
978
|
+
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
979
|
+
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
|
980
|
+
$protocol = 'HTTP/1.0';
|
981
|
+
$status_header = "$protocol $code $description";
|
982
|
+
if ( function_exists( 'apply_filters' ) )
|
983
|
+
|
984
|
+
/**
|
985
|
+
* Filter an HTTP status header.
|
986
|
+
*
|
987
|
+
* @since 2.2.0
|
988
|
+
*
|
989
|
+
* @param string $status_header HTTP status header.
|
990
|
+
* @param int $code HTTP status code.
|
991
|
+
* @param string $description Description for the status code.
|
992
|
+
* @param string $protocol Server protocol.
|
993
|
+
*/
|
994
|
+
$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
|
995
|
+
|
996
|
+
@header( $status_header, true, $code );
|
997
|
+
}
|
998
|
+
|
999
|
+
/**
|
1000
|
+
* Get the header information to prevent caching.
|
1001
|
+
*
|
1002
|
+
* The several different headers cover the different ways cache prevention
|
1003
|
+
* is handled by different browsers
|
1004
|
+
*
|
1005
|
+
* @since 2.8.0
|
1006
|
+
*
|
1007
|
+
* @return array The associative array of header names and field values.
|
1008
|
+
*/
|
1009
|
+
function wp_get_nocache_headers() {
|
1010
|
+
$headers = array(
|
1011
|
+
'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
|
1012
|
+
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
|
1013
|
+
'Pragma' => 'no-cache',
|
1014
|
+
);
|
1015
|
+
|
1016
|
+
if ( function_exists('apply_filters') ) {
|
1017
|
+
/**
|
1018
|
+
* Filter the cache-controlling headers.
|
1019
|
+
*
|
1020
|
+
* @since 2.8.0
|
1021
|
+
*
|
1022
|
+
* @see wp_get_nocache_headers()
|
1023
|
+
*
|
1024
|
+
* @param array $headers {
|
1025
|
+
* Header names and field values.
|
1026
|
+
*
|
1027
|
+
* @type string $Expires Expires header.
|
1028
|
+
* @type string $Cache-Control Cache-Control header.
|
1029
|
+
* @type string $Pragma Pragma header.
|
1030
|
+
* }
|
1031
|
+
*/
|
1032
|
+
$headers = (array) apply_filters( 'nocache_headers', $headers );
|
1033
|
+
}
|
1034
|
+
$headers['Last-Modified'] = false;
|
1035
|
+
return $headers;
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
/**
|
1039
|
+
* Set the headers to prevent caching for the different browsers.
|
1040
|
+
*
|
1041
|
+
* Different browsers support different nocache headers, so several
|
1042
|
+
* headers must be sent so that all of them get the point that no
|
1043
|
+
* caching should occur.
|
1044
|
+
*
|
1045
|
+
* @since 2.0.0
|
1046
|
+
*
|
1047
|
+
* @see wp_get_nocache_headers()
|
1048
|
+
*/
|
1049
|
+
function nocache_headers() {
|
1050
|
+
$headers = wp_get_nocache_headers();
|
1051
|
+
|
1052
|
+
unset( $headers['Last-Modified'] );
|
1053
|
+
|
1054
|
+
// In PHP 5.3+, make sure we are not sending a Last-Modified header.
|
1055
|
+
if ( function_exists( 'header_remove' ) ) {
|
1056
|
+
@header_remove( 'Last-Modified' );
|
1057
|
+
} else {
|
1058
|
+
// In PHP 5.2, send an empty Last-Modified header, but only as a
|
1059
|
+
// last resort to override a header already sent. #WP23021
|
1060
|
+
foreach ( headers_list() as $header ) {
|
1061
|
+
if ( 0 === stripos( $header, 'Last-Modified' ) ) {
|
1062
|
+
$headers['Last-Modified'] = '';
|
1063
|
+
break;
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
foreach( $headers as $name => $field_value )
|
1069
|
+
@header("{$name}: {$field_value}");
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
/**
|
1073
|
+
* Set the headers for caching for 10 days with JavaScript content type.
|
1074
|
+
*
|
1075
|
+
* @since 2.1.0
|
1076
|
+
*/
|
1077
|
+
function cache_javascript_headers() {
|
1078
|
+
$expiresOffset = 10 * DAY_IN_SECONDS;
|
1079
|
+
|
1080
|
+
header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
|
1081
|
+
header( "Vary: Accept-Encoding" ); // Handle proxies
|
1082
|
+
header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
/**
|
1086
|
+
* Retrieve the number of database queries during the WordPress execution.
|
1087
|
+
*
|
1088
|
+
* @since 2.0.0
|
1089
|
+
*
|
1090
|
+
* @global wpdb $wpdb WordPress database access abstraction object.
|
1091
|
+
*
|
1092
|
+
* @return int Number of database queries.
|
1093
|
+
*/
|
1094
|
+
function get_num_queries() {
|
1095
|
+
global $wpdb;
|
1096
|
+
return $wpdb->num_queries;
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
/**
|
1100
|
+
* Whether input is yes or no.
|
1101
|
+
*
|
1102
|
+
* Must be 'y' to be true.
|
1103
|
+
*
|
1104
|
+
* @since 1.0.0
|
1105
|
+
*
|
1106
|
+
* @param string $yn Character string containing either 'y' (yes) or 'n' (no).
|
1107
|
+
* @return bool True if yes, false on anything else.
|
1108
|
+
*/
|
1109
|
+
function bool_from_yn( $yn ) {
|
1110
|
+
return ( strtolower( $yn ) == 'y' );
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
/**
|
1114
|
+
* Load the feed template from the use of an action hook.
|
1115
|
+
*
|
1116
|
+
* If the feed action does not have a hook, then the function will die with a
|
1117
|
+
* message telling the visitor that the feed is not valid.
|
1118
|
+
*
|
1119
|
+
* It is better to only have one hook for each feed.
|
1120
|
+
*
|
1121
|
+
* @since 2.1.0
|
1122
|
+
*
|
1123
|
+
* @uses $wp_query Used to tell if the use a comment feed.
|
1124
|
+
*/
|
1125
|
+
function do_feed() {
|
1126
|
+
global $wp_query;
|
1127
|
+
|
1128
|
+
$feed = get_query_var( 'feed' );
|
1129
|
+
|
1130
|
+
// Remove the pad, if present.
|
1131
|
+
$feed = preg_replace( '/^_+/', '', $feed );
|
1132
|
+
|
1133
|
+
if ( $feed == '' || $feed == 'feed' )
|
1134
|
+
$feed = get_default_feed();
|
1135
|
+
|
1136
|
+
$hook = 'do_feed_' . $feed;
|
1137
|
+
if ( ! has_action( $hook ) )
|
1138
|
+
wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
|
1139
|
+
|
1140
|
+
/**
|
1141
|
+
* Fires once the given feed is loaded.
|
1142
|
+
*
|
1143
|
+
* The dynamic hook name, $hook, refers to the feed name.
|
1144
|
+
*
|
1145
|
+
* @since 2.1.0
|
1146
|
+
*
|
1147
|
+
* @param bool $is_comment_feed Whether the feed is a comment feed.
|
1148
|
+
*/
|
1149
|
+
do_action( $hook, $wp_query->is_comment_feed );
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
/**
|
1153
|
+
* Load the RDF RSS 0.91 Feed template.
|
1154
|
+
*
|
1155
|
+
* @since 2.1.0
|
1156
|
+
*
|
1157
|
+
* @see load_template()
|
1158
|
+
*/
|
1159
|
+
function do_feed_rdf() {
|
1160
|
+
load_template( ABSPATH . WPINC . '/feed-rdf.php' );
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
/**
|
1164
|
+
* Load the RSS 1.0 Feed Template.
|
1165
|
+
*
|
1166
|
+
* @since 2.1.0
|
1167
|
+
*
|
1168
|
+
* @see load_template()
|
1169
|
+
*/
|
1170
|
+
function do_feed_rss() {
|
1171
|
+
load_template( ABSPATH . WPINC . '/feed-rss.php' );
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
/**
|
1175
|
+
* Load either the RSS2 comment feed or the RSS2 posts feed.
|
1176
|
+
*
|
1177
|
+
* @since 2.1.0
|
1178
|
+
*
|
1179
|
+
* @see load_template()
|
1180
|
+
*
|
1181
|
+
* @param bool $for_comments True for the comment feed, false for normal feed.
|
1182
|
+
*/
|
1183
|
+
function do_feed_rss2( $for_comments ) {
|
1184
|
+
if ( $for_comments )
|
1185
|
+
load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
|
1186
|
+
else
|
1187
|
+
load_template( ABSPATH . WPINC . '/feed-rss2.php' );
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
/**
|
1191
|
+
* Load either Atom comment feed or Atom posts feed.
|
1192
|
+
*
|
1193
|
+
* @since 2.1.0
|
1194
|
+
*
|
1195
|
+
* @see load_template()
|
1196
|
+
*
|
1197
|
+
* @param bool $for_comments True for the comment feed, false for normal feed.
|
1198
|
+
*/
|
1199
|
+
function do_feed_atom( $for_comments ) {
|
1200
|
+
if ($for_comments)
|
1201
|
+
load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
|
1202
|
+
else
|
1203
|
+
load_template( ABSPATH . WPINC . '/feed-atom.php' );
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
/**
|
1207
|
+
* Display the robots.txt file content.
|
1208
|
+
*
|
1209
|
+
* The echo content should be with usage of the permalinks or for creating the
|
1210
|
+
* robots.txt file.
|
1211
|
+
*
|
1212
|
+
* @since 2.1.0
|
1213
|
+
*/
|
1214
|
+
function do_robots() {
|
1215
|
+
header( 'Content-Type: text/plain; charset=utf-8' );
|
1216
|
+
|
1217
|
+
/**
|
1218
|
+
* Fires when displaying the robots.txt file.
|
1219
|
+
*
|
1220
|
+
* @since 2.1.0
|
1221
|
+
*/
|
1222
|
+
do_action( 'do_robotstxt' );
|
1223
|
+
|
1224
|
+
$output = "User-agent: *\n";
|
1225
|
+
$public = get_option( 'blog_public' );
|
1226
|
+
if ( '0' == $public ) {
|
1227
|
+
$output .= "Disallow: /\n";
|
1228
|
+
} else {
|
1229
|
+
$site_url = parse_url( site_url() );
|
1230
|
+
$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
|
1231
|
+
$output .= "Disallow: $path/wp-admin/\n";
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
/**
|
1235
|
+
* Filter the robots.txt output.
|
1236
|
+
*
|
1237
|
+
* @since 3.0.0
|
1238
|
+
*
|
1239
|
+
* @param string $output Robots.txt output.
|
1240
|
+
* @param bool $public Whether the site is considered "public".
|
1241
|
+
*/
|
1242
|
+
echo apply_filters( 'robots_txt', $output, $public );
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
/**
|
1246
|
+
* Test whether blog is already installed.
|
1247
|
+
*
|
1248
|
+
* The cache will be checked first. If you have a cache plugin, which saves
|
1249
|
+
* the cache values, then this will work. If you use the default WordPress
|
1250
|
+
* cache, and the database goes away, then you might have problems.
|
1251
|
+
*
|
1252
|
+
* Checks for the 'siteurl' option for whether WordPress is installed.
|
1253
|
+
*
|
1254
|
+
* @since 2.1.0
|
1255
|
+
*
|
1256
|
+
* @global wpdb $wpdb WordPress database access abstraction object.
|
1257
|
+
*
|
1258
|
+
* @return bool Whether the blog is already installed.
|
1259
|
+
*/
|
1260
|
+
function is_blog_installed() {
|
1261
|
+
global $wpdb;
|
1262
|
+
|
1263
|
+
/*
|
1264
|
+
* Check cache first. If options table goes away and we have true
|
1265
|
+
* cached, oh well.
|
1266
|
+
*/
|
1267
|
+
if ( wp_cache_get( 'is_blog_installed' ) )
|
1268
|
+
return true;
|
1269
|
+
|
1270
|
+
$suppress = $wpdb->suppress_errors();
|
1271
|
+
if ( ! defined( 'WP_INSTALLING' ) ) {
|
1272
|
+
$alloptions = wp_load_alloptions();
|
1273
|
+
}
|
1274
|
+
// If siteurl is not set to autoload, check it specifically
|
1275
|
+
if ( !isset( $alloptions['siteurl'] ) )
|
1276
|
+
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
|
1277
|
+
else
|
1278
|
+
$installed = $alloptions['siteurl'];
|
1279
|
+
$wpdb->suppress_errors( $suppress );
|
1280
|
+
|
1281
|
+
$installed = !empty( $installed );
|
1282
|
+
wp_cache_set( 'is_blog_installed', $installed );
|
1283
|
+
|
1284
|
+
if ( $installed )
|
1285
|
+
return true;
|
1286
|
+
|
1287
|
+
// If visiting repair.php, return true and let it take over.
|
1288
|
+
if ( defined( 'WP_REPAIRING' ) )
|
1289
|
+
return true;
|
1290
|
+
|
1291
|
+
$suppress = $wpdb->suppress_errors();
|
1292
|
+
|
1293
|
+
/*
|
1294
|
+
* Loop over the WP tables. If none exist, then scratch install is allowed.
|
1295
|
+
* If one or more exist, suggest table repair since we got here because the
|
1296
|
+
* options table could not be accessed.
|
1297
|
+
*/
|
1298
|
+
$wp_tables = $wpdb->tables();
|
1299
|
+
foreach ( $wp_tables as $table ) {
|
1300
|
+
// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
|
1301
|
+
if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
|
1302
|
+
continue;
|
1303
|
+
if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
|
1304
|
+
continue;
|
1305
|
+
|
1306
|
+
if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
|
1307
|
+
continue;
|
1308
|
+
|
1309
|
+
// One or more tables exist. We are insane.
|
1310
|
+
|
1311
|
+
wp_load_translations_early();
|
1312
|
+
|
1313
|
+
// Die with a DB error.
|
1314
|
+
$wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
|
1315
|
+
dead_db();
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
$wpdb->suppress_errors( $suppress );
|
1319
|
+
|
1320
|
+
wp_cache_set( 'is_blog_installed', false );
|
1321
|
+
|
1322
|
+
return false;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
/**
|
1326
|
+
* Retrieve URL with nonce added to URL query.
|
1327
|
+
*
|
1328
|
+
* @since 2.0.4
|
1329
|
+
*
|
1330
|
+
* @param string $actionurl URL to add nonce action.
|
1331
|
+
* @param string $action Optional. Nonce action name. Default -1.
|
1332
|
+
* @param string $name Optional. Nonce name. Default '_wpnonce'.
|
1333
|
+
* @return string Escaped URL with nonce action added.
|
1334
|
+
*/
|
1335
|
+
function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
|
1336
|
+
$actionurl = str_replace( '&', '&', $actionurl );
|
1337
|
+
return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
/**
|
1341
|
+
* Retrieve or display nonce hidden field for forms.
|
1342
|
+
*
|
1343
|
+
* The nonce field is used to validate that the contents of the form came from
|
1344
|
+
* the location on the current site and not somewhere else. The nonce does not
|
1345
|
+
* offer absolute protection, but should protect against most cases. It is very
|
1346
|
+
* important to use nonce field in forms.
|
1347
|
+
*
|
1348
|
+
* The $action and $name are optional, but if you want to have better security,
|
1349
|
+
* it is strongly suggested to set those two parameters. It is easier to just
|
1350
|
+
* call the function without any parameters, because validation of the nonce
|
1351
|
+
* doesn't require any parameters, but since crackers know what the default is
|
1352
|
+
* it won't be difficult for them to find a way around your nonce and cause
|
1353
|
+
* damage.
|
1354
|
+
*
|
1355
|
+
* The input name will be whatever $name value you gave. The input value will be
|
1356
|
+
* the nonce creation value.
|
1357
|
+
*
|
1358
|
+
* @since 2.0.4
|
1359
|
+
*
|
1360
|
+
* @param string $action Optional. Action name. Default -1.
|
1361
|
+
* @param string $name Optional. Nonce name. Default '_wpnonce'.
|
1362
|
+
* @param bool $referer Optional. Whether to set the referer field for validation. Default true.
|
1363
|
+
* @param bool $echo Optional. Whether to display or return hidden form field. Default true.
|
1364
|
+
* @return string Nonce field HTML markup.
|
1365
|
+
*/
|
1366
|
+
function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
|
1367
|
+
$name = esc_attr( $name );
|
1368
|
+
$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
|
1369
|
+
|
1370
|
+
if ( $referer )
|
1371
|
+
$nonce_field .= wp_referer_field( false );
|
1372
|
+
|
1373
|
+
if ( $echo )
|
1374
|
+
echo $nonce_field;
|
1375
|
+
|
1376
|
+
return $nonce_field;
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
/**
|
1380
|
+
* Retrieve or display referer hidden field for forms.
|
1381
|
+
*
|
1382
|
+
* The referer link is the current Request URI from the server super global. The
|
1383
|
+
* input name is '_wp_http_referer', in case you wanted to check manually.
|
1384
|
+
*
|
1385
|
+
* @since 2.0.4
|
1386
|
+
*
|
1387
|
+
* @param bool $echo Optional. Whether to echo or return the referer field. Default true.
|
1388
|
+
* @return string Referer field HTML markup.
|
1389
|
+
*/
|
1390
|
+
function wp_referer_field( $echo = true ) {
|
1391
|
+
$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
|
1392
|
+
|
1393
|
+
if ( $echo )
|
1394
|
+
echo $referer_field;
|
1395
|
+
return $referer_field;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
/**
|
1399
|
+
* Retrieve or display original referer hidden field for forms.
|
1400
|
+
*
|
1401
|
+
* The input name is '_wp_original_http_referer' and will be either the same
|
1402
|
+
* value of wp_referer_field(), if that was posted already or it will be the
|
1403
|
+
* current page, if it doesn't exist.
|
1404
|
+
*
|
1405
|
+
* @since 2.0.4
|
1406
|
+
*
|
1407
|
+
* @param bool $echo Optional. Whether to echo the original http referer. Default true.
|
1408
|
+
* @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
|
1409
|
+
* Default 'current'.
|
1410
|
+
* @return string Original referer field.
|
1411
|
+
*/
|
1412
|
+
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
|
1413
|
+
if ( ! $ref = wp_get_original_referer() ) {
|
1414
|
+
$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
|
1415
|
+
}
|
1416
|
+
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
|
1417
|
+
if ( $echo )
|
1418
|
+
echo $orig_referer_field;
|
1419
|
+
return $orig_referer_field;
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
/**
|
1423
|
+
* Retrieve referer from '_wp_http_referer' or HTTP referer.
|
1424
|
+
*
|
1425
|
+
* If it's the same as the current request URL, will return false.
|
1426
|
+
*
|
1427
|
+
* @since 2.0.4
|
1428
|
+
*
|
1429
|
+
* @return string|bool False on failure. Referer URL on success.
|
1430
|
+
*/
|
1431
|
+
function wp_get_referer() {
|
1432
|
+
if ( ! function_exists( 'wp_validate_redirect' ) )
|
1433
|
+
return false;
|
1434
|
+
$ref = false;
|
1435
|
+
if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
|
1436
|
+
$ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
|
1437
|
+
else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
|
1438
|
+
$ref = wp_unslash( $_SERVER['HTTP_REFERER'] );
|
1439
|
+
|
1440
|
+
if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) )
|
1441
|
+
return wp_validate_redirect( $ref, false );
|
1442
|
+
return false;
|
1443
|
+
}
|
1444
|
+
|
1445
|
+
/**
|
1446
|
+
* Retrieve original referer that was posted, if it exists.
|
1447
|
+
*
|
1448
|
+
* @since 2.0.4
|
1449
|
+
*
|
1450
|
+
* @return string|bool False if no original referer or original referer if set.
|
1451
|
+
*/
|
1452
|
+
function wp_get_original_referer() {
|
1453
|
+
if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
|
1454
|
+
return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
|
1455
|
+
return false;
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
/**
|
1459
|
+
* Recursive directory creation based on full path.
|
1460
|
+
*
|
1461
|
+
* Will attempt to set permissions on folders.
|
1462
|
+
*
|
1463
|
+
* @since 2.0.1
|
1464
|
+
*
|
1465
|
+
* @param string $target Full path to attempt to create.
|
1466
|
+
* @return bool Whether the path was created. True if path already exists.
|
1467
|
+
*/
|
1468
|
+
function wp_mkdir_p( $target ) {
|
1469
|
+
$wrapper = null;
|
1470
|
+
|
1471
|
+
// Strip the protocol.
|
1472
|
+
if( wp_is_stream( $target ) ) {
|
1473
|
+
list( $wrapper, $target ) = explode( '://', $target, 2 );
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
// From php.net/mkdir user contributed notes.
|
1477
|
+
$target = str_replace( '//', '/', $target );
|
1478
|
+
|
1479
|
+
// Put the wrapper back on the target.
|
1480
|
+
if( $wrapper !== null ) {
|
1481
|
+
$target = $wrapper . '://' . $target;
|
1482
|
+
}
|
1483
|
+
|
1484
|
+
/*
|
1485
|
+
* Safe mode fails with a trailing slash under certain PHP versions.
|
1486
|
+
* Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
|
1487
|
+
*/
|
1488
|
+
$target = rtrim($target, '/');
|
1489
|
+
if ( empty($target) )
|
1490
|
+
$target = '/';
|
1491
|
+
|
1492
|
+
if ( file_exists( $target ) )
|
1493
|
+
return @is_dir( $target );
|
1494
|
+
|
1495
|
+
// We need to find the permissions of the parent folder that exists and inherit that.
|
1496
|
+
$target_parent = dirname( $target );
|
1497
|
+
while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
|
1498
|
+
$target_parent = dirname( $target_parent );
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
// Get the permission bits.
|
1502
|
+
if ( $stat = @stat( $target_parent ) ) {
|
1503
|
+
$dir_perms = $stat['mode'] & 0007777;
|
1504
|
+
} else {
|
1505
|
+
$dir_perms = 0777;
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
if ( @mkdir( $target, $dir_perms, true ) ) {
|
1509
|
+
|
1510
|
+
/*
|
1511
|
+
* If a umask is set that modifies $dir_perms, we'll have to re-set
|
1512
|
+
* the $dir_perms correctly with chmod()
|
1513
|
+
*/
|
1514
|
+
if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
|
1515
|
+
$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
|
1516
|
+
for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
|
1517
|
+
@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
|
1518
|
+
}
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
return true;
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
return false;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
/**
|
1528
|
+
* Test if a give filesystem path is absolute.
|
1529
|
+
*
|
1530
|
+
* For example, '/foo/bar', or 'c:\windows'.
|
1531
|
+
*
|
1532
|
+
* @since 2.5.0
|
1533
|
+
*
|
1534
|
+
* @param string $path File path.
|
1535
|
+
* @return bool True if path is absolute, false is not absolute.
|
1536
|
+
*/
|
1537
|
+
function path_is_absolute( $path ) {
|
1538
|
+
/*
|
1539
|
+
* This is definitive if true but fails if $path does not exist or contains
|
1540
|
+
* a symbolic link.
|
1541
|
+
*/
|
1542
|
+
if ( realpath($path) == $path )
|
1543
|
+
return true;
|
1544
|
+
|
1545
|
+
if ( strlen($path) == 0 || $path[0] == '.' )
|
1546
|
+
return false;
|
1547
|
+
|
1548
|
+
// Windows allows absolute paths like this.
|
1549
|
+
if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
|
1550
|
+
return true;
|
1551
|
+
|
1552
|
+
// A path starting with / or \ is absolute; anything else is relative.
|
1553
|
+
return ( $path[0] == '/' || $path[0] == '\\' );
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
/**
|
1557
|
+
* Join two filesystem paths together.
|
1558
|
+
*
|
1559
|
+
* For example, 'give me $path relative to $base'. If the $path is absolute,
|
1560
|
+
* then it the full path is returned.
|
1561
|
+
*
|
1562
|
+
* @since 2.5.0
|
1563
|
+
*
|
1564
|
+
* @param string $base Base path.
|
1565
|
+
* @param string $path Path relative to $base.
|
1566
|
+
* @return string The path with the base or absolute path.
|
1567
|
+
*/
|
1568
|
+
function path_join( $base, $path ) {
|
1569
|
+
if ( path_is_absolute($path) )
|
1570
|
+
return $path;
|
1571
|
+
|
1572
|
+
return rtrim($base, '/') . '/' . ltrim($path, '/');
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
/**
|
1576
|
+
* Normalize a filesystem path.
|
1577
|
+
*
|
1578
|
+
* Replaces backslashes with forward slashes for Windows systems, and ensures
|
1579
|
+
* no duplicate slashes exist.
|
1580
|
+
*
|
1581
|
+
* @since 3.9.0
|
1582
|
+
*
|
1583
|
+
* @param string $path Path to normalize.
|
1584
|
+
* @return string Normalized path.
|
1585
|
+
*/
|
1586
|
+
function wp_normalize_path( $path ) {
|
1587
|
+
$path = str_replace( '\\', '/', $path );
|
1588
|
+
$path = preg_replace( '|/+|','/', $path );
|
1589
|
+
return $path;
|
1590
|
+
}
|
1591
|
+
|
1592
|
+
/**
|
1593
|
+
* Determine a writable directory for temporary files.
|
1594
|
+
*
|
1595
|
+
* Function's preference is the return value of sys_get_temp_dir(),
|
1596
|
+
* followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
|
1597
|
+
* before finally defaulting to /tmp/
|
1598
|
+
*
|
1599
|
+
* In the event that this function does not find a writable location,
|
1600
|
+
* It may be overridden by the WP_TEMP_DIR constant in your wp-config.php file.
|
1601
|
+
*
|
1602
|
+
* @since 2.5.0
|
1603
|
+
*
|
1604
|
+
* @return string Writable temporary directory.
|
1605
|
+
*/
|
1606
|
+
function get_temp_dir() {
|
1607
|
+
static $temp;
|
1608
|
+
if ( defined('WP_TEMP_DIR') )
|
1609
|
+
return trailingslashit(WP_TEMP_DIR);
|
1610
|
+
|
1611
|
+
if ( $temp )
|
1612
|
+
return trailingslashit( $temp );
|
1613
|
+
|
1614
|
+
if ( function_exists('sys_get_temp_dir') ) {
|
1615
|
+
$temp = sys_get_temp_dir();
|
1616
|
+
if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
|
1617
|
+
return trailingslashit( $temp );
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
$temp = ini_get('upload_tmp_dir');
|
1621
|
+
if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
|
1622
|
+
return trailingslashit( $temp );
|
1623
|
+
|
1624
|
+
$temp = WP_CONTENT_DIR . '/';
|
1625
|
+
if ( is_dir( $temp ) && wp_is_writable( $temp ) )
|
1626
|
+
return $temp;
|
1627
|
+
|
1628
|
+
$temp = '/tmp/';
|
1629
|
+
return $temp;
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
/**
|
1633
|
+
* Determine if a directory is writable.
|
1634
|
+
*
|
1635
|
+
* This function is used to work around certain ACL issues in PHP primarily
|
1636
|
+
* affecting Windows Servers.
|
1637
|
+
*
|
1638
|
+
* @since 3.6.0
|
1639
|
+
*
|
1640
|
+
* @see win_is_writable()
|
1641
|
+
*
|
1642
|
+
* @param string $path Path to check for write-ability.
|
1643
|
+
* @return bool Whether the path is writable.
|
1644
|
+
*/
|
1645
|
+
function wp_is_writable( $path ) {
|
1646
|
+
if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
|
1647
|
+
return win_is_writable( $path );
|
1648
|
+
else
|
1649
|
+
return @is_writable( $path );
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
/**
|
1653
|
+
* Workaround for Windows bug in is_writable() function
|
1654
|
+
*
|
1655
|
+
* PHP has issues with Windows ACL's for determine if a
|
1656
|
+
* directory is writable or not, this works around them by
|
1657
|
+
* checking the ability to open files rather than relying
|
1658
|
+
* upon PHP to interprate the OS ACL.
|
1659
|
+
*
|
1660
|
+
* @since 2.8.0
|
1661
|
+
*
|
1662
|
+
* @see http://bugs.php.net/bug.php?id=27609
|
1663
|
+
* @see http://bugs.php.net/bug.php?id=30931
|
1664
|
+
*
|
1665
|
+
* @param string $path Windows path to check for write-ability.
|
1666
|
+
* @return bool Whether the path is writable.
|
1667
|
+
*/
|
1668
|
+
function win_is_writable( $path ) {
|
1669
|
+
|
1670
|
+
if ( $path[strlen( $path ) - 1] == '/' ) // if it looks like a directory, check a random file within the directory
|
1671
|
+
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
|
1672
|
+
else if ( is_dir( $path ) ) // If it's a directory (and not a file) check a random file within the directory
|
1673
|
+
return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
|
1674
|
+
|
1675
|
+
// check tmp file for read/write capabilities
|
1676
|
+
$should_delete_tmp_file = !file_exists( $path );
|
1677
|
+
$f = @fopen( $path, 'a' );
|
1678
|
+
if ( $f === false )
|
1679
|
+
return false;
|
1680
|
+
fclose( $f );
|
1681
|
+
if ( $should_delete_tmp_file )
|
1682
|
+
unlink( $path );
|
1683
|
+
return true;
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
/**
|
1687
|
+
* Get an array containing the current upload directory's path and url.
|
1688
|
+
*
|
1689
|
+
* Checks the 'upload_path' option, which should be from the web root folder,
|
1690
|
+
* and if it isn't empty it will be used. If it is empty, then the path will be
|
1691
|
+
* 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will
|
1692
|
+
* override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path.
|
1693
|
+
*
|
1694
|
+
* The upload URL path is set either by the 'upload_url_path' option or by using
|
1695
|
+
* the 'WP_CONTENT_URL' constant and appending '/uploads' to the path.
|
1696
|
+
*
|
1697
|
+
* If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in
|
1698
|
+
* the administration settings panel), then the time will be used. The format
|
1699
|
+
* will be year first and then month.
|
1700
|
+
*
|
1701
|
+
* If the path couldn't be created, then an error will be returned with the key
|
1702
|
+
* 'error' containing the error message. The error suggests that the parent
|
1703
|
+
* directory is not writable by the server.
|
1704
|
+
*
|
1705
|
+
* On success, the returned array will have many indices:
|
1706
|
+
* 'path' - base directory and sub directory or full path to upload directory.
|
1707
|
+
* 'url' - base url and sub directory or absolute URL to upload directory.
|
1708
|
+
* 'subdir' - sub directory if uploads use year/month folders option is on.
|
1709
|
+
* 'basedir' - path without subdir.
|
1710
|
+
* 'baseurl' - URL path without subdir.
|
1711
|
+
* 'error' - set to false.
|
1712
|
+
*
|
1713
|
+
* @since 2.0.0
|
1714
|
+
*
|
1715
|
+
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
1716
|
+
* @return array See above for description.
|
1717
|
+
*/
|
1718
|
+
function wp_upload_dir( $time = null ) {
|
1719
|
+
$siteurl = get_option( 'siteurl' );
|
1720
|
+
$upload_path = trim( get_option( 'upload_path' ) );
|
1721
|
+
|
1722
|
+
if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
|
1723
|
+
$dir = WP_CONTENT_DIR . '/uploads';
|
1724
|
+
} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
|
1725
|
+
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
1726
|
+
$dir = path_join( ABSPATH, $upload_path );
|
1727
|
+
} else {
|
1728
|
+
$dir = $upload_path;
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
if ( !$url = get_option( 'upload_url_path' ) ) {
|
1732
|
+
if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
|
1733
|
+
$url = WP_CONTENT_URL . '/uploads';
|
1734
|
+
else
|
1735
|
+
$url = trailingslashit( $siteurl ) . $upload_path;
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
/*
|
1739
|
+
* Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
|
1740
|
+
* We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
|
1741
|
+
*/
|
1742
|
+
if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
|
1743
|
+
$dir = ABSPATH . UPLOADS;
|
1744
|
+
$url = trailingslashit( $siteurl ) . UPLOADS;
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
// If multisite (and if not the main site in a post-MU network)
|
1748
|
+
if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
|
1749
|
+
|
1750
|
+
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
|
1751
|
+
/*
|
1752
|
+
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
|
1753
|
+
* straightforward: Append sites/%d if we're not on the main site (for post-MU
|
1754
|
+
* networks). (The extra directory prevents a four-digit ID from conflicting with
|
1755
|
+
* a year-based directory for the main site. But if a MU-era network has disabled
|
1756
|
+
* ms-files rewriting manually, they don't need the extra directory, as they never
|
1757
|
+
* had wp-content/uploads for the main site.)
|
1758
|
+
*/
|
1759
|
+
|
1760
|
+
if ( defined( 'MULTISITE' ) )
|
1761
|
+
$ms_dir = '/sites/' . get_current_blog_id();
|
1762
|
+
else
|
1763
|
+
$ms_dir = '/' . get_current_blog_id();
|
1764
|
+
|
1765
|
+
$dir .= $ms_dir;
|
1766
|
+
$url .= $ms_dir;
|
1767
|
+
|
1768
|
+
} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
|
1769
|
+
/*
|
1770
|
+
* Handle the old-form ms-files.php rewriting if the network still has that enabled.
|
1771
|
+
* When ms-files rewriting is enabled, then we only listen to UPLOADS when:
|
1772
|
+
* 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
|
1773
|
+
* there, and
|
1774
|
+
* 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
|
1775
|
+
* the original blog ID.
|
1776
|
+
*
|
1777
|
+
* Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
|
1778
|
+
* (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
|
1779
|
+
* as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
|
1780
|
+
* rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
|
1781
|
+
*/
|
1782
|
+
|
1783
|
+
if ( defined( 'BLOGUPLOADDIR' ) )
|
1784
|
+
$dir = untrailingslashit( BLOGUPLOADDIR );
|
1785
|
+
else
|
1786
|
+
$dir = ABSPATH . UPLOADS;
|
1787
|
+
$url = trailingslashit( $siteurl ) . 'files';
|
1788
|
+
}
|
1789
|
+
}
|
1790
|
+
|
1791
|
+
$basedir = $dir;
|
1792
|
+
$baseurl = $url;
|
1793
|
+
|
1794
|
+
$subdir = '';
|
1795
|
+
if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
|
1796
|
+
// Generate the yearly and monthly dirs
|
1797
|
+
if ( !$time )
|
1798
|
+
$time = current_time( 'mysql' );
|
1799
|
+
$y = substr( $time, 0, 4 );
|
1800
|
+
$m = substr( $time, 5, 2 );
|
1801
|
+
$subdir = "/$y/$m";
|
1802
|
+
}
|
1803
|
+
|
1804
|
+
$dir .= $subdir;
|
1805
|
+
$url .= $subdir;
|
1806
|
+
|
1807
|
+
/**
|
1808
|
+
* Filter the uploads directory data.
|
1809
|
+
*
|
1810
|
+
* @since 2.0.0
|
1811
|
+
*
|
1812
|
+
* @param array $uploads Array of upload directory data with keys of 'path',
|
1813
|
+
* 'url', 'subdir, 'basedir', and 'error'.
|
1814
|
+
*/
|
1815
|
+
$uploads = apply_filters( 'upload_dir',
|
1816
|
+
array(
|
1817
|
+
'path' => $dir,
|
1818
|
+
'url' => $url,
|
1819
|
+
'subdir' => $subdir,
|
1820
|
+
'basedir' => $basedir,
|
1821
|
+
'baseurl' => $baseurl,
|
1822
|
+
'error' => false,
|
1823
|
+
) );
|
1824
|
+
|
1825
|
+
// Make sure we have an uploads directory.
|
1826
|
+
if ( ! wp_mkdir_p( $uploads['path'] ) ) {
|
1827
|
+
if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
|
1828
|
+
$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
|
1829
|
+
else
|
1830
|
+
$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
|
1831
|
+
|
1832
|
+
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
|
1833
|
+
$uploads['error'] = $message;
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
return $uploads;
|
1837
|
+
}
|
1838
|
+
|
1839
|
+
/**
|
1840
|
+
* Get a filename that is sanitized and unique for the given directory.
|
1841
|
+
*
|
1842
|
+
* If the filename is not unique, then a number will be added to the filename
|
1843
|
+
* before the extension, and will continue adding numbers until the filename is
|
1844
|
+
* unique.
|
1845
|
+
*
|
1846
|
+
* The callback is passed three parameters, the first one is the directory, the
|
1847
|
+
* second is the filename, and the third is the extension.
|
1848
|
+
*
|
1849
|
+
* @since 2.5.0
|
1850
|
+
*
|
1851
|
+
* @param string $dir Directory.
|
1852
|
+
* @param string $filename File name.
|
1853
|
+
* @param callback $unique_filename_callback Callback. Default null.
|
1854
|
+
* @return string New filename, if given wasn't unique.
|
1855
|
+
*/
|
1856
|
+
function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
|
1857
|
+
// Sanitize the file name before we begin processing.
|
1858
|
+
$filename = sanitize_file_name($filename);
|
1859
|
+
|
1860
|
+
// Separate the filename into a name and extension.
|
1861
|
+
$info = pathinfo($filename);
|
1862
|
+
$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
|
1863
|
+
$name = basename($filename, $ext);
|
1864
|
+
|
1865
|
+
// Edge case: if file is named '.ext', treat as an empty name.
|
1866
|
+
if ( $name === $ext )
|
1867
|
+
$name = '';
|
1868
|
+
|
1869
|
+
/*
|
1870
|
+
* Increment the file number until we have a unique file to save in $dir.
|
1871
|
+
* Use callback if supplied.
|
1872
|
+
*/
|
1873
|
+
if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
|
1874
|
+
$filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
|
1875
|
+
} else {
|
1876
|
+
$number = '';
|
1877
|
+
|
1878
|
+
// Change '.ext' to lower case.
|
1879
|
+
if ( $ext && strtolower($ext) != $ext ) {
|
1880
|
+
$ext2 = strtolower($ext);
|
1881
|
+
$filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
|
1882
|
+
|
1883
|
+
// Check for both lower and upper case extension or image sub-sizes may be overwritten.
|
1884
|
+
while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
|
1885
|
+
$new_number = $number + 1;
|
1886
|
+
$filename = str_replace( "$number$ext", "$new_number$ext", $filename );
|
1887
|
+
$filename2 = str_replace( "$number$ext2", "$new_number$ext2", $filename2 );
|
1888
|
+
$number = $new_number;
|
1889
|
+
}
|
1890
|
+
return $filename2;
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
while ( file_exists( $dir . "/$filename" ) ) {
|
1894
|
+
if ( '' == "$number$ext" )
|
1895
|
+
$filename = $filename . ++$number . $ext;
|
1896
|
+
else
|
1897
|
+
$filename = str_replace( "$number$ext", ++$number . $ext, $filename );
|
1898
|
+
}
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
return $filename;
|
1902
|
+
}
|
1903
|
+
|
1904
|
+
/**
|
1905
|
+
* Create a file in the upload folder with given content.
|
1906
|
+
*
|
1907
|
+
* If there is an error, then the key 'error' will exist with the error message.
|
1908
|
+
* If success, then the key 'file' will have the unique file path, the 'url' key
|
1909
|
+
* will have the link to the new file. and the 'error' key will be set to false.
|
1910
|
+
*
|
1911
|
+
* This function will not move an uploaded file to the upload folder. It will
|
1912
|
+
* create a new file with the content in $bits parameter. If you move the upload
|
1913
|
+
* file, read the content of the uploaded file, and then you can give the
|
1914
|
+
* filename and content to this function, which will add it to the upload
|
1915
|
+
* folder.
|
1916
|
+
*
|
1917
|
+
* The permissions will be set on the new file automatically by this function.
|
1918
|
+
*
|
1919
|
+
* @since 2.0.0
|
1920
|
+
*
|
1921
|
+
* @param string $name Filename.
|
1922
|
+
* @param null $deprecated Never used. Set to null.
|
1923
|
+
* @param mixed $bits File content
|
1924
|
+
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
|
1925
|
+
* @return array
|
1926
|
+
*/
|
1927
|
+
function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
|
1928
|
+
if ( !empty( $deprecated ) )
|
1929
|
+
_deprecated_argument( __FUNCTION__, '2.0' );
|
1930
|
+
|
1931
|
+
if ( empty( $name ) )
|
1932
|
+
return array( 'error' => __( 'Empty filename' ) );
|
1933
|
+
|
1934
|
+
$wp_filetype = wp_check_filetype( $name );
|
1935
|
+
if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
|
1936
|
+
return array( 'error' => __( 'Invalid file type' ) );
|
1937
|
+
|
1938
|
+
$upload = wp_upload_dir( $time );
|
1939
|
+
|
1940
|
+
if ( $upload['error'] !== false )
|
1941
|
+
return $upload;
|
1942
|
+
|
1943
|
+
/**
|
1944
|
+
* Filter whether to treat the upload bits as an error.
|
1945
|
+
*
|
1946
|
+
* Passing a non-array to the filter will effectively short-circuit preparing
|
1947
|
+
* the upload bits, returning that value instead.
|
1948
|
+
*
|
1949
|
+
* @since 3.0.0
|
1950
|
+
*
|
1951
|
+
* @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return.
|
1952
|
+
*/
|
1953
|
+
$upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
|
1954
|
+
if ( !is_array( $upload_bits_error ) ) {
|
1955
|
+
$upload[ 'error' ] = $upload_bits_error;
|
1956
|
+
return $upload;
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
$filename = wp_unique_filename( $upload['path'], $name );
|
1960
|
+
|
1961
|
+
$new_file = $upload['path'] . "/$filename";
|
1962
|
+
if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
|
1963
|
+
if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
|
1964
|
+
$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
|
1965
|
+
else
|
1966
|
+
$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
|
1967
|
+
|
1968
|
+
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
|
1969
|
+
return array( 'error' => $message );
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
$ifp = @ fopen( $new_file, 'wb' );
|
1973
|
+
if ( ! $ifp )
|
1974
|
+
return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
|
1975
|
+
|
1976
|
+
@fwrite( $ifp, $bits );
|
1977
|
+
fclose( $ifp );
|
1978
|
+
clearstatcache();
|
1979
|
+
|
1980
|
+
// Set correct file permissions
|
1981
|
+
$stat = @ stat( dirname( $new_file ) );
|
1982
|
+
$perms = $stat['mode'] & 0007777;
|
1983
|
+
$perms = $perms & 0000666;
|
1984
|
+
@ chmod( $new_file, $perms );
|
1985
|
+
clearstatcache();
|
1986
|
+
|
1987
|
+
// Compute the URL
|
1988
|
+
$url = $upload['url'] . "/$filename";
|
1989
|
+
|
1990
|
+
return array( 'file' => $new_file, 'url' => $url, 'error' => false );
|
1991
|
+
}
|
1992
|
+
|
1993
|
+
/**
|
1994
|
+
* Retrieve the file type based on the extension name.
|
1995
|
+
*
|
1996
|
+
* @since 2.5.0
|
1997
|
+
*
|
1998
|
+
* @param string $ext The extension to search.
|
1999
|
+
* @return string|null The file type, example: audio, video, document, spreadsheet, etc.
|
2000
|
+
* Null if not found.
|
2001
|
+
*/
|
2002
|
+
function wp_ext2type( $ext ) {
|
2003
|
+
$ext = strtolower( $ext );
|
2004
|
+
|
2005
|
+
/**
|
2006
|
+
* Filter file type based on the extension name.
|
2007
|
+
*
|
2008
|
+
* @since 2.5.0
|
2009
|
+
*
|
2010
|
+
* @see wp_ext2type()
|
2011
|
+
*
|
2012
|
+
* @param array $ext2type Multi-dimensional array with extensions for a default set
|
2013
|
+
* of file types.
|
2014
|
+
*/
|
2015
|
+
$ext2type = apply_filters( 'ext2type', array(
|
2016
|
+
'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ),
|
2017
|
+
'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
|
2018
|
+
'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
|
2019
|
+
'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd' ),
|
2020
|
+
'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),
|
2021
|
+
'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
|
2022
|
+
'text' => array( 'asc', 'csv', 'tsv', 'txt' ),
|
2023
|
+
'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
|
2024
|
+
'code' => array( 'css', 'htm', 'html', 'php', 'js' ),
|
2025
|
+
) );
|
2026
|
+
|
2027
|
+
foreach ( $ext2type as $type => $exts )
|
2028
|
+
if ( in_array( $ext, $exts ) )
|
2029
|
+
return $type;
|
2030
|
+
|
2031
|
+
return null;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
/**
|
2035
|
+
* Retrieve the file type from the file name.
|
2036
|
+
*
|
2037
|
+
* You can optionally define the mime array, if needed.
|
2038
|
+
*
|
2039
|
+
* @since 2.0.4
|
2040
|
+
*
|
2041
|
+
* @param string $filename File name or path.
|
2042
|
+
* @param array $mimes Optional. Key is the file extension with value as the mime type.
|
2043
|
+
* @return array Values with extension first and mime type.
|
2044
|
+
*/
|
2045
|
+
function wp_check_filetype( $filename, $mimes = null ) {
|
2046
|
+
if ( empty($mimes) )
|
2047
|
+
$mimes = get_allowed_mime_types();
|
2048
|
+
$type = false;
|
2049
|
+
$ext = false;
|
2050
|
+
|
2051
|
+
foreach ( $mimes as $ext_preg => $mime_match ) {
|
2052
|
+
$ext_preg = '!\.(' . $ext_preg . ')$!i';
|
2053
|
+
if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
|
2054
|
+
$type = $mime_match;
|
2055
|
+
$ext = $ext_matches[1];
|
2056
|
+
break;
|
2057
|
+
}
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
return compact( 'ext', 'type' );
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
/**
|
2064
|
+
* Attempt to determine the real file type of a file.
|
2065
|
+
*
|
2066
|
+
* If unable to, the file name extension will be used to determine type.
|
2067
|
+
*
|
2068
|
+
* If it's determined that the extension does not match the file's real type,
|
2069
|
+
* then the "proper_filename" value will be set with a proper filename and extension.
|
2070
|
+
*
|
2071
|
+
* Currently this function only supports validating images known to getimagesize().
|
2072
|
+
*
|
2073
|
+
* @since 3.0.0
|
2074
|
+
*
|
2075
|
+
* @param string $file Full path to the file.
|
2076
|
+
* @param string $filename The name of the file (may differ from $file due to $file being
|
2077
|
+
* in a tmp directory).
|
2078
|
+
* @param array $mimes Optional. Key is the file extension with value as the mime type.
|
2079
|
+
* @return array Values for the extension, MIME, and either a corrected filename or false
|
2080
|
+
* if original $filename is valid.
|
2081
|
+
*/
|
2082
|
+
function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
2083
|
+
|
2084
|
+
$proper_filename = false;
|
2085
|
+
|
2086
|
+
// Do basic extension validation and MIME mapping
|
2087
|
+
$wp_filetype = wp_check_filetype( $filename, $mimes );
|
2088
|
+
$ext = $wp_filetype['ext'];
|
2089
|
+
$type = $wp_filetype['type'];
|
2090
|
+
|
2091
|
+
// We can't do any further validation without a file to work with
|
2092
|
+
if ( ! file_exists( $file ) ) {
|
2093
|
+
return compact( 'ext', 'type', 'proper_filename' );
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
// We're able to validate images using GD
|
2097
|
+
if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
|
2098
|
+
|
2099
|
+
// Attempt to figure out what type of image it actually is
|
2100
|
+
$imgstats = @getimagesize( $file );
|
2101
|
+
|
2102
|
+
// If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
|
2103
|
+
if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
|
2104
|
+
/**
|
2105
|
+
* Filter the list mapping image mime types to their respective extensions.
|
2106
|
+
*
|
2107
|
+
* @since 3.0.0
|
2108
|
+
*
|
2109
|
+
* @param array $mime_to_ext Array of image mime types and their matching extensions.
|
2110
|
+
*/
|
2111
|
+
$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
|
2112
|
+
'image/jpeg' => 'jpg',
|
2113
|
+
'image/png' => 'png',
|
2114
|
+
'image/gif' => 'gif',
|
2115
|
+
'image/bmp' => 'bmp',
|
2116
|
+
'image/tiff' => 'tif',
|
2117
|
+
) );
|
2118
|
+
|
2119
|
+
// Replace whatever is after the last period in the filename with the correct extension
|
2120
|
+
if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
|
2121
|
+
$filename_parts = explode( '.', $filename );
|
2122
|
+
array_pop( $filename_parts );
|
2123
|
+
$filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
|
2124
|
+
$new_filename = implode( '.', $filename_parts );
|
2125
|
+
|
2126
|
+
if ( $new_filename != $filename ) {
|
2127
|
+
$proper_filename = $new_filename; // Mark that it changed
|
2128
|
+
}
|
2129
|
+
// Redefine the extension / MIME
|
2130
|
+
$wp_filetype = wp_check_filetype( $new_filename, $mimes );
|
2131
|
+
$ext = $wp_filetype['ext'];
|
2132
|
+
$type = $wp_filetype['type'];
|
2133
|
+
}
|
2134
|
+
}
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
/**
|
2138
|
+
* Filter the "real" file type of the given file.
|
2139
|
+
*
|
2140
|
+
* @since 3.0.0
|
2141
|
+
*
|
2142
|
+
* @param array $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
|
2143
|
+
* 'proper_filename' keys.
|
2144
|
+
* @param string $file Full path to the file.
|
2145
|
+
* @param string $filename The name of the file (may differ from $file due to
|
2146
|
+
* $file being in a tmp directory).
|
2147
|
+
* @param array $mimes Key is the file extension with value as the mime type.
|
2148
|
+
*/
|
2149
|
+
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
/**
|
2153
|
+
* Retrieve list of mime types and file extensions.
|
2154
|
+
*
|
2155
|
+
* @since 3.5.0
|
2156
|
+
*
|
2157
|
+
* @return array Array of mime types keyed by the file extension regex corresponding to those types.
|
2158
|
+
*/
|
2159
|
+
function wp_get_mime_types() {
|
2160
|
+
/**
|
2161
|
+
* Filter the list of mime types and file extensions.
|
2162
|
+
*
|
2163
|
+
* This filter should be used to add, not remove, mime types. To remove
|
2164
|
+
* mime types, use the 'upload_mimes' filter.
|
2165
|
+
*
|
2166
|
+
* @since 3.5.0
|
2167
|
+
*
|
2168
|
+
* @param array $wp_get_mime_types Mime types keyed by the file extension regex
|
2169
|
+
* corresponding to those types.
|
2170
|
+
*/
|
2171
|
+
return apply_filters( 'mime_types', array(
|
2172
|
+
// Image formats.
|
2173
|
+
'jpg|jpeg|jpe' => 'image/jpeg',
|
2174
|
+
'gif' => 'image/gif',
|
2175
|
+
'png' => 'image/png',
|
2176
|
+
'bmp' => 'image/bmp',
|
2177
|
+
'tif|tiff' => 'image/tiff',
|
2178
|
+
'ico' => 'image/x-icon',
|
2179
|
+
// Video formats.
|
2180
|
+
'asf|asx' => 'video/x-ms-asf',
|
2181
|
+
'wmv' => 'video/x-ms-wmv',
|
2182
|
+
'wmx' => 'video/x-ms-wmx',
|
2183
|
+
'wm' => 'video/x-ms-wm',
|
2184
|
+
'avi' => 'video/avi',
|
2185
|
+
'divx' => 'video/divx',
|
2186
|
+
'flv' => 'video/x-flv',
|
2187
|
+
'mov|qt' => 'video/quicktime',
|
2188
|
+
'mpeg|mpg|mpe' => 'video/mpeg',
|
2189
|
+
'mp4|m4v' => 'video/mp4',
|
2190
|
+
'ogv' => 'video/ogg',
|
2191
|
+
'webm' => 'video/webm',
|
2192
|
+
'mkv' => 'video/x-matroska',
|
2193
|
+
'3gp|3gpp' => 'video/3gpp', // Can also be audio
|
2194
|
+
'3g2|3gp2' => 'video/3gpp2', // Can also be audio
|
2195
|
+
// Text formats.
|
2196
|
+
'txt|asc|c|cc|h|srt' => 'text/plain',
|
2197
|
+
'csv' => 'text/csv',
|
2198
|
+
'tsv' => 'text/tab-separated-values',
|
2199
|
+
'ics' => 'text/calendar',
|
2200
|
+
'rtx' => 'text/richtext',
|
2201
|
+
'css' => 'text/css',
|
2202
|
+
'htm|html' => 'text/html',
|
2203
|
+
'vtt' => 'text/vtt',
|
2204
|
+
'dfxp' => 'application/ttaf+xml',
|
2205
|
+
// Audio formats.
|
2206
|
+
'mp3|m4a|m4b' => 'audio/mpeg',
|
2207
|
+
'ra|ram' => 'audio/x-realaudio',
|
2208
|
+
'wav' => 'audio/wav',
|
2209
|
+
'ogg|oga' => 'audio/ogg',
|
2210
|
+
'mid|midi' => 'audio/midi',
|
2211
|
+
'wma' => 'audio/x-ms-wma',
|
2212
|
+
'wax' => 'audio/x-ms-wax',
|
2213
|
+
'mka' => 'audio/x-matroska',
|
2214
|
+
// Misc application formats.
|
2215
|
+
'rtf' => 'application/rtf',
|
2216
|
+
'js' => 'application/javascript',
|
2217
|
+
'pdf' => 'application/pdf',
|
2218
|
+
'swf' => 'application/x-shockwave-flash',
|
2219
|
+
'class' => 'application/java',
|
2220
|
+
'tar' => 'application/x-tar',
|
2221
|
+
'zip' => 'application/zip',
|
2222
|
+
'gz|gzip' => 'application/x-gzip',
|
2223
|
+
'rar' => 'application/rar',
|
2224
|
+
'7z' => 'application/x-7z-compressed',
|
2225
|
+
'exe' => 'application/x-msdownload',
|
2226
|
+
'psd' => 'application/octet-stream',
|
2227
|
+
// MS Office formats.
|
2228
|
+
'doc' => 'application/msword',
|
2229
|
+
'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
|
2230
|
+
'wri' => 'application/vnd.ms-write',
|
2231
|
+
'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
|
2232
|
+
'mdb' => 'application/vnd.ms-access',
|
2233
|
+
'mpp' => 'application/vnd.ms-project',
|
2234
|
+
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
2235
|
+
'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
|
2236
|
+
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
2237
|
+
'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
|
2238
|
+
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
2239
|
+
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
2240
|
+
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
2241
|
+
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
2242
|
+
'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
|
2243
|
+
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
|
2244
|
+
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
2245
|
+
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
|
2246
|
+
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
2247
|
+
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
|
2248
|
+
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
|
2249
|
+
'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
|
2250
|
+
'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
|
2251
|
+
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
2252
|
+
'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
|
2253
|
+
'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
|
2254
|
+
'oxps' => 'application/oxps',
|
2255
|
+
'xps' => 'application/vnd.ms-xpsdocument',
|
2256
|
+
// OpenOffice formats.
|
2257
|
+
'odt' => 'application/vnd.oasis.opendocument.text',
|
2258
|
+
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
2259
|
+
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
2260
|
+
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
2261
|
+
'odc' => 'application/vnd.oasis.opendocument.chart',
|
2262
|
+
'odb' => 'application/vnd.oasis.opendocument.database',
|
2263
|
+
'odf' => 'application/vnd.oasis.opendocument.formula',
|
2264
|
+
// WordPerfect formats.
|
2265
|
+
'wp|wpd' => 'application/wordperfect',
|
2266
|
+
// iWork formats.
|
2267
|
+
'key' => 'application/vnd.apple.keynote',
|
2268
|
+
'numbers' => 'application/vnd.apple.numbers',
|
2269
|
+
'pages' => 'application/vnd.apple.pages',
|
2270
|
+
) );
|
2271
|
+
}
|
2272
|
+
/**
|
2273
|
+
* Retrieve list of allowed mime types and file extensions.
|
2274
|
+
*
|
2275
|
+
* @since 2.8.6
|
2276
|
+
*
|
2277
|
+
* @uses wp_get_upload_mime_types() to fetch the list of mime types
|
2278
|
+
*
|
2279
|
+
* @param int|WP_User $user Optional. User to check. Defaults to current user.
|
2280
|
+
* @return array Array of mime types keyed by the file extension regex corresponding
|
2281
|
+
* to those types.
|
2282
|
+
*/
|
2283
|
+
function get_allowed_mime_types( $user = null ) {
|
2284
|
+
$t = wp_get_mime_types();
|
2285
|
+
|
2286
|
+
unset( $t['swf'], $t['exe'] );
|
2287
|
+
if ( function_exists( 'current_user_can' ) )
|
2288
|
+
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
|
2289
|
+
|
2290
|
+
if ( empty( $unfiltered ) )
|
2291
|
+
unset( $t['htm|html'] );
|
2292
|
+
|
2293
|
+
/**
|
2294
|
+
* Filter list of allowed mime types and file extensions.
|
2295
|
+
*
|
2296
|
+
* @since 2.0.0
|
2297
|
+
*
|
2298
|
+
* @param array $t Mime types keyed by the file extension regex corresponding to
|
2299
|
+
* those types. 'swf' and 'exe' removed from full list. 'htm|html' also
|
2300
|
+
* removed depending on '$user' capabilities.
|
2301
|
+
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
|
2302
|
+
*/
|
2303
|
+
return apply_filters( 'upload_mimes', $t, $user );
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
/**
|
2307
|
+
* Display "Are You Sure" message to confirm the action being taken.
|
2308
|
+
*
|
2309
|
+
* If the action has the nonce explain message, then it will be displayed
|
2310
|
+
* along with the "Are you sure?" message.
|
2311
|
+
*
|
2312
|
+
* @since 2.0.4
|
2313
|
+
*
|
2314
|
+
* @param string $action The nonce action.
|
2315
|
+
*/
|
2316
|
+
function wp_nonce_ays( $action ) {
|
2317
|
+
$title = __( 'WordPress Failure Notice' );
|
2318
|
+
if ( 'log-out' == $action ) {
|
2319
|
+
$html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>';
|
2320
|
+
$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
|
2321
|
+
$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
|
2322
|
+
} else {
|
2323
|
+
$html = __( 'Are you sure you want to do this?' );
|
2324
|
+
if ( wp_get_referer() )
|
2325
|
+
$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
|
2326
|
+
}
|
2327
|
+
|
2328
|
+
wp_die( $html, $title, array('response' => 403) );
|
2329
|
+
}
|
2330
|
+
|
2331
|
+
/**
|
2332
|
+
* Kill WordPress execution and display HTML message with error message.
|
2333
|
+
*
|
2334
|
+
* This function complements the die() PHP function. The difference is that
|
2335
|
+
* HTML will be displayed to the user. It is recommended to use this function
|
2336
|
+
* only, when the execution should not continue any further. It is not
|
2337
|
+
* recommended to call this function very often and try to handle as many errors
|
2338
|
+
* as possible silently.
|
2339
|
+
*
|
2340
|
+
* @since 2.0.4
|
2341
|
+
*
|
2342
|
+
* @param string $message Optional. Error message. Default empty.
|
2343
|
+
* @param string $title Optional. Error title. Default empty.
|
2344
|
+
* @param string|array $args Optional. Arguments to control behavior. Default empty array.
|
2345
|
+
*/
|
2346
|
+
function wp_die( $message = '', $title = '', $args = array() ) {
|
2347
|
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
2348
|
+
/**
|
2349
|
+
* Filter callback for killing WordPress execution for AJAX requests.
|
2350
|
+
*
|
2351
|
+
* @since 3.4.0
|
2352
|
+
*
|
2353
|
+
* @param callback $function Callback function name.
|
2354
|
+
*/
|
2355
|
+
$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
|
2356
|
+
} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
|
2357
|
+
/**
|
2358
|
+
* Filter callback for killing WordPress execution for XML-RPC requests.
|
2359
|
+
*
|
2360
|
+
* @since 3.4.0
|
2361
|
+
*
|
2362
|
+
* @param callback $function Callback function name.
|
2363
|
+
*/
|
2364
|
+
$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
|
2365
|
+
} else {
|
2366
|
+
/**
|
2367
|
+
* Filter callback for killing WordPress execution for all non-AJAX, non-XML-RPC requests.
|
2368
|
+
*
|
2369
|
+
* @since 3.0.0
|
2370
|
+
*
|
2371
|
+
* @param callback $function Callback function name.
|
2372
|
+
*/
|
2373
|
+
$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
call_user_func( $function, $message, $title, $args );
|
2377
|
+
}
|
2378
|
+
|
2379
|
+
/**
|
2380
|
+
* Kill WordPress execution and display HTML message with error message.
|
2381
|
+
*
|
2382
|
+
* This is the default handler for wp_die if you want a custom one for your
|
2383
|
+
* site then you can overload using the wp_die_handler filter in wp_die
|
2384
|
+
*
|
2385
|
+
* @since 3.0.0
|
2386
|
+
* @access private
|
2387
|
+
*
|
2388
|
+
* @param string $message Error message.
|
2389
|
+
* @param string $title Optional. Error title. Default empty.
|
2390
|
+
* @param string|array $args Optional. Arguments to control behavior. Default empty array.
|
2391
|
+
*/
|
2392
|
+
function _default_wp_die_handler( $message, $title = '', $args = array() ) {
|
2393
|
+
$defaults = array( 'response' => 500 );
|
2394
|
+
$r = wp_parse_args($args, $defaults);
|
2395
|
+
|
2396
|
+
$have_gettext = function_exists('__');
|
2397
|
+
|
2398
|
+
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
|
2399
|
+
if ( empty( $title ) ) {
|
2400
|
+
$error_data = $message->get_error_data();
|
2401
|
+
if ( is_array( $error_data ) && isset( $error_data['title'] ) )
|
2402
|
+
$title = $error_data['title'];
|
2403
|
+
}
|
2404
|
+
$errors = $message->get_error_messages();
|
2405
|
+
switch ( count( $errors ) ) {
|
2406
|
+
case 0 :
|
2407
|
+
$message = '';
|
2408
|
+
break;
|
2409
|
+
case 1 :
|
2410
|
+
$message = "<p>{$errors[0]}</p>";
|
2411
|
+
break;
|
2412
|
+
default :
|
2413
|
+
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
|
2414
|
+
break;
|
2415
|
+
}
|
2416
|
+
} elseif ( is_string( $message ) ) {
|
2417
|
+
$message = "<p>$message</p>";
|
2418
|
+
}
|
2419
|
+
|
2420
|
+
if ( isset( $r['back_link'] ) && $r['back_link'] ) {
|
2421
|
+
$back_text = $have_gettext? __('« Back') : '« Back';
|
2422
|
+
$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
if ( ! did_action( 'admin_head' ) ) :
|
2426
|
+
if ( !headers_sent() ) {
|
2427
|
+
status_header( $r['response'] );
|
2428
|
+
nocache_headers();
|
2429
|
+
header( 'Content-Type: text/html; charset=utf-8' );
|
2430
|
+
}
|
2431
|
+
|
2432
|
+
if ( empty($title) )
|
2433
|
+
$title = $have_gettext ? __('WordPress › Error') : 'WordPress › Error';
|
2434
|
+
|
2435
|
+
$text_direction = 'ltr';
|
2436
|
+
if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
|
2437
|
+
$text_direction = 'rtl';
|
2438
|
+
elseif ( function_exists( 'is_rtl' ) && is_rtl() )
|
2439
|
+
$text_direction = 'rtl';
|
2440
|
+
?>
|
2441
|
+
<!DOCTYPE html>
|
2442
|
+
<!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
|
2443
|
+
-->
|
2444
|
+
<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
|
2445
|
+
<head>
|
2446
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
2447
|
+
<title><?php echo $title ?></title>
|
2448
|
+
<style type="text/css">
|
2449
|
+
html {
|
2450
|
+
background: #f1f1f1;
|
2451
|
+
}
|
2452
|
+
body {
|
2453
|
+
background: #fff;
|
2454
|
+
color: #444;
|
2455
|
+
font-family: "Open Sans", sans-serif;
|
2456
|
+
margin: 2em auto;
|
2457
|
+
padding: 1em 2em;
|
2458
|
+
max-width: 700px;
|
2459
|
+
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
|
2460
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.13);
|
2461
|
+
}
|
2462
|
+
h1 {
|
2463
|
+
border-bottom: 1px solid #dadada;
|
2464
|
+
clear: both;
|
2465
|
+
color: #666;
|
2466
|
+
font: 24px "Open Sans", sans-serif;
|
2467
|
+
margin: 30px 0 0 0;
|
2468
|
+
padding: 0;
|
2469
|
+
padding-bottom: 7px;
|
2470
|
+
}
|
2471
|
+
#error-page {
|
2472
|
+
margin-top: 50px;
|
2473
|
+
}
|
2474
|
+
#error-page p {
|
2475
|
+
font-size: 14px;
|
2476
|
+
line-height: 1.5;
|
2477
|
+
margin: 25px 0 20px;
|
2478
|
+
}
|
2479
|
+
#error-page code {
|
2480
|
+
font-family: Consolas, Monaco, monospace;
|
2481
|
+
}
|
2482
|
+
ul li {
|
2483
|
+
margin-bottom: 10px;
|
2484
|
+
font-size: 14px ;
|
2485
|
+
}
|
2486
|
+
a {
|
2487
|
+
color: #21759B;
|
2488
|
+
text-decoration: none;
|
2489
|
+
}
|
2490
|
+
a:hover {
|
2491
|
+
color: #D54E21;
|
2492
|
+
}
|
2493
|
+
.button {
|
2494
|
+
background: #f7f7f7;
|
2495
|
+
border: 1px solid #cccccc;
|
2496
|
+
color: #555;
|
2497
|
+
display: inline-block;
|
2498
|
+
text-decoration: none;
|
2499
|
+
font-size: 13px;
|
2500
|
+
line-height: 26px;
|
2501
|
+
height: 28px;
|
2502
|
+
margin: 0;
|
2503
|
+
padding: 0 10px 1px;
|
2504
|
+
cursor: pointer;
|
2505
|
+
-webkit-border-radius: 3px;
|
2506
|
+
-webkit-appearance: none;
|
2507
|
+
border-radius: 3px;
|
2508
|
+
white-space: nowrap;
|
2509
|
+
-webkit-box-sizing: border-box;
|
2510
|
+
-moz-box-sizing: border-box;
|
2511
|
+
box-sizing: border-box;
|
2512
|
+
|
2513
|
+
-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
|
2514
|
+
box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
|
2515
|
+
vertical-align: top;
|
2516
|
+
}
|
2517
|
+
|
2518
|
+
.button.button-large {
|
2519
|
+
height: 29px;
|
2520
|
+
line-height: 28px;
|
2521
|
+
padding: 0 12px;
|
2522
|
+
}
|
2523
|
+
|
2524
|
+
.button:hover,
|
2525
|
+
.button:focus {
|
2526
|
+
background: #fafafa;
|
2527
|
+
border-color: #999;
|
2528
|
+
color: #222;
|
2529
|
+
}
|
2530
|
+
|
2531
|
+
.button:focus {
|
2532
|
+
-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2);
|
2533
|
+
box-shadow: 1px 1px 1px rgba(0,0,0,.2);
|
2534
|
+
}
|
2535
|
+
|
2536
|
+
.button:active {
|
2537
|
+
background: #eee;
|
2538
|
+
border-color: #999;
|
2539
|
+
color: #333;
|
2540
|
+
-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
|
2541
|
+
box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
<?php if ( 'rtl' == $text_direction ) : ?>
|
2545
|
+
body { font-family: Tahoma, Arial; }
|
2546
|
+
<?php endif; ?>
|
2547
|
+
</style>
|
2548
|
+
</head>
|
2549
|
+
<body id="error-page">
|
2550
|
+
<?php endif; // ! did_action( 'admin_head' ) ?>
|
2551
|
+
<?php echo $message; ?>
|
2552
|
+
</body>
|
2553
|
+
</html>
|
2554
|
+
<?php
|
2555
|
+
die();
|
2556
|
+
}
|
2557
|
+
|
2558
|
+
/**
|
2559
|
+
* Kill WordPress execution and display XML message with error message.
|
2560
|
+
*
|
2561
|
+
* This is the handler for wp_die when processing XMLRPC requests.
|
2562
|
+
*
|
2563
|
+
* @since 3.2.0
|
2564
|
+
* @access private
|
2565
|
+
*
|
2566
|
+
* @param string $message Error message.
|
2567
|
+
* @param string $title Optional. Error title. Default empty.
|
2568
|
+
* @param string|array $args Optional. Arguments to control behavior. Default empty array.
|
2569
|
+
*/
|
2570
|
+
function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
|
2571
|
+
global $wp_xmlrpc_server;
|
2572
|
+
$defaults = array( 'response' => 500 );
|
2573
|
+
|
2574
|
+
$r = wp_parse_args($args, $defaults);
|
2575
|
+
|
2576
|
+
if ( $wp_xmlrpc_server ) {
|
2577
|
+
$error = new IXR_Error( $r['response'] , $message);
|
2578
|
+
$wp_xmlrpc_server->output( $error->getXml() );
|
2579
|
+
}
|
2580
|
+
die();
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
/**
|
2584
|
+
* Kill WordPress ajax execution.
|
2585
|
+
*
|
2586
|
+
* This is the handler for wp_die when processing Ajax requests.
|
2587
|
+
*
|
2588
|
+
* @since 3.4.0
|
2589
|
+
* @access private
|
2590
|
+
*
|
2591
|
+
* @param string $message Optional. Response to print. Default empty.
|
2592
|
+
*/
|
2593
|
+
function _ajax_wp_die_handler( $message = '' ) {
|
2594
|
+
if ( is_scalar( $message ) )
|
2595
|
+
die( (string) $message );
|
2596
|
+
die( '0' );
|
2597
|
+
}
|
2598
|
+
|
2599
|
+
/**
|
2600
|
+
* Kill WordPress execution.
|
2601
|
+
*
|
2602
|
+
* This is the handler for wp_die when processing APP requests.
|
2603
|
+
*
|
2604
|
+
* @since 3.4.0
|
2605
|
+
* @access private
|
2606
|
+
*
|
2607
|
+
* @param string $message Optional. Response to print. Default empty.
|
2608
|
+
*/
|
2609
|
+
function _scalar_wp_die_handler( $message = '' ) {
|
2610
|
+
if ( is_scalar( $message ) )
|
2611
|
+
die( (string) $message );
|
2612
|
+
die();
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
/**
|
2616
|
+
* Send a JSON response back to an Ajax request.
|
2617
|
+
*
|
2618
|
+
* @since 3.5.0
|
2619
|
+
*
|
2620
|
+
* @param mixed $response Variable (usually an array or object) to encode as JSON,
|
2621
|
+
* then print and die.
|
2622
|
+
*/
|
2623
|
+
function wp_send_json( $response ) {
|
2624
|
+
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
2625
|
+
echo json_encode( $response );
|
2626
|
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
|
2627
|
+
wp_die();
|
2628
|
+
else
|
2629
|
+
die;
|
2630
|
+
}
|
2631
|
+
|
2632
|
+
/**
|
2633
|
+
* Send a JSON response back to an Ajax request, indicating success.
|
2634
|
+
*
|
2635
|
+
* @since 3.5.0
|
2636
|
+
*
|
2637
|
+
* @param mixed $data Data to encode as JSON, then print and die.
|
2638
|
+
*/
|
2639
|
+
function wp_send_json_success( $data = null ) {
|
2640
|
+
$response = array( 'success' => true );
|
2641
|
+
|
2642
|
+
if ( isset( $data ) )
|
2643
|
+
$response['data'] = $data;
|
2644
|
+
|
2645
|
+
wp_send_json( $response );
|
2646
|
+
}
|
2647
|
+
|
2648
|
+
/**
|
2649
|
+
* Send a JSON response back to an Ajax request, indicating failure.
|
2650
|
+
*
|
2651
|
+
* @since 3.5.0
|
2652
|
+
*
|
2653
|
+
* @param mixed $data Data to encode as JSON, then print and die.
|
2654
|
+
*/
|
2655
|
+
function wp_send_json_error( $data = null ) {
|
2656
|
+
$response = array( 'success' => false );
|
2657
|
+
|
2658
|
+
if ( isset( $data ) )
|
2659
|
+
$response['data'] = $data;
|
2660
|
+
|
2661
|
+
wp_send_json( $response );
|
2662
|
+
}
|
2663
|
+
|
2664
|
+
/**
|
2665
|
+
* Retrieve the WordPress home page URL.
|
2666
|
+
*
|
2667
|
+
* If the constant named 'WP_HOME' exists, then it will be used and returned
|
2668
|
+
* by the function. This can be used to counter the redirection on your local
|
2669
|
+
* development environment.
|
2670
|
+
*
|
2671
|
+
* @since 2.2.0
|
2672
|
+
* @access private
|
2673
|
+
*
|
2674
|
+
* @see WP_HOME
|
2675
|
+
*
|
2676
|
+
* @param string $url URL for the home location.
|
2677
|
+
* @return string Homepage location.
|
2678
|
+
*/
|
2679
|
+
function _config_wp_home( $url = '' ) {
|
2680
|
+
if ( defined( 'WP_HOME' ) )
|
2681
|
+
return untrailingslashit( WP_HOME );
|
2682
|
+
return $url;
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
/**
|
2686
|
+
* Retrieve the WordPress site URL.
|
2687
|
+
*
|
2688
|
+
* If the constant named 'WP_SITEURL' is defined, then the value in that
|
2689
|
+
* constant will always be returned. This can be used for debugging a site
|
2690
|
+
* on your localhost while not having to change the database to your URL.
|
2691
|
+
*
|
2692
|
+
* @since 2.2.0
|
2693
|
+
* @access private
|
2694
|
+
*
|
2695
|
+
* @see WP_SITEURL
|
2696
|
+
*
|
2697
|
+
* @param string $url URL to set the WordPress site location.
|
2698
|
+
* @return string The WordPress Site URL.
|
2699
|
+
*/
|
2700
|
+
function _config_wp_siteurl( $url = '' ) {
|
2701
|
+
if ( defined( 'WP_SITEURL' ) )
|
2702
|
+
return untrailingslashit( WP_SITEURL );
|
2703
|
+
return $url;
|
2704
|
+
}
|
2705
|
+
|
2706
|
+
/**
|
2707
|
+
* Set the localized direction for MCE plugin.
|
2708
|
+
*
|
2709
|
+
* Will only set the direction to 'rtl', if the WordPress locale has
|
2710
|
+
* the text direction set to 'rtl'.
|
2711
|
+
*
|
2712
|
+
* Fills in the 'directionality' setting, enables the 'directionality'
|
2713
|
+
* plugin, and adds the 'ltr' button to 'toolbar1', formerly
|
2714
|
+
* 'theme_advanced_buttons1' array keys. These keys are then returned
|
2715
|
+
* in the $input (TinyMCE settings) array.
|
2716
|
+
*
|
2717
|
+
* @since 2.1.0
|
2718
|
+
* @access private
|
2719
|
+
*
|
2720
|
+
* @param array $input MCE settings array.
|
2721
|
+
* @return array Direction set for 'rtl', if needed by locale.
|
2722
|
+
*/
|
2723
|
+
function _mce_set_direction( $input ) {
|
2724
|
+
if ( is_rtl() ) {
|
2725
|
+
$input['directionality'] = 'rtl';
|
2726
|
+
$input['plugins'] .= ',directionality';
|
2727
|
+
$input['toolbar1'] .= ',ltr';
|
2728
|
+
}
|
2729
|
+
|
2730
|
+
return $input;
|
2731
|
+
}
|
2732
|
+
|
2733
|
+
|
2734
|
+
/**
|
2735
|
+
* Convert smiley code to the icon graphic file equivalent.
|
2736
|
+
*
|
2737
|
+
* You can turn off smilies, by going to the write setting screen and unchecking
|
2738
|
+
* the box, or by setting 'use_smilies' option to false or removing the option.
|
2739
|
+
*
|
2740
|
+
* Plugins may override the default smiley list by setting the $wpsmiliestrans
|
2741
|
+
* to an array, with the key the code the blogger types in and the value the
|
2742
|
+
* image file.
|
2743
|
+
*
|
2744
|
+
* The $wp_smiliessearch global is for the regular expression and is set each
|
2745
|
+
* time the function is called.
|
2746
|
+
*
|
2747
|
+
* The full list of smilies can be found in the function and won't be listed in
|
2748
|
+
* the description. Probably should create a Codex page for it, so that it is
|
2749
|
+
* available.
|
2750
|
+
*
|
2751
|
+
* @global array $wpsmiliestrans
|
2752
|
+
* @global array $wp_smiliessearch
|
2753
|
+
*
|
2754
|
+
* @since 2.2.0
|
2755
|
+
*/
|
2756
|
+
function smilies_init() {
|
2757
|
+
global $wpsmiliestrans, $wp_smiliessearch;
|
2758
|
+
|
2759
|
+
// don't bother setting up smilies if they are disabled
|
2760
|
+
if ( !get_option( 'use_smilies' ) )
|
2761
|
+
return;
|
2762
|
+
|
2763
|
+
if ( !isset( $wpsmiliestrans ) ) {
|
2764
|
+
$wpsmiliestrans = array(
|
2765
|
+
':mrgreen:' => 'icon_mrgreen.gif',
|
2766
|
+
':neutral:' => 'icon_neutral.gif',
|
2767
|
+
':twisted:' => 'icon_twisted.gif',
|
2768
|
+
':arrow:' => 'icon_arrow.gif',
|
2769
|
+
':shock:' => 'icon_eek.gif',
|
2770
|
+
':smile:' => 'icon_smile.gif',
|
2771
|
+
':???:' => 'icon_confused.gif',
|
2772
|
+
':cool:' => 'icon_cool.gif',
|
2773
|
+
':evil:' => 'icon_evil.gif',
|
2774
|
+
':grin:' => 'icon_biggrin.gif',
|
2775
|
+
':idea:' => 'icon_idea.gif',
|
2776
|
+
':oops:' => 'icon_redface.gif',
|
2777
|
+
':razz:' => 'icon_razz.gif',
|
2778
|
+
':roll:' => 'icon_rolleyes.gif',
|
2779
|
+
':wink:' => 'icon_wink.gif',
|
2780
|
+
':cry:' => 'icon_cry.gif',
|
2781
|
+
':eek:' => 'icon_surprised.gif',
|
2782
|
+
':lol:' => 'icon_lol.gif',
|
2783
|
+
':mad:' => 'icon_mad.gif',
|
2784
|
+
':sad:' => 'icon_sad.gif',
|
2785
|
+
'8-)' => 'icon_cool.gif',
|
2786
|
+
'8-O' => 'icon_eek.gif',
|
2787
|
+
':-(' => 'icon_sad.gif',
|
2788
|
+
':-)' => 'icon_smile.gif',
|
2789
|
+
':-?' => 'icon_confused.gif',
|
2790
|
+
':-D' => 'icon_biggrin.gif',
|
2791
|
+
':-P' => 'icon_razz.gif',
|
2792
|
+
':-o' => 'icon_surprised.gif',
|
2793
|
+
':-x' => 'icon_mad.gif',
|
2794
|
+
':-|' => 'icon_neutral.gif',
|
2795
|
+
';-)' => 'icon_wink.gif',
|
2796
|
+
// This one transformation breaks regular text with frequency.
|
2797
|
+
// '8)' => 'icon_cool.gif',
|
2798
|
+
'8O' => 'icon_eek.gif',
|
2799
|
+
':(' => 'icon_sad.gif',
|
2800
|
+
':)' => 'icon_smile.gif',
|
2801
|
+
':?' => 'icon_confused.gif',
|
2802
|
+
':D' => 'icon_biggrin.gif',
|
2803
|
+
':P' => 'icon_razz.gif',
|
2804
|
+
':o' => 'icon_surprised.gif',
|
2805
|
+
':x' => 'icon_mad.gif',
|
2806
|
+
':|' => 'icon_neutral.gif',
|
2807
|
+
';)' => 'icon_wink.gif',
|
2808
|
+
':!:' => 'icon_exclaim.gif',
|
2809
|
+
':?:' => 'icon_question.gif',
|
2810
|
+
);
|
2811
|
+
}
|
2812
|
+
|
2813
|
+
if (count($wpsmiliestrans) == 0) {
|
2814
|
+
return;
|
2815
|
+
}
|
2816
|
+
|
2817
|
+
/*
|
2818
|
+
* NOTE: we sort the smilies in reverse key order. This is to make sure
|
2819
|
+
* we match the longest possible smilie (:???: vs :?) as the regular
|
2820
|
+
* expression used below is first-match
|
2821
|
+
*/
|
2822
|
+
krsort($wpsmiliestrans);
|
2823
|
+
|
2824
|
+
$spaces = wp_spaces_regexp();
|
2825
|
+
|
2826
|
+
// Begin first "subpattern"
|
2827
|
+
$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
|
2828
|
+
|
2829
|
+
$subchar = '';
|
2830
|
+
foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
|
2831
|
+
$firstchar = substr($smiley, 0, 1);
|
2832
|
+
$rest = substr($smiley, 1);
|
2833
|
+
|
2834
|
+
// new subpattern?
|
2835
|
+
if ($firstchar != $subchar) {
|
2836
|
+
if ($subchar != '') {
|
2837
|
+
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern"
|
2838
|
+
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
|
2839
|
+
}
|
2840
|
+
$subchar = $firstchar;
|
2841
|
+
$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
|
2842
|
+
} else {
|
2843
|
+
$wp_smiliessearch .= '|';
|
2844
|
+
}
|
2845
|
+
$wp_smiliessearch .= preg_quote($rest, '/');
|
2846
|
+
}
|
2847
|
+
|
2848
|
+
$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
|
2849
|
+
|
2850
|
+
}
|
2851
|
+
|
2852
|
+
/**
|
2853
|
+
* Merge user defined arguments into defaults array.
|
2854
|
+
*
|
2855
|
+
* This function is used throughout WordPress to allow for both string or array
|
2856
|
+
* to be merged into another array.
|
2857
|
+
*
|
2858
|
+
* @since 2.2.0
|
2859
|
+
*
|
2860
|
+
* @param string|array $args Value to merge with $defaults
|
2861
|
+
* @param array $defaults Optional. Array that serves as the defaults. Default empty.
|
2862
|
+
* @return array Merged user defined values with defaults.
|
2863
|
+
*/
|
2864
|
+
function wp_parse_args( $args, $defaults = '' ) {
|
2865
|
+
if ( is_object( $args ) )
|
2866
|
+
$r = get_object_vars( $args );
|
2867
|
+
elseif ( is_array( $args ) )
|
2868
|
+
$r =& $args;
|
2869
|
+
else
|
2870
|
+
wp_parse_str( $args, $r );
|
2871
|
+
|
2872
|
+
if ( is_array( $defaults ) )
|
2873
|
+
return array_merge( $defaults, $r );
|
2874
|
+
return $r;
|
2875
|
+
}
|
2876
|
+
|
2877
|
+
/**
|
2878
|
+
* Clean up an array, comma- or space-separated list of IDs.
|
2879
|
+
*
|
2880
|
+
* @since 3.0.0
|
2881
|
+
*
|
2882
|
+
* @param array|string $list List of ids.
|
2883
|
+
* @return array Sanitized array of IDs.
|
2884
|
+
*/
|
2885
|
+
function wp_parse_id_list( $list ) {
|
2886
|
+
if ( !is_array($list) )
|
2887
|
+
$list = preg_split('/[\s,]+/', $list);
|
2888
|
+
|
2889
|
+
return array_unique(array_map('absint', $list));
|
2890
|
+
}
|
2891
|
+
|
2892
|
+
/**
|
2893
|
+
* Extract a slice of an array, given a list of keys.
|
2894
|
+
*
|
2895
|
+
* @since 3.1.0
|
2896
|
+
*
|
2897
|
+
* @param array $array The original array.
|
2898
|
+
* @param array $keys The list of keys.
|
2899
|
+
* @return array The array slice.
|
2900
|
+
*/
|
2901
|
+
function wp_array_slice_assoc( $array, $keys ) {
|
2902
|
+
$slice = array();
|
2903
|
+
foreach ( $keys as $key )
|
2904
|
+
if ( isset( $array[ $key ] ) )
|
2905
|
+
$slice[ $key ] = $array[ $key ];
|
2906
|
+
|
2907
|
+
return $slice;
|
2908
|
+
}
|
2909
|
+
|
2910
|
+
/**
|
2911
|
+
* Filters a list of objects, based on a set of key => value arguments.
|
2912
|
+
*
|
2913
|
+
* @since 3.0.0
|
2914
|
+
*
|
2915
|
+
* @param array $list An array of objects to filter
|
2916
|
+
* @param array $args Optional. An array of key => value arguments to match
|
2917
|
+
* against each object. Default empty array.
|
2918
|
+
* @param string $operator Optional. The logical operation to perform. 'or' means
|
2919
|
+
* only one element from the array needs to match; 'and'
|
2920
|
+
* means all elements must match. Default 'and'.
|
2921
|
+
* @param bool|string $field A field from the object to place instead of the entire object.
|
2922
|
+
* Default false.
|
2923
|
+
* @return array A list of objects or object fields.
|
2924
|
+
*/
|
2925
|
+
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
|
2926
|
+
if ( ! is_array( $list ) )
|
2927
|
+
return array();
|
2928
|
+
|
2929
|
+
$list = wp_list_filter( $list, $args, $operator );
|
2930
|
+
|
2931
|
+
if ( $field )
|
2932
|
+
$list = wp_list_pluck( $list, $field );
|
2933
|
+
|
2934
|
+
return $list;
|
2935
|
+
}
|
2936
|
+
|
2937
|
+
/**
|
2938
|
+
* Filters a list of objects, based on a set of key => value arguments.
|
2939
|
+
*
|
2940
|
+
* @since 3.1.0
|
2941
|
+
*
|
2942
|
+
* @param array $list An array of objects to filter.
|
2943
|
+
* @param array $args Optional. An array of key => value arguments to match
|
2944
|
+
* against each object. Default empty array.
|
2945
|
+
* @param string $operator Optional. The logical operation to perform. 'AND' means
|
2946
|
+
* all elements from the array must match. 'OR' means only
|
2947
|
+
* one element needs to match. 'NOT' means no elements may
|
2948
|
+
* match. Default 'AND'.
|
2949
|
+
* @return array Array of found values.
|
2950
|
+
*/
|
2951
|
+
function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
|
2952
|
+
if ( ! is_array( $list ) )
|
2953
|
+
return array();
|
2954
|
+
|
2955
|
+
if ( empty( $args ) )
|
2956
|
+
return $list;
|
2957
|
+
|
2958
|
+
$operator = strtoupper( $operator );
|
2959
|
+
$count = count( $args );
|
2960
|
+
$filtered = array();
|
2961
|
+
|
2962
|
+
foreach ( $list as $key => $obj ) {
|
2963
|
+
$to_match = (array) $obj;
|
2964
|
+
|
2965
|
+
$matched = 0;
|
2966
|
+
foreach ( $args as $m_key => $m_value ) {
|
2967
|
+
if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
|
2968
|
+
$matched++;
|
2969
|
+
}
|
2970
|
+
|
2971
|
+
if ( ( 'AND' == $operator && $matched == $count )
|
2972
|
+
|| ( 'OR' == $operator && $matched > 0 )
|
2973
|
+
|| ( 'NOT' == $operator && 0 == $matched ) ) {
|
2974
|
+
$filtered[$key] = $obj;
|
2975
|
+
}
|
2976
|
+
}
|
2977
|
+
|
2978
|
+
return $filtered;
|
2979
|
+
}
|
2980
|
+
|
2981
|
+
/**
|
2982
|
+
* Pluck a certain field out of each object in a list.
|
2983
|
+
*
|
2984
|
+
* This has the same functionality and prototype of
|
2985
|
+
* array_column() (PHP 5.5) but also supports objects.
|
2986
|
+
*
|
2987
|
+
* @since 3.1.0
|
2988
|
+
* @since 4.0.0 $index_key parameter added.
|
2989
|
+
*
|
2990
|
+
* @param array $list List of objects or arrays
|
2991
|
+
* @param int|string $field Field from the object to place instead of the entire object
|
2992
|
+
* @param int|string $index_key Optional. Field from the object to use as keys for the new array.
|
2993
|
+
* Default null.
|
2994
|
+
* @return array Array of found values. If $index_key is set, an array of found values with keys
|
2995
|
+
* corresponding to $index_key.
|
2996
|
+
*/
|
2997
|
+
function wp_list_pluck( $list, $field, $index_key = null ) {
|
2998
|
+
if ( ! $index_key ) {
|
2999
|
+
/*
|
3000
|
+
* This is simple. Could at some point wrap array_column()
|
3001
|
+
* if we knew we had an array of arrays.
|
3002
|
+
*/
|
3003
|
+
foreach ( $list as $key => $value ) {
|
3004
|
+
if ( is_object( $value ) ) {
|
3005
|
+
$list[ $key ] = $value->$field;
|
3006
|
+
} else {
|
3007
|
+
$list[ $key ] = $value[ $field ];
|
3008
|
+
}
|
3009
|
+
}
|
3010
|
+
return $list;
|
3011
|
+
}
|
3012
|
+
|
3013
|
+
/*
|
3014
|
+
* When index_key is not set for a particular item, push the value
|
3015
|
+
* to the end of the stack. This is how array_column() behaves.
|
3016
|
+
*/
|
3017
|
+
$newlist = array();
|
3018
|
+
foreach ( $list as $value ) {
|
3019
|
+
if ( is_object( $value ) ) {
|
3020
|
+
if ( isset( $value->$index_key ) ) {
|
3021
|
+
$newlist[ $value->$index_key ] = $value->$field;
|
3022
|
+
} else {
|
3023
|
+
$newlist[] = $value->$field;
|
3024
|
+
}
|
3025
|
+
} else {
|
3026
|
+
if ( isset( $value[ $index_key ] ) ) {
|
3027
|
+
$newlist[ $value[ $index_key ] ] = $value[ $field ];
|
3028
|
+
} else {
|
3029
|
+
$newlist[] = $value[ $field ];
|
3030
|
+
}
|
3031
|
+
}
|
3032
|
+
}
|
3033
|
+
|
3034
|
+
return $newlist;
|
3035
|
+
}
|
3036
|
+
|
3037
|
+
/**
|
3038
|
+
* Determines if Widgets library should be loaded.
|
3039
|
+
*
|
3040
|
+
* Checks to make sure that the widgets library hasn't already been loaded.
|
3041
|
+
* If it hasn't, then it will load the widgets library and run an action hook.
|
3042
|
+
*
|
3043
|
+
* @since 2.2.0
|
3044
|
+
*/
|
3045
|
+
function wp_maybe_load_widgets() {
|
3046
|
+
/**
|
3047
|
+
* Filter whether to load the Widgets library.
|
3048
|
+
*
|
3049
|
+
* Passing a falsey value to the filter will effectively short-circuit
|
3050
|
+
* the Widgets library from loading.
|
3051
|
+
*
|
3052
|
+
* @since 2.8.0
|
3053
|
+
*
|
3054
|
+
* @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
|
3055
|
+
* Default true.
|
3056
|
+
*/
|
3057
|
+
if ( ! apply_filters( 'load_default_widgets', true ) ) {
|
3058
|
+
return;
|
3059
|
+
}
|
3060
|
+
|
3061
|
+
require_once( ABSPATH . WPINC . '/default-widgets.php' );
|
3062
|
+
|
3063
|
+
add_action( '_admin_menu', 'wp_widgets_add_menu' );
|
3064
|
+
}
|
3065
|
+
|
3066
|
+
/**
|
3067
|
+
* Append the Widgets menu to the themes main menu.
|
3068
|
+
*
|
3069
|
+
* @since 2.2.0
|
3070
|
+
*
|
3071
|
+
* @uses $submenu The administration submenu list.
|
3072
|
+
*/
|
3073
|
+
function wp_widgets_add_menu() {
|
3074
|
+
global $submenu;
|
3075
|
+
|
3076
|
+
if ( ! current_theme_supports( 'widgets' ) )
|
3077
|
+
return;
|
3078
|
+
|
3079
|
+
$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
|
3080
|
+
ksort( $submenu['themes.php'], SORT_NUMERIC );
|
3081
|
+
}
|
3082
|
+
|
3083
|
+
/**
|
3084
|
+
* Flush all output buffers for PHP 5.2.
|
3085
|
+
*
|
3086
|
+
* Make sure all output buffers are flushed before our singletons are destroyed.
|
3087
|
+
*
|
3088
|
+
* @since 2.2.0
|
3089
|
+
*/
|
3090
|
+
function wp_ob_end_flush_all() {
|
3091
|
+
$levels = ob_get_level();
|
3092
|
+
for ($i=0; $i<$levels; $i++)
|
3093
|
+
ob_end_flush();
|
3094
|
+
}
|
3095
|
+
|
3096
|
+
/**
|
3097
|
+
* Load custom DB error or display WordPress DB error.
|
3098
|
+
*
|
3099
|
+
* If a file exists in the wp-content directory named db-error.php, then it will
|
3100
|
+
* be loaded instead of displaying the WordPress DB error. If it is not found,
|
3101
|
+
* then the WordPress DB error will be displayed instead.
|
3102
|
+
*
|
3103
|
+
* The WordPress DB error sets the HTTP status header to 500 to try to prevent
|
3104
|
+
* search engines from caching the message. Custom DB messages should do the
|
3105
|
+
* same.
|
3106
|
+
*
|
3107
|
+
* This function was backported to WordPress 2.3.2, but originally was added
|
3108
|
+
* in WordPress 2.5.0.
|
3109
|
+
*
|
3110
|
+
* @since 2.3.2
|
3111
|
+
*
|
3112
|
+
* @global wpdb $wpdb WordPress database access abstraction object.
|
3113
|
+
*/
|
3114
|
+
function dead_db() {
|
3115
|
+
global $wpdb;
|
3116
|
+
|
3117
|
+
wp_load_translations_early();
|
3118
|
+
|
3119
|
+
// Load custom DB error template, if present.
|
3120
|
+
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
|
3121
|
+
require_once( WP_CONTENT_DIR . '/db-error.php' );
|
3122
|
+
die();
|
3123
|
+
}
|
3124
|
+
|
3125
|
+
// If installing or in the admin, provide the verbose message.
|
3126
|
+
if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
|
3127
|
+
wp_die($wpdb->error);
|
3128
|
+
|
3129
|
+
// Otherwise, be terse.
|
3130
|
+
status_header( 500 );
|
3131
|
+
nocache_headers();
|
3132
|
+
header( 'Content-Type: text/html; charset=utf-8' );
|
3133
|
+
?>
|
3134
|
+
<!DOCTYPE html>
|
3135
|
+
<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
|
3136
|
+
<head>
|
3137
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
3138
|
+
<title><?php _e( 'Database Error' ); ?></title>
|
3139
|
+
|
3140
|
+
</head>
|
3141
|
+
<body>
|
3142
|
+
<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
|
3143
|
+
</body>
|
3144
|
+
</html>
|
3145
|
+
<?php
|
3146
|
+
die();
|
3147
|
+
}
|
3148
|
+
|
3149
|
+
/**
|
3150
|
+
* Convert a value to non-negative integer.
|
3151
|
+
*
|
3152
|
+
* @since 2.5.0
|
3153
|
+
*
|
3154
|
+
* @param mixed $maybeint Data you wish to have converted to a non-negative integer.
|
3155
|
+
* @return int A non-negative integer.
|
3156
|
+
*/
|
3157
|
+
function absint( $maybeint ) {
|
3158
|
+
return abs( intval( $maybeint ) );
|
3159
|
+
}
|
3160
|
+
|
3161
|
+
/**
|
3162
|
+
* Mark a function as deprecated and inform when it has been used.
|
3163
|
+
*
|
3164
|
+
* There is a hook deprecated_function_run that will be called that can be used
|
3165
|
+
* to get the backtrace up to what file and function called the deprecated
|
3166
|
+
* function.
|
3167
|
+
*
|
3168
|
+
* The current behavior is to trigger a user error if WP_DEBUG is true.
|
3169
|
+
*
|
3170
|
+
* This function is to be used in every function that is deprecated.
|
3171
|
+
*
|
3172
|
+
* @since 2.5.0
|
3173
|
+
* @access private
|
3174
|
+
*
|
3175
|
+
* @param string $function The function that was called.
|
3176
|
+
* @param string $version The version of WordPress that deprecated the function.
|
3177
|
+
* @param string $replacement Optional. The function that should have been called. Default null.
|
3178
|
+
*/
|
3179
|
+
function _deprecated_function( $function, $version, $replacement = null ) {
|
3180
|
+
|
3181
|
+
/**
|
3182
|
+
* Fires when a deprecated function is called.
|
3183
|
+
*
|
3184
|
+
* @since 2.5.0
|
3185
|
+
*
|
3186
|
+
* @param string $function The function that was called.
|
3187
|
+
* @param string $replacement The function that should have been called.
|
3188
|
+
* @param string $version The version of WordPress that deprecated the function.
|
3189
|
+
*/
|
3190
|
+
do_action( 'deprecated_function_run', $function, $replacement, $version );
|
3191
|
+
|
3192
|
+
/**
|
3193
|
+
* Filter whether to trigger an error for deprecated functions.
|
3194
|
+
*
|
3195
|
+
* @since 2.5.0
|
3196
|
+
*
|
3197
|
+
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
|
3198
|
+
*/
|
3199
|
+
if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
|
3200
|
+
if ( function_exists( '__' ) ) {
|
3201
|
+
if ( ! is_null( $replacement ) )
|
3202
|
+
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
|
3203
|
+
else
|
3204
|
+
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
|
3205
|
+
} else {
|
3206
|
+
if ( ! is_null( $replacement ) )
|
3207
|
+
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
|
3208
|
+
else
|
3209
|
+
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
|
3210
|
+
}
|
3211
|
+
}
|
3212
|
+
}
|
3213
|
+
|
3214
|
+
/**
|
3215
|
+
* Mark a file as deprecated and inform when it has been used.
|
3216
|
+
*
|
3217
|
+
* There is a hook deprecated_file_included that will be called that can be used
|
3218
|
+
* to get the backtrace up to what file and function included the deprecated
|
3219
|
+
* file.
|
3220
|
+
*
|
3221
|
+
* The current behavior is to trigger a user error if WP_DEBUG is true.
|
3222
|
+
*
|
3223
|
+
* This function is to be used in every file that is deprecated.
|
3224
|
+
*
|
3225
|
+
* @since 2.5.0
|
3226
|
+
* @access private
|
3227
|
+
*
|
3228
|
+
* @param string $file The file that was included.
|
3229
|
+
* @param string $version The version of WordPress that deprecated the file.
|
3230
|
+
* @param string $replacement Optional. The file that should have been included based on ABSPATH.
|
3231
|
+
* Default null.
|
3232
|
+
* @param string $message Optional. A message regarding the change. Default empty.
|
3233
|
+
*/
|
3234
|
+
function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
|
3235
|
+
|
3236
|
+
/**
|
3237
|
+
* Fires when a deprecated file is called.
|
3238
|
+
*
|
3239
|
+
* @since 2.5.0
|
3240
|
+
*
|
3241
|
+
* @param string $file The file that was called.
|
3242
|
+
* @param string $replacement The file that should have been included based on ABSPATH.
|
3243
|
+
* @param string $version The version of WordPress that deprecated the file.
|
3244
|
+
* @param string $message A message regarding the change.
|
3245
|
+
*/
|
3246
|
+
do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
|
3247
|
+
|
3248
|
+
/**
|
3249
|
+
* Filter whether to trigger an error for deprecated files.
|
3250
|
+
*
|
3251
|
+
* @since 2.5.0
|
3252
|
+
*
|
3253
|
+
* @param bool $trigger Whether to trigger the error for deprecated files. Default true.
|
3254
|
+
*/
|
3255
|
+
if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
|
3256
|
+
$message = empty( $message ) ? '' : ' ' . $message;
|
3257
|
+
if ( function_exists( '__' ) ) {
|
3258
|
+
if ( ! is_null( $replacement ) )
|
3259
|
+
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
|
3260
|
+
else
|
3261
|
+
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
|
3262
|
+
} else {
|
3263
|
+
if ( ! is_null( $replacement ) )
|
3264
|
+
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
|
3265
|
+
else
|
3266
|
+
trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
|
3267
|
+
}
|
3268
|
+
}
|
3269
|
+
}
|
3270
|
+
/**
|
3271
|
+
* Mark a function argument as deprecated and inform when it has been used.
|
3272
|
+
*
|
3273
|
+
* This function is to be used whenever a deprecated function argument is used.
|
3274
|
+
* Before this function is called, the argument must be checked for whether it was
|
3275
|
+
* used by comparing it to its default value or evaluating whether it is empty.
|
3276
|
+
* For example:
|
3277
|
+
* <code>
|
3278
|
+
* if ( ! empty( $deprecated ) ) {
|
3279
|
+
* _deprecated_argument( __FUNCTION__, '3.0' );
|
3280
|
+
* }
|
3281
|
+
* </code>
|
3282
|
+
*
|
3283
|
+
* There is a hook deprecated_argument_run that will be called that can be used
|
3284
|
+
* to get the backtrace up to what file and function used the deprecated
|
3285
|
+
* argument.
|
3286
|
+
*
|
3287
|
+
* The current behavior is to trigger a user error if WP_DEBUG is true.
|
3288
|
+
*
|
3289
|
+
* @since 3.0.0
|
3290
|
+
* @access private
|
3291
|
+
*
|
3292
|
+
* @param string $function The function that was called.
|
3293
|
+
* @param string $version The version of WordPress that deprecated the argument used.
|
3294
|
+
* @param string $message Optional. A message regarding the change. Default null.
|
3295
|
+
*/
|
3296
|
+
function _deprecated_argument( $function, $version, $message = null ) {
|
3297
|
+
|
3298
|
+
/**
|
3299
|
+
* Fires when a deprecated argument is called.
|
3300
|
+
*
|
3301
|
+
* @since 3.0.0
|
3302
|
+
*
|
3303
|
+
* @param string $function The function that was called.
|
3304
|
+
* @param string $message A message regarding the change.
|
3305
|
+
* @param string $version The version of WordPress that deprecated the argument used.
|
3306
|
+
*/
|
3307
|
+
do_action( 'deprecated_argument_run', $function, $message, $version );
|
3308
|
+
|
3309
|
+
/**
|
3310
|
+
* Filter whether to trigger an error for deprecated arguments.
|
3311
|
+
*
|
3312
|
+
* @since 3.0.0
|
3313
|
+
*
|
3314
|
+
* @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
|
3315
|
+
*/
|
3316
|
+
if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
|
3317
|
+
if ( function_exists( '__' ) ) {
|
3318
|
+
if ( ! is_null( $message ) )
|
3319
|
+
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
|
3320
|
+
else
|
3321
|
+
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
|
3322
|
+
} else {
|
3323
|
+
if ( ! is_null( $message ) )
|
3324
|
+
trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
|
3325
|
+
else
|
3326
|
+
trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
|
3327
|
+
}
|
3328
|
+
}
|
3329
|
+
}
|
3330
|
+
|
3331
|
+
/**
|
3332
|
+
* Mark something as being incorrectly called.
|
3333
|
+
*
|
3334
|
+
* There is a hook doing_it_wrong_run that will be called that can be used
|
3335
|
+
* to get the backtrace up to what file and function called the deprecated
|
3336
|
+
* function.
|
3337
|
+
*
|
3338
|
+
* The current behavior is to trigger a user error if WP_DEBUG is true.
|
3339
|
+
*
|
3340
|
+
* @since 3.1.0
|
3341
|
+
* @access private
|
3342
|
+
*
|
3343
|
+
* @param string $function The function that was called.
|
3344
|
+
* @param string $message A message explaining what has been done incorrectly.
|
3345
|
+
* @param string $version The version of WordPress where the message was added.
|
3346
|
+
*/
|
3347
|
+
function _doing_it_wrong( $function, $message, $version ) {
|
3348
|
+
|
3349
|
+
/**
|
3350
|
+
* Fires when the given function is being used incorrectly.
|
3351
|
+
*
|
3352
|
+
* @since 3.1.0
|
3353
|
+
*
|
3354
|
+
* @param string $function The function that was called.
|
3355
|
+
* @param string $message A message explaining what has been done incorrectly.
|
3356
|
+
* @param string $version The version of WordPress where the message was added.
|
3357
|
+
*/
|
3358
|
+
do_action( 'doing_it_wrong_run', $function, $message, $version );
|
3359
|
+
|
3360
|
+
/**
|
3361
|
+
* Filter whether to trigger an error for _doing_it_wrong() calls.
|
3362
|
+
*
|
3363
|
+
* @since 3.1.0
|
3364
|
+
*
|
3365
|
+
* @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
|
3366
|
+
*/
|
3367
|
+
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
|
3368
|
+
if ( function_exists( '__' ) ) {
|
3369
|
+
$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
|
3370
|
+
$message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
|
3371
|
+
trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
|
3372
|
+
} else {
|
3373
|
+
$version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
|
3374
|
+
$message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
|
3375
|
+
trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
|
3376
|
+
}
|
3377
|
+
}
|
3378
|
+
}
|
3379
|
+
|
3380
|
+
/**
|
3381
|
+
* Is the server running earlier than 1.5.0 version of lighttpd?
|
3382
|
+
*
|
3383
|
+
* @since 2.5.0
|
3384
|
+
*
|
3385
|
+
* @return bool Whether the server is running lighttpd < 1.5.0.
|
3386
|
+
*/
|
3387
|
+
function is_lighttpd_before_150() {
|
3388
|
+
$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
|
3389
|
+
$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
|
3390
|
+
return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
|
3391
|
+
}
|
3392
|
+
|
3393
|
+
/**
|
3394
|
+
* Does the specified module exist in the Apache config?
|
3395
|
+
*
|
3396
|
+
* @since 2.5.0
|
3397
|
+
*
|
3398
|
+
* @param string $mod The module, e.g. mod_rewrite.
|
3399
|
+
* @param bool $default Optional. The default return value if the module is not found. Default false.
|
3400
|
+
* @return bool Whether the specified module is loaded.
|
3401
|
+
*/
|
3402
|
+
function apache_mod_loaded($mod, $default = false) {
|
3403
|
+
global $is_apache;
|
3404
|
+
|
3405
|
+
if ( !$is_apache )
|
3406
|
+
return false;
|
3407
|
+
|
3408
|
+
if ( function_exists( 'apache_get_modules' ) ) {
|
3409
|
+
$mods = apache_get_modules();
|
3410
|
+
if ( in_array($mod, $mods) )
|
3411
|
+
return true;
|
3412
|
+
} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
|
3413
|
+
ob_start();
|
3414
|
+
phpinfo(8);
|
3415
|
+
$phpinfo = ob_get_clean();
|
3416
|
+
if ( false !== strpos($phpinfo, $mod) )
|
3417
|
+
return true;
|
3418
|
+
}
|
3419
|
+
return $default;
|
3420
|
+
}
|
3421
|
+
|
3422
|
+
/**
|
3423
|
+
* Check if IIS 7+ supports pretty permalinks.
|
3424
|
+
*
|
3425
|
+
* @since 2.8.0
|
3426
|
+
*
|
3427
|
+
* @return bool Whether IIS7 supports permalinks.
|
3428
|
+
*/
|
3429
|
+
function iis7_supports_permalinks() {
|
3430
|
+
global $is_iis7;
|
3431
|
+
|
3432
|
+
$supports_permalinks = false;
|
3433
|
+
if ( $is_iis7 ) {
|
3434
|
+
/* First we check if the DOMDocument class exists. If it does not exist, then we cannot
|
3435
|
+
* easily update the xml configuration file, hence we just bail out and tell user that
|
3436
|
+
* pretty permalinks cannot be used.
|
3437
|
+
*
|
3438
|
+
* Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
|
3439
|
+
* URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
|
3440
|
+
* Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
|
3441
|
+
* via ISAPI then pretty permalinks will not work.
|
3442
|
+
*/
|
3443
|
+
$supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
|
3444
|
+
}
|
3445
|
+
|
3446
|
+
/**
|
3447
|
+
* Filter whether IIS 7+ supports pretty permalinks.
|
3448
|
+
*
|
3449
|
+
* @since 2.8.0
|
3450
|
+
*
|
3451
|
+
* @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
|
3452
|
+
*/
|
3453
|
+
return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );
|
3454
|
+
}
|
3455
|
+
|
3456
|
+
/**
|
3457
|
+
* File validates against allowed set of defined rules.
|
3458
|
+
*
|
3459
|
+
* A return value of '1' means that the $file contains either '..' or './'. A
|
3460
|
+
* return value of '2' means that the $file contains ':' after the first
|
3461
|
+
* character. A return value of '3' means that the file is not in the allowed
|
3462
|
+
* files list.
|
3463
|
+
*
|
3464
|
+
* @since 1.2.0
|
3465
|
+
*
|
3466
|
+
* @param string $file File path.
|
3467
|
+
* @param array $allowed_files List of allowed files.
|
3468
|
+
* @return int 0 means nothing is wrong, greater than 0 means something was wrong.
|
3469
|
+
*/
|
3470
|
+
function validate_file( $file, $allowed_files = '' ) {
|
3471
|
+
if ( false !== strpos( $file, '..' ) )
|
3472
|
+
return 1;
|
3473
|
+
|
3474
|
+
if ( false !== strpos( $file, './' ) )
|
3475
|
+
return 1;
|
3476
|
+
|
3477
|
+
if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
|
3478
|
+
return 3;
|
3479
|
+
|
3480
|
+
if (':' == substr( $file, 1, 1 ) )
|
3481
|
+
return 2;
|
3482
|
+
|
3483
|
+
return 0;
|
3484
|
+
}
|
3485
|
+
|
3486
|
+
/**
|
3487
|
+
* Determine if SSL is used.
|
3488
|
+
*
|
3489
|
+
* @since 2.6.0
|
3490
|
+
*
|
3491
|
+
* @return bool True if SSL, false if not used.
|
3492
|
+
*/
|
3493
|
+
function is_ssl() {
|
3494
|
+
if ( isset($_SERVER['HTTPS']) ) {
|
3495
|
+
if ( 'on' == strtolower($_SERVER['HTTPS']) )
|
3496
|
+
return true;
|
3497
|
+
if ( '1' == $_SERVER['HTTPS'] )
|
3498
|
+
return true;
|
3499
|
+
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
|
3500
|
+
return true;
|
3501
|
+
}
|
3502
|
+
return false;
|
3503
|
+
}
|
3504
|
+
|
3505
|
+
/**
|
3506
|
+
* Whether SSL login should be forced.
|
3507
|
+
*
|
3508
|
+
* @since 2.6.0
|
3509
|
+
*
|
3510
|
+
* @see force_ssl_admin()
|
3511
|
+
*
|
3512
|
+
* @param string|bool $force Optional Whether to force SSL login. Default null.
|
3513
|
+
* @return bool True if forced, false if not forced.
|
3514
|
+
*/
|
3515
|
+
function force_ssl_login( $force = null ) {
|
3516
|
+
return force_ssl_admin( $force );
|
3517
|
+
}
|
3518
|
+
|
3519
|
+
/**
|
3520
|
+
* Whether to force SSL used for the Administration Screens.
|
3521
|
+
*
|
3522
|
+
* @since 2.6.0
|
3523
|
+
*
|
3524
|
+
* @param string|bool $force Optional. Whether to force SSL in admin screens. Default null.
|
3525
|
+
* @return bool True if forced, false if not forced.
|
3526
|
+
*/
|
3527
|
+
function force_ssl_admin( $force = null ) {
|
3528
|
+
static $forced = false;
|
3529
|
+
|
3530
|
+
if ( !is_null( $force ) ) {
|
3531
|
+
$old_forced = $forced;
|
3532
|
+
$forced = $force;
|
3533
|
+
return $old_forced;
|
3534
|
+
}
|
3535
|
+
|
3536
|
+
return $forced;
|
3537
|
+
}
|
3538
|
+
|
3539
|
+
/**
|
3540
|
+
* Guess the URL for the site.
|
3541
|
+
*
|
3542
|
+
* Will remove wp-admin links to retrieve only return URLs not in the wp-admin
|
3543
|
+
* directory.
|
3544
|
+
*
|
3545
|
+
* @since 2.6.0
|
3546
|
+
*
|
3547
|
+
* @return string The guessed URL.
|
3548
|
+
*/
|
3549
|
+
function wp_guess_url() {
|
3550
|
+
if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
|
3551
|
+
$url = WP_SITEURL;
|
3552
|
+
} else {
|
3553
|
+
$abspath_fix = str_replace( '\\', '/', ABSPATH );
|
3554
|
+
$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
|
3555
|
+
|
3556
|
+
// The request is for the admin
|
3557
|
+
if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
|
3558
|
+
$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
|
3559
|
+
|
3560
|
+
// The request is for a file in ABSPATH
|
3561
|
+
} elseif ( $script_filename_dir . '/' == $abspath_fix ) {
|
3562
|
+
// Strip off any file/query params in the path
|
3563
|
+
$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
|
3564
|
+
|
3565
|
+
} else {
|
3566
|
+
if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
|
3567
|
+
// Request is hitting a file inside ABSPATH
|
3568
|
+
$directory = str_replace( ABSPATH, '', $script_filename_dir );
|
3569
|
+
// Strip off the sub directory, and any file/query paramss
|
3570
|
+
$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
|
3571
|
+
} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
|
3572
|
+
// Request is hitting a file above ABSPATH
|
3573
|
+
$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
|
3574
|
+
// Strip off any file/query params from the path, appending the sub directory to the install
|
3575
|
+
$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
|
3576
|
+
} else {
|
3577
|
+
$path = $_SERVER['REQUEST_URI'];
|
3578
|
+
}
|
3579
|
+
}
|
3580
|
+
|
3581
|
+
$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
|
3582
|
+
$url = $schema . $_SERVER['HTTP_HOST'] . $path;
|
3583
|
+
}
|
3584
|
+
|
3585
|
+
return rtrim($url, '/');
|
3586
|
+
}
|
3587
|
+
|
3588
|
+
/**
|
3589
|
+
* Temporarily suspend cache additions.
|
3590
|
+
*
|
3591
|
+
* Stops more data being added to the cache, but still allows cache retrieval.
|
3592
|
+
* This is useful for actions, such as imports, when a lot of data would otherwise
|
3593
|
+
* be almost uselessly added to the cache.
|
3594
|
+
*
|
3595
|
+
* Suspension lasts for a single page load at most. Remember to call this
|
3596
|
+
* function again if you wish to re-enable cache adds earlier.
|
3597
|
+
*
|
3598
|
+
* @since 3.3.0
|
3599
|
+
*
|
3600
|
+
* @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
|
3601
|
+
* @return bool The current suspend setting
|
3602
|
+
*/
|
3603
|
+
function wp_suspend_cache_addition( $suspend = null ) {
|
3604
|
+
static $_suspend = false;
|
3605
|
+
|
3606
|
+
if ( is_bool( $suspend ) )
|
3607
|
+
$_suspend = $suspend;
|
3608
|
+
|
3609
|
+
return $_suspend;
|
3610
|
+
}
|
3611
|
+
|
3612
|
+
/**
|
3613
|
+
* Suspend cache invalidation.
|
3614
|
+
*
|
3615
|
+
* Turns cache invalidation on and off. Useful during imports where you don't wont to do
|
3616
|
+
* invalidations every time a post is inserted. Callers must be sure that what they are
|
3617
|
+
* doing won't lead to an inconsistent cache when invalidation is suspended.
|
3618
|
+
*
|
3619
|
+
* @since 2.7.0
|
3620
|
+
*
|
3621
|
+
* @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.
|
3622
|
+
* @return bool The current suspend setting.
|
3623
|
+
*/
|
3624
|
+
function wp_suspend_cache_invalidation( $suspend = true ) {
|
3625
|
+
global $_wp_suspend_cache_invalidation;
|
3626
|
+
|
3627
|
+
$current_suspend = $_wp_suspend_cache_invalidation;
|
3628
|
+
$_wp_suspend_cache_invalidation = $suspend;
|
3629
|
+
return $current_suspend;
|
3630
|
+
}
|
3631
|
+
|
3632
|
+
/**
|
3633
|
+
* Determine whether a site is the main site of the current network.
|
3634
|
+
*
|
3635
|
+
* @since 3.0.0
|
3636
|
+
*
|
3637
|
+
* @param int $site_id Optional. Site ID to test. Defaults to current site.
|
3638
|
+
* Defaults to current site.
|
3639
|
+
* @return bool True if $site_id is the main site of the network, or if not
|
3640
|
+
* running Multisite.
|
3641
|
+
*/
|
3642
|
+
function is_main_site( $site_id = null ) {
|
3643
|
+
// This is the current network's information; 'site' is old terminology.
|
3644
|
+
global $current_site;
|
3645
|
+
|
3646
|
+
if ( ! is_multisite() )
|
3647
|
+
return true;
|
3648
|
+
|
3649
|
+
if ( ! $site_id )
|
3650
|
+
$site_id = get_current_blog_id();
|
3651
|
+
|
3652
|
+
return (int) $site_id === (int) $current_site->blog_id;
|
3653
|
+
}
|
3654
|
+
|
3655
|
+
/**
|
3656
|
+
* Determine whether a network is the main network of the Multisite install.
|
3657
|
+
*
|
3658
|
+
* @since 3.7.0
|
3659
|
+
*
|
3660
|
+
* @param int $network_id Optional. Network ID to test. Defaults to current network.
|
3661
|
+
* @return bool True if $network_id is the main network, or if not running Multisite.
|
3662
|
+
*/
|
3663
|
+
function is_main_network( $network_id = null ) {
|
3664
|
+
global $wpdb;
|
3665
|
+
|
3666
|
+
if ( ! is_multisite() )
|
3667
|
+
return true;
|
3668
|
+
|
3669
|
+
$current_network_id = (int) get_current_site()->id;
|
3670
|
+
|
3671
|
+
if ( ! $network_id )
|
3672
|
+
$network_id = $current_network_id;
|
3673
|
+
$network_id = (int) $network_id;
|
3674
|
+
|
3675
|
+
if ( defined( 'PRIMARY_NETWORK_ID' ) )
|
3676
|
+
return $network_id === (int) PRIMARY_NETWORK_ID;
|
3677
|
+
|
3678
|
+
if ( 1 === $current_network_id )
|
3679
|
+
return $network_id === $current_network_id;
|
3680
|
+
|
3681
|
+
$primary_network_id = (int) wp_cache_get( 'primary_network_id', 'site-options' );
|
3682
|
+
|
3683
|
+
if ( $primary_network_id )
|
3684
|
+
return $network_id === $primary_network_id;
|
3685
|
+
|
3686
|
+
$primary_network_id = (int) $wpdb->get_var( "SELECT id FROM $wpdb->site ORDER BY id LIMIT 1" );
|
3687
|
+
wp_cache_add( 'primary_network_id', $primary_network_id, 'site-options' );
|
3688
|
+
|
3689
|
+
return $network_id === $primary_network_id;
|
3690
|
+
}
|
3691
|
+
|
3692
|
+
/**
|
3693
|
+
* Determine whether global terms are enabled.
|
3694
|
+
*
|
3695
|
+
* @since 3.0.0
|
3696
|
+
*
|
3697
|
+
* @return bool True if multisite and global terms enabled.
|
3698
|
+
*/
|
3699
|
+
function global_terms_enabled() {
|
3700
|
+
if ( ! is_multisite() )
|
3701
|
+
return false;
|
3702
|
+
|
3703
|
+
static $global_terms = null;
|
3704
|
+
if ( is_null( $global_terms ) ) {
|
3705
|
+
|
3706
|
+
/**
|
3707
|
+
* Filter whether global terms are enabled.
|
3708
|
+
*
|
3709
|
+
* Passing a non-null value to the filter will effectively short-circuit the function,
|
3710
|
+
* returning the value of the 'global_terms_enabled' site option instead.
|
3711
|
+
*
|
3712
|
+
* @since 3.0.0
|
3713
|
+
*
|
3714
|
+
* @param null $anbled Whether global terms are enabled.
|
3715
|
+
*/
|
3716
|
+
$filter = apply_filters( 'global_terms_enabled', null );
|
3717
|
+
if ( ! is_null( $filter ) )
|
3718
|
+
$global_terms = (bool) $filter;
|
3719
|
+
else
|
3720
|
+
$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
|
3721
|
+
}
|
3722
|
+
return $global_terms;
|
3723
|
+
}
|
3724
|
+
|
3725
|
+
/**
|
3726
|
+
* gmt_offset modification for smart timezone handling.
|
3727
|
+
*
|
3728
|
+
* Overrides the gmt_offset option if we have a timezone_string available.
|
3729
|
+
*
|
3730
|
+
* @since 2.8.0
|
3731
|
+
*
|
3732
|
+
* @return float|bool Timezone GMT offset, false otherwise.
|
3733
|
+
*/
|
3734
|
+
function wp_timezone_override_offset() {
|
3735
|
+
if ( !$timezone_string = get_option( 'timezone_string' ) ) {
|
3736
|
+
return false;
|
3737
|
+
}
|
3738
|
+
|
3739
|
+
$timezone_object = timezone_open( $timezone_string );
|
3740
|
+
$datetime_object = date_create();
|
3741
|
+
if ( false === $timezone_object || false === $datetime_object ) {
|
3742
|
+
return false;
|
3743
|
+
}
|
3744
|
+
return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
|
3745
|
+
}
|
3746
|
+
|
3747
|
+
/**
|
3748
|
+
* Sort-helper for timezones.
|
3749
|
+
*
|
3750
|
+
* @since 2.9.0
|
3751
|
+
* @access private
|
3752
|
+
*
|
3753
|
+
* @param array $a
|
3754
|
+
* @param array $b
|
3755
|
+
* @return int
|
3756
|
+
*/
|
3757
|
+
function _wp_timezone_choice_usort_callback( $a, $b ) {
|
3758
|
+
// Don't use translated versions of Etc
|
3759
|
+
if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
|
3760
|
+
// Make the order of these more like the old dropdown
|
3761
|
+
if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
|
3762
|
+
return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
|
3763
|
+
}
|
3764
|
+
if ( 'UTC' === $a['city'] ) {
|
3765
|
+
if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
|
3766
|
+
return 1;
|
3767
|
+
}
|
3768
|
+
return -1;
|
3769
|
+
}
|
3770
|
+
if ( 'UTC' === $b['city'] ) {
|
3771
|
+
if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
|
3772
|
+
return -1;
|
3773
|
+
}
|
3774
|
+
return 1;
|
3775
|
+
}
|
3776
|
+
return strnatcasecmp( $a['city'], $b['city'] );
|
3777
|
+
}
|
3778
|
+
if ( $a['t_continent'] == $b['t_continent'] ) {
|
3779
|
+
if ( $a['t_city'] == $b['t_city'] ) {
|
3780
|
+
return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
|
3781
|
+
}
|
3782
|
+
return strnatcasecmp( $a['t_city'], $b['t_city'] );
|
3783
|
+
} else {
|
3784
|
+
// Force Etc to the bottom of the list
|
3785
|
+
if ( 'Etc' === $a['continent'] ) {
|
3786
|
+
return 1;
|
3787
|
+
}
|
3788
|
+
if ( 'Etc' === $b['continent'] ) {
|
3789
|
+
return -1;
|
3790
|
+
}
|
3791
|
+
return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
|
3792
|
+
}
|
3793
|
+
}
|
3794
|
+
|
3795
|
+
/**
|
3796
|
+
* Gives a nicely-formatted list of timezone strings.
|
3797
|
+
*
|
3798
|
+
* @since 2.9.0
|
3799
|
+
*
|
3800
|
+
* @param string $selected_zone Selected timezone.
|
3801
|
+
* @return string
|
3802
|
+
*/
|
3803
|
+
function wp_timezone_choice( $selected_zone ) {
|
3804
|
+
static $mo_loaded = false;
|
3805
|
+
|
3806
|
+
$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
|
3807
|
+
|
3808
|
+
// Load translations for continents and cities
|
3809
|
+
if ( !$mo_loaded ) {
|
3810
|
+
$locale = get_locale();
|
3811
|
+
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
|
3812
|
+
load_textdomain( 'continents-cities', $mofile );
|
3813
|
+
$mo_loaded = true;
|
3814
|
+
}
|
3815
|
+
|
3816
|
+
$zonen = array();
|
3817
|
+
foreach ( timezone_identifiers_list() as $zone ) {
|
3818
|
+
$zone = explode( '/', $zone );
|
3819
|
+
if ( !in_array( $zone[0], $continents ) ) {
|
3820
|
+
continue;
|
3821
|
+
}
|
3822
|
+
|
3823
|
+
// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
|
3824
|
+
$exists = array(
|
3825
|
+
0 => ( isset( $zone[0] ) && $zone[0] ),
|
3826
|
+
1 => ( isset( $zone[1] ) && $zone[1] ),
|
3827
|
+
2 => ( isset( $zone[2] ) && $zone[2] ),
|
3828
|
+
);
|
3829
|
+
$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
|
3830
|
+
$exists[4] = ( $exists[1] && $exists[3] );
|
3831
|
+
$exists[5] = ( $exists[2] && $exists[3] );
|
3832
|
+
|
3833
|
+
$zonen[] = array(
|
3834
|
+
'continent' => ( $exists[0] ? $zone[0] : '' ),
|
3835
|
+
'city' => ( $exists[1] ? $zone[1] : '' ),
|
3836
|
+
'subcity' => ( $exists[2] ? $zone[2] : '' ),
|
3837
|
+
't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
|
3838
|
+
't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
|
3839
|
+
't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
|
3840
|
+
);
|
3841
|
+
}
|
3842
|
+
usort( $zonen, '_wp_timezone_choice_usort_callback' );
|
3843
|
+
|
3844
|
+
$structure = array();
|
3845
|
+
|
3846
|
+
if ( empty( $selected_zone ) ) {
|
3847
|
+
$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
|
3848
|
+
}
|
3849
|
+
|
3850
|
+
foreach ( $zonen as $key => $zone ) {
|
3851
|
+
// Build value in an array to join later
|
3852
|
+
$value = array( $zone['continent'] );
|
3853
|
+
|
3854
|
+
if ( empty( $zone['city'] ) ) {
|
3855
|
+
// It's at the continent level (generally won't happen)
|
3856
|
+
$display = $zone['t_continent'];
|
3857
|
+
} else {
|
3858
|
+
// It's inside a continent group
|
3859
|
+
|
3860
|
+
// Continent optgroup
|
3861
|
+
if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
|
3862
|
+
$label = $zone['t_continent'];
|
3863
|
+
$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
|
3864
|
+
}
|
3865
|
+
|
3866
|
+
// Add the city to the value
|
3867
|
+
$value[] = $zone['city'];
|
3868
|
+
|
3869
|
+
$display = $zone['t_city'];
|
3870
|
+
if ( !empty( $zone['subcity'] ) ) {
|
3871
|
+
// Add the subcity to the value
|
3872
|
+
$value[] = $zone['subcity'];
|
3873
|
+
$display .= ' - ' . $zone['t_subcity'];
|
3874
|
+
}
|
3875
|
+
}
|
3876
|
+
|
3877
|
+
// Build the value
|
3878
|
+
$value = join( '/', $value );
|
3879
|
+
$selected = '';
|
3880
|
+
if ( $value === $selected_zone ) {
|
3881
|
+
$selected = 'selected="selected" ';
|
3882
|
+
}
|
3883
|
+
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
|
3884
|
+
|
3885
|
+
// Close continent optgroup
|
3886
|
+
if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
|
3887
|
+
$structure[] = '</optgroup>';
|
3888
|
+
}
|
3889
|
+
}
|
3890
|
+
|
3891
|
+
// Do UTC
|
3892
|
+
$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
|
3893
|
+
$selected = '';
|
3894
|
+
if ( 'UTC' === $selected_zone )
|
3895
|
+
$selected = 'selected="selected" ';
|
3896
|
+
$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
|
3897
|
+
$structure[] = '</optgroup>';
|
3898
|
+
|
3899
|
+
// Do manual UTC offsets
|
3900
|
+
$structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
|
3901
|
+
$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
|
3902
|
+
0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
|
3903
|
+
foreach ( $offset_range as $offset ) {
|
3904
|
+
if ( 0 <= $offset )
|
3905
|
+
$offset_name = '+' . $offset;
|
3906
|
+
else
|
3907
|
+
$offset_name = (string) $offset;
|
3908
|
+
|
3909
|
+
$offset_value = $offset_name;
|
3910
|
+
$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
|
3911
|
+
$offset_name = 'UTC' . $offset_name;
|
3912
|
+
$offset_value = 'UTC' . $offset_value;
|
3913
|
+
$selected = '';
|
3914
|
+
if ( $offset_value === $selected_zone )
|
3915
|
+
$selected = 'selected="selected" ';
|
3916
|
+
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
|
3917
|
+
|
3918
|
+
}
|
3919
|
+
$structure[] = '</optgroup>';
|
3920
|
+
|
3921
|
+
return join( "\n", $structure );
|
3922
|
+
}
|
3923
|
+
|
3924
|
+
/**
|
3925
|
+
* Strip close comment and close php tags from file headers used by WP.
|
3926
|
+
*
|
3927
|
+
* @since 2.8.0
|
3928
|
+
* @access private
|
3929
|
+
*
|
3930
|
+
* @see https://core.trac.wordpress.org/ticket/8497
|
3931
|
+
*
|
3932
|
+
* @param string $str Header comment to clean up.
|
3933
|
+
* @return string
|
3934
|
+
*/
|
3935
|
+
function _cleanup_header_comment( $str ) {
|
3936
|
+
return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
|
3937
|
+
}
|
3938
|
+
|
3939
|
+
/**
|
3940
|
+
* Permanently delete posts, pages, attachments, and comments which have been
|
3941
|
+
* in the trash for EMPTY_TRASH_DAYS.
|
3942
|
+
*
|
3943
|
+
* @since 2.9.0
|
3944
|
+
*/
|
3945
|
+
function wp_scheduled_delete() {
|
3946
|
+
global $wpdb;
|
3947
|
+
|
3948
|
+
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
|
3949
|
+
|
3950
|
+
$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
|
3951
|
+
|
3952
|
+
foreach ( (array) $posts_to_delete as $post ) {
|
3953
|
+
$post_id = (int) $post['post_id'];
|
3954
|
+
if ( !$post_id )
|
3955
|
+
continue;
|
3956
|
+
|
3957
|
+
$del_post = get_post($post_id);
|
3958
|
+
|
3959
|
+
if ( !$del_post || 'trash' != $del_post->post_status ) {
|
3960
|
+
delete_post_meta($post_id, '_wp_trash_meta_status');
|
3961
|
+
delete_post_meta($post_id, '_wp_trash_meta_time');
|
3962
|
+
} else {
|
3963
|
+
wp_delete_post($post_id);
|
3964
|
+
}
|
3965
|
+
}
|
3966
|
+
|
3967
|
+
$comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
|
3968
|
+
|
3969
|
+
foreach ( (array) $comments_to_delete as $comment ) {
|
3970
|
+
$comment_id = (int) $comment['comment_id'];
|
3971
|
+
if ( !$comment_id )
|
3972
|
+
continue;
|
3973
|
+
|
3974
|
+
$del_comment = get_comment($comment_id);
|
3975
|
+
|
3976
|
+
if ( !$del_comment || 'trash' != $del_comment->comment_approved ) {
|
3977
|
+
delete_comment_meta($comment_id, '_wp_trash_meta_time');
|
3978
|
+
delete_comment_meta($comment_id, '_wp_trash_meta_status');
|
3979
|
+
} else {
|
3980
|
+
wp_delete_comment($comment_id);
|
3981
|
+
}
|
3982
|
+
}
|
3983
|
+
}
|
3984
|
+
|
3985
|
+
/**
|
3986
|
+
* Retrieve metadata from a file.
|
3987
|
+
*
|
3988
|
+
* Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
|
3989
|
+
* Each piece of metadata must be on its own line. Fields can not span multiple
|
3990
|
+
* lines, the value will get cut at the end of the first line.
|
3991
|
+
*
|
3992
|
+
* If the file data is not within that first 8kiB, then the author should correct
|
3993
|
+
* their plugin file and move the data headers to the top.
|
3994
|
+
*
|
3995
|
+
* @see http://codex.wordpress.org/File_Header
|
3996
|
+
*
|
3997
|
+
* @since 2.9.0
|
3998
|
+
* @param string $file Path to the file.
|
3999
|
+
* @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name').
|
4000
|
+
* @param string $context Optional. If specified adds filter hook "extra_{$context}_headers".
|
4001
|
+
* Default empty.
|
4002
|
+
*/
|
4003
|
+
function get_file_data( $file, $default_headers, $context = '' ) {
|
4004
|
+
// We don't need to write to the file, so just open for reading.
|
4005
|
+
$fp = fopen( $file, 'r' );
|
4006
|
+
|
4007
|
+
// Pull only the first 8kiB of the file in.
|
4008
|
+
$file_data = fread( $fp, 8192 );
|
4009
|
+
|
4010
|
+
// PHP will close file handle, but we are good citizens.
|
4011
|
+
fclose( $fp );
|
4012
|
+
|
4013
|
+
// Make sure we catch CR-only line endings.
|
4014
|
+
$file_data = str_replace( "\r", "\n", $file_data );
|
4015
|
+
|
4016
|
+
/**
|
4017
|
+
* Filter extra file headers by context.
|
4018
|
+
*
|
4019
|
+
* The dynamic portion of the hook name, $context, refers to the context
|
4020
|
+
* where extra headers might be loaded.
|
4021
|
+
*
|
4022
|
+
* @since 2.9.0
|
4023
|
+
*
|
4024
|
+
* @param array $extra_context_headers Empty array by default.
|
4025
|
+
*/
|
4026
|
+
if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
|
4027
|
+
$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
|
4028
|
+
$all_headers = array_merge( $extra_headers, (array) $default_headers );
|
4029
|
+
} else {
|
4030
|
+
$all_headers = $default_headers;
|
4031
|
+
}
|
4032
|
+
|
4033
|
+
foreach ( $all_headers as $field => $regex ) {
|
4034
|
+
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
|
4035
|
+
$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
|
4036
|
+
else
|
4037
|
+
$all_headers[ $field ] = '';
|
4038
|
+
}
|
4039
|
+
|
4040
|
+
return $all_headers;
|
4041
|
+
}
|
4042
|
+
|
4043
|
+
/**
|
4044
|
+
* Returns true.
|
4045
|
+
*
|
4046
|
+
* Useful for returning true to filters easily.
|
4047
|
+
*
|
4048
|
+
* @since 3.0.0
|
4049
|
+
*
|
4050
|
+
* @see __return_false()
|
4051
|
+
*
|
4052
|
+
* @return bool True.
|
4053
|
+
*/
|
4054
|
+
function __return_true() {
|
4055
|
+
return true;
|
4056
|
+
}
|
4057
|
+
|
4058
|
+
/**
|
4059
|
+
* Returns false.
|
4060
|
+
*
|
4061
|
+
* Useful for returning false to filters easily.
|
4062
|
+
*
|
4063
|
+
* @since 3.0.0
|
4064
|
+
*
|
4065
|
+
* @see __return_true()
|
4066
|
+
*
|
4067
|
+
* @return bool False.
|
4068
|
+
*/
|
4069
|
+
function __return_false() {
|
4070
|
+
return false;
|
4071
|
+
}
|
4072
|
+
|
4073
|
+
/**
|
4074
|
+
* Returns 0.
|
4075
|
+
*
|
4076
|
+
* Useful for returning 0 to filters easily.
|
4077
|
+
*
|
4078
|
+
* @since 3.0.0
|
4079
|
+
*
|
4080
|
+
* @return int 0.
|
4081
|
+
*/
|
4082
|
+
function __return_zero() {
|
4083
|
+
return 0;
|
4084
|
+
}
|
4085
|
+
|
4086
|
+
/**
|
4087
|
+
* Returns an empty array.
|
4088
|
+
*
|
4089
|
+
* Useful for returning an empty array to filters easily.
|
4090
|
+
*
|
4091
|
+
* @since 3.0.0
|
4092
|
+
*
|
4093
|
+
* @return array Empty array.
|
4094
|
+
*/
|
4095
|
+
function __return_empty_array() {
|
4096
|
+
return array();
|
4097
|
+
}
|
4098
|
+
|
4099
|
+
/**
|
4100
|
+
* Returns null.
|
4101
|
+
*
|
4102
|
+
* Useful for returning null to filters easily.
|
4103
|
+
*
|
4104
|
+
* @since 3.4.0
|
4105
|
+
*
|
4106
|
+
* @return null Null value.
|
4107
|
+
*/
|
4108
|
+
function __return_null() {
|
4109
|
+
return null;
|
4110
|
+
}
|
4111
|
+
|
4112
|
+
/**
|
4113
|
+
* Returns an empty string.
|
4114
|
+
*
|
4115
|
+
* Useful for returning an empty string to filters easily.
|
4116
|
+
*
|
4117
|
+
* @since 3.7.0
|
4118
|
+
*
|
4119
|
+
* @see __return_null()
|
4120
|
+
*
|
4121
|
+
* @return string Empty string.
|
4122
|
+
*/
|
4123
|
+
function __return_empty_string() {
|
4124
|
+
return '';
|
4125
|
+
}
|
4126
|
+
|
4127
|
+
/**
|
4128
|
+
* Send a HTTP header to disable content type sniffing in browsers which support it.
|
4129
|
+
*
|
4130
|
+
* @since 3.0.0
|
4131
|
+
*
|
4132
|
+
* @see http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
|
4133
|
+
* @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
|
4134
|
+
*/
|
4135
|
+
function send_nosniff_header() {
|
4136
|
+
@header( 'X-Content-Type-Options: nosniff' );
|
4137
|
+
}
|
4138
|
+
|
4139
|
+
/**
|
4140
|
+
* Return a MySQL expression for selecting the week number based on the start_of_week option.
|
4141
|
+
*
|
4142
|
+
* @internal
|
4143
|
+
* @since 3.0.0
|
4144
|
+
*
|
4145
|
+
* @param string $column Database column.
|
4146
|
+
* @return string SQL clause.
|
4147
|
+
*/
|
4148
|
+
function _wp_mysql_week( $column ) {
|
4149
|
+
switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
|
4150
|
+
case 1 :
|
4151
|
+
return "WEEK( $column, 1 )";
|
4152
|
+
case 2 :
|
4153
|
+
case 3 :
|
4154
|
+
case 4 :
|
4155
|
+
case 5 :
|
4156
|
+
case 6 :
|
4157
|
+
return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
|
4158
|
+
case 0 :
|
4159
|
+
default :
|
4160
|
+
return "WEEK( $column, 0 )";
|
4161
|
+
}
|
4162
|
+
}
|
4163
|
+
|
4164
|
+
/**
|
4165
|
+
* Find hierarchy loops using a callback function that maps object IDs to parent IDs.
|
4166
|
+
*
|
4167
|
+
* @since 3.1.0
|
4168
|
+
* @access private
|
4169
|
+
*
|
4170
|
+
* @param callback $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID.
|
4171
|
+
* @param int $start The ID to start the loop check at.
|
4172
|
+
* @param int $start_parent The parent_ID of $start to use instead of calling $callback( $start ).
|
4173
|
+
* Use null to always use $callback
|
4174
|
+
* @param array $callback_args Optional. Additional arguments to send to $callback.
|
4175
|
+
* @return array IDs of all members of loop.
|
4176
|
+
*/
|
4177
|
+
function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
|
4178
|
+
$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
|
4179
|
+
|
4180
|
+
if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
|
4181
|
+
return array();
|
4182
|
+
|
4183
|
+
return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
|
4184
|
+
}
|
4185
|
+
|
4186
|
+
/**
|
4187
|
+
* Use the "The Tortoise and the Hare" algorithm to detect loops.
|
4188
|
+
*
|
4189
|
+
* For every step of the algorithm, the hare takes two steps and the tortoise one.
|
4190
|
+
* If the hare ever laps the tortoise, there must be a loop.
|
4191
|
+
*
|
4192
|
+
* @since 3.1.0
|
4193
|
+
* @access private
|
4194
|
+
*
|
4195
|
+
* @param callback $callback Function that accepts ( ID, callback_arg, ... ) and outputs parent_ID.
|
4196
|
+
* @param int $start The ID to start the loop check at.
|
4197
|
+
* @param array $override Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback.
|
4198
|
+
* Default empty array.
|
4199
|
+
* @param array $callback_args Optional. Additional arguments to send to $callback. Default empty array.
|
4200
|
+
* @param bool $_return_loop Optional. Return loop members or just detect presence of loop? Only set
|
4201
|
+
* to true if you already know the given $start is part of a loop (otherwise
|
4202
|
+
* the returned array might include branches). Default false.
|
4203
|
+
* @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
|
4204
|
+
* $_return_loop
|
4205
|
+
*/
|
4206
|
+
function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
|
4207
|
+
$tortoise = $hare = $evanescent_hare = $start;
|
4208
|
+
$return = array();
|
4209
|
+
|
4210
|
+
// Set evanescent_hare to one past hare
|
4211
|
+
// Increment hare two steps
|
4212
|
+
while (
|
4213
|
+
$tortoise
|
4214
|
+
&&
|
4215
|
+
( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
|
4216
|
+
&&
|
4217
|
+
( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
|
4218
|
+
) {
|
4219
|
+
if ( $_return_loop )
|
4220
|
+
$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
|
4221
|
+
|
4222
|
+
// tortoise got lapped - must be a loop
|
4223
|
+
if ( $tortoise == $evanescent_hare || $tortoise == $hare )
|
4224
|
+
return $_return_loop ? $return : $tortoise;
|
4225
|
+
|
4226
|
+
// Increment tortoise by one step
|
4227
|
+
$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
|
4228
|
+
}
|
4229
|
+
|
4230
|
+
return false;
|
4231
|
+
}
|
4232
|
+
|
4233
|
+
/**
|
4234
|
+
* Send a HTTP header to limit rendering of pages to same origin iframes.
|
4235
|
+
*
|
4236
|
+
* @since 3.1.3
|
4237
|
+
*
|
4238
|
+
* @see https://developer.mozilla.org/en/the_x-frame-options_response_header
|
4239
|
+
*/
|
4240
|
+
function send_frame_options_header() {
|
4241
|
+
@header( 'X-Frame-Options: SAMEORIGIN' );
|
4242
|
+
}
|
4243
|
+
|
4244
|
+
/**
|
4245
|
+
* Retrieve a list of protocols to allow in HTML attributes.
|
4246
|
+
*
|
4247
|
+
* @since 3.3.0
|
4248
|
+
*
|
4249
|
+
* @see wp_kses()
|
4250
|
+
* @see esc_url()
|
4251
|
+
*
|
4252
|
+
* @return array Array of allowed protocols.
|
4253
|
+
*/
|
4254
|
+
function wp_allowed_protocols() {
|
4255
|
+
static $protocols;
|
4256
|
+
|
4257
|
+
if ( empty( $protocols ) ) {
|
4258
|
+
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp' );
|
4259
|
+
|
4260
|
+
/**
|
4261
|
+
* Filter the list of protocols allowed in HTML attributes.
|
4262
|
+
*
|
4263
|
+
* @since 3.0.0
|
4264
|
+
*
|
4265
|
+
* @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
|
4266
|
+
*/
|
4267
|
+
$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
|
4268
|
+
}
|
4269
|
+
|
4270
|
+
return $protocols;
|
4271
|
+
}
|
4272
|
+
|
4273
|
+
/**
|
4274
|
+
* Return a comma-separated string of functions that have been called to get
|
4275
|
+
* to the current point in code.
|
4276
|
+
*
|
4277
|
+
* @since 3.4.0
|
4278
|
+
*
|
4279
|
+
* @see https://core.trac.wordpress.org/ticket/19589
|
4280
|
+
*
|
4281
|
+
* @param string $ignore_class Optional. A class to ignore all function calls within - useful
|
4282
|
+
* when you want to just give info about the callee. Default null.
|
4283
|
+
* @param int $skip_frames Optional. A number of stack frames to skip - useful for unwinding
|
4284
|
+
* back to the source of the issue. Default 0.
|
4285
|
+
* @param bool $pretty Optional. Whether or not you want a comma separated string or raw
|
4286
|
+
* array returned. Default true.
|
4287
|
+
* @return string|array Either a string containing a reversed comma separated trace or an array
|
4288
|
+
* of individual calls.
|
4289
|
+
*/
|
4290
|
+
function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
|
4291
|
+
if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
|
4292
|
+
$trace = debug_backtrace( false );
|
4293
|
+
else
|
4294
|
+
$trace = debug_backtrace();
|
4295
|
+
|
4296
|
+
$caller = array();
|
4297
|
+
$check_class = ! is_null( $ignore_class );
|
4298
|
+
$skip_frames++; // skip this function
|
4299
|
+
|
4300
|
+
foreach ( $trace as $call ) {
|
4301
|
+
if ( $skip_frames > 0 ) {
|
4302
|
+
$skip_frames--;
|
4303
|
+
} elseif ( isset( $call['class'] ) ) {
|
4304
|
+
if ( $check_class && $ignore_class == $call['class'] )
|
4305
|
+
continue; // Filter out calls
|
4306
|
+
|
4307
|
+
$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
|
4308
|
+
} else {
|
4309
|
+
if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) {
|
4310
|
+
$caller[] = "{$call['function']}('{$call['args'][0]}')";
|
4311
|
+
} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
|
4312
|
+
$caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')";
|
4313
|
+
} else {
|
4314
|
+
$caller[] = $call['function'];
|
4315
|
+
}
|
4316
|
+
}
|
4317
|
+
}
|
4318
|
+
if ( $pretty )
|
4319
|
+
return join( ', ', array_reverse( $caller ) );
|
4320
|
+
else
|
4321
|
+
return $caller;
|
4322
|
+
}
|
4323
|
+
|
4324
|
+
/**
|
4325
|
+
* Retrieve ids that are not already present in the cache.
|
4326
|
+
*
|
4327
|
+
* @since 3.4.0
|
4328
|
+
* @access private
|
4329
|
+
*
|
4330
|
+
* @param array $object_ids ID list.
|
4331
|
+
* @param string $cache_key The cache bucket to check against.
|
4332
|
+
*
|
4333
|
+
* @return array List of ids not present in the cache.
|
4334
|
+
*/
|
4335
|
+
function _get_non_cached_ids( $object_ids, $cache_key ) {
|
4336
|
+
$clean = array();
|
4337
|
+
foreach ( $object_ids as $id ) {
|
4338
|
+
$id = (int) $id;
|
4339
|
+
if ( !wp_cache_get( $id, $cache_key ) ) {
|
4340
|
+
$clean[] = $id;
|
4341
|
+
}
|
4342
|
+
}
|
4343
|
+
|
4344
|
+
return $clean;
|
4345
|
+
}
|
4346
|
+
|
4347
|
+
/**
|
4348
|
+
* Test if the current device has the capability to upload files.
|
4349
|
+
*
|
4350
|
+
* @since 3.4.0
|
4351
|
+
* @access private
|
4352
|
+
*
|
4353
|
+
* @return bool true|false Whether the device is able to upload files.
|
4354
|
+
*/
|
4355
|
+
function _device_can_upload() {
|
4356
|
+
if ( ! wp_is_mobile() )
|
4357
|
+
return true;
|
4358
|
+
|
4359
|
+
$ua = $_SERVER['HTTP_USER_AGENT'];
|
4360
|
+
|
4361
|
+
if ( strpos($ua, 'iPhone') !== false
|
4362
|
+
|| strpos($ua, 'iPad') !== false
|
4363
|
+
|| strpos($ua, 'iPod') !== false ) {
|
4364
|
+
return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
|
4365
|
+
}
|
4366
|
+
|
4367
|
+
return true;
|
4368
|
+
}
|
4369
|
+
|
4370
|
+
/**
|
4371
|
+
* Test if a given path is a stream URL
|
4372
|
+
*
|
4373
|
+
* @param string $path The resource path or URL.
|
4374
|
+
* @return bool True if the path is a stream URL.
|
4375
|
+
*/
|
4376
|
+
function wp_is_stream( $path ) {
|
4377
|
+
$wrappers = stream_get_wrappers();
|
4378
|
+
$wrappers_re = '(' . join('|', $wrappers) . ')';
|
4379
|
+
|
4380
|
+
return preg_match( "!^$wrappers_re://!", $path ) === 1;
|
4381
|
+
}
|
4382
|
+
|
4383
|
+
/**
|
4384
|
+
* Test if the supplied date is valid for the Gregorian calendar.
|
4385
|
+
*
|
4386
|
+
* @since 3.5.0
|
4387
|
+
*
|
4388
|
+
* @see checkdate()
|
4389
|
+
*
|
4390
|
+
* @param int $month Month number.
|
4391
|
+
* @param int $day Day number.
|
4392
|
+
* @param int $year Year number.
|
4393
|
+
* @param string $source_date The date to filter.
|
4394
|
+
* @return bool True if valid date, false if not valid date.
|
4395
|
+
*/
|
4396
|
+
function wp_checkdate( $month, $day, $year, $source_date ) {
|
4397
|
+
/**
|
4398
|
+
* Filter whether the given date is valid for the Gregorian calendar.
|
4399
|
+
*
|
4400
|
+
* @since 3.5.0
|
4401
|
+
*
|
4402
|
+
* @param bool $checkdate Whether the given date is valid.
|
4403
|
+
* @param string $source_date Date to check.
|
4404
|
+
*/
|
4405
|
+
return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
|
4406
|
+
}
|
4407
|
+
|
4408
|
+
/**
|
4409
|
+
* Load the auth check for monitoring whether the user is still logged in.
|
4410
|
+
*
|
4411
|
+
* Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
|
4412
|
+
*
|
4413
|
+
* This is disabled for certain screens where a login screen could cause an
|
4414
|
+
* inconvenient interruption. A filter called wp_auth_check_load can be used
|
4415
|
+
* for fine-grained control.
|
4416
|
+
*
|
4417
|
+
* @since 3.6.0
|
4418
|
+
*/
|
4419
|
+
function wp_auth_check_load() {
|
4420
|
+
if ( ! is_admin() && ! is_user_logged_in() )
|
4421
|
+
return;
|
4422
|
+
|
4423
|
+
if ( defined( 'IFRAME_REQUEST' ) )
|
4424
|
+
return;
|
4425
|
+
|
4426
|
+
$screen = get_current_screen();
|
4427
|
+
$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
|
4428
|
+
$show = ! in_array( $screen->id, $hidden );
|
4429
|
+
|
4430
|
+
/**
|
4431
|
+
* Filter whether to load the authentication check.
|
4432
|
+
*
|
4433
|
+
* Passing a falsey value to the filter will effectively short-circuit
|
4434
|
+
* loading the authentication check.
|
4435
|
+
*
|
4436
|
+
* @since 3.6.0
|
4437
|
+
*
|
4438
|
+
* @param bool $show Whether to load the authentication check.
|
4439
|
+
* @param WP_Screen $screen The current screen object.
|
4440
|
+
*/
|
4441
|
+
if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
|
4442
|
+
wp_enqueue_style( 'wp-auth-check' );
|
4443
|
+
wp_enqueue_script( 'wp-auth-check' );
|
4444
|
+
|
4445
|
+
add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
|
4446
|
+
add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
|
4447
|
+
}
|
4448
|
+
}
|
4449
|
+
|
4450
|
+
/**
|
4451
|
+
* Output the HTML that shows the wp-login dialog when the user is no longer logged in.
|
4452
|
+
*
|
4453
|
+
* @since 3.6.0
|
4454
|
+
*/
|
4455
|
+
function wp_auth_check_html() {
|
4456
|
+
$login_url = wp_login_url();
|
4457
|
+
$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
|
4458
|
+
$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
|
4459
|
+
|
4460
|
+
/**
|
4461
|
+
* Filter whether the authentication check originated at the same domain.
|
4462
|
+
*
|
4463
|
+
* @since 3.6.0
|
4464
|
+
*
|
4465
|
+
* @param bool $same_domain Whether the authentication check originated at the same domain.
|
4466
|
+
*/
|
4467
|
+
$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
|
4468
|
+
$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
|
4469
|
+
|
4470
|
+
?>
|
4471
|
+
<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
|
4472
|
+
<div id="wp-auth-check-bg"></div>
|
4473
|
+
<div id="wp-auth-check">
|
4474
|
+
<div class="wp-auth-check-close" tabindex="0" title="<?php esc_attr_e('Close'); ?>"></div>
|
4475
|
+
<?php
|
4476
|
+
|
4477
|
+
if ( $same_domain ) {
|
4478
|
+
?>
|
4479
|
+
<div id="wp-auth-check-form" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
|
4480
|
+
<?php
|
4481
|
+
}
|
4482
|
+
|
4483
|
+
?>
|
4484
|
+
<div class="wp-auth-fallback">
|
4485
|
+
<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
|
4486
|
+
<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
|
4487
|
+
<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
|
4488
|
+
</div>
|
4489
|
+
</div>
|
4490
|
+
</div>
|
4491
|
+
<?php
|
4492
|
+
}
|
4493
|
+
|
4494
|
+
/**
|
4495
|
+
* Check whether a user is still logged in, for the heartbeat.
|
4496
|
+
*
|
4497
|
+
* Send a result that shows a log-in box if the user is no longer logged in,
|
4498
|
+
* or if their cookie is within the grace period.
|
4499
|
+
*
|
4500
|
+
* @since 3.6.0
|
4501
|
+
*
|
4502
|
+
* @param array|object $response The Heartbeat response object or array.
|
4503
|
+
* @return array|object $response The Heartbeat response object or array with 'wp-auth-check'
|
4504
|
+
* value set.
|
4505
|
+
*/
|
4506
|
+
function wp_auth_check( $response ) {
|
4507
|
+
$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
|
4508
|
+
return $response;
|
4509
|
+
}
|
4510
|
+
|
4511
|
+
/**
|
4512
|
+
* Return RegEx body to liberally match an opening HTML tag.
|
4513
|
+
*
|
4514
|
+
* Matches an opening HTML tag that:
|
4515
|
+
* 1. Is self-closing or
|
4516
|
+
* 2. Has no body but has a closing tag of the same name or
|
4517
|
+
* 3. Contains a body and a closing tag of the same name
|
4518
|
+
*
|
4519
|
+
* Note: this RegEx does not balance inner tags and does not attempt
|
4520
|
+
* to produce valid HTML
|
4521
|
+
*
|
4522
|
+
* @since 3.6.0
|
4523
|
+
*
|
4524
|
+
* @param string $tag An HTML tag name. Example: 'video'.
|
4525
|
+
* @return string Tag RegEx.
|
4526
|
+
*/
|
4527
|
+
function get_tag_regex( $tag ) {
|
4528
|
+
if ( empty( $tag ) )
|
4529
|
+
return;
|
4530
|
+
return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
|
4531
|
+
}
|
4532
|
+
|
4533
|
+
/**
|
4534
|
+
* Retrieve a canonical form of the provided charset appropriate for passing to PHP
|
4535
|
+
* functions such as htmlspecialchars() and charset html attributes.
|
4536
|
+
*
|
4537
|
+
* @since 3.6.0
|
4538
|
+
* @access private
|
4539
|
+
*
|
4540
|
+
* @see https://core.trac.wordpress.org/ticket/23688
|
4541
|
+
*
|
4542
|
+
* @param string $charset A charset name.
|
4543
|
+
* @return string The canonical form of the charset.
|
4544
|
+
*/
|
4545
|
+
function _canonical_charset( $charset ) {
|
4546
|
+
if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
|
4547
|
+
'UTF8' === $charset )
|
4548
|
+
return 'UTF-8';
|
4549
|
+
|
4550
|
+
if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
|
4551
|
+
'iso8859-1' === $charset || 'ISO8859-1' === $charset )
|
4552
|
+
return 'ISO-8859-1';
|
4553
|
+
|
4554
|
+
return $charset;
|
4555
|
+
}
|
4556
|
+
|
4557
|
+
/**
|
4558
|
+
* Set the mbstring internal encoding to a binary safe encoding when func_overload
|
4559
|
+
* is enabled.
|
4560
|
+
*
|
4561
|
+
* When mbstring.func_overload is in use for multi-byte encodings, the results from
|
4562
|
+
* strlen() and similar functions respect the utf8 characters, causing binary data
|
4563
|
+
* to return incorrect lengths.
|
4564
|
+
*
|
4565
|
+
* This function overrides the mbstring encoding to a binary-safe encoding, and
|
4566
|
+
* resets it to the users expected encoding afterwards through the
|
4567
|
+
* `reset_mbstring_encoding` function.
|
4568
|
+
*
|
4569
|
+
* It is safe to recursively call this function, however each
|
4570
|
+
* `mbstring_binary_safe_encoding()` call must be followed up with an equal number
|
4571
|
+
* of `reset_mbstring_encoding()` calls.
|
4572
|
+
*
|
4573
|
+
* @since 3.7.0
|
4574
|
+
*
|
4575
|
+
* @see reset_mbstring_encoding()
|
4576
|
+
*
|
4577
|
+
* @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
|
4578
|
+
* Default false.
|
4579
|
+
*/
|
4580
|
+
function mbstring_binary_safe_encoding( $reset = false ) {
|
4581
|
+
static $encodings = array();
|
4582
|
+
static $overloaded = null;
|
4583
|
+
|
4584
|
+
if ( is_null( $overloaded ) )
|
4585
|
+
$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
|
4586
|
+
|
4587
|
+
if ( false === $overloaded )
|
4588
|
+
return;
|
4589
|
+
|
4590
|
+
if ( ! $reset ) {
|
4591
|
+
$encoding = mb_internal_encoding();
|
4592
|
+
array_push( $encodings, $encoding );
|
4593
|
+
mb_internal_encoding( 'ISO-8859-1' );
|
4594
|
+
}
|
4595
|
+
|
4596
|
+
if ( $reset && $encodings ) {
|
4597
|
+
$encoding = array_pop( $encodings );
|
4598
|
+
mb_internal_encoding( $encoding );
|
4599
|
+
}
|
4600
|
+
}
|
4601
|
+
|
4602
|
+
/**
|
4603
|
+
* Reset the mbstring internal encoding to a users previously set encoding.
|
4604
|
+
*
|
4605
|
+
* @see mbstring_binary_safe_encoding()
|
4606
|
+
*
|
4607
|
+
* @since 3.7.0
|
4608
|
+
*/
|
4609
|
+
function reset_mbstring_encoding() {
|
4610
|
+
mbstring_binary_safe_encoding( true );
|
4611
|
+
}
|
4612
|
+
|
4613
|
+
/**
|
4614
|
+
* Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ).
|
4615
|
+
*
|
4616
|
+
* @since 4.0.0
|
4617
|
+
*
|
4618
|
+
* @param mixed $var Boolean value to validate.
|
4619
|
+
* @return bool Whether the value is validated.
|
4620
|
+
*/
|
4621
|
+
function wp_validate_boolean( $var ) {
|
4622
|
+
if ( is_bool( $var ) ) {
|
4623
|
+
return $var;
|
4624
|
+
}
|
4625
|
+
|
4626
|
+
if ( 'false' === $var ) {
|
4627
|
+
return false;
|
4628
|
+
}
|
4629
|
+
|
4630
|
+
return (bool) $var;
|
4631
|
+
}
|