the wp_head hook. * * See {@see 'wp_head'}. * * @since 2.5.0 */ function wp_generator() { /** * Filters the output of the XHTML generator tag. * * @since 2.5.0 * * @param string $generator_type The XHTML generator. */ the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) ); } /** * Displays the generator XML or Comment for RSS, ATOM, etc. * * Returns the correct generator type for the requested output format. Allows * for a plugin to filter generators overall the {@see 'the_generator'} filter. * * @since 2.5.0 * * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export). */ function the_generator( $type ) { /** * Filters the output of the XHTML generator tag for display. * * @since 2.5.0 * * @param string $generator_type The generator output. * @param string $type The type of generator to output. Accepts 'html', * 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'. */ echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "\n"; } /** * Creates the generator XML or Comment for RSS, ATOM, etc. * * Returns the correct generator type for the requested output format. Allows * for a plugin to filter generators on an individual basis using the * {@see 'get_the_generator_$type'} filter. * * @since 2.5.0 * * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export). * @return string|void The HTML content for the generator. */ function get_the_generator( $type = '' ) { if ( empty( $type ) ) { $current_filter = current_filter(); if ( empty( $current_filter ) ) { return; } switch ( $current_filter ) { case 'rss2_head': case 'commentsrss2_head': $type = 'rss2'; break; case 'rss_head': case 'opml_head': $type = 'comment'; break; case 'rdf_header': $type = 'rdf'; break; case 'atom_head': case 'comments_atom_head': case 'app_head': $type = 'atom'; break; } } switch ( $type ) { case 'html': $gen = ''; break; case 'xhtml': $gen = ''; break; case 'atom': $gen = 'WordPress'; break; case 'rss2': $gen = '' . sanitize_url( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . ''; break; case 'rdf': $gen = ''; break; case 'comment': $gen = ''; break; case 'export': $gen = ''; break; } /** * Filters the HTML for the retrieved generator type. * * The dynamic portion of the hook name, `$type`, refers to the generator type. * * Possible hook names include: * * - `get_the_generator_atom` * - `get_the_generator_comment` * - `get_the_generator_export` * - `get_the_generator_html` * - `get_the_generator_rdf` * - `get_the_generator_rss2` * - `get_the_generator_xhtml` * * @since 2.5.0 * * @param string $gen The HTML markup output to wp_head(). * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', * 'rss2', 'rdf', 'comment', 'export'. */ return apply_filters( "get_the_generator_{$type}", $gen, $type ); } /** * Outputs the HTML checked attribute. * * Compares the first two arguments and if identical marks as checked. * * @since 1.0.0 * * @param mixed $checked One of the values to compare. * @param mixed $current Optional. The other value to compare if not just true. * Default true. * @param bool $display Optional. Whether to echo or just return the string. * Default true. * @return string HTML attribute or empty string. */ function checked( $checked, $current = true, $display = true ) { return __checked_selected_helper( $checked, $current, $display, 'checked' ); } /** * Outputs the HTML selected attribute. * * Compares the first two arguments and if identical marks as selected. * * @since 1.0.0 * * @param mixed $selected One of the values to compare. * @param mixed $current Optional. The other value to compare if not just true. * Default true. * @param bool $display Optional. Whether to echo or just return the string. * Default true. * @return string HTML attribute or empty string. */ function selected( $selected, $current = true, $display = true ) { return __checked_selected_helper( $selected, $current, $display, 'selected' ); } /** * Outputs the HTML disabled attribute. * * Compares the first two arguments and if identical marks as disabled. * * @since 3.0.0 * * @param mixed $disabled One of the values to compare. * @param mixed $current Optional. The other value to compare if not just true. * Default true. * @param bool $display Optional. Whether to echo or just return the string. * Default true. * @return string HTML attribute or empty string. */ function disabled( $disabled, $current = true, $display = true ) { return __checked_selected_helper( $disabled, $current, $display, 'disabled' ); } /** * Outputs the HTML readonly attribute. * * Compares the first two arguments and if identical marks as readonly. * * @since 5.9.0 * * @param mixed $readonly_value One of the values to compare. * @param mixed $current Optional. The other value to compare if not just true. * Default true. * @param bool $display Optional. Whether to echo or just return the string. * Default true. * @return string HTML attribute or empty string. */ function wp_readonly( $readonly_value, $current = true, $display = true ) { return __checked_selected_helper( $readonly_value, $current, $display, 'readonly' ); } /* * Include a compat `readonly()` function on PHP < 8.1. Since PHP 8.1, * `readonly` is a reserved keyword and cannot be used as a function name. * In order to avoid PHP parser errors, this function was extracted * to a separate file and is only included conditionally on PHP < 8.1. */ if ( PHP_VERSION_ID < 80100 ) { require_once __DIR__ . '/php-compat/readonly.php'; } /** * Private helper function for checked, selected, disabled and readonly. * * Compares the first two arguments and if identical marks as `$type`. * * @since 2.8.0 * @access private * * @param mixed $helper One of the values to compare. * @param mixed $current The other value to compare if not just true. * @param bool $display Whether to echo or just return the string. * @param string $type The type of checked|selected|disabled|readonly we are doing. * @return string HTML attribute or empty string. */ function __checked_selected_helper( $helper, $current, $display, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore if ( (string) $helper === (string) $current ) { $result = " $type='$type'"; } else { $result = ''; } if ( $display ) { echo $result; } return $result; } /** * Assigns a visual indicator for required form fields. * * @since 6.1.0 * * @return string Indicator glyph wrapped in a `span` tag. */ function wp_required_field_indicator() { /* translators: Character to identify required form fields. */ $glyph = __( '*' ); $indicator = '' . esc_html( $glyph ) . ''; /** * Filters the markup for a visual indicator of required form fields. * * @since 6.1.0 * * @param string $indicator Markup for the indicator element. */ return apply_filters( 'wp_required_field_indicator', $indicator ); } /** * Creates a message to explain required form fields. * * @since 6.1.0 * * @return string Message text and glyph wrapped in a `span` tag. */ function wp_required_field_message() { $message = sprintf( '%s', /* translators: %s: Asterisk symbol (*). */ sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator() ) ); /** * Filters the message to explain required form fields. * * @since 6.1.0 * * @param string $message Message text and glyph wrapped in a `span` tag. */ return apply_filters( 'wp_required_field_message', $message ); } /** * Default settings for heartbeat. * * Outputs the nonce used in the heartbeat XHR. * * @since 3.6.0 * * @param array $settings * @return array Heartbeat settings. */ function wp_heartbeat_settings( $settings ) { if ( ! is_admin() ) { $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); } if ( is_user_logged_in() ) { $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); } return $settings; } ct $data_object Data model like WP_Term or WP_Post. * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True on success, WP_Error object if a field cannot be updated. */ protected function update_additional_fields_for_object( $data_object, $request ) { $additional_fields = $this->get_additional_fields(); foreach ( $additional_fields as $field_name => $field_options ) { if ( ! $field_options['update_callback'] ) { continue; } // Don't run the update callbacks if the data wasn't passed in the request. if ( ! isset( $request[ $field_name ] ) ) { continue; } $result = call_user_func( $field_options['update_callback'], $request[ $field_name ], $data_object, $field_name, $request, $this->get_object_type() ); if ( is_wp_error( $result ) ) { return $result; } } return true; } /** * Adds the schema from additional fields to a schema array. * * The type of object is inferred from the passed schema. * * @since 4.7.0 * * @param array $schema Schema array. * @return array Modified Schema array. */ protected function add_additional_fields_schema( $schema ) { if ( empty( $schema['title'] ) ) { return $schema; } // Can't use $this->get_object_type otherwise we cause an inf loop. $object_type = $schema['title']; $additional_fields = $this->get_additional_fields( $object_type ); foreach ( $additional_fields as $field_name => $field_options ) { if ( ! $field_options['schema'] ) { continue; } $schema['properties'][ $field_name ] = $field_options['schema']; } return $schema; } /** * Retrieves all of the registered additional fields for a given object-type. * * @since 4.7.0 * * @global array $wp_rest_additional_fields Holds registered fields, organized by object type. * * @param string $object_type Optional. The object type. * @return array Registered additional fields (if any), empty array if none or if the object type * could not be inferred. */ protected function get_additional_fields( $object_type = null ) { global $wp_rest_additional_fields; if ( ! $object_type ) { $object_type = $this->get_object_type(); } if ( ! $object_type ) { return array(); } if ( ! $wp_rest_additional_fields || ! isset( $wp_rest_additional_fields[ $object_type ] ) ) { return array(); } return $wp_rest_additional_fields[ $object_type ]; } /** * Retrieves the object type this controller is responsible for managing. * * @since 4.7.0 * * @return string Object type for the controller. */ protected function get_object_type() { $schema = $this->get_item_schema(); if ( ! $schema || ! isset( $schema['title'] ) ) { return null; } return $schema['title']; } /** * Gets an array of fields to be included on the response. * * Included fields are based on item schema and `_fields=` request argument. * * @since 4.9.6 * * @param WP_REST_Request $request Full details about the request. * @return string[] Fields to be included in the response. */ public function get_fields_for_response( $request ) { $schema = $this->get_item_schema(); $properties = isset( $schema['properties'] ) ? $schema['properties'] : array(); $additional_fields = $this->get_additional_fields(); foreach ( $additional_fields as $field_name => $field_options ) { /* * For back-compat, include any field with an empty schema * because it won't be present in $this->get_item_schema(). */ if ( is_null( $field_options['schema'] ) ) { $properties[ $field_name ] = $field_options; } } // Exclude fields that specify a different context than the request context. $context = $request['context']; if ( $context ) { foreach ( $properties as $name => $options ) { if ( ! empty( $options['context'] ) && ! in_array( $context, $options['context'], true ) ) { unset( $properties[ $name ] ); } } } $fields = array_keys( $properties ); /* * '_links' and '_embedded' are not typically part of the item schema, * but they can be specified in '_fields', so they are added here as a * convenience for checking with rest_is_field_included(). */ $fields[] = '_links'; if ( $request->has_param( '_embed' ) ) { $fields[] = '_embedded'; } $fields = array_unique( $fields ); if ( ! isset( $request['_fields'] ) ) { return $fields; } $requested_fields = wp_parse_list( $request['_fields'] ); if ( 0 === count( $requested_fields ) ) { return $fields; } // Trim off outside whitespace from the comma delimited list. $requested_fields = array_map( 'trim', $requested_fields ); // Always persist 'id', because it can be needed for add_additional_fields_to_object(). if ( in_array( 'id', $fields, true ) ) { $requested_fields[] = 'id'; } // Return the list of all requested fields which appear in the schema. return array_reduce( $requested_fields, static function ( $response_fields, $field ) use ( $fields ) { if ( in_array( $field, $fields, true ) ) { $response_fields[] = $field; return $response_fields; } // Check for nested fields if $field is not a direct match. $nested_fields = explode( '.', $field ); /* * A nested field is included so long as its top-level property * is present in the schema. */ if ( in_array( $nested_fields[0], $fields, true ) ) { $response_fields[] = $field; } return $response_fields; }, array() ); } /** * Retrieves an array of endpoint arguments from the item schema for the controller. * * @since 4.7.0 * * @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are * checked for required values and may fall-back to a given default, this is not done * on `EDITABLE` requests. Default WP_REST_Server::CREATABLE. * @return array Endpoint arguments. */ public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) { return rest_get_endpoint_args_for_schema( $this->get_item_schema(), $method ); } /** * Sanitizes the slug value. * * @since 4.7.0 * * @internal We can't use sanitize_title() directly, as the second * parameter is the fallback title, which would end up being set to the * request object. * * @see https://github.com/WP-API/WP-API/issues/1585 * * @todo Remove this in favour of https://core.trac.wordpress.org/ticket/34659 * * @param string $slug Slug value passed in request. * @return string Sanitized value for the slug. */ public function sanitize_slug( $slug ) { return sanitize_title( $slug ); } }
Fatal error: Uncaught Error: Class 'WP_REST_Controller' not found in /home/ocb/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:17 Stack trace: #0 /home/ocb/public_html/wp-settings.php(286): require() #1 /home/ocb/public_html/wp-config.php(77): require_once('/home/ocb/publi...') #2 /home/ocb/public_html/wp-load.php(50): require_once('/home/ocb/publi...') #3 /home/ocb/public_html/wp-blog-header.php(13): require_once('/home/ocb/publi...') #4 /home/ocb/public_html/index.php(17): require('/home/ocb/publi...') #5 {main} thrown in /home/ocb/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 17

Fatal error: Uncaught Error: Call to a member function set() on null in /home/ocb/public_html/wp-includes/l10n.php:856 Stack trace: #0 /home/ocb/public_html/wp-includes/l10n.php(959): load_textdomain('default', '/home/ocb/publi...', 'lv') #1 /home/ocb/public_html/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain() #2 [internal function]: WP_Fatal_Error_Handler->handle() #3 {main} thrown in /home/ocb/public_html/wp-includes/l10n.php on line 856