case 'site_option': $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); break; case 'user_meta': $user_id = get_current_user_id(); if ( $user_id ) { $replacement = get_user_meta( $user_id, $replace, true ); } break; default: $replacement = get_theme_mod( $replace ); if ( ! $replacement ) { $replacement = Values::get_value( $this->field['kirki_config'], $replace ); } } $replacement = ( false === $replacement ) ? '' : $replacement; if ( is_array( $value ) ) { foreach ( $value as $k => $v ) { $_val = ( isset( $value[ $v ] ) ) ? $value[ $v ] : $v; $value[ $k ] = str_replace( $search, $replacement, $_val ); } return $value; } $value = str_replace( $search, $replacement, $value ); } } return $value; } /** * Parses the output arguments. * Calls the process_output method for each of them. * * @access protected */ protected function parse_output() { foreach ( $this->output as $output ) { $skip = false; // Apply any sanitization callbacks defined. $value = $this->apply_sanitize_callback( $output, $this->value ); // Skip if value is empty. if ( '' === $this->value ) { $skip = true; } // No need to proceed this if the current value is the same as in the "exclude" value. if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) { foreach ( $output['exclude'] as $exclude ) { if ( is_array( $value ) ) { if ( is_array( $exclude ) ) { $diff1 = array_diff( $value, $exclude ); $diff2 = array_diff( $exclude, $value ); if ( empty( $diff1 ) && empty( $diff2 ) ) { $skip = true; } } // If 'choice' is defined check for sub-values too. // Fixes https://github.com/aristath/kirki/issues/1416. if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison $skip = true; } } if ( $skip ) { continue; } // Skip if value is defined as excluded. if ( $exclude === $value || ( '' === $exclude && empty( $value ) ) ) { $skip = true; } } } if ( $skip ) { continue; } // Apply any value patterns defined. $value = $this->apply_value_pattern( $output, $value ); if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { $output['element'] = array_unique( $output['element'] ); sort( $output['element'] ); $output['element'] = implode( ',', $output['element'] ); } $value = $this->process_value( $value, $output ); if ( is_admin() ) { // In admin area, only output kirki-styles/kirki-inline-styles inside editing screen. if ( ! isset( $_GET['editor'] ) || 1 !== (int) $_GET['editor'] ) { // phpcs:ignore WordPress.Security.NonceVerification continue; } } else { // Check if this is a frontend style. if ( isset( $output['context'] ) && ! in_array( 'front', $output['context'], true ) ) { continue; } } /** * Inside gutenberg editing screen, prepend `.editor-styles-wrapper` to the element * so that it doesn't polute elements other than inside the editing content. */ if ( isset( $_GET['editor'] ) && 1 === (int) $_GET['editor'] ) { if ( isset( $output['element'] ) && ! empty( $output['element'] ) ) { if ( -1 < strpos( $output['element'], ',' ) ) { $elms = explode( ',', $output['element'] ); foreach ( $elms as $index => $elm ) { if ( ! empty( $elm ) ) { $elms[ $index ] = '.editor-styles-wrapper ' . $elm; $elms[ $index ] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $elms[ $index ] ); } } $output['element'] = implode( ',', $elms ); } else { $output['element'] = '.editor-styles-wrapper ' . $output['element']; $output['element'] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $output['element'] ); } } } $this->process_output( $output, $value ); } } /** * Parses an output and creates the styles array for it. * * @access protected * @param array $output The field output. * @param string|array $value The value. * * @return null */ protected function process_output( $output, $value ) { $output = apply_filters( 'kirki_output_item_args', $output, $value, $this->output, $this->field ); if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { return; } $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; // Properties that can accept multiple values. // Useful for example for gradients where all browsers use the "background-image" property // and the browser prefixes go in the value_pattern arg. $accepts_multiple = [ 'background-image', 'background', ]; if ( in_array( $output['property'], $accepts_multiple, true ) ) { if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; } $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; return; } if ( is_string( $value ) || is_numeric( $value ) ) { $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; } } /** * Some CSS properties are unique. * We need to tweak the value to make everything works as expected. * * @access protected * @param string $property The CSS property. * @param string|array $value The value. * * @return array */ protected function process_property_value( $property, $value ) { $properties = apply_filters( 'kirki_output_property_classnames', [ 'font-family' => '\Kirki\Module\CSS\Property\Font_Family', 'background-image' => '\Kirki\Module\CSS\Property\Background_Image', 'background-position' => '\Kirki\Module\CSS\Property\Background_Position', ] ); if ( array_key_exists( $property, $properties ) ) { $classname = $properties[ $property ]; $obj = new $classname( $property, $value ); return $obj->get_value(); } return $value; } /** * Returns the value. * * @access protected * @param string|array $value The value. * @param array $output The field "output". * @return string|array */ protected function process_value( $value, $output ) { if ( isset( $output['property'] ) ) { return $this->process_property_value( $output['property'], $value ); } return $value; } /** * Exploses the private $styles property to the world * * @access protected * @return array */ public function get_styles() { return $this->styles; } } case 'site_option': $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); break; case 'user_meta': $user_id = get_current_user_id(); if ( $user_id ) { $replacement = get_user_meta( $user_id, $replace, true ); } break; default: $replacement = get_theme_mod( $replace ); if ( ! $replacement ) { $replacement = Values::get_value( $this->field['kirki_config'], $replace ); } } $replacement = ( false === $replacement ) ? '' : $replacement; if ( is_array( $value ) ) { foreach ( $value as $k => $v ) { $_val = ( isset( $value[ $v ] ) ) ? $value[ $v ] : $v; $value[ $k ] = str_replace( $search, $replacement, $_val ); } return $value; } $value = str_replace( $search, $replacement, $value ); } } return $value; } /** * Parses the output arguments. * Calls the process_output method for each of them. * * @access protected */ protected function parse_output() { foreach ( $this->output as $output ) { $skip = false; // Apply any sanitization callbacks defined. $value = $this->apply_sanitize_callback( $output, $this->value ); // Skip if value is empty. if ( '' === $this->value ) { $skip = true; } // No need to proceed this if the current value is the same as in the "exclude" value. if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) { foreach ( $output['exclude'] as $exclude ) { if ( is_array( $value ) ) { if ( is_array( $exclude ) ) { $diff1 = array_diff( $value, $exclude ); $diff2 = array_diff( $exclude, $value ); if ( empty( $diff1 ) && empty( $diff2 ) ) { $skip = true; } } // If 'choice' is defined check for sub-values too. // Fixes https://github.com/aristath/kirki/issues/1416. if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison $skip = true; } } if ( $skip ) { continue; } // Skip if value is defined as excluded. if ( $exclude === $value || ( '' === $exclude && empty( $value ) ) ) { $skip = true; } } } if ( $skip ) { continue; } // Apply any value patterns defined. $value = $this->apply_value_pattern( $output, $value ); if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { $output['element'] = array_unique( $output['element'] ); sort( $output['element'] ); $output['element'] = implode( ',', $output['element'] ); } $value = $this->process_value( $value, $output ); if ( is_admin() ) { // In admin area, only output kirki-styles/kirki-inline-styles inside editing screen. if ( ! isset( $_GET['editor'] ) || 1 !== (int) $_GET['editor'] ) { // phpcs:ignore WordPress.Security.NonceVerification continue; } } else { // Check if this is a frontend style. if ( isset( $output['context'] ) && ! in_array( 'front', $output['context'], true ) ) { continue; } } /** * Inside gutenberg editing screen, prepend `.editor-styles-wrapper` to the element * so that it doesn't polute elements other than inside the editing content. */ if ( isset( $_GET['editor'] ) && 1 === (int) $_GET['editor'] ) { if ( isset( $output['element'] ) && ! empty( $output['element'] ) ) { if ( -1 < strpos( $output['element'], ',' ) ) { $elms = explode( ',', $output['element'] ); foreach ( $elms as $index => $elm ) { if ( ! empty( $elm ) ) { $elms[ $index ] = '.editor-styles-wrapper ' . $elm; $elms[ $index ] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $elms[ $index ] ); } } $output['element'] = implode( ',', $elms ); } else { $output['element'] = '.editor-styles-wrapper ' . $output['element']; $output['element'] = str_ireplace( '.editor-styles-wrapper :root', '.editor-styles-wrapper', $output['element'] ); } } } $this->process_output( $output, $value ); } } /** * Parses an output and creates the styles array for it. * * @access protected * @param array $output The field output. * @param string|array $value The value. * * @return null */ protected function process_output( $output, $value ) { $output = apply_filters( 'kirki_output_item_args', $output, $value, $this->output, $this->field ); if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { return; } $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; // Properties that can accept multiple values. // Useful for example for gradients where all browsers use the "background-image" property // and the browser prefixes go in the value_pattern arg. $accepts_multiple = [ 'background-image', 'background', ]; if ( in_array( $output['property'], $accepts_multiple, true ) ) { if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; } $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; return; } if ( is_string( $value ) || is_numeric( $value ) ) { $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; } } /** * Some CSS properties are unique. * We need to tweak the value to make everything works as expected. * * @access protected * @param string $property The CSS property. * @param string|array $value The value. * * @return array */ protected function process_property_value( $property, $value ) { $properties = apply_filters( 'kirki_output_property_classnames', [ 'font-family' => '\Kirki\Module\CSS\Property\Font_Family', 'background-image' => '\Kirki\Module\CSS\Property\Background_Image', 'background-position' => '\Kirki\Module\CSS\Property\Background_Position', ] ); if ( array_key_exists( $property, $properties ) ) { $classname = $properties[ $property ]; $obj = new $classname( $property, $value ); return $obj->get_value(); } return $value; } /** * Returns the value. * * @access protected * @param string|array $value The value. * @param array $output The field "output". * @return string|array */ protected function process_value( $value, $output ) { if ( isset( $output['property'] ) ) { return $this->process_property_value( $output['property'], $value ); } return $value; } /** * Exploses the private $styles property to the world * * @access protected * @return array */ public function get_styles() { return $this->styles; } }
Fatal error: Uncaught Error: Class "Kirki\Module\CSS\Output" not found in /htdocs/wp-content/plugins/kirki/kirki-packages/field-background/src/CSS/Background.php:19 Stack trace: #0 /htdocs/wp-content/plugins/all-in-one-seo-pack/vendor/composer/ClassLoader.php(576): include() #1 /htdocs/wp-content/plugins/all-in-one-seo-pack/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/htdocs/wp-cont...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('Kirki\\Field\\CSS...') #3 /htdocs/wp-content/plugins/kirki/kirki-packages/compatibility/src/Aliases.php(164): class_exists('Kirki\\Field\\CSS...') #4 /htdocs/wp-content/plugins/kirki/kirki-packages/compatibility/src/Aliases.php(151): Kirki\Compatibility\Aliases->add_aliases() #5 /htdocs/wp-content/plugins/kirki/inc/bootstrap.php(15): Kirki\Compatibility\Aliases->__construct() #6 /htdocs/wp-content/plugins/kirki/kirki.php(44): require_once('/htdocs/wp-cont...') #7 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #8 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #9 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #10 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #11 /htdocs/index.php(17): require('/htdocs/wp-blog...') #12 {main} thrown in /htdocs/wp-content/plugins/kirki/kirki-packages/field-background/src/CSS/Background.php on line 19