';
}
elseif ( $arg['type'] == "text" )
{
$val = esc_attr($val);
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$output .= '
'."\n";
$output .= '
'. $arg['desc'] .'
'."\n";
}
elseif ( $arg['type'] == "textarea" )
{
$val = esc_textarea($val);
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$output .= '
'."\n";
$output .= '
'. $arg['desc'] .' '."\n";
}
elseif ( $arg['type'] == "radio" )
{
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$values = $arg['values'];
$output .= '
';
foreach ($values as $value) {
$output .= ' '.$value.' ';
}
$output .= '
';
$output .= '
'. $arg['desc'] .' '."\n";
}
elseif ( $arg['type'] == "select" )
{
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$values = $arg['values'];
$output .= '
';
foreach ($values as $value) {
$output .= ''.$value.' ';
}
$output .= ' ';
$output .= '
'. $arg['desc'] .'
'."\n";
}
elseif ( $arg['type'] == "font" )
{
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$output .= '
';
$output .= '';
$websafe_fonts = array("Georgia", "Times New Roman", "Andale Mono", "Arial", "Arial Black", "Impact", "Trebuchet MS", "Verdana", "Webdings", "Comic Sans MS", "Courier New", "Century Gothic", "Lucida", "Lucida Grande", "Palatino", "Tahoma");
foreach ($websafe_fonts as $websafe) {
$output .= ''.$websafe.' ';
}
$output .= ' ';
$output .= ' ';
$output .= '
'. $arg['desc'] .'
'."\n";
}
elseif ( $arg['type'] == "image" )
{
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$output .= '
'."\n";
$output .= '
'. $arg['desc'] .'
'."\n";
$output .= '
'."\n";
$output .= '
'."\n";
$output .= '
'."\n";
}
elseif ( $arg['type'] == "color" )
{
$val = esc_attr($val);
$output .= '
'. $arg['name'] .' '."\n";
if ( $val == "" && $arg['default'] != "") $icefit_settings[$arg['id']] = $val = $arg['default'];
$output .= '
'."\n";
$output .= '
'. $arg['desc'] .'
'."\n";
}
elseif ( $arg['type'] == "gopro" )
{
$output .= '
'. $arg['name'] .' '."\n";
$output .= '
Unleash the full potential of BoldR by upgrading to BoldR Pro!
';
$output .= '
The Pro version comes with a great set of awesome features:
';
$output .= '
Fully Responsive Design
Quick Setup Page Templates
Unlimited Slideshows
Wide or Boxed layout
Unlimited colors and backgrounds
(Pro Only) Revolutionary WYSIWYG Layout Builder
(Pro Only) Visual Shortcodes , fully integrated in WordPress\' Visual editor (no coding skills needed!)
(Pro Only) Powerful shortcodes and custom widgets
(Pro Only) Portfolio section
(Pro Only) Partners and/or Clients\' logos carousel
(Pro Only) Clients\' testimonials carousel
(Pro Only) Unlimited sidebars
(Pro Only) One click setup AJAX contact form
(Pro Only) Google Maps API v3 integration
(Pro Only) Pro dedicated support forum access
GPLv3 License : Buy once, use as many time as you wish!
Cross-browsers support , optimized for IE8+, Firefox, Chrome, Safari and Opera (note: IE7 and older are no longer supported.)
Lifetime free updates and continued support for the latest WordPress versions
';
$output .= '
Learn More and Upgrade Now! ';
}
elseif ( $arg['type'] == "end_menu" )
{
$output .= '
';
}
}
update_option($icefit_settings_slug,$icefit_settings);
return $output;
}
// AJAX callback function for the "reset" button (resets settings to default)
function icefit_settings_reset_ajax_callback() {
global $icefit_settings_slug;
// Get settings from the database
$icefit_settings = get_option($icefit_settings_slug);
// Get the settings template
$options = icefit_settings_template();
// Revert all settings to default value
foreach($options as $arg){
if ($arg['type'] != 'start_menu' && $arg['type'] != 'end_menu') {
$icefit_settings[$arg['id']] = $arg['default'];
}
}
// Updates settings in the database
update_option($icefit_settings_slug,$icefit_settings);
}
add_action('wp_ajax_icefit_settings_reset_ajax_post_action', 'icefit_settings_reset_ajax_callback');
// AJAX callback function for the "Save changes" button (updates user's settings in the database)
function icefit_settings_ajax_callback() {
global $icefit_settings_slug;
// Check nonce
check_ajax_referer('icefit_settings_ajax_post_action','icefit_settings_nonce');
// Get POST data
$data = $_POST['data'];
parse_str($data,$output);
// Get current settings from the database
$icefit_settings = get_option($icefit_settings_slug);
// Get the settings template
$options = icefit_settings_template();
// Updates all settings according to POST data
foreach($options as $option_array){
$ids = array ('gopro', 'custom_css', 'page2', 'unlimited_sidebar', 'endpage2', 'headings_font', 'socialmedia', 'facebook_url', 'twitter_url', 'googleplus_url', 'linkedin_url', 'instagram_url', 'pinterest_url', 'tumblr_url', 'stumbleupon_url', 'dribbble_url', 'behance_url', 'deviantart_url', 'flickr_url', 'youtube_url', 'vimeo_url', 'yelp_url', 'rss_url', 'endpage4' );
if (in_array($option_array['id'], $ids)) {
if ($option_array['type'] != 'start_menu' && $option_array['type'] != 'end_menu') {
$id = $option_array['id'];
$new_value = $option_array['default'];
$icefit_settings[$id] = stripslashes($new_value);
}
} else {
if ($option_array['type'] != 'start_menu' && $option_array['type'] != 'end_menu') {
$id = $option_array['id'];
if ($option_array['type'] == "text") {
$new_value = esc_textarea($output[$option_array['id']]);
} else {
$new_value = $output[$option_array['id']];
}
$icefit_settings[$id] = stripslashes($new_value);
}
}
}
// Updates settings in the database
update_option($icefit_settings_slug,$icefit_settings);
}
add_action('wp_ajax_icefit_settings_ajax_post_action', 'icefit_settings_ajax_callback');
// NOJS fallback for the "Save changes" button
function icefit_settings_save_nojs() {
global $icefit_settings_slug;
// Get POST data
// parse_str($_POST,$output);
// Get current settings from the database
$icefit_settings = get_option($icefit_settings_slug);
// Get the settings template
$options = icefit_settings_template();
// Updates all settings according to POST data
foreach($options as $option_array){
$ids = array ('gopro', 'custom_css', 'page2', 'unlimited_sidebar', 'endpage2', 'headings_font', 'socialmedia', 'facebook_url', 'twitter_url', 'googleplus_url', 'linkedin_url', 'instagram_url', 'pinterest_url', 'tumblr_url', 'stumbleupon_url', 'dribbble_url', 'behance_url', 'deviantart_url', 'flickr_url', 'youtube_url', 'vimeo_url', 'yelp_url', 'rss_url', 'endpage4' );
if (isset($option_array['id']) && in_array($option_array['id'], $ids)) {
if ($option_array['type'] != 'start_menu' && $option_array['type'] != 'end_menu') {
$id = $option_array['id'];
$new_value = $option_array['default'];
$icefit_settings[$id] = stripslashes($new_value);
}
} else {
if ( isset($option_array['id']) && $option_array['type'] != 'start_menu' && $option_array['type'] != 'end_menu' ) {
$id = $option_array['id'];
if ($option_array['type'] == "text") {
$new_value = esc_textarea($_POST[$option_array['id']]);
} else {
$new_value = $_POST[$option_array['id']];
}
$icefit_settings[$id] = stripslashes($new_value);
}
}
}
// Updates settings in the database
update_option($icefit_settings_slug,$icefit_settings);
}
// Update settings template in the database upon theme activation
function icefit_settings_theme_activation() {
global $icefit_settings_slug;
// Get current settings from the database
$icefit_settings = get_option($icefit_settings_slug);
// Get the settings template
$options = icefit_settings_template();
// Updates all settings
foreach($options as $option_array){
if ($option_array['type'] != 'start_menu' && $option_array['type'] != 'end_menu') {
$id = $option_array['id'];
if ( !isset( $icefit_settings[$id] ) )
$icefit_settings[$id] = stripslashes($option_array['default']);
}
}
// Updates settings in the database
update_option($icefit_settings_slug,$icefit_settings);
}
add_action('after_switch_theme', 'icefit_settings_theme_activation');
// Outputs the settings panel
function icefit_settings_page(){
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
global $icefit_settings_slug;
global $icefit_settings_name;
if (isset( $_POST['reset-no-js'] ) && $_POST['reset-no-js']) {
icefit_settings_reset_ajax_callback();
echo '