HEX
Server: Apache
System: Linux cpanelx.inxs.ro 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: crowdandsafety (1041)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/cwd/wp-content/plugins/cornerstone/includes/integration/csv/controls.php
<?php

function cs_csv_controls($settings = []) {
  $hasInput = (bool) cs_get_array_value($settings, 'has_input', true);

  $out = $hasInput
    ? cs_csv_input_controls($settings)
    : [];

  $out = array_merge($out, [
    // Has Headers
    [
      'key' => 'has_header',
      'label' => __('Has Header', 'cornerstone'),
      'description' => __('Is the first row a list of header / column titles? Will use integers as the keys of the CSV if not, and the first row will be looped over', 'cornerstone'),
      'type' => 'toggle',
    ],

    // Delimiter
    [
      'key' => 'delimiter',
      'label' => __('Delimiter', 'cornerstone'),
      'description' => __('Which character delimits each column of data. This is typically a comma (,) or pipe (|)', 'cornerstone'),
      'type' => 'text',
    ],
  ]);

  return $out;
}

/**
 * CSV Input control
 * file, raw
 */
function cs_csv_input_controls($settings = []) {

  return [
    // Type of CSV content
    [
      'key' => 'type',
      'label' => __('Type', 'cornerstone'),
      'type' => 'choose',
      'options' => [
        'choices' => [
          [
            'value' => 'file',
            'label' => __('File', 'cornerstone'),
          ],
          [
            'value' => 'content',
            'label' => __("Content", "cornerstone"),
          ],
        ]
      ],
    ],

    // File Input
    [
      'key' => 'file',
      'type' => 'file',
      'label' => __('File', 'cornerstone'),
      'options' => [
        'file_types' => ['text/csv'],
      ],
      'conditions' => [
        [
          'key' => 'type',
          'op' => '==',
          'value' => 'file',
        ],
      ],
    ],

    // Content / Text
    [
      'key' => 'content',
      //'type' => 'textarea',
      'type' => 'text-editor',
      'options' => [
        'mode' => 'text',
        'expandable' => true,
        'only_raw' => true,
        'height' => 6,
      ],
      'conditions' => [
        [
          'key' => 'type',
          'op' => '==',
          'value' => 'content',
        ]
      ],
    ],

  ];
}