$setting) {
if (!empty($key)) {
$options[$key] = isset($options[$key]) ? sanitize_text_field($options[$key]) : '';
}
}
}
return $options;
}
public static function get_option_settings(){
return array(
'css_save_as' => array(
'type' => 'select',
'label' => __('CSS Add Via', 'ultimate-post'),
'options' => array(
'wp_head' => __( 'Header - (Internal)','ultimate-post' ),
'filesystem' => __( 'File System - (External)','ultimate-post' ),
),
'default' => 'wp_head',
'desc' => __('Select where you want to save CSS.', 'ultimate-post')
),
'preloader_style' => array(
'type' => 'select',
'label' => __('Preloader Style', 'ultimate-post'),
'options' => array(
'style1' => __( 'Preloader Style 1','ultimate-post' ),
'style2' => __( 'Preloader Style 2','ultimate-post' ),
),
'default' => 'style1',
'desc' => __('Select Preloader Style.', 'ultimate-post')
),
'container_width' => array(
'type' => 'number',
'label' => __('Container Width', 'ultimate-post'),
'default' => '1140',
'desc' => __('Change Container Width.', 'ultimate-post')
),
'hide_import_btn' => array(
'type' => 'switch',
'label' => __('Hide Import Button', 'ultimate-post'),
'default' => '',
'desc' => __('Hide Import Layout Button from the Gutenberg Editor.', 'ultimate-post')
),
);
}
public static function get_recommended_themes(){
$recommended_themes = array(
'coblog' => array(
'name' => 'Coblog',
'slug' => 'coblog',
'url' => 'https://wordpress.org/themes/coblog',
'logo' => ULTP_URL.'assets/img/WordPress.png'
),
'blocksy' => array(
'name' => 'Blocksy',
'slug' => 'blocksy',
'url' => 'https://wordpress.org/themes/blocksy/',
'logo' => ULTP_URL.'assets/img/WordPress.png'
),
);
$html = '';
foreach ($recommended_themes as $key => $value) {
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
}
echo $html;
}
public static function get_changelog_data() {
$html = '';
$resource_data = file_get_contents(ULTP_PATH.'/readme.txt', "r");
$data = array();
if ($resource_data) {
$resource_data = explode('== Changelog ==', $resource_data);
if (isset($resource_data[1])) {
$resource_data = $resource_data[1];
$resource_data = explode("\n", $resource_data);
$inner = false;
$count = -1;
foreach ($resource_data as $element) {
if ($element){
if (substr_count($element, '=') > 1) {
$count++;
$temp = trim(str_replace('=', '', $element));
if (strpos($temp, '-') !== false) {
$temp = explode('-', $temp);
$data[$count]['date'] = trim($temp[1]);
$data[$count]['version'] = trim($temp[0]);
}
}
if (strpos($element, '* New:') !== false) {
$data[$count]['new'][] = trim(str_replace('* New:', '', $element));
}
if (strpos($element, '* Fix:') !== false) {
$data[$count]['fix'][] = trim(str_replace('* Fix:', '', $element));
}
if (strpos($element, '* Update:') !== false) {
$data[$count]['update'][] = trim(str_replace('* Update:', '', $element));
}
}
}
}
}
if (!empty($data)) {
foreach ($data as $k => $inner_data) {
$html .= '';
foreach ($inner_data as $key => $changelog) {
if ($key == 'date') {
$html .= '
'.__('Released on ', 'ultimate-post').' '.$changelog.'
';
} elseif($key == 'version') {
$html .= '
'.__('Version', 'ultimate-post').' : '.$changelog.'
';
} else {
foreach ($changelog as $keyword => $val) {
$html .= '
'.$key.' '.$val.'
';
}
}
}
$html .= '
';
}
}
echo $html;
}
public static function get_settings_data() {
$html = '';
$option_data = get_option( 'ultp_options' );
if(!$option_data){
$option_data = ultimate_post()->init_set_data();
}
$data = self::get_option_settings();
$html .= '';
$html .= '
';
$html .= '
';
$html .= wp_nonce_field( "ultp_options-options" );
foreach ($data as $key => $value) {
$html .= '
';
$html .= '
'.$value['label'].'
';
$html .= '
';
switch ($value['type']) {
case 'select':
$html .= '
';
$val = isset($option_data[$key]) ? $option_data[$key] : (isset($value['default']) ? $value['default'] : '');
$html .= '
';
foreach ( $value['options'] as $id => $label ) {
$html .= '';
$html .= strip_tags( $label );
$html .= ' ';
}
$html .= ' ';
$html .= '
'.$value['desc'].'
';
$html .= '
';
break;
case 'color':
$html .= '
';
$val = isset($option_data[$key]) ? $option_data[$key] : (isset($value['default']) ? $value['default'] : '');
$html .= '
';
$html .= '
'.$value['desc'].'
';
$html .= '
';
break;
case 'number':
$html .= '
';
$val = isset($option_data[$key]) ? $option_data[$key] : (isset($value['default']) ? $value['default'] : '');
$html .= '
';
$html .= '
'.$value['desc'].'
';
$html .= '
';
break;
case 'switch':
$html .= '
';
$val = isset($option_data[$key]) ? $option_data[$key] : (isset($value['default']) ? $value['default'] : '');
$html .= '
';
$html .= '
'.$value['desc'].'
';
$html .= '
';
break;
default:
# code...
break;
}
$html .= '
';
$html .= '
';
}
$html .= '
';
$html .= '
';
echo '';
}
public static function get_support_data() {
$html = '';
$html .= '';//ultp-admin-sidebar
echo $html;
}
/**
* Settings page output
*/
public static function create_admin_page() { ?>
VIDEO
VIDEO
VIDEO
VIDEO
VIDEO
VIDEO
VIDEO
VIDEO