/** * Handle updating a plugin's status. * * @since 5.5.0 * * @param string $plugin The plugin file to update. * @param string $new_status The plugin's new status. * @param string $current_status The plugin's current status. * @return true|WP_Error */ Matches theme∙/** * Checks if the plugin matches the requested parameters. * * @since 5.5.0 * * @param WP_REST_Request $request The request to require the plugin matches against. * @param array $item The plugin item. * @return bool */) { $this->namespace = 'wp/v2'; $this->res/** * Determine if the endpoints are available. * * Only the 'Direct' filesystem transport, and SSH/FTP when credentials are stored are supported at present. * * @since 5.5.0 * * @return true|WP_Error True if filesystem is available, WP_Error otherwise. */er::READABLE, 'cal/** * Checks whether a given request has permission to install and activate plugins. * * @since 5.5.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has permission, WP_Error object otherwise. */ce, sprintf( '/%s/(                                                            шCз:S     #5▒пл╨АHprAylesheet' => array( 'description' => __( "The theme's stylesheet. This uniquely identifies the theme." ), 'type' => 'string', 'sanitize_callback' => array( $this, '_sanitize_stylesheet_ca                                                            Н.]ыЗчА`Dh;S    ┌dM╜═%Я°╫z;SFз:S     ^шwюvо╢р#qA°Fз:S      ╤╠0╔wГx-pAЁGз:S ╦ё╦амПЕ8%qAшHз:S     3°r■чА VmAрIз:S FлtсХ `╕А6qA╪Jз:S     №&Рь&qA                                                             Гx;S    КTЕ▓╨А` N;Se stylesheet name. * @return string Sanitized stylesheet. */ public function _sanitize_stylesheet_callback( $stylesheet ) { return urldecode( $stylesheet ); } /** * Checks if a given request has access to read thАа └ р8Ё30@#`$2А(1└67@DL`FGАJKРMyаNZ└PQрTU\d ^_@bc`itpjsРmn░qr╨wx|| curre                                                            Ф    IНКSА ?}@Sction_params(); if ( isset( $registered['status'], $request['status'] ) && is_array( $request['status'] ) && array( 'active' ) === $request['status'] ) { return $this->check_read_active_theme_permission(); } return                                                            Ф    IНКSАрAц:S ), array( 'status' => rest_authorization_required_code() ) ); } /** * Checks if a given request has access to read the theme. * * @since 5.7.0 * * @param WP_REST_Request $request Full details about the req                                                            Ї    IНКSАрмz@Srror object. */ public function get_item_permissions_check( $request ) { if ( current_user_can( 'switch_themes' ) || current_user_can( 'manage_network_themes' ) ) { return true; } $wp_theme = wp_get_theme(                                                             Ї    IНКSА└√ф:Sheme, $current_theme ) ) { return $this->check_read_active_theme_permission(); } return new WP_Error( 'rest_cannot_view_themes', __( 'Sorry, you are not allowed to view themes.' ), array( 'status' => rest_au                                                            Ї    IНКSАрЫ`;S7.0 * * @return true|WP_Error True if the theme can be read, WP_Error object otherwise. */ protected function check_read_active_theme_permission() { if } else { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: List of element names. */ __( 'Fields other than %s are not currently supported for the sitemap index.' ), implode( ',', array( 'loc', 'lastmod' ) ) ), '5.5.0' ); } } } return $sitemap_index->asXML(); } /** * Renders a sitemap. * * @since 5.5.0 * * @param array $url_list Array of URLs for a sitemap. */ public function render_sitemap( $url_list ) { header( 'Content-type: application/xml; charset=UTF-8' ); $this->check_for_simple_xml_availability(); $sitemap_xml = $this->get_sitemap_xml( $url_list ); if ( ! empty( $sitemap_xml ) ) { // All output is escaped within get_sitemap_xml(). // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $sitemap_xml; } } /** * Gets XML for a sitemap. * * @since 5.5.0 * * @param array $url_list Array of URLs for a sitemap. * @return string|false A well-formed XML string for a sitemap index. False on error. */ public function get_sitemap_xml( $url_list ) { $urlset = new SimpleXMLElement( sprintf( '%1$s%2$s%3$s', '', $this->stylesheet, '' ) ); foreach ( $url_list as $url_item ) { $url = $urlset->addChild( 'url' ); // Add each element as a child node to the entry. foreach ( $url_item as $name => $value ) { if ( 'loc' === $name ) { $url->addChild( $name, esc_url( $value ) ); } elseif ( in_array( $name, array( 'lastmod', 'changefreq', 'priority' ), true ) ) { $url->addChild( $name, esc_xml( $value ) ); } else { _doing_it_wrong( __METHOD__, sprintf( /* translators: %s: List of element names. */ __( 'Fields other than %s are not currently supported for sitemaps.' ), implode( ',', array( 'loc', 'lastmod', 'changefreq', 'priority' ) ) ), '5.5.0' ); } } } return $urlset->asXML(); } /** * Checks for the availability of the SimpleXML extension and errors if missing. * * @since 5.5.0 */ private function check_for_simple_xml_availability() { if ( ! class_exists( 'SimpleXMLElement' ) ) { add_filter( 'wp_die_handler', static function () { return '_xml_wp_die_handler'; } ); wp_die( sprintf( /* translators: %s: SimpleXML */ esc_xml( __( 'Could not generate XML sitemap due to missing %s extension' ) ), 'SimpleXML' ), esc_xml( __( 'WordPress › Error' ) ), array( 'response' => 501, // "Not implemented". ) ); } } }