<commit_before><?php
/**
 * Repeater Customizer Control.
 *
 * @package     Kirki
 * @subpackage  Controls
 * @copyright   Copyright (c) 2016, <NAME>
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
 * @since       1.0
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'Kirki_Controls_Repeater_Control' ) ) {

	class Kirki_Controls_Repeater_Control extends Kirki_Customize_Control {

		public $type = 'repeater';

		public $fields = array();

		// will store a filtered version of value for advenced fields (like images..)
		protected $filtered_value = array();

		public $row_label = array();

		public function __construct( $manager, $id, $args = array() ) {

			$l10n = Kirki_l10n::get_strings();

			parent::__construct( $manager, $id, $args );

			// Set up defaults for row labels.
			$this->row_label = array(
				'type' => 'text',
				'value' => $l10n['row'],
				'field' => false,
			);
			// Validating args for row labels.
			if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {
				// Validating row label type.
				if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) {
					$this->row_label['type'] = $args['row_label']['type'];
				}
				// Validating row label type.
				if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) {
					$this->row_label['value'] = esc_attr( $args['row_label']['value'] );
				}
				// Validating row label field.
				if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) {
					$this->row_label['field'] = esc_attr( $args['row_label']['field'] );
				} else {
					// If from field is not set correctly, making sure standard is set as the type.
					$this->row_label['type'] = 'text';
				}
			}

			if ( empty( $this->button_label ) ) {
				$this->button_label = $l10n['add-new'].' '.$this->row_label['value'];
			}

			if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) {
				$args['fields'] = array();
			}

			// An array to store keys of fields that need to be filtered.
			$image_fields_to_filter = array();

			foreach ( $args['fields'] as $key => $value ) {
				if ( ! isset( $value['default'] ) ) {
					$args['fields'][ $key ]['default'] = '';
				}

				if ( ! isset( $value['label'] ) ) {
					$args['fields'][ $key ]['label'] = '';
				}
				$args['fields'][ $key ]['id'] = $key;

				// We check if the filed is an image or a cropped_image.
				if ( isset( $value['type'] ) && ( 'image' === $value['type'] || 'cropped_image' === $value["type"] ) ) {
					// We add it to the list of fields that need some extra filtering/processing.
					$image_fields_to_filter[ $key ] = true;
				}
			}

			$this->fields = $args['fields'];

			// Now we are going to filter the fields
			// First we create a copy of the value that would be used otherwise
			$this->filtered_value = $this->value();

			if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {

				// We iterate over the list of fields
				foreach ( $this->filtered_value as &$filtered_value_field ) {

					if ( is_array( $filtered_value_field ) && ! empty( $filtered_value_field ) ) {

						// We iterate over the list of properties for this field<commit_msg>use single quotes instead of double quotes<commit_after><?php
/**
 * Repeater Customizer Control.
 *
 * @package     Kirki
 * @subpackage  Controls
 * @copyright   Copyright (c) 2016, <NAME>
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
 * @since       1.0
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'Kirki_Controls_Repeater_Control' ) ) {

	class Kirki_Controls_Repeater_Control extends Kirki_Customize_Control {

		public $type = 'repeater';

		public $fields = array();

		// will store a filtered version of value for advenced fields (like images..)
		protected $filtered_value = array();

		public $row_label = array();

		public function __construct( $manager, $id, $args = array() ) {

			$l10n = Kirki_l10n::get_strings();

			parent::__construct( $manager, $id, $args );

			// Set up defaults for row labels.
			$this->row_label = array(
				'type' => 'text',
				'value' => $l10n['row'],
				'field' => false,
			);
			// Validating args for row labels.
			if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {
				// Validating row label type.
				if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) {
					$this->row_label['type'] = $args['row_label']['type'];
				}
				// Validating row label type.
				if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) {
					$this->row_label['value'] = esc_attr( $args['row_label']['value'] );
				}
				// Validating row label field.
				if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) {
					$this->row_label['field'] = esc_attr( $args['row_label']['field'] );
				} else {
					// If from field is not set correctly, making sure standard is set as the type.
					$this->row_label['type'] = 'text';
				}
			}

			if ( empty( $this->button_label ) ) {
				$this->button_label = $l10n['add-new'].' '.$this->row_label['value'];
			}

			if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) {
				$args['fields'] = array();
			}

			// An array to store keys of fields that need to be filtered.
			$image_fields_to_filter = array();

			foreach ( $args['fields'] as $key => $value ) {
				if ( ! isset( $value['default'] ) ) {
					$args['fields'][ $key ]['default'] = '';
				}

				if ( ! isset( $value['label'] ) ) {
					$args['fields'][ $key ]['label'] = '';
				}
				$args['fields'][ $key ]['id'] = $key;

				// We check if the filed is an image or a cropped_image.
				if ( isset( $value['type'] ) && ( 'image' === $value['type'] || 'cropped_image' === $value['type'] ) ) {
					// We add it to the list of fields that need some extra filtering/processing.
					$image_fields_to_filter[ $key ] = true;
				}
			}

			$this->fields = $args['fields'];

			// Now we are going to filter the fields
			// First we create a copy of the value that would be used otherwise
			$this->filtered_value = $this->value();

			if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {

				// We iterate over the list of fields
				foreach ( $this->filtered_value as &$filtered_value_field ) {

					if ( is_array( $filtered_value_field ) && ! empty( $filtered_value_field ) ) {

						// We iterate over the list of properties for this field
{'fraction_non_alphanumeric': 0.19057229349863053, 'fraction_numerical': 0.004036326942482341, 'mean_word_length': 3.2434250764525996, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 41, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3433526', 'n_tokens_mistral': 2685, 'n_tokens_neox': 2294, 'n_words': 589}