"two columns ", "element1-6" => "two columns ",
"1/5" => "one-fifth column ", "element1-5" => "one-fifth column ",
"1/4" => "three columns ", "element1-4" => "three columns ",
"1/3" => "four columns ", "element1-3" => "four columns ",
"1/2" => "six columns ", "element1-2" => "six columns ",
"2/3" => "eight columns ", "element2-3" => "eight columns ",
"3/4" => "nine columns ", "element3-4" => "nine columns ",
"1/1" => "twelve columns ", "element1-1" => "twelve columns " );
$gdl_class_to_num = array(
"element1-6" => 1/6, "1/6"=>1/6,
"element1-5" => 1/5, "1/5"=>1/5,
"element1-4" => 1/4, "1/4"=>1/4,
"element1-3" => 1/3, "1/3"=>1/3,
"element1-2" => 0.5, "1/2"=>0.5,
"element2-3" => 2/3, "2/3"=>2/3,
"element3-4" => 3/4, "3/4"=>3/4,
"element1-1" => 1, "1/1" => 1 );
// Print the item size
with it's class
function print_item_size($item_size, $item_row_size = '0', $addition_class='',
$html_row_tag = 'div', $html_col_tag = 'div', $additional_style=''){
global $gdl_div_size_num_class, $gdl_class_to_num;
// init the first row
if( empty($item_row_size) ){
echo '<' . $html_row_tag .' class="row">';
}
$gdl_row_class = $gdl_div_size_num_class[$item_size] . $addition_class;
$gdl_item_size = $gdl_class_to_num[$item_size];
$item_row_size = $item_row_size + $gdl_item_size;
if($item_row_size > 1){
$item_row_size = $gdl_item_size;
echo '
';
echo '
'; // close row
echo '<' . $html_row_tag . ' class="row">'; // open new row
}
if( empty($additional_style) ){
echo '<' . $html_col_tag . ' class="' . $gdl_row_class . '">';
}else{
echo '<' . $html_col_tag . ' class="' . $gdl_row_class . '" style="' . $additional_style . '">';
}
return $item_row_size;
}
// Print the item size with it's class
function return_item_size($item_size, $item_row_size = '0', $addition_class='', $html_row_tag = 'div', $html_col_tag = 'div'){
global $gdl_div_size_num_class, $gdl_class_to_num;
$return = "";
// init the first row
if( empty($item_row_size) ){
$return = $return . '<' . $html_row_tag .' class="row">';
}
$gdl_row_class = $gdl_div_size_num_class[$item_size] . $addition_class;
$gdl_item_size = $gdl_class_to_num[$item_size];
$item_row_size = $item_row_size + $gdl_item_size;
if($item_row_size > 1){
$item_row_size = $gdl_item_size;
$return = $return . '
';
$return = $return . '
'; // close row
$return = $return . '<' . $html_row_tag . ' class="row">'; // open new row
}
$return = $return . '<' . $html_col_tag . ' class="' . $gdl_row_class . '">';
return array( 'row-size'=>$item_row_size, 'return'=>$return);
}
// Print page header
function print_page_header( $header, $caption = '' ){
echo ''; // page header wrapper
}
// Print header of each item
function print_item_header( $header, $addition_class = '', $additional_html = '' ){
if(!empty($header)){
echo '';
}
}
// Print accordion
function print_accordion_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
$gdl_active = 'active';
$tab_xml = find_xml_node($item_xml, 'tab-item');
echo "";
}
// Print column
function print_column_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
echo '';
echo do_shortcode(html_entity_decode(find_xml_value($item_xml,'column-text')));
echo '
';
}
// Print Content Item
function print_content_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
wp_reset_query();
if(have_posts()){
while(have_posts()){
the_post();
the_content();
}
}
}
// Print Divider
function print_divider($item_xml){
echo '';
echo '
';
echo find_xml_value($item_xml, 'text');
echo '
';
echo '
';
echo '
';
}
// Print gallery
function print_gallery_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
global $gallery_div_size_num_class, $sidebar_type, $gdl_element_id;
$gallery_row_size = 0;
$gallery_page = find_xml_value($item_xml, 'page');
$gallery_size = find_xml_value($item_xml, 'item-size');
$item_size = $gallery_div_size_num_class[$gallery_size][$sidebar_type];
$gallery_post = get_posts(array('post_type' => 'gdl-gallery', 'name'=>$gallery_page, 'numberposts'=> 1));
echo '';
$slider_xml_string = get_post_meta($gallery_post[0]->ID,'post-option-gallery-xml', true);
$slider_xml_dom = new DOMDocument();
if( !empty( $slider_xml_string ) ){
$slider_xml_dom->loadXML($slider_xml_string);
foreach( $slider_xml_dom->documentElement->childNodes as $slider ){
$gallery_row_size = print_item_size($gallery_size, $gallery_row_size, 'mb40');
$link_type = find_xml_value($slider, 'linktype');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $item_size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
echo '
';
if( $link_type == 'Link to URL' ){
$link = find_xml_value( $slider, 'link');
echo '
';
echo '';
echo '';
}else if( $link_type == 'Lightbox' ){
$image_full = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
echo '
';
echo '';
echo '';
}else{
echo '
';
}
echo '
'; // gallery-thumbnail-image
echo '
'; // print item size
}
echo '';
echo ''; // end row
$gdl_element_id++;
}
echo ''; // gdl gallery item
}
// Print Message Box
function print_message_box($item_xml){
$box_color = find_xml_value($item_xml, 'color');
$box_title = find_xml_value($item_xml, 'title');
$box_content = html_entity_decode(find_xml_value($item_xml, 'content'));
echo '';
echo '
' . $box_title . '
';
echo '
' . do_shortcode($box_content) . '
';
echo '
';
}
// Print personnal item
function print_personnal_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
global $personnal_div_size_num_class, $sidebar_type;
$num_fetch = find_xml_value($item_xml, 'num-fetch');
$category = find_xml_value($item_xml, 'category', false);
$category = ( $category == 'All' )? '': $category;
$personnal_size = find_xml_value($item_xml, 'item-size');
$personnal_row_size = 0;
$item_size = $personnal_div_size_num_class[$personnal_size][$sidebar_type];
$post_temp = query_posts(array('post_type'=>'personnal',
'personnal-category'=>$category, 'posts_per_page'=>$num_fetch));
echo '';
while( have_posts() ){
the_post();
$personnal_row_size = print_item_size($personnal_size, $personnal_row_size, 'personnal-item-wrapper');
echo '
';
$thumbnail_id = get_post_thumbnail_id();
$thumbnail = wp_get_attachment_image_src( $thumbnail_id , $item_size );
$alt_text = get_post_meta($thumbnail_id , '_wp_attachment_image_alt', true);
if( !empty($thumbnail) ){
echo '
';
}
echo '
';
the_title();
echo '
';
$position = get_post_meta( get_the_ID(), 'personnal-option-position', true );
if( !empty($position) ){
echo '
' . $position . "
";
}
echo '
';
the_content();
echo '
';
$social_info = get_post_meta( get_the_ID(), 'personnal-option-social-info', true );
if( !empty($social_info) ){
echo '
';
echo do_shortcode($social_info);
echo '
';
echo '
';
}
echo '
';
echo '
'; // personnal item
echo '
'; //close print_item_size
}
echo '';
echo ''; //close row
echo '';
}
// Print price item
function print_price_item($item_xml){
global $gdl_admin_translator;
if( $gdl_admin_translator == 'enable' ){
$translator_read_more = get_option(THEME_SHORT_NAME.'_translator_read_more_price', 'BUY NOW');
}else{
$translator_read_more = __('BUY NOW','gdl_front_end');
}
$price_item_row_size = 0;
$price_item_number = find_xml_value($item_xml, 'item-number');
$price_item_category = find_xml_value($item_xml, 'category', false);
$price_item_category = ($price_item_category == 'All')? '': $price_item_category;
$price_posts = get_posts(array('post_type'=>'price_table', 'price-table-category'=>$price_item_category,
'numberposts'=>$price_item_number));
echo '';
foreach($price_posts as $price_post){
$best_price = get_post_meta( $price_post->ID, 'price-table-best-price', true );
$best_price = ($best_price == 'Yes')? ' best-price':'';
$price_item_row_size = print_item_size('1/' . $price_item_number,
$price_item_row_size, 'price-item-wrapper wrapper mb0' . $best_price);
echo '
';
echo '
';
echo '
';
echo '
' . $price_post->post_title . '
';
echo '
';
_e(get_post_meta( $price_post->ID, 'price-table-price-tag', true ), 'gdl_front_end');
$suffix = __(get_post_meta( $price_post->ID, 'price-table-price-suffix', true ), 'gdl_front_end');
if( !empty($suffix) ){ echo '' . $suffix . ''; }
echo '
';
echo '
'; // price-title-wrapper
echo '
';
echo apply_filters('the_content', $price_post->post_content);
echo '
';
$price_url = __(get_post_meta( $price_post->ID, 'price-table-option-url', true ), 'gdl_front_end');
if( !empty($price_url) ){
echo '
';
}
echo '
';
echo '
'; // price item
echo '
'; // price item inner wrapper
echo '
'; // print item size
}
echo '';
echo ''; // end row
echo ''; // price table wrapper
}
// Print postslider item
function print_post_slider_item($item_xml){
global $gdl_date_format;
print_item_header( find_xml_value($item_xml, 'header') );
$num_fetch = find_xml_value($item_xml, 'num-fetch');
$num_excerpt = find_xml_value($item_xml, 'num-excerpt');
$show_caption = find_xml_value($item_xml, 'show-caption');
$category = find_xml_value($item_xml, 'category', false);
$category = ($category == 'All')? '': $category;
$postslider_xml = "";
$postslider_xml = $postslider_xml . create_xml_tag('size', find_xml_value($item_xml, 'size'));
$postslider_xml = $postslider_xml . create_xml_tag('width', find_xml_value($item_xml, 'width'));
$postslider_xml = $postslider_xml . create_xml_tag('height', find_xml_value($item_xml, 'height'));
$postslider_xml = $postslider_xml . create_xml_tag('slider-type', find_xml_value($item_xml, 'slider-type'));
$postslider_xml = $postslider_xml . "";
query_posts(array('post_type'=>'post', 'category_name'=>$category, 'posts_per_page'=>$num_fetch ));
while( have_posts() ){
the_post();
$postslider_xml = $postslider_xml . "";
$postslider_xml = $postslider_xml . create_xml_tag('image', get_post_thumbnail_id(get_the_ID()) );
$postslider_xml = $postslider_xml . create_xml_tag('linktype', 'Link to URL' );
$postslider_xml = $postslider_xml . create_xml_tag('link', htmlspecialchars(get_permalink()) );
$postslider_xml = $postslider_xml . create_xml_tag('comment', get_comments_number(get_the_ID()) );
if( $show_caption == "Yes" ){
$postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()) );
$postslider_xml = $postslider_xml . create_xml_tag('caption', htmlspecialchars(gdl_get_excerpt($num_excerpt)) );
}else if( $show_caption == "Show Date" ){
$postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()) );
$postslider_xml = $postslider_xml . create_xml_tag('caption', __('Posted on ', 'gdl_front_end') . get_the_time($gdl_date_format) );
}
$postslider_xml = $postslider_xml . "";
}
$postslider_xml = $postslider_xml . "";
$postslider_xml = $postslider_xml . "";
$slider_xml_val = new DOMDocument();
$slider_xml_val->loadXML($postslider_xml);
foreach( $slider_xml_val->documentElement->childNodes as $slider_item_xml){
print_slider_item($slider_item_xml);
}
wp_reset_query();
}
// Print postslider item
function print_top_post_slider_item($category, $num_fetch, $width, $height){
global $gdl_date_format;
$category = ($category == 'All')? '': $category;
$postslider_xml = "";
$postslider_xml = $postslider_xml . create_xml_tag('width', $width);
$postslider_xml = $postslider_xml . create_xml_tag('height', $height);
$postslider_xml = $postslider_xml . create_xml_tag('slider-type', 'Carousel Slider');
$postslider_xml = $postslider_xml . "";
query_posts(array('post_type'=>'post', 'category_name'=>$category, 'posts_per_page'=>$num_fetch ));
while( have_posts() ){
the_post();
$postslider_xml = $postslider_xml . "";
$postslider_xml = $postslider_xml . create_xml_tag('image', get_post_thumbnail_id(get_the_ID()) );
$postslider_xml = $postslider_xml . create_xml_tag('linktype', 'Link to URL' );
$postslider_xml = $postslider_xml . create_xml_tag('link', htmlspecialchars(get_permalink()) );
$postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()) );
$postslider_xml = $postslider_xml . create_xml_tag('caption', __('Posted on ', 'gdl_front_end') . get_the_time($gdl_date_format) );
$postslider_xml = $postslider_xml . create_xml_tag('comment', get_comments_number(get_the_ID()) );
$postslider_xml = $postslider_xml . "";
}
$postslider_xml = $postslider_xml . "";
$postslider_xml = $postslider_xml . "";
$slider_xml_val = new DOMDocument();
$slider_xml_val->loadXML($postslider_xml);
foreach( $slider_xml_val->documentElement->childNodes as $slider_item_xml){
print_slider_item($slider_item_xml);
}
wp_reset_query();
}
// Print stunning text
function print_stunning_text($item_xml){
$title = find_xml_value($item_xml, 'title');
$caption = html_entity_decode(find_xml_value($item_xml, 'caption'));
$shadow = (find_xml_value($item_xml, 'shadow') != 'No')? 'shadow-on': '';
echo '';
echo '
';
echo '
';
echo '
' . $title . '
';
echo '
' . do_shortcode($caption) . '
';
echo '
'; // stunning text content
echo '
';
echo '
'; //stunning-text-inner-wrapper
if( !empty($shadow) ){
echo '
';
}
echo '
';
}
// Print Tab
function print_tab_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
$num = 0;
$tab_title = array();
$tab_content = array();
$tab_xml = find_xml_node($item_xml, 'tab-item');
foreach($tab_xml->childNodes as $toggle_box){
$tab_title[$num] = find_xml_value($toggle_box, 'title');
$tab_content[$num] = html_entity_decode(find_xml_value($toggle_box, 'caption'));
$num++;
}
echo '';
// tab title
echo '
";
// tab content
echo '
';
echo "
";
for($i=0; $i<$num; $i++){
echo '- ' . do_shortcode($tab_content[$i]) . '
';
}
echo "
";
echo '
'; // gdl tab
}
// Print Testimonial
function print_testimonial($item_xml){
$display_type = find_xml_value($item_xml, 'display-type');
if( $display_type == 'Carousel Testimonial' ){
$additional = 'navigation-on';
}else{
$additional = '';
}
print_item_header( find_xml_value($item_xml, 'header'), $additional );
$num_fetch = find_xml_value($item_xml, 'num-fetch');
$orderby = find_xml_value($item_xml, 'orderby');
$order = find_xml_value($item_xml, 'order');
$category = find_xml_value($item_xml, 'category', false);
$category = ( $category == 'All' )? '': $category;
$item_size = find_xml_value($item_xml, 'item-size');
$testimonial_row_size = 0;
query_posts(array( 'post_type'=>'testimonial', 'orderby'=>$orderby, 'posts_per_page'=>$num_fetch,
'order'=>$order, 'testimonial-category'=>$category ));
if( $display_type == 'Static Testimonial' ){
echo '';
if( have_posts() ){
while( have_posts() ){
the_post();
$testimonial_row_size = print_item_size($item_size, $testimonial_row_size, 'mb20');
echo '
';
// testimonial content
echo '
';
the_content();
echo '
';
// testimonial author
$author = get_the_title();
$position = get_post_meta( get_the_ID(), "testimonial-option-author-position", true );
echo '
';
echo '' . $author . '';
if( !empty($position) ){
echo ', ' . $position . '';
}
echo '
';
echo '
'; // testimonial item
echo '
'; // close print_item_size
}
}
echo '';
echo ''; // close row
echo ''; // gdl static testimonial
}else if( $display_type == 'Carousel Testimonial' ){
echo '';
// navigation
echo '
';
echo '
';
echo '
';
echo '
';
// content
echo '
';
if( have_posts() ){
while( have_posts() ){
the_post();
echo '
';
// testimonial content
echo '
';
echo '
';
the_content();
echo '
';
echo '
';
// testimonial author
$author = get_the_title();
$position = get_post_meta( get_the_ID(), "testimonial-option-author-position", true );
echo '
';
echo '' . $author . '';
if( !empty($position) ){
echo ', ' . $position . '';
}
echo '
';
echo '
'; // testimonial item
}
}
echo '
'; //testimonial-item-wrapper
echo '
';
}
wp_reset_query();
}
// Print Toggle Box
function print_toggle_box_item($item_xml){
print_item_header( find_xml_value($item_xml, 'header') );
$tab_xml = find_xml_node($item_xml, 'tab-item');
echo "';
}
// Print the slider item
function print_slider_item($item_xml){
$xml_size = find_xml_value($item_xml, 'size');
if( $xml_size == 'full-width' ){
echo '';
}else{
echo '
';
}
$slider_width = find_xml_value($item_xml, 'width');
$slider_height = find_xml_value($item_xml, 'height');
if( !empty($slider_width) && !empty($slider_height) ){
$xml_size = $slider_width . 'x' . $slider_height;
}else if( $xml_size == 'full-width' ){
$xml_size = 'full';
}else{
$xml_size = '980x360';
}
switch(find_xml_value($item_xml,'slider-type')){
case 'Anything Slider':
print_anything_slider(find_xml_node($item_xml,'slider-item'), $xml_size);
break;
case 'Nivo Slider':
print_nivo_slider(find_xml_node($item_xml,'slider-item'), $xml_size);
break;
case 'Flex Slider':
print_flex_slider(find_xml_node($item_xml,'slider-item'), $xml_size);
break;
case 'Carousel Slider':
print_carousel_slider(find_xml_node($item_xml,'slider-item'), $xml_size);
break;
}
echo "
";
}
// Print contact form
function print_contact_form($item_xml){
global $gdl_admin_translator;
if( $gdl_admin_translator == 'enable' ){
$gdl_name_string = get_option(THEME_SHORT_NAME.'_translator_name_contact_form', 'Name');
$gdl_name_error_string = get_option(THEME_SHORT_NAME.'_translator_name_error_contact_form', 'Please enter your name');
$gdl_email_string = get_option(THEME_SHORT_NAME.'_translator_email_contact_form', 'Email');
$gdl_email_error_string = get_option(THEME_SHORT_NAME.'_translator_email_error_contact_form', 'Please enter a valid email address');
$gdl_message_string = get_option(THEME_SHORT_NAME.'_translator_message_contact_form', 'Message');
$gdl_message_error_string = get_option(THEME_SHORT_NAME.'_translator_message_error_contact_form', 'Please enter message');
$gdl_submit_button = get_option(THEME_SHORT_NAME.'_translator_submit_contact_form','Submit');
}else{
$gdl_name_string = __('Name','gdl_front_end');
$gdl_name_error_string = __('Please enter your name','gdl_front_end');
$gdl_email_string = __('Email','gdl_front_end');
$gdl_email_error_string = __('Please enter a valid email address','gdl_front_end');
$gdl_message_string = __('Message','gdl_front_end');
$gdl_message_error_string = __('Please enter message','gdl_front_end');
$gdl_submit_button = __('Submit','gdl_front_end');
}
?>