| Server IP : 172.67.159.97 / Your IP : 216.73.217.154 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/integration/csv/ |
Upload File : |
<?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',
]
],
],
];
}