<?php
/**
 * Clearfy quick start options
 *
 * @author Alex Kovalev <alex.kovalevv@gmail.com>
 * @copyright (c) 03.06.2020, Webcraftic
 * @version 1.0
 */

/*add_filter("wbcr_clearfy_group_options", function ($options) {
	$options[] = array(
		'name' => 'ajs_enabled',
		'title' => __('Enable Async JavaScript', 'async-javascript'),
		'tags' => array('optimize_code')
	);

	$options[] = array(
		'name' => 'ajs_method',
		'title' => __('Javascript load mode', 'async-javascript'),
		'tags' => array('optimize_code'),
		'values' => ['optimize_code' => 'defer']
	);

	$options[] = array(
		'name' => 'ajs_jquery',
		'title' => __('jQuery load', 'async-javascript'),
		'tags' => array('optimize_code'),
		'values' => ['optimize_code' => 'exclude']
	);

	$options[] = array(
		'name' => 'ajs_exclusions',
		'title' => __('Exclude scripts', 'async-javascript'),
		'tags' => array()
	);

	$options[] = array(
		'name' => 'ajs_async',
		'title' => __('Scripts to async', 'async-javascript'),
		'tags' => array()
	);

	$options[] = array(
		'name' => 'ajs_defer',
		'title' => __('Scripts to defer', 'async-javascript'),
		'tags' => array()
	);

	$options[] = array(
		'name' => 'ajs_plugin_exclusions',
		'title' => __('Plugin Exclusions', 'async-javascript'),
		'tags' => array()
	);

	$options[] = array(
		'name' => 'ajs_theme_exclusions',
		'title' => __('Theme Exclusions', 'async-javascript'),
		'tags' => array()
	);

	return $options;
});*/

add_filter('wmac/pages/settings_form_options', function ($options) {

	$options[] = array(
		'type' => 'html',
		'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>CDN general settings</strong>.', 'clearfy') . '<p>' . __('General cdn settings.', 'clearfy') . '</p></div>'
	);

	/*$options[] = array(
		'type' => 'checkbox',
		'way' => 'buttons',
		'name' => 'enable_cdn',
		'title' => __('Enable CDN', 'clearfy'),
		'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => __('Enable CDN.', 'clearfy'),
		'default' => false
	);*/

	$options[] = array(
		'type' => 'textbox',
		'name' => 'cdn_cname',
		'title' => __('Specify the CNAME(s) below', 'clearfy'),
		'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => __('All URLs of static files (CSS, JS, images) will be rewritten to the CNAME(s) you provide.', 'clearfy'),
		'default' => ''
	);
	$options[] = [
		'type' => 'dropdown',
		'way' => 'buttons',
		'name' => 'cdn_zone',
		'data' => [
			['all', __('All files', 'clearfy')],
			['css_and_js', __('CSS ans Javascripts', 'clearfy')],
			['js', __('Javascripts', 'clearfy')],
			['css', __('CSS', 'clearfy')],
			['images', __('Images', 'clearfy')],
		],
		'title' => __('File types', 'clearfy'),
		'hint' => __('Types of files that will be uploaded through the provider you have installed cdn.', 'clearfy'),
		//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'default' => 'all'
	];
	/*$options[] = array(
		'type' => 'html',
		'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Bunny CDN settings</strong>.', 'clearfy') . '<p>' . __('These settings are needed to integrate with Bunny CDN so that you can automatically purge cache.', 'clearfy') . '</p></div>'
	);
	$options[] = array(
		'type' => 'textbox',
		'name' => 'bunny_cdn_api_key',
		'title' => __('Bunny CDN API Key (Optional):', 'clearfy'),
		//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => sprintf(__('The <a href="%s" target="_blank">bunny.net</a> API key to manage the zone. Adding this will enable features such as cache purging. Read more about how to get a API Key in the <a href="%s" target="_blank">documentation</a>.', 'clearfy'), 'https://bunnycdn.com/?ref=gem0b5av1a', 'https://clearfy.pro/docs/cdn-setup/'),
		'default' => ''
	);
	$options[] = array(
		'type' => 'html',
		'html' => '<div class="wbcr-factory-page-group-header">' . __('<strong>Cdn77 settings</strong>.', 'clearfy') . '<p>' . __('These settings are needed to integrate with cdn77.com so that you can automatically purge cache.', 'clearfy') . '</p></div>'
	);
	$options[] = array(
		'type' => 'textbox',
		'name' => 'cdn77_api_login',
		'title' => __('Login (Optional):', 'clearfy'),
		//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => sprintf(__('Login in cdn77.com. Adding this will enable features such as cache purging. Read more about how to get a login in the <a href="%s" target="_blank">documentation</a>.', 'clearfy'), 'https://clearfy.pro/docs/cdn-setup/'),
		'default' => ''
	);
	$options[] = array(
		'type' => 'textbox',
		'name' => 'cdn77_api_cdnid',
		'title' => __('CDN ID (Optional):', 'clearfy'),
		//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => sprintf(__('ID in cdn77.com. Adding this will enable features such as cache purging. Read more about how to get a ID in the <a href="%s" target="_blank">documentation</a>.', 'clearfy'), 'https://clearfy.pro/docs/cdn-setup/'),
		'default' => ''
	);
	$options[] = array(
		'type' => 'textbox',
		'name' => 'cdn77_api_key',
		'title' => __('API Key (Optional):', 'clearfy'),
		//'layout' => array('hint-type' => 'icon', 'hint-icon-color' => 'grey'),
		'hint' => sprintf(__('API Key in cdn77.com. Adding this will enable features such as cache purging. Read more about how to get a API Key in the <a href="%s" target="_blank">documentation</a>.', 'clearfy'), 'https://clearfy.pro/docs/cdn-setup/'),
		'default' => ''
	);*/

	return $options;
});
