'','page_left_class'=>'twelve columns', 'page_item_class'=>'twelve columns');
if( $sidebar == "right-sidebar" || $sidebar == "left-sidebar" ){
$sidebar_type = 'one-sidebar';
$sidebar_array['sidebar_class'] = "single-sidebar right-sidebar";
$sidebar_array['page_left_class'] = "page-left-right-sidebar";
$sidebar_array['page_item_class'] = "twelve columns";
}else if( $sidebar == "both-sidebar" || $sidebar == "both-sidebar-reverse" ){
$sidebar_type = 'both-sidebar';
$sidebar_array['sidebar_class'] = "both-sidebar";
$sidebar_array['page_left_class'] = "page-left-both-sidebar";
$sidebar_array['page_item_class'] = "nine columns";
}
return $sidebar_array;
}
// Check if url is from which type of video
function get_video($url, $width = 640, $height = 360){
if( empty($width) && empty($height) ){ $width = 640; $height = 360; }
if(strpos($url,'youtube')){
get_youtube($url, $width, $height);
}else if(strpos($url,'youtu.be')){
get_youtube($url, $width, $height, 'youtu.be');
}else if(strpos($url,'vimeo')){
get_vimeo($url, $width, $height);
}
}
// Print HTML5 Video
function get_html5_video($video){
if( class_exists('JWP6_Shortcode') ){
echo JWP6_Shortcode::the_content_filter($video);
}
}
// Print youtube video
function get_youtube($url, $width = 640, $height = 360, $type = 'youtube', $return = false){
if( $type == 'youtube' ){
preg_match('/[\\?\\&]v=([^\\?\\&]+)/',$url,$id);
}else{
preg_match('/youtu.be\/([^\\?\\&]+)/', $url, $id);
}
$attr = "";
if( strpos($url, 'autoplay=1') > 0 ) $attr = "&autoplay=1";
if( strpos($url, 'rel=0') > 0 ) $attr = $attr . "&rel=0";
if( !$return ){
echo '';
}else{
return '';
}
}
// Print vimeo video
function get_vimeo($url, $width = 640, $height = 360, $return = false){
preg_match('/https?:\/\/vimeo.com\/(\d+)$/', $url, $id);
if( !$return ){
echo '';
}else{
return '';
}
}
// Print nivo slider
function print_nivo_slider($slider_xml, $size='940x360'){
if( empty($slider_xml) ) return;
global $gdl_element_id;
$caption_array = array();
$caption_num = 0;
echo '
';
echo '
';
foreach($slider_xml->childNodes as $slider){
$title = find_xml_value($slider, 'title');
$caption = html_entity_decode(find_xml_value($slider, 'caption'));
$link = find_xml_value($slider, 'link');
$link_type = find_xml_value($slider, 'linktype');
$comment = find_xml_value($slider, 'comment');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
if($link_type == 'Lightbox'){
$image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
echo '
';
}else if($link_type == 'Link to Video'){
echo '';
}else if($link_type != 'No Link'){
echo '';
}
echo '';
if($link_type != 'No Link'){
echo '';
}
}
echo "
"; // nivo slider
echo "
"; // nivo slider wrapper
for( $i=0; $i<$caption_num; $i++ ){
echo "";
$comment_class = (!empty($caption_array[$i]['comment']))? 'comment-on': '';
echo '"; // gdl-slider-caption-wrapper
if( !empty($caption_array[$i]['comment']) ){
echo '';
}
echo "
";
}
$gdl_element_id++;
}
// Print flex slider
function print_flex_slider($slider_xml, $size="940x360"){
if( empty($slider_xml) ) return;
global $gdl_element_id;
echo '';
echo '
';
foreach($slider_xml->childNodes as $slider){
$title = find_xml_value($slider, 'title');
$caption = html_entity_decode(find_xml_value($slider, 'caption'));
$link = find_xml_value($slider, 'link');
$link_type = find_xml_value($slider, 'linktype');
$comment = find_xml_value($slider, 'comment');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
echo '- ';
if($link_type == 'Lightbox'){
$image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
echo '';
}else if($link_type == 'Link to Video'){
echo '';
}else if($link_type != 'No Link'){
echo '';
}
echo '';
if( !empty($title) || !empty($caption) ){
$comment_class = (!empty($comment))? 'comment-on': '';
echo '
';
echo ''; // gdl-slider-caption-wrapper
if( !empty($comment) ){
echo '';
}
echo '
';
}
if($link_type != 'No Link'){
echo '';
}
echo ' ';
}
echo "
";
$gdl_element_id++;
echo "
"; // flex slider
}
// Print Stack Images
function print_stack_images($slider_xml, $size="940x360"){
if( empty($slider_xml) ) return;
global $gdl_element_id;
echo '';
foreach($slider_xml->childNodes as $slider){
$title = find_xml_value($slider, 'title');
$caption = html_entity_decode(find_xml_value($slider, 'caption'));
$link = find_xml_value($slider, 'link');
$link_type = find_xml_value($slider, 'linktype');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
echo '
';
}
$gdl_element_id++;
echo '
';
echo "
"; // stack-images-wrapper
}
// Print carousel slider
function print_carousel_slider($slider_xml, $size="940x360"){
if( empty($slider_xml) ) return;
global $gdl_element_id;
echo '';
echo '
';
foreach($slider_xml->childNodes as $slider){
$title = find_xml_value($slider, 'title');
$caption = html_entity_decode(find_xml_value($slider, 'caption'));
$link = find_xml_value($slider, 'link');
$link_type = find_xml_value($slider, 'linktype');
$comment = find_xml_value($slider, 'comment');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
echo '- ';
if($link_type == 'Lightbox'){
$image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
echo '';
}else if($link_type == 'Link to Video'){
echo '';
}else if($link_type != 'No Link'){
echo '';
}
echo '';
if( !empty($title) || !empty($caption) ){
echo '';
if( !empty($comment) ){
echo '';
}
echo '
';
echo '
';
if( !empty($title) ){
echo '
' . $title . '
';
}
if( !empty($caption) ){
echo '
'. $caption . '
';
}
echo '
';
echo '
';
}
if($link_type != 'No Link'){
echo '';
}
echo ' ';
}
echo "
";
$gdl_element_id++;
echo "
"; // flex slider
}
// Print anything slider
function print_anything_slider($slider_xml, $size='940x360'){
if( empty($slider_xml) ) return;
global $gdl_element_id;
echo '';
foreach($slider_xml->childNodes as $slider){
$title = find_xml_value($slider, 'title');
$caption = html_entity_decode(find_xml_value($slider, 'caption'));
$link = find_xml_value($slider, 'link');
$link_type = find_xml_value($slider, 'linktype');
$image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
$alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
echo '- ';
if($link_type == 'Link to Video'){
echo get_video($link, gdl_get_width($size), gdl_get_height($size));
}else{
if($link_type == 'Lightbox'){
$image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
echo '';
}else if($link_type != 'No Link'){
echo '';
}
echo '';
if(!empty($title) || !empty($caption)){
echo '
';
if( !empty($title) ){
echo '
' . $title . '
';
echo "
";
}
if( !empty($caption) ){
echo '
';
echo "
";
}
echo '
';
};
if($link_type != 'No Link'){
echo '';
}
}
echo ' ';
}
echo "
";
$gdl_element_id ++;
}
// send contact form email
add_action('wp_ajax_submit_contact_form','gdl_submit_contact_form');
add_action('wp_ajax_nopriv_submit_contact_form','gdl_submit_contact_form');
function gdl_submit_contact_form(){
global $gdl_admin_translator;
if( $gdl_admin_translator == 'enable' ){
$gdl_send_complete = get_option(THEME_SHORT_NAME.'_translator_contact_send_complete', 'The e-mail was sent successfully');
$gdl_send_error = get_option(THEME_SHORT_NAME.'_translator_contact_send_error', 'Message cannot be sent to destination');
}else{
$gdl_send_complete = __('The e-mail was sent successfully','gdl_front_end');
$gdl_send_error = __('Message cannot be sent to destination','gdl_front_end');
}
$return_data = array('success'=>'0');
if(empty($_POST)){
$return_data['value'] = 'Cannot send email to destination. No parameter receive form AJAX call.';
die ( json_encode($return_data) );
}
$name = $_POST['name'];
if(empty($name)){
$return_data['value'] = 'Please enter your name.';
die ( json_encode($return_data) );
}
$email = $_POST['email'];
if(empty($email)){
$return_data['value'] = 'Please enter a valid email address.';
die ( json_encode($return_data) );
}
$message = $_POST['message'];
if(empty($message)){
$return_data['value'] = 'Please enter message.';
die ( json_encode($return_data) );
}
$receiver = $_POST['receiver'];
$messages = "You have received a new contact form message. \n";
$messages = $messages . 'Name : ' . $name . " \n";
$messages = $messages . 'Email : ' . $email . " \n";
$messages = $messages . 'Message : ' . $message;
$header = "From: " . $name . " <" . $email . "> \r\n";
$header = $header . "To: " . $receiver . " \r\n";
$header = $header . 'Content-Type: text/plain; charset=UTF-8 ' . " \r\n";
if( wp_mail($receiver, 'New contact form received', $messages, $header) ){
$return_data['success'] = '1';
$return_data['value'] = $gdl_send_complete;
die( json_encode($return_data) );
}else{
$return_data['value'] = $gdl_send_error;
die( json_encode($return_data) );
}
}
?>
" . $caption_array[$i]['title'] . "
"; } if( !empty($caption_array[$i]['caption']) ){ echo "