yıl önce sql-storage.js 77628cf8bf first comm 2 yıl önce srcset.js 77628cf8bf first comm 2 yıl önce stream.js 77628cf8bf first comm 2 yıl önce streams.js 77628cf8bf first comm 2 yıl önce stricttransportsecurity.js 77628cf8bf first comm 2 yıl önce style-scoped.js 77628cf8bf first comm 2 yıl önce subresource-bundling.js 77628cf8bf first comm 2 yıl önce subresource-integrity.js 77628cf8bf first comm 2 yıl önce svg-css.js 77628cf8bf first comm 2 yıl önce svg-filters.js 77628cf8bf first comm 2 yıl önce svg-fonts.js 77628cf8bf first comm 2 yıl önce svg-fragment.js 77628cf8bf first comm 2 yıl önce svg-html.js 77628cf8bf first comm 2 yıl önce svg-html5.js 77628cf8bf first comm 2 yıl önce svg-img.js 77628cf8bf first comm 2 yıl önce svg-smil.js 77628cf8bf first comm 2 yıl önce svg.js 77628cf8bf first comm 2 yıl önce sxg.js 77628cf8bf first comm 2 yıl önce tabindex-attr.js 77628cf8bf first comm 2 yıl önce template-literals.js 77628cf8bf first comm 2 yıl önce template.js 77628cf8bf first comm 2 yıl önce temporal.js 77628cf8bf first comm 2 yıl önce testfeat.js 77628cf8bf first comm 2 yıl önce text-decoration.js 77628cf8bf first comm 2 yıl önce text-emphasis.js 77628cf8bf first comm 2 yıl önce text-overflow.js 77628cf8bf first comm 2 yıl önce text-size-adjust.js 77628cf8bf first comm 2 yıl önce text-stroke.js 77628cf8bf first comm 2 yıl önce textcontent.js 77628cf8bf first comm 2 yıl önce textencoder.js 77628cf8bf first comm 2 yıl önce tls1-1.js 77628cf8bf first comm 2 yıl önce tls1-2.js 77628cf8bf first comm 2 yıl önce tls1-3.js 77628cf8bf first comm 2 yıl önce touch.js 77628cf8bf first comm 2 yıl önce transforms2d.js 77628cf8bf first comm 2 yıl önce transforms3d.js 77628cf8bf first comm 2 yıl önce trusted-types.js 77628cf8bf first comm 2 yıl önce ttf.js 77628cf8bf first comm 2 yıl önce typedarrays.js 77628cf8bf first comm 2 yıl önce u2f.js 77628cf8bf first comm 2 yıl önce unhandledrejection.js 77628cf8bf first comm 2 yıl önce upgradeinsecurerequests.js 77628cf8bf first comm 2 yıl önce url-scroll-to-text-fragment.js 77628cf8bf first comm 2 yıl önce url.js 77628cf8bf first comm 2 yıl önce urlsearchparams.js 77628cf8bf first comm 2 yıl önce use-strict.js 77628cf8bf first comm 2 yıl önce user-select-none.js 77628cf8bf first comm 2 yıl önce user-timing.js 77628cf8bf first comm 2 yıl önce variable-fonts.js 77628cf8bf first comm 2 yıl önce vector-effect.js 77628cf8bf first comm 2 yıl önce vibration.js 77628cf8bf first comm 2 yıl önce video.js 77628cf8bf first comm 2 yıl önce videotracks.js 77628cf8bf first comm 2 yıl önce viewport-unit-variants.js 77628cf8bf first comm 2 yıl önce viewport-units.js 77628cf8bf first comm 2 yıl önce wai-aria.js 77628cf8bf first comm 2 yıl önce wake-lock.js 77628cf8bf first comm 2 yıl önce wasm.js 77628cf8bf first comm 2 yıl önce wav.js 77628cf8bf first comm 2 yıl önce wbr-element.js 77628cf8bf first comm 2 yıl önce web-animation.js 77628cf8bf first comm 2 yıl önce web-app-manifest.js 77628cf8bf first comm 2 yıl önce web-bluetooth.js 77628cf8bf first comm 2 yıl önce web-serial.js 77628cf8bf first comm 2 yıl önce web-share.js 77628cf8bf first comm 2 yıl önce webauthn.js 77628cf8bf first comm 2 yıl önce webcodecs.js 77628cf8bf first comm 2 yıl önce webgl.js 77628cf8bf first comm 2 yıl önce webgl2.js 77628cf8bf first comm 2 yıl önce webgpu.js 77628cf8bf first comm 2 yıl önce webhid.js 77628cf8bf first comm 2 yıl önce webkit-user-drag.js 77628cf8bf first comm 2 yıl önce webm.js 77628cf8bf first comm 2 yıl önce webnfc.js 77628cf8bf first comm 2 yıl önce webp.js 77628cf8bf first comm 2 yıl önce websockets.js 77628cf8bf first comm 2 yıl önce webtransport.js 77628cf8bf first comm 2 yıl önce webusb.js 77628cf8bf first comm 2 yıl önce webvr.js 77628cf8bf first comm 2 yıl önce webvtt.js 77628cf8bf first comm 2 yıl önce webworkers.js 77628cf8bf first comm 2 yıl önce webxr.js 77628cf8bf first comm 2 yıl önce will-change.js 77628cf8bf first comm 2 yıl önce woff.js 77628cf8bf first comm 2 yıl önce woff2.js 77628cf8bf first comm 2 yıl önce word-break.js 77628cf8bf first comm 2 yıl önce wordwrap.js 77628cf8bf first comm 2 yıl önce x-doc-messaging.js 77628cf8bf first comm 2 yıl önce x-frame-options.js 77628cf8bf first comm 2 yıl önce xhr2.js 77628cf8bf first comm 2 yıl önce xhtml.js 77628cf8bf first comm 2 yıl önce xhtmlsmil.js 77628cf8bf first comm 2 yıl önce xml-serializer.js 77628cf8bf first comm 2 yıl önce tum/whitesports - Gogs: Simplico Git Service

