function tfuse_class($param, $return = false) { $tfuse_class = ''; $sidebar_position = tfuse_sidebar_position(); if ($param == 'middle') { if (is_page_template('template-contact.php')) { if ($sidebar_position == 'left') { $tfuse_class = ' class="middle sidebarLeft nobg"'; } elseif ($sidebar_position == 'right') { $tfuse_class = ' class="middle sidebarRight nobg"'; } else { $tfuse_class = ' class="middle"'; } } else { if ($sidebar_position == 'left') { $tfuse_class = ' class="middle sidebarLeft"'; } elseif ($sidebar_position == 'right') { $tfuse_class = ' class="middle sidebarRight"'; } else { $tfuse_class = ' class="middle"'; } } } elseif ($param == 'content') { $tfuse_class = isset($sidebar_position) && $sidebar_position != 'full' ? ' class="grid_8 content"' : ' class="content"'; } if ($return) { return $tfuse_class; } else { echo $tfuse_class; } }
<?php get_header(); $sidebar_position = tfuse_sidebar_position(); tfuse_shortcode_content('top'); wp_register_script('isotope', tfuse_get_file_uri('/js/isotope.pkgd.min.js'), array('jquery'), '1.0', true); wp_enqueue_script('isotope'); global $post; $columns = tfuse_get_portfolio_columns(); $ID = tfuse_return_term_id(); ?> <div id="main" class="site-main blog" role="main"> <?php tfuse_custom_cat_title($ID, 'events'); ?> <div <?php tfuse_class('middle'); ?> > <div class="row"> <div class="col-sm-12"> <section class="gallery"> <?php tfuse_show_gallery_filter(); ?> <ul id="gallery-list" class="gallery-list <?php echo $columns; ?> "> <?php if (have_posts()) {
function tf_reservationform_shortcode($atts) { global $TFUSE; $pluginfolder = home_url() . '/wp-includes/js/jquery/ui'; wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-datepicker', $pluginfolder . '/jquery.ui.datepicker.min.js', array('jquery', 'jquery-ui-core')); wp_register_script('reservation_forms_js', get_template_directory_uri() . '/js/reservation_frontend.js', array('jquery'), '1.1.0', true); wp_enqueue_script('reservation_forms_js'); wp_enqueue_script('jquery-form'); wp_register_style('jquery_css', TFUSE_ADMIN_CSS . '/jquery-ui-1.8.14.custom.css'); wp_enqueue_style('jquery_css'); wp_register_style('reservation_forms_css', get_template_directory_uri() . '/theme_config/extensions/reservationform/static/css/reservation_form.css', true, '1.1.0'); wp_enqueue_style('reservation_forms_css'); extract(shortcode_atts(array('tf_rf_formid' => '-1'), $atts)); $out = ''; $form_exists = false; $is_preview = false; if ($tf_rf_formid != '-1') { $is_preview = false; $form = get_term_by('id', $tf_rf_formid, 'reservations'); $form_exists = is_object($form) && count($form) > 0 ? true : false; $form = unserialize($form->description); } elseif ($TFUSE->request->isset_COOKIE('res_form_array')) { $is_preview = true; $form_exists = true; $form = unserialize($TFUSE->request->COOKIE('res_form_array')); unset($_COOKIE['form_array']); } if ($form_exists) { $out .= '<div class="widget-container widget_reservation contact-form"><h2 id="header_message">' . __(urldecode($form['header_message']), 'tfuse') . '</h2>'; $out .= '<div id="form_messages" class="submit_message" ><h2></h2></div>'; $inputs = $TFUSE->get->ext_config('RESERVATIONFORM', 'base'); $input_array = $inputs['input_types']; $out .= '<a name="contact"></a><form id="reservationForm" action="" method="post" class="reservationForm" name="reservationForm">'; $out .= '<input id="this_form_id" type="hidden" value="' . $tf_rf_formid . '" />'; $fields = ''; $fcount = 1; $linewidth = 0; $earr = array(); $linenr = 1; $lines = array(); $countForm = count($form['input']); $dimension = 48; $lines[$linenr] = 0; foreach ($form['input'] as $form_input_arr) { $earr[$fcount]['width'] = $form_input_arr['width']; $linewidth += $form_input_arr['width']; if (isset($form_input_arr['newline'])) { $linewidth = $form_input_arr['width']; $earr[$fcount]['class'] = ' '; if ($fcount > 1) { $linenr++; $lines[$linenr] = 0; } $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth > 100) { $linewidth = $form_input_arr['width']; $linenr++; $lines[$linenr] = 0; $earr[$fcount - 1]['class'] = ' omega '; $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth == 100) { $linewidth = 0; $earr[$fcount]['class'] = ' omega '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; $linenr++; $lines[$linenr] = 0; } else { $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } if ($countForm == $fcount && !isset($form_input_arr['newline'])) { $earr[$fcount]['class'] = ' omega '; } $fcount++; } $text_type = array(); $email_type = array(); foreach ($input_array as $input) { if ($input['name'] == 'Text line') { $text_type = $input; } if ($input['name'] == 'Email') { $email_type = $input; } if (!empty($text_type) && !empty($email_type)) { break; } } $input_array['date_in'] = $text_type; $input_array['date_out'] = $text_type; $input_array['res_email'] = $email_type; $linewidth = 0; $fcount = 1; $margin = 30; foreach ($form['input'] as $form_input) { $field = ''; $input = array(); if (isset($input_array[$form_input['type']])) { $input = $input_array[$form_input['type']]; } if (isset($input['properties'])) { $proprstr = ''; foreach ($input['properties'] as $key => $value) { $proprstr .= $key . "=" . $value . " "; } } $floating = isset($form_input['newline']) ? 'clear:left;' : ' '; if (!isset($input['properties']['class'])) { $input['properties']['class'] = ''; } $input['properties']['class'] .= isset($input['name']) && $input['name'] == 'Email' ? ' ' . TF_THEME_PREFIX . '_email' : ''; $input['properties']['class'] .= isset($form_input['required']) ? ' tf_rf_required_input ' : ''; $label_text = isset($form_input['required']) ? trim(urldecode($form_input['label'])) . ' ' . urldecode($form['required_text']) : trim(urldecode($form_input['label'])); $input['id'] = isset($input['id']) ? str_replace('%%name%%', urldecode($form_input['shortcode']), $input['id']) : TF_THEME_PREFIX . '_' . urldecode($form_input['shortcode']); $form_input['classes'] = $earr[$fcount]['class']; $form_input['floating'] = $floating; $form_input['label_text'] = $label_text; $label = '<label for="' . TF_THEME_PREFIX . "_" . trim(urldecode($form_input['shortcode'])) . '">' . urldecode($label_text) . '</label><br/>'; if ($is_preview) { $sidebar_position = 'full'; } else { $sidebar_position = tfuse_sidebar_position(); } $element_line = $earr[$fcount]['line']; if ($sidebar_position == 'full') { if ($is_preview) { $ewidth = 640 - $lines[$element_line] + $margin; } else { $ewidth = 942 - $lines[$element_line] + $margin; } } else { $ewidth = 584 - $lines[$element_line] + $margin; } if (isset($form_input['newline']) && $form_input['newline'] == 1) { $linewidth = $form_input['width']; } else { $linewidth += $form_input['width']; } if ($form_input['width'] == 100) { $form_input['ewidthpx'] = $ewidth; $linewidth = 0; } elseif ($linewidth > 100) { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); $linewidth = 0; } else { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); } if ($lines[$element_line] == $dimension && $form_input['width'] >= 40 && $form_input['width'] <= 90) { $form_input['ewidthpx'] = (int) (($ewidth - $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 40 && $form_input['width'] > 32) { $form_input['ewidthpx'] = (int) (($ewidth - 2 * $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 33) { $form_input['ewidthpx'] = (int) (($ewidth - 3 * $dimension) * $form_input['width'] / 100); } if ($is_preview && $input['type'] == 'select') { $form_input['ewidthpx'] -= 40; } if ($is_preview && $input['type'] == 'text' && ($form_input['type'] == 'date_in' || $form_input['type'] == 'date_out')) { $form_input['ewidthpx'] += 22; } $fcount++; if (in_array($form_input['type'], array('date_in', 'date_out'))) { $input['type'] = 'res_datepicker'; } elseif ($form_input['type'] == 'res_email') { $input['type'] = 'res_text'; } else { $input['type'] = 'res_' . $input['type']; } if (!function_exists($input['type'])) { continue; } $input_field = $input['type']($input, $form_input); if ($input['type'] == 'checkbox') { $tmp = $label; $label = $input_field; $input_field = $tmp; } $fields .= $input_field; } $out .= $fields; $surse = get_template_directory_uri() . '/images/ajax-loader.gif'; $out .= '<div class="clear"></div><div class="row" style="clear:left;width:100%">'; $out .= '<span class="reset-link"><a href="#" onclick="resetFields(this,event)">' . __(urldecode($form['reset_button']), 'tfuse') . '</a></span>'; $out .= '<a href="#" id="sending" class="btn-send2"><span>' . __('Sending ...', 'tfuse') . '</span></a> <input type="submit" id="send_reservation" class="btn-send btn-submit" name="submit" title="Submit message" value="' . __(urldecode($form['submit_mess']), 'tfuse') . '" /> <img id="sending_img" src="' . $surse . '" alt="Sending" style="margin-left:-15px; margin-bottom:-6px; display: none; border:0;" /></div> <div class="field_submit"><div class="notice">' . __(urldecode($form['tf_rf_form_notice']), 'tfuse') . '</div></div></form></div>'; } else { $out = "<p>This Form is not defined!!</p>"; } return $out; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'tfuse') : $instance['title'], $instance, $this->id_base); $c = @$instance['count'] ? '1' : '0'; $h = @$instance['hierarchical'] ? '1' : '0'; $d = @$instance['dropdown'] ? '1' : '0'; $e = !empty($instance['hide_empty']) ? '0' : '1'; $p = empty($instance['parent']) ? '1' : '0'; $sid_pos = tfuse_sidebar_position(); $b = $instance['b'] = empty($instance['b']) ? '' : $instance['b']; $class = $b ? 'widget-boxed' : ''; $before_widget = '<div class="widget widget_categories ' . $class . '">'; $after_widget = '</div>'; $before_title = '<h3 class="widget-title">'; $after_title = '</h3>'; echo $before_widget; $title = tfuse_qtranslate($title); if ($title) { echo $before_title . $title . $after_title; } if ($p) { $cat_ID = get_query_var('cat'); $the_category = get_category($cat_ID); $parent_id = @$the_category->parent; if ($parent_id == 0) { $parent_id = $cat_ID; } } else { $parent_id = 0; } $cat_args = array('orderby' => 'parent,name', 'show_count' => $c, 'hierarchical' => $h, 'echo' => 0, 'hide_empty' => $e, 'child_of' => $parent_id); if ($d) { $cat_args['show_option_none'] = __('Select Category', 'tfuse'); echo wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); ?> <script type='text/javascript'> /* <![CDATA[ */ var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo home_url(); ?> /?cat="+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; /* ]]> */ </script> <?php } else { ?> <ul> <?php $cat_args['title_li'] = ''; $list_categories = wp_list_categories(apply_filters('widget_categories_args', $cat_args)); $intPos = strripos($list_categories, '<a'); $intPos = $intPos + 2; printf("%s class=\"last\" %s", substr($list_categories, 0, $intPos), substr($list_categories, $intPos, strlen($list_categories))); ?> </ul> <?php } echo $after_widget; }
function tf_contactform_shortcode($atts) { global $TFUSE; wp_register_script('contact_forms_js', get_template_directory_uri() . '/js/contact_forms.js', array('jquery'), '1.1.0', true); wp_enqueue_script('contact_forms_js'); wp_enqueue_script('jquery-form'); wp_enqueue_script('jquery'); wp_register_style('contact_forms_css', get_template_directory_uri() . '/theme_config/extensions/contactform/static/css/contact_form.css', true, '1.1.0'); wp_enqueue_style('contact_forms_css'); extract(shortcode_atts(array('tf_cf_formid' => '-1'), $atts)); $out = ''; $form_exists = false; $is_preview = false; if ($tf_cf_formid != '-1') { $is_preview = false; $forms = get_option(TF_THEME_PREFIX . '_tfuse_contact_forms'); if (isset($forms[$tf_cf_formid])) { $form_exists = true; $form = $forms[$tf_cf_formid]; } } elseif ($TFUSE->request->COOKIE('form_array')) { $form_exists = true; $is_preview = true; $form = unserialize($TFUSE->request->COOKIE('form_array')); $TFUSE->request->COOKIE('form_array', null); } if ($form_exists) { $out .= '<section class="wrap-contact-form clearfix"> <div class="container"> <div class="add-comment contact-form" id="addcomments">'; $out .= '<h2 class="title-contact-form" id="header_message">' . urldecode($form['header_message']) . '</h2> <div id="form_messages" class="submit_message" ></div><div class="clear"></div>'; $inputs = $TFUSE->get->ext_config('CONTACTFORM', 'base'); $input_array = $inputs['input_types']; if ($TFUSE->request->POST('submit')) { $TFUSE->ext->contactform->sendSmtp($tf_cf_formid); } $out .= '<form id="contactForm" action="" method="post" class="ajax_form contact-form contactForm" name="contactForm">'; $out .= '<input id="this_form_id" type="hidden" value="' . $tf_cf_formid . '" />'; $fields = ''; $fcount = 1; $linewidth = 0; $earr = array(); $linenr = 1; $countForm = count($form['input']); $dimension = 27; $lines = array(); $lines[$linenr] = 0; $line1 = array(); $line2 = array(); foreach ($form['input'] as $form_input_arr1) { if (isset($form_input_arr1['column']) && $form_input_arr1['column'] == 0) { $line1[] = $form_input_arr1; } else { $line2[] = $form_input_arr1; } } if (isset($line2[0])) { $line2[0]['newline'] = 1; } $colmuns = array_merge($line1, $line2); foreach ($colmuns as $form_input_arr) { $earr[$fcount]['width'] = $form_input_arr['width']; $linewidth += $form_input_arr['width']; if (isset($form_input_arr['newline'])) { $linewidth = $form_input_arr['width']; $earr[$fcount]['class'] = ' '; if ($fcount > 1) { $linenr++; $lines[$linenr] = 0; } $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth > 100) { $linewidth = $form_input_arr['width']; $linenr++; $lines[$linenr] = 0; $earr[$fcount - 1]['class'] = ' omega '; $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth == 100) { $linewidth = 0; $earr[$fcount]['class'] = ' omega '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; $linenr++; $lines[$linenr] = 0; } else { $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } if ($countForm == $fcount && !isset($form_input_arr['newline'])) { $earr[$fcount]['class'] = ' omega '; } $fcount++; } $linewidth = 0; $fcount = 1; $margin = 27; $out_left = '<div class="column-left">'; $out_right = '<div class="column-right">'; foreach ($colmuns as $form_input) { $field = ''; $field_m = ''; $input = $input_array[$form_input['type']]; $floating = isset($form_input['newline']) ? 'clear:left;' : ''; if (!isset($input['properties']['class'])) { $input['properties']['class'] = ''; } $input['properties']['class'] .= $input['name'] == 'Email' ? ' ' . TF_THEME_PREFIX . '_email' : ''; $input['properties']['class'] .= isset($form_input['required']) && $form_input['required'] ? ' tf_cf_required_input ' : ''; $label_text = isset($form_input['required']) && $form_input['required'] ? trim($form_input['label']) . ' ' . $form['required_text'] : trim($form_input['label']); $input['id'] = str_replace('%%name%%', strtolower(str_ireplace(' ', '_', $form_input['shortcode'])), $input['id']); $form_input['classes'] = $earr[$fcount]['class']; $form_input['floating'] = $floating; $form_input['label_text'] = $label_text; if ($is_preview) { $sidebar_position = 'full'; } else { $sidebar_position = tfuse_sidebar_position(); } $element_line = $earr[$fcount]['line']; if ($sidebar_position == 'full' || is_page() && basename(get_page_template()) == 'template-page-full.php') { if ($is_preview) { $ewidth = 275 - $lines[$element_line] + $margin; } else { if ($form_input["column"] == 0) { $ewidth = 355 - $lines[$element_line] + $margin; } else { $ewidth = 755 - $lines[$element_line] + $margin; } } } else { if ($form_input["column"] == 0) { $ewidth = 212 - $lines[$element_line] + $margin; } else { $ewidth = 452 - $lines[$element_line] + $margin; } } if (isset($form_input['newline'])) { $linewidth = $form_input['width']; } else { $linewidth += $form_input['width']; } if ($form_input['width'] == 100) { $form_input['ewidthpx'] = $ewidth; $linewidth = 0; } elseif ($linewidth > 100) { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); $linewidth = 0; } else { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); } if ($lines[$element_line] == $dimension && $form_input['width'] >= 40 && $form_input['width'] <= 90) { $form_input['ewidthpx'] = (int) (($ewidth - $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 40 && $form_input['width'] > 32) { $form_input['ewidthpx'] = (int) (($ewidth - 2 * $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 33) { $form_input['ewidthpx'] = (int) (($ewidth - 3 * $dimension) * $form_input['width'] / 100); } // if($is_preview && $input['type'] == 'select') $form_input['ewidthpx'] -=26; $input_field = $input['type']($input, $form_input); if (stripos('[input]', $form['form_template']) !== false) { } else { if (isset($form_input_arr1['column']) && $form_input["column"] == 0) { $out_left .= $input_field; } else { $out_right .= $input_field; } } $fcount++; } $surse = get_template_directory_uri() . '/images/ajax-loader.gif'; $out_left .= '</div>'; $out_right .= '<label></label><span class="btn btn-submit-contact-form"> <input type="submit" id="sending" class=" btn-send2" style="display: none;" value="' . __('Sending', 'tfuse') . '..." /> <input type="submit" id="send_form" name="submit" class="btn-submit2" title="Submit mesage" value="' . $form['submit_mess'] . '" /> <img id="sending_img" src="' . $surse . '" alt="" style="margin-bottom: -25px;display: none; border:0;" /></span> </span>'; $out .= $out_left . $out_right; $out .= '</form><div class="clear"></div></div></div><div class="clear"></div></section>'; } else { $out = "<p>This Form is not defined!!</p>"; } global $wp_query; if (!isset($wp_query->queried_object->ID)) { return $out; } return $out; }
function tf_contactform_shortcode($atts) { global $TFUSE; wp_register_script('contact_forms_js', get_template_directory_uri() . '/js/contact_forms.js', array('jquery'), '1.1.0', true); wp_enqueue_script('contact_forms_js'); wp_enqueue_script('jquery-form'); wp_enqueue_script('jquery'); wp_register_style('contact_forms_css', get_template_directory_uri() . '/theme_config/extensions/contactform/static/css/contact_form.css', true, '1.1.0'); wp_enqueue_style('contact_forms_css'); extract(shortcode_atts(array('tf_cf_formid' => '-1'), $atts)); $out = ''; $form_exists = false; $is_preview = false; if ($tf_cf_formid != '-1') { $is_preview = false; $forms = get_option(TF_THEME_PREFIX . '_tfuse_contact_forms'); if (isset($forms[$tf_cf_formid])) { $form_exists = true; $form = $forms[$tf_cf_formid]; } } elseif ($TFUSE->request->isset_COOKIE('form_array')) { $form_exists = true; $is_preview = true; $form = unserialize($TFUSE->request->COOKIE('form_array')); unset($_COOKIE['form_array']); } if ($form_exists) { $out .= '<div class="contact-form">'; $out .= '<h2 id="header_message">' . urldecode($form['header_message']) . '</h2><div id="form_messages" class="submit_message" ></div>'; $inputs = $TFUSE->get->ext_config('CONTACTFORM', 'base'); $input_array = $inputs['input_types']; if ($TFUSE->request->isset_POST('submit')) { $TFUSE->ext->contactform->sendSmtp($tf_cf_formid); } $out .= '<a name="contact"></a><form id="contactForm" action="" method="post" class="ajax_form contactForm" name="contactForm">'; $out .= '<input id="this_form_id" type="hidden" value="' . $tf_cf_formid . '" />'; $fields = ''; $fcount = 1; $linewidth = 0; $earr = array(); $linenr = 1; $countForm = count($form['input']); $dimension = 62; $lines = array(); $lines[$linenr] = 0; foreach ($form['input'] as $form_input_arr) { $earr[$fcount]['width'] = $form_input_arr['width']; $linewidth += $form_input_arr['width']; if (isset($form_input_arr['newline'])) { $linewidth = $form_input_arr['width']; $earr[$fcount]['class'] = ' '; if ($fcount > 1) { $linenr++; $lines[$linenr] = 0; } $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth > 100) { $linewidth = $form_input_arr['width']; $linenr++; $lines[$linenr] = 0; $earr[$fcount - 1]['class'] = ' omega '; $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth == 100) { $linewidth = 0; $earr[$fcount]['class'] = ' omega '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; $linenr++; $lines[$linenr] = 0; } else { $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } if ($countForm == $fcount && !isset($form_input_arr['newline'])) { $earr[$fcount]['class'] = ' omega '; } $fcount++; } $linewidth = 0; $fcount = 1; $margin = 40; foreach ($form['input'] as $form_input) { $field = ''; $field_m = ''; $input = $input_array[$form_input['type']]; $floating = isset($form_input['newline']) ? 'clear:left;' : ''; if (!isset($input['properties']['class'])) { $input['properties']['class'] = ''; } $input['properties']['class'] .= $input['name'] == 'Email' ? ' ' . TF_THEME_PREFIX . '_email' : ''; $input['properties']['class'] .= isset($form_input['required']) && $form_input['required'] ? ' tf_cf_required_input ' : ''; $label_text = isset($form_input['required']) && $form_input['required'] ? trim($form_input['label']) . ' ' . $form['required_text'] : trim($form_input['label']); $input['id'] = str_replace('%%name%%', strtolower(str_ireplace(' ', '_', $form_input['shortcode'])), $input['id']); $form_input['classes'] = $earr[$fcount]['class']; $form_input['floating'] = $floating; $form_input['label_text'] = $label_text; if ($is_preview) { $sidebar_position = 'full'; } else { $sidebar_position = tfuse_sidebar_position(); } if (isset($form_input['newline'])) { $field_m .= '<div class="clear"></div>'; } $element_line = $earr[$fcount]['line']; if ($sidebar_position == 'full') { if ($is_preview) { $ewidth = 640 - $lines[$element_line] + $margin; } else { $ewidth = 942 - $lines[$element_line] + $margin; } } else { $ewidth = 584 - $lines[$element_line] + $margin; } if (isset($form_input['newline'])) { $linewidth = $form_input['width']; } else { $linewidth += $form_input['width']; } if ($form_input['width'] == 100) { $form_input['ewidthpx'] = $ewidth; $linewidth = 0; } elseif ($linewidth > 100) { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); $linewidth = 0; } else { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); } if ($lines[$element_line] == $dimension && $form_input['width'] >= 40 && $form_input['width'] <= 90) { $form_input['ewidthpx'] = (int) (($ewidth - $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 40 && $form_input['width'] > 32) { $form_input['ewidthpx'] = (int) (($ewidth - 2 * $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 33) { $form_input['ewidthpx'] = (int) (($ewidth - 3 * $dimension) * $form_input['width'] / 100); } if ($is_preview && $input['type'] == 'select') { $form_input['ewidthpx'] -= 44; } $input_field = $input['type']($input, $form_input); if (stripos('[input]', $form['form_template']) !== false) { } else { $field_m .= $input_field; } if (trim($earr[$fcount]['class']) == 'omega') { $field_m .= '<div class="clear"></div>'; } $field .= $field_m; $fields .= $field; $fcount++; } $out .= $fields; $surse = get_template_directory_uri() . '/images/ajax-loader.gif'; $out .= '<div class="clear"></div><div class="row" style="width:100%">'; $out .= '<span class="reset-link"><a href="#" onclick="resetFields(this,event)">' . urldecode($form['reset_button']) . '</a></span>'; $out .= '<a href="#" id="sending" class="btn-send2"><span>' . __('Sending ...', 'tfuse') . '</span></a> <input type="submit" id="send_form" class="btn-submit" name="submit" title="Submit message" value="' . $form['submit_mess'] . '" /> <img id="sending_img" src="' . $surse . '" alt="Sending" style="margin-left:-10px; margin-bottom:-6px; display: none; border:0;" /></div> </form></div>'; } else { $out = "<p>This Form is not defined!!</p>"; } return $out; }
function tfuse_class($param, $return = false) { $tfuse_class = ''; $sidebar_position = tfuse_sidebar_position(); if ($param == 'middle') { if ($sidebar_position == 'left') { $tfuse_class = ' class="container sidebar-left"'; } elseif ($sidebar_position == 'right') { $tfuse_class = ' class="container sidebar-right"'; } else { $tfuse_class = ' class="container full-width"'; } } if ($return) { return $tfuse_class; } else { echo $tfuse_class; } }
function tf_reservationform_shortcode($atts) { global $TFUSE; $pluginfolder = home_url() . '/wp-includes/js/jquery/ui'; wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-datepicker', $pluginfolder . '/jquery.ui.datepicker.min.js', array('jquery', 'jquery-ui-core')); wp_register_script('reservation_forms_js', get_template_directory_uri() . '/js/reservation_frontend.js', array('jquery'), '1.1.0', true); wp_enqueue_script('reservation_forms_js'); wp_enqueue_script('jquery-form'); wp_register_style('jquery_css', TFUSE_ADMIN_CSS . '/jquery-ui-1.8.14.custom.css'); wp_enqueue_style('jquery_css'); wp_register_style('reservation_forms_css', get_template_directory_uri() . '/theme_config/extensions/reservationform/static/css/reservation_form.css', true, '1.1.0'); wp_enqueue_style('reservation_forms_css'); extract(shortcode_atts(array('tf_rf_formid' => '-1'), $atts)); $out = ''; $form_exists = false; $is_preview = false; if ($tf_rf_formid != '-1') { $is_preview = false; $form = get_term_by('id', $tf_rf_formid, 'reservations'); $form_exists = is_object($form) && count($form) > 0 ? true : false; $form = unserialize($form->description); } elseif ($TFUSE->request->COOKIE('res_form_array')) { $is_preview = true; $form_exists = true; $form = unserialize($TFUSE->request->COOKIE('res_form_array')); $TFUSE->request->COOKIE('form_array', null); } if ($form_exists) { $out .= '<section class="wrap-contact-form clearfix"> <div class="container"> <div class="add-comment" id="addcomments"> <h2 class="title-contact-form" id="header_message">' . urldecode($form['header_message']) . '</h2>'; $out .= '<div id="form_messages" class="submit_message" ></div><div class="clear"></div>'; $inputs = $TFUSE->get->ext_config('RESERVATIONFORM', 'base'); $input_array = $inputs['input_types']; $out .= '<form id="reservationForm" action="" method="post" class="contactForm contact-form reservationForm" name="reservationForm">'; $out .= '<input id="this_form_id" type="hidden" value="' . $tf_rf_formid . '" />'; $fields = ''; $fcount = 1; $linewidth = 0; $earr = array(); $linenr = 1; $lines = array(); $countForm = count($form['input']); $dimension = 27; $lines[$linenr] = 0; $line1 = array(); $line2 = array(); foreach ($form['input'] as $form_input_arr1) { if (@$form_input_arr1['column'] == 0) { $line1[] = $form_input_arr1; } else { $line2[] = $form_input_arr1; } } if (isset($line2[0])) { $line2[0]['newline'] = 1; } $colmuns = array_merge($line1, $line2); foreach ($colmuns as $form_input_arr) { $earr[$fcount]['width'] = $form_input_arr['width']; $linewidth += $form_input_arr['width']; if (isset($form_input_arr['newline']) && $form_input_arr['newline'] == 1) { $linewidth = $form_input_arr['width']; $earr[$fcount]['class'] = ' '; if ($fcount > 1) { $linenr++; $lines[$linenr] = 0; } $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth > 100) { $linewidth = $form_input_arr['width']; $linenr++; $lines[$linenr] = 0; $earr[$fcount - 1]['class'] = ' omega '; $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth == 100) { $linewidth = 0; $earr[$fcount]['class'] = ' omega '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; $linenr++; $lines[$linenr] = 0; } else { $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } if ($countForm == $fcount && !isset($form_input_arr['newline'])) { $earr[$fcount]['class'] = ' omega '; } $fcount++; } $text_type = array(); $email_type = array(); foreach ($input_array as $input) { if ($input['name'] == 'Text line') { $text_type = $input; } if ($input['name'] == 'Email') { $email_type = $input; } if (!empty($text_type) && !empty($email_type)) { break; } } $input_array['date_in'] = $text_type; $input_array['date_out'] = $text_type; $input_array['res_email'] = $email_type; $linewidth = 0; $fcount = 1; $margin = 27; $out_left = '<div class="column-left">'; $out_right = '<div class="column-right">'; foreach ($colmuns as $form_input) { $field = ''; $input = array(); if (isset($input_array[$form_input['type']])) { $input = $input_array[$form_input['type']]; } if (isset($input['properties'])) { $proprstr = ''; foreach ($input['properties'] as $key => $value) { $proprstr .= $key . "=" . $value . " "; } } $floating = isset($form_input['newline']) ? 'clear:left;' : ' '; if (!isset($input['properties']['class'])) { $input['properties']['class'] = ''; } $input['properties']['class'] .= isset($input['name']) && $input['name'] == 'Email' ? ' ' . TF_THEME_PREFIX . '_email' : ''; $input['properties']['class'] .= isset($form_input['required']) ? ' tf_rf_required_input ' : ''; $label_text = isset($form_input['required']) ? trim(urldecode($form_input['label'])) . ' ' . urldecode($form['required_text']) : trim(urldecode($form_input['label'])); $input['id'] = isset($input['id']) ? str_replace('%%name%%', urldecode($form_input['shortcode']), $input['id']) : TF_THEME_PREFIX . '_' . urldecode($form_input['shortcode']); $form_input['classes'] = $earr[$fcount]['class']; $form_input['floating'] = $floating; $form_input['label_text'] = $label_text; $label = '<label for="' . TF_THEME_PREFIX . "_" . trim(urldecode($form_input['shortcode'])) . '">' . urldecode($label_text) . '</label><br/>'; if ($is_preview) { $sidebar_position = 'full'; } else { $sidebar_position = tfuse_sidebar_position(); } $element_line = $earr[$fcount]['line']; if ($sidebar_position == 'full' || is_page() && basename(get_page_template()) == 'template-page-full.php') { if ($is_preview) { $ewidth = 621 - $lines[$element_line] + $margin; } else { if ($form_input["column"] == 0) { $ewidth = 355 - $lines[$element_line] + $margin; } else { $ewidth = 755 - $lines[$element_line] + $margin; } } } else { if ($form_input["column"] == 0) { $ewidth = 212 - $lines[$element_line] + $margin; } else { $ewidth = 452 - $lines[$element_line] + $margin; } } if (isset($form_input['newline']) && $form_input['newline'] == 1) { $linewidth = $form_input['width']; } else { $linewidth += $form_input['width']; } if ($form_input['width'] == 100) { $form_input['ewidthpx'] = $ewidth; $linewidth = 0; } elseif ($linewidth > 100) { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); $linewidth = 0; } else { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); } if ($lines[$element_line] == $dimension && $form_input['width'] >= 40 && $form_input['width'] <= 90) { $form_input['ewidthpx'] = (int) (($ewidth - $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 40 && $form_input['width'] > 32) { $form_input['ewidthpx'] = (int) (($ewidth - 2 * $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 33) { $form_input['ewidthpx'] = (int) (($ewidth - 3 * $dimension) * $form_input['width'] / 100); } // if($is_preview && $input['type'] == 'select') $form_input['ewidthpx'] -=12; // if ($is_preview && $input['type'] == 'text' && ($form_input['type']=='date_in' || $form_input['type']=='date_out') ) // { // $form_input['ewidthpx'] +=25; // global $dist_select; // $dist_select = -25; // } // else $dist_select=0; $fcount++; if (in_array($form_input['type'], array('date_in', 'date_out'))) { $input['type'] = 'res_datepicker'; } elseif ($form_input['type'] == 'res_email') { $input['type'] = 'res_text'; } else { $input['type'] = 'res_' . $input['type']; } if (!function_exists($input['type'])) { continue; } $input_field = $input['type']($input, $form_input); if ($input['type'] == 'checkbox') { $tmp = $label; $label = $input_field; $input_field = $tmp; } if (@$form_input["column"] == 0) { $out_left .= $input_field; } else { $out_right .= $input_field; } } $surse = get_template_directory_uri() . '/images/ajax-loader.gif'; $out_left .= '</div>'; $out_right .= '<div class="clear"></div> <span class="btn btn-submit-contact-form"> <input type="submit" id="sending" class=" btn-send2" style="display: none;" value="' . __('Sending', 'tfuse') . '..." /> <input type="submit" id="send_reservation" name="submit" class="btn-submit2" title="Submit mesage" value="' . urldecode($form['submit_mess']) . '" /> <img id="sending_img" src="' . $surse . '" alt="" style="margin-bottom: -25px;display: none; border:0;" /></span> </span>'; $out .= $out_left . $out_right; $out .= '</form><div class="clear"></div></div><div class="clear"></div></section>'; } else { $out = "<p>This Form is not defined!!</p>"; } global $wp_query; if (!isset($wp_query->queried_object->ID)) { return $out; } return $out; }
function tf_reservationform_shortcode($atts) { global $TFUSE; $template_directory = get_template_directory_uri(); wp_enqueue_script('jquery'); wp_register_script('reservation_forms_js', $template_directory . '/js/reservation_frontend.js', array('jquery'), '1.1.0', true); wp_enqueue_script('reservation_forms_js'); wp_enqueue_script('jquery-form'); wp_register_style('jquery_css', TFUSE_ADMIN_CSS . '/jquery-ui-1.8.14.custom.css'); wp_enqueue_style('jquery_css'); wp_register_style('reservation_forms_css', $template_directory . '/theme_config/extensions/reservationform/static/css/reservation_form.css', true, '1.1.0'); wp_enqueue_style('reservation_forms_css'); extract(shortcode_atts(array('tf_rf_formid' => '-1'), $atts)); $out = ''; $form_exists = false; $is_preview = false; if ($tf_rf_formid != '-1') { $is_preview = false; $form = get_term_by('id', $tf_rf_formid, 'reservations'); $form_exists = is_object($form) && count($form) > 0 ? true : false; $form = unserialize($form->description); } elseif ($TFUSE->request->COOKIE('res_form_array')) { $is_preview = true; $form_exists = true; $form = unserialize($TFUSE->request->COOKIE('res_form_array')); $TFUSE->request->COOKIE('form_array', null); } if ($form_exists) { $out .= '<div class="container reservation-container">'; if ($form['header_message'] != '') { $out .= '<h3 id="header_message">' . __(urldecode($form['header_message']), 'tfuse') . '</h3>'; } $inputs = $TFUSE->get->ext_config('RESERVATIONFORM', 'base'); $input_array = $inputs['input_types']; $out .= '<form id="reservationForm" action="#" method="post" class="reservationForm" name="reservationForm"><div class="row">'; $out .= '<input id="this_form_id" type="hidden" value="' . $tf_rf_formid . '" />'; $fcount = 1; $linewidth = 0; $earr = array(); $linenr = 1; $lines = array(); $countForm = count($form['input']); $dimension = 25; $lines[$linenr] = 0; $line1 = array(); $line2 = array(); foreach ($form['input'] as $form_input_arr1) { if (isset($form_input_arr1['column']) && $form_input_arr1['column'] == 1) { $line2[] = $form_input_arr1; } else { $line1[] = $form_input_arr1; } } if (isset($line2[0])) { $line2[0]['newline'] = 1; } $colmuns = array_merge($line1, $line2); foreach ($colmuns as $form_input_arr) { $earr[$fcount]['width'] = $form_input_arr['width']; $linewidth += $form_input_arr['width']; if (isset($form_input_arr['newline']) && $form_input_arr['newline'] == 1) { $linewidth = $form_input_arr['width']; $earr[$fcount]['class'] = ' '; if ($fcount > 1) { $linenr++; $lines[$linenr] = 0; } $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth > 100) { $linewidth = $form_input_arr['width']; $linenr++; $lines[$linenr] = 0; $earr[$fcount - 1]['class'] = ' omega '; $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } elseif ($linewidth == 100) { $linewidth = 0; $earr[$fcount]['class'] = ' omega '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; $linenr++; $lines[$linenr] = 0; } else { $earr[$fcount]['class'] = ' '; $earr[$fcount]['line'] = $linenr; $lines[$linenr] += $dimension; } if ($countForm == $fcount && !isset($form_input_arr['newline'])) { $earr[$fcount]['class'] = ' omega '; } $fcount++; } $text_type = array(); $email_type = array(); foreach ($input_array as $input) { if ($input['name'] == 'Text line') { $text_type = $input; } if ($input['name'] == 'Email') { $email_type = $input; } if (!empty($text_type) && !empty($email_type)) { break; } } $input_array['date_in'] = $text_type; $input_array['date_out'] = $text_type; $input_array['res_email'] = $email_type; $linewidth = 0; $fcount = 1; $margin = 25; $out_left = '<div class="col-lg-3 col-lg-offset-1 col-md-4 col-sm-7 col-xs-10 left-colum">'; $out_right = '<div class="col-md-7 col-xs-12 right-colum">'; foreach ($colmuns as $form_input) { $input = array(); if (isset($input_array[$form_input['type']])) { $input = $input_array[$form_input['type']]; } if (isset($input['properties'])) { $proprstr = ''; foreach ($input['properties'] as $key => $value) { $proprstr .= $key . "=" . $value . " "; } } $floating = isset($form_input['newline']) ? 'clear:left;' : ' '; if (!isset($input['properties']['class'])) { $input['properties']['class'] = ''; } $input['properties']['class'] .= isset($input['name']) && $input['name'] == 'Email' ? ' ' . TF_THEME_PREFIX . '_email' : ''; $input['properties']['class'] .= isset($form_input['required']) ? ' tf_rf_required_input ' : ''; $label_text = isset($form_input['required']) ? trim(urldecode($form_input['label'])) . ' ' . urldecode($form['required_text']) : trim(urldecode($form_input['label'])); $input['id'] = isset($input['id']) ? str_replace('%%name%%', urldecode($form_input['shortcode']), $input['id']) : TF_THEME_PREFIX . '_' . urldecode($form_input['shortcode']); $form_input['classes'] = $earr[$fcount]['class']; $form_input['floating'] = $floating; $form_input['label_text'] = $label_text; $label = '<label for="' . TF_THEME_PREFIX . "_" . trim(urldecode($form_input['shortcode'])) . '">' . urldecode($label_text) . '</label><br/>'; if ($is_preview) { $sidebar_position = 'full'; } else { $sidebar_position = tfuse_sidebar_position(); } $element_line = $earr[$fcount]['line']; if ($sidebar_position == 'full' || $form['position'] == 'before_content') { if ($is_preview) { $ewidth = 590 - $lines[$element_line] + $margin; } else { if (isset($form_input["column"]) && $form_input["column"] == '0') { // special for left column $margin_leftc = 12; $line_left = $lines[$element_line] / 25 * $margin_leftc; $ewidth = 216 - $line_left + $margin_leftc; } else { $ewidth = 616 - $lines[$element_line] + $margin; } } } else { if (isset($form_input["column"]) && $form_input["column"] == '0') { // special for left column $margin_leftc = 12; $line_left = $lines[$element_line] / 25 * $margin_leftc; $ewidth = 144 - $line_left + $margin_leftc; } else { $ewidth = 380 - $lines[$element_line] + $margin; } } if (isset($form_input['newline']) && $form_input['newline'] == 1) { $linewidth = $form_input['width']; } else { $linewidth += $form_input['width']; } if ($form_input['width'] == 100) { $form_input['ewidthpx'] = $ewidth; $linewidth = 0; } elseif ($linewidth > 100) { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); $linewidth = 0; } else { $form_input['ewidthpx'] = (int) ($ewidth * $form_input['width'] / 100); } // for single element in next line if ($lines[$element_line] == $dimension && $form_input['width'] >= 40 && $form_input['width'] <= 90) { $form_input['ewidthpx'] = (int) (($ewidth - $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 40 && $form_input['width'] > 32) { $form_input['ewidthpx'] = (int) (($ewidth - 2 * $dimension) * $form_input['width'] / 100); } elseif ($lines[$element_line] == $dimension && $form_input['width'] < 33) { $form_input['ewidthpx'] = (int) (($ewidth - 3 * $dimension) * $form_input['width'] / 100); } $fcount++; if (in_array($form_input['type'], array('date_in', 'date_out'))) { $input['type'] = 'res_datepicker'; } elseif ($form_input['type'] == 9) { $input['type'] = 'res_text'; } else { $input['type'] = 'res_' . $input['type']; } if (!function_exists($input['type'])) { continue; } $input_field = $input['type']($input, $form_input); if ($input['type'] == 'checkbox') { $tmp = $label; $label = $input_field; $input_field = $tmp; } if (isset($form_input["column"]) && $form_input["column"] == '1') { $out_right .= $input_field; } else { $out_left .= $input_field; } } $out_left .= '</div>'; $out_right .= '<div class="clear"></div><div class="reservation_submit"> <span id="send_form"> <input class="btn-submit" type="submit" id="submit" name="submit" value="' . __(urldecode($form['submit_mess']), 'tfuse') . '"> </span>'; if ($form['reset_button'] != '') { $out_right .= '<a onclick="resetFields(this,event)" href="#" class="link-reset">' . __(urldecode($form['reset_button']), 'tfuse') . '</a>'; } $out_right .= '<span id="sending" style="display: none;"> <input class="btn-submit" type="submit" id="submit" name="submit" value="' . __('Sending ...', 'tfuse') . '"> </span> </div> </div>'; $out .= $out_left . $out_right; $out .= '</div></form> <div id="form_messages" class="submit_message" ></div> </div>'; } else { $out = __("<p>This Form is not defined !</p>", "tfuse"); } return $out; }