Нема описа

class-automatic-upgrader-skin.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /**
  3. * Upgrader API: Automatic_Upgrader_Skin class
  4. *
  5. * @package WordPress
  6. * @subpackage Upgrader
  7. * @since 4.6.0
  8. */
  9. /**
  10. * Upgrader Skin for Automatic WordPress Upgrades.
  11. *
  12. * This skin is designed to be used when no output is intended, all output
  13. * is captured and stored for the caller to process and log/email/discard.
  14. *
  15. * @since 3.7.0
  16. * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader-skins.php.
  17. *
  18. * @see Bulk_Upgrader_Skin
  19. */
  20. class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
  21. protected $messages = array();
  22. /**
  23. * Determines whether the upgrader needs FTP/SSH details in order to connect
  24. * to the filesystem.
  25. *
  26. * @since 3.7.0
  27. * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
  28. *
  29. * @see request_filesystem_credentials()
  30. *
  31. * @param bool|WP_Error $error Optional. Whether the current request has failed to connect,
  32. * or an error object. Default false.
  33. * @param string $context Optional. Full path to the directory that is tested
  34. * for being writable. Default empty.
  35. * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
  36. * @return bool True on success, false on failure.
  37. */
  38. public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
  39. if ( $context ) {
  40. $this->options['context'] = $context;
  41. }
  42. /*
  43. * TODO: Fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version.
  44. * This will output a credentials form in event of failure. We don't want that, so just hide with a buffer.
  45. */
  46. ob_start();
  47. $result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
  48. ob_end_clean();
  49. return $result;
  50. }
  51. /**
  52. * Retrieves the upgrade messages.
  53. *
  54. * @since 3.7.0
  55. *
  56. * @return string[] Messages during an upgrade.
  57. */
  58. public function get_upgrade_messages() {
  59. return $this->messages;
  60. }
  61. /**
  62. * Stores a message about the upgrade.
  63. *
  64. * @since 3.7.0
  65. *
  66. * @param string|array|WP_Error $data Message data.
  67. * @param mixed ...$args Optional text replacements.
  68. */
  69. public function feedback( $data, ...$args ) {
  70. if ( is_wp_error( $data ) ) {
  71. $string = $data->get_error_message();
  72. } elseif ( is_array( $data ) ) {
  73. return;
  74. } else {
  75. $string = $data;
  76. }
  77. if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
  78. $string = $this->upgrader->strings[ $string ];
  79. }
  80. if ( strpos( $string, '%' ) !== false ) {
  81. if ( ! empty( $args ) ) {
  82. $string = vsprintf( $string, $args );
  83. }
  84. }
  85. $string = trim( $string );
  86. // Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
  87. $string = wp_kses(
  88. $string,
  89. array(
  90. 'a' => array(
  91. 'href' => true,
  92. ),
  93. 'br' => true,
  94. 'em' => true,
  95. 'strong' => true,
  96. )
  97. );
  98. if ( empty( $string ) ) {
  99. return;
  100. }
  101. $this->messages[] = $string;
  102. }
  103. /**
  104. * Creates a new output buffer.
  105. *
  106. * @since 3.7.0
  107. */
  108. public function header() {
  109. ob_start();
  110. }
  111. /**
  112. * Retrieves the buffered content, deletes the buffer, and processes the output.
  113. *
  114. * @since 3.7.0
  115. */
  116. public function footer() {
  117. $output = ob_get_clean();
  118. if ( ! empty( $output ) ) {
  119. $this->feedback( $output );
  120. }
  121. }
  122. }