/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animation' => 'no', 'address' => '', 'height' => '300px', 'icon' => '', 'infobox' => '', 'infobox_background_color' => '', 'infobox_content' => '', 'infobox_text_color' => '', 'map_style' => '', 'overlay_color' => '', 'popup' => 'yes', 'scale' => 'yes', 'scrollwheel' => 'yes', 'type' => 'roadmap', 'width' => '100%', 'zoom' => '14', 'zoom_pancontrol' => 'yes'), $args); extract($defaults); self::$args = $defaults; $html = ''; if ($address) { $addresses = explode('|', $address); if ($addresses) { self::$args['address'] = $addresses; } $num_of_addresses = count($addresses); if ($infobox_content) { $infobox_content_array = explode('|', $infobox_content); } else { $infobox_content_array = ''; } if ($icon) { $icon_array = explode('|', $icon); } else { $icon_array = ''; } if ($map_style == 'theme') { $map_style = 'custom'; $icon = 'theme'; $animation = 'yes'; $infobox = 'custom'; $infobox_background_color = FusionCore_Plugin::hex2rgb($smof_data['primary_color']); $infobox_background_color = 'rgba(' . $infobox_background_color[0] . ', ' . $infobox_background_color[1] . ', ' . $infobox_background_color[2] . ', 0.8)'; $overlay_color = $smof_data['primary_color']; $brightness_level = FusionCore_Plugin::calc_color_brightness($smof_data['primary_color']); if ($brightness_level > 140) { $infobox_text_color = '#fff'; } else { $infobox_text_color = '#747474'; } } // If only one custom icon is set, use it for all markers if ($map_style == 'custom' && $icon && $icon != 'theme' && $icon_array && count($icon_array) == 1) { $icon_url = $icon_array[0]; for ($i = 0; $i < $num_of_addresses; $i++) { $icon_array[$i] = $icon_url; } } if ($icon == 'theme' && $map_style == 'custom') { for ($i = 0; $i < $num_of_addresses; $i++) { $icon_array[$i] = plugins_url('images/avada_map_marker.png', dirname(__FILE__)); } } if (wp_script_is('google-maps-api', 'registered')) { wp_print_scripts('google-maps-api'); } if (wp_script_is('google-maps-infobox', 'registered')) { wp_print_scripts('google-maps-infobox'); } foreach (self::$args['address'] as $add) { $add = trim($add); $add_arr = explode("\n", $add); $add_arr = array_filter($add_arr, 'trim'); $add = implode('<br/>', $add_arr); $add = str_replace("\r", '', $add); $add = str_replace("\n", '', $add); $coordinates[]['address'] = $add; } if (!is_array($coordinates)) { return; } for ($i = 0; $i < $num_of_addresses; $i++) { if (strpos(self::$args['address'][$i], 'latlng=') === 0) { self::$args['address'][$i] = $coordinates[$i]['address']; } } if (is_array($infobox_content_array) && !empty($infobox_content_array)) { for ($i = 0; $i < $num_of_addresses; $i++) { if (!array_key_exists($i, $infobox_content_array)) { $infobox_content_array[$i] = self::$args['address'][$i]; } } self::$args['infobox_content'] = $infobox_content_array; } else { self::$args['infobox_content'] = self::$args['address']; } $cached_addresses = get_option('fusion_map_addresses'); foreach (self::$args['address'] as $key => $address) { $json_addresses[] = array('address' => $address, 'infobox_content' => html_entity_decode(self::$args['infobox_content'][$key])); if (isset($icon_array) && is_array($icon_array) && array_key_exists($key, $icon_array)) { $json_addresses[$key]['marker'] = $icon_array[$key]; } if (strpos($address, strtolower('latlng=')) !== false) { $json_addresses[$key]['address'] = str_replace('latlng=', '', $address); $latLng = explode(',', $json_addresses[$key]['address']); $json_addresses[$key]['coordinates'] = true; $json_addresses[$key]['latitude'] = $latLng[0]; $json_addresses[$key]['longitude'] = $latLng[1]; $json_addresses[$key]['cache'] = false; if (strpos(self::$args['infobox_content'][$key], strtolower('latlng=')) !== false) { $json_addresses[$key]['infobox_content'] = ''; } if (isset($cached_addresses[trim($json_addresses[$key]['latitude'] . ',' . $json_addresses[$key]['longitude'])])) { $json_addresses[$key]['geocoded_address'] = $cached_addresses[trim($json_addresses[$key]['latitude'] . ',' . $json_addresses[$key]['longitude'])]['address']; $json_addresses[$key]['cache'] = true; } } else { $json_addresses[$key]['coordinates'] = false; $json_addresses[$key]['cache'] = false; if (isset($cached_addresses[trim($json_addresses[$key]['address'])])) { $json_addresses[$key]['latitude'] = $cached_addresses[trim($json_addresses[$key]['address'])]['latitude']; $json_addresses[$key]['longitude'] = $cached_addresses[trim($json_addresses[$key]['address'])]['longitude']; $json_addresses[$key]['cache'] = true; } } } $json_addresses = json_encode($json_addresses); $map_id = uniqid('fusion_map_'); // generate a unique ID for this map $this->map_id = $map_id; ob_start(); ?> <script type="text/javascript"> var map_<?php echo $map_id; ?> ; var markers = []; var counter = 0; function fusion_run_map_<?php echo $map_id; ?> () { jQuery('#<?php echo $map_id; ?> ').fusion_maps({ addresses: <?php echo $json_addresses; ?> , animations: <?php echo $animation == 'yes' ? 'true' : 'false'; ?> , infobox_background_color: '<?php echo $infobox_background_color; ?> ', infobox_styling: '<?php echo $infobox; ?> ', infobox_text_color: '<?php echo $infobox_text_color; ?> ', map_style: '<?php echo $map_style; ?> ', map_type: '<?php echo $type; ?> ', marker_icon: '<?php echo $icon; ?> ', overlay_color: '<?php echo $overlay_color; ?> ', overlay_color_hsl: <?php echo json_encode(FusionCore_Plugin::rgb2hsl($overlay_color)); ?> , pan_control: <?php echo $zoom_pancontrol == 'yes' ? 'true' : 'false'; ?> , show_address: <?php echo $popup == 'yes' ? 'true' : 'false'; ?> , scale_control: <?php echo $scale == 'yes' ? 'true' : 'false'; ?> , scrollwheel: <?php echo $scrollwheel == 'yes' ? 'true' : 'false'; ?> , zoom: <?php echo $zoom; ?> , zoom_control: <?php echo $zoom_pancontrol == 'yes' ? 'true' : 'false'; ?> , }); } google.maps.event.addDomListener(window, 'load', fusion_run_map_<?php echo $map_id; ?> ); </script> <?php if ($defaults['id']) { $html = ob_get_clean() . sprintf('<div id="%s"><div %s></div></div>', $defaults['id'], FusionCore_Plugin::attributes('google-map-shortcode')); } else { $html = ob_get_clean() . sprintf('<div %s></div>', FusionCore_Plugin::attributes('google-map-shortcode')); } } return $html; }
/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'lightbox' => 'no', 'linktarget' => '_self', 'name' => '', 'social_icon_boxed' => strtolower($smof_data['social_links_boxed']), 'social_icon_boxed_colors' => strtolower($smof_data['social_links_box_color']), 'social_icon_boxed_radius' => strtolower($smof_data['social_links_boxed_radius']), 'social_icon_colors' => strtolower($smof_data['social_links_icon_color']), 'social_icon_order' => '', 'social_icon_tooltip' => strtolower($smof_data['social_links_tooltip_placement']), 'pic_bordercolor' => strtolower($smof_data['person_border_color']), 'pic_bordersize' => strtolower($smof_data['person_border_size']), 'pic_link' => '', 'pic_style' => 'none', 'pic_style_color' => strtolower($smof_data['person_style_color']), 'picture' => '', 'title' => '', 'facebook' => '', 'twitter' => '', 'instagram' => '', 'linkedin' => '', 'dribbble' => '', 'rss' => '', 'youtube' => '', 'pinterest' => '', 'flickr' => '', 'vimeo' => '', 'tumblr' => '', 'google' => '', 'googleplus' => '', 'digg' => '', 'blogger' => '', 'skype' => '', 'myspace' => '', 'deviantart' => '', 'yahoo' => '', 'reddit' => '', 'forrst' => '', 'paypal' => '', 'dropbox' => '', 'soundcloud' => '', 'vk' => '', 'email' => ''), $args); extract($defaults); self::$args = $defaults; if ($smof_data['social_icons_new']) { self::$args['linktarget'] == '_blank'; } else { self::$args['linktarget'] == '_self'; } self::$args['styles'] = ''; $rgb = FusionCore_Plugin::hex2rgb($defaults['pic_style_color']); if ($pic_style == 'glow') { self::$args['styles'] .= "-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } if ($pic_style == 'dropshadow') { self::$args['styles'] .= "\n\t\t\t\t-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } $inner_content = ''; if ($picture) { $picture = sprintf('<img %s />', FusionCore_Plugin::attributes('person-shortcode-img')); if ($pic_link) { $picture = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('person-shortcode-href'), $picture); } $picture = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('person-shortcode-image-wrapper'), FusionCore_Plugin::attributes('person-shortcode-image-container'), $picture); } if ($name || $title || $content) { $social_networks = $this->get_social_links_array(); if (!is_array($social_icon_order)) { $social_icon_order = explode('|', $social_icon_order); } //$social_networks = FusionCore_Plugin::order_array_like_array( $social_networks, $social_icon_order ); $social_icon_colors = explode('|', $social_icon_colors); $num_of_icon_colors = count($social_icon_colors); $social_icon_boxed_colors = explode('|', $social_icon_boxed_colors); $num_of_box_colors = count($social_icon_boxed_colors); $icons = ''; if (isset($smof_data['social_sorter']) && $smof_data['social_sorter']) { $order = $smof_data['social_sorter']; $ordered_array = explode(',', $order); if (isset($ordered_array) && $ordered_array && is_array($ordered_array)) { $social_networks_old = $social_networks; $social_networks = array(); foreach ($ordered_array as $key => $field_order) { $field_order_number = str_replace('social_sorter_', '', $field_order); $find_the_field = $smof_data['social_sorter_' . $field_order_number]; $field_name = str_replace('_link', '', $smof_data['social_sorter_' . $field_order_number]); if ($field_name == 'google') { $field_name = 'googleplus'; } elseif ($field_name == 'email') { $field_name = 'mail'; } if (!isset($social_networks_old[$field_name])) { continue; } $social_networks[$field_name] = $social_networks_old[$field_name]; } } } for ($i = 0; $i < count($social_networks); $i++) { if ($num_of_icon_colors == 1) { $social_icon_colors[$i] = $social_icon_colors[0]; } if ($num_of_box_colors == 1) { $social_icon_boxed_colors[$i] = $social_icon_boxed_colors[0]; } } $i = 0; foreach ($social_networks as $network => $link) { $icon_options = array('social_network' => $network, 'social_link' => $link, 'icon_color' => $i < count($social_icon_colors) ? $social_icon_colors[$i] : '', 'box_color' => $i < count($social_icon_boxed_colors) ? $social_icon_boxed_colors[$i] : ''); $icons .= sprintf('<a %s></a>', FusionCore_Plugin::attributes('person-shortcode-icon', $icon_options)); $i++; } $inner_content .= sprintf('<div %s><div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s>%s</div></div><div %s>%s</div></div>', FusionCore_Plugin::attributes('person-desc'), FusionCore_Plugin::attributes('person-shortcode-author'), FusionCore_Plugin::attributes('person-author-wrapper'), FusionCore_Plugin::attributes('person-name'), $name, FusionCore_Plugin::attributes('person-title'), $title, FusionCore_Plugin::attributes('person-shortcode-social-networks'), $icons, FusionCore_Plugin::attributes('person-content fusion-clearfix'), do_shortcode($content)); } $html = sprintf('<div %s>%s%s</div>', FusionCore_Plugin::attributes('person-shortcode'), $picture, $inner_content); return $html; }
/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'animation' => 'no', 'address' => '', 'height' => '300px', 'icon' => '', 'infobox' => '', 'infobox_background_color' => '', 'infobox_content' => '', 'infobox_text_color' => '', 'map_style' => '', 'overlay_color' => '', 'popup' => 'yes', 'scale' => 'yes', 'scrollwheel' => 'yes', 'type' => 'roadmap', 'width' => '100%', 'zoom' => '14', 'zoom_pancontrol' => 'yes'), $args); extract($defaults); self::$args = $defaults; $html = ''; if ($address) { $addresses = explode('|', $address); if ($infobox_content) { $infobox_content_array = explode('|', $infobox_content); } else { $infobox_content_array = ''; } if ($icon) { $icon_array = explode('|', $icon); } else { $icon_array = ''; } if ($addresses) { self::$args['address'] = $addresses; } $num_of_addresses = count($addresses); if ($map_style == 'theme') { $map_style = 'custom'; $icon = 'theme'; $animation = 'yes'; $infobox = 'custom'; $infobox_background_color = FusionCore_Plugin::hex2rgb($smof_data['primary_color']); $infobox_background_color = 'rgba(' . $infobox_background_color[0] . ', ' . $infobox_background_color[1] . ', ' . $infobox_background_color[2] . ', 0.8)'; $overlay_color = $smof_data['primary_color']; $brightness_level = FusionCore_Plugin::calc_color_brightness($smof_data['primary_color']); if ($brightness_level > 140) { $infobox_text_color = '#fff'; } else { $infobox_text_color = '#747474'; } } if ($map_style == 'custom') { $animation = 'yes'; } if ($icon == 'theme' && $map_style == 'custom') { for ($i = 0; $i < $num_of_addresses; $i++) { $icon_array[$i] = plugins_url('images/avada_map_marker.png', dirname(__FILE__)); } } wp_print_scripts('google-maps-api'); wp_print_scripts('google-maps-infobox'); foreach (self::$args['address'] as $add) { $coordinates[] = $this->get_coordinates($add); } if (!is_array($coordinates)) { return; } for ($i = 0; $i < $num_of_addresses; $i++) { if (strpos(self::$args['address'][$i], 'latlng=') === 0) { self::$args['address'][$i] = $coordinates[$i]['address']; } } if (is_array($infobox_content_array) && !empty($infobox_content_array)) { for ($i = 0; $i < $num_of_addresses; $i++) { if (!array_key_exists($i, $infobox_content_array)) { $infobox_content_array[$i] = self::$args['address'][$i]; } } self::$args['infobox_content'] = $infobox_content_array; } else { self::$args['infobox_content'] = self::$args['address']; } $map_id = uniqid('fusion_map_'); // generate a unique ID for this map $this->map_id = $map_id; ob_start(); ?> <script type="text/javascript"> var map_<?php echo $map_id; ?> ; var markers = []; var counter = 0; function fusion_run_map_<?php echo $map_id; ?> () { var location = new google.maps.LatLng(<?php echo $coordinates[0]['lat']; ?> , <?php echo $coordinates[0]['lng']; ?> ); var map_options = { zoom: <?php echo $zoom; ?> , center: location, mapTypeId: google.maps.MapTypeId.<?php echo strtoupper($type); ?> , scrollwheel: <?php echo $scrollwheel == 'yes' ? 'true' : 'false'; ?> , scaleControl: <?php echo $scale == 'yes' ? 'true' : 'false'; ?> , panControl: <?php echo $zoom_pancontrol == 'yes' ? 'true' : 'false'; ?> , zoomControl: <?php echo $zoom_pancontrol == 'yes' ? 'true' : 'false'; ?> }; map_<?php echo $map_id; ?> = new google.maps.Map(document.getElementById("<?php echo esc_attr($map_id); ?> "), map_options); <?php $i = 0; ?> <?php foreach ($coordinates as $key => $coordinate) { $infobox_content = trim(self::$args['infobox_content'][$key]); $infobox_content_arr = explode("\n", $infobox_content); $infobox_content_arr = array_filter($infobox_content_arr, 'trim'); $infobox_content = implode('', $infobox_content_arr); $infobox_content = str_replace("\r", '', $infobox_content); $infobox_content = str_replace("\n", '', $infobox_content); ?> var content_string = "<div class='info-window'><?php echo $infobox_content; ?> </div>"; <?php if ($overlay_color && $map_style == 'custom') { $hsl = FusionCore_Plugin::rgb2hsl($overlay_color); ?> var styles = [ { stylers: [ { hue: '<?php echo $overlay_color; ?> ' }, <?php if (self::$args['map_style'] == 'custom') { ?> { saturation: '<?php echo $hsl['sat'] * 2 - 100; ?> ' }, { lightness: '<?php echo $hsl['lum'] * 2 - 100; ?> ' } <?php } elseif (self::$args['map_style'] == 'theme') { ?> { saturation: '-20' }, <?php } ?> ] },{ featureType: "road", elementType: "geometry", stylers: [ { visibility: "simplified" } ] },{ featureType: "road", elementType: "labels", } ]; map_<?php echo $map_id; ?> .setOptions({styles: styles}); <?php } ?> map_<?php echo $map_id; ?> _args = { position: new google.maps.LatLng("<?php echo $coordinate['lat']; ?> ", "<?php echo $coordinate['lng']; ?> "), map: map_<?php echo $map_id; ?> }; <?php if ($animation == 'yes') { ?> map_<?php echo $map_id; ?> _args.animation = google.maps.Animation.DROP; <?php } ?> <?php if ($icon == 'theme' && isset($icon_array[$i]) && $icon_array[$i] && $map_style == 'custom') { ?> map_<?php echo $map_id; ?> _args.icon = new google.maps.MarkerImage( '<?php echo $icon_array[$i]; ?> ', null, null, null, new google.maps.Size( 37, 55 ) ); <?php } else { if (isset($icon_array[$i]) && $icon_array[$i] && $map_style == 'custom') { ?> map_<?php echo $map_id; ?> _args.icon = '<?php echo $icon_array[$i]; ?> '; <?php } } ?> <?php $i++; ?> markers[counter] = new google.maps.Marker(map_<?php echo $map_id; ?> _args); <?php if ($infobox == 'custom' && $map_style == 'custom') { ?> var info_box_div = document.createElement('div'); info_box_div.className = 'fusion-info-box'; info_box_div.style.cssText = 'background-color:<?php echo $infobox_background_color; ?> ;color:<?php echo $infobox_text_color; ?> ;'; info_box_div.innerHTML = content_string; var info_box_options = { content: info_box_div ,disableAutoPan: false ,maxWidth: 150 ,pixelOffset: new google.maps.Size(-125, 10) ,zIndex: null ,boxStyle: { background: 'none' ,opacity: 1 ,width: "250px" } ,closeBoxMargin: "2px 2px 2px 2px" ,closeBoxURL: "<?php echo is_ssl() ? 'https' : 'http'; ?> ://www.google.com/intl/en_us/mapfiles/close.gif" ,infoBoxClearance: new google.maps.Size(1, 1) }; markers[counter]['infowindow'] = new InfoBox(info_box_options); markers[counter]['infowindow'].open(map_<?php echo $map_id; ?> , markers[counter]); <?php if ($popup != 'yes') { ?> markers[counter]['infowindow'].setVisible( false ); <?php } ?> google.maps.event.addListener(markers[counter], 'click', function() { if( this['infowindow'].getVisible() ) { this['infowindow'].setVisible( false ); } else { this['infowindow'].setVisible( true ); } }); <?php } else { ?> markers[counter]['infowindow'] = new google.maps.InfoWindow({ content: content_string }); <?php if ($popup == 'yes') { ?> markers[counter]['infowindow'].show = true; markers[counter]['infowindow'].open(map_<?php echo $map_id; ?> , markers[counter]); <?php } ?> google.maps.event.addListener(markers[counter], 'click', function() { if(this['infowindow'].show) { this['infowindow'].close(map_<?php echo $map_id; ?> , this); this['infowindow'].show = false; } else { this['infowindow'].open(map_<?php echo $map_id; ?> , this); this['infowindow'].show = true; } }); <?php } ?> counter++; <?php } ?> } google.maps.event.addDomListener(window, 'load', fusion_run_map_<?php echo $map_id; ?> ); </script> <?php if ($defaults['id']) { $html = ob_get_clean() . sprintf('<div id="%s"><div %s></div></div>', $defaults['id'], FusionCore_Plugin::attributes('google-map-shortcode')); } else { $html = ob_get_clean() . sprintf('<div %s></div>', FusionCore_Plugin::attributes('google-map-shortcode')); } } return $html; }
/** * Render the parent shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render_parent($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'name' => ''), $args); extract($defaults); self::$parent_args = $defaults; ob_start(); $term = $name; $term_details = get_term_by('slug', $term, 'slide-page'); if (!$term_details) { return do_shortcode('[alert type="error" border_size="1px" box_shadow="yes"]Incorrect slider name. Please make sure to use a valid slider slug.[/alert]'); } $slider_settings = get_option('taxonomy_' . $term_details->term_id); self::$slider_settings = $slider_settings; $args = array('post_type' => 'slide', 'posts_per_page' => -1, 'suppress_filters' => 0); $args['tax_query'][] = array('taxonomy' => 'slide-page', 'field' => 'slug', 'terms' => $term); $query = new WP_Query($args); if ($query->have_posts()) { ?> <div <?php echo FusionCore_Plugin::attributes('fusion-slider-wrapper'); ?> > <div class="fusion-slider-loading"><?php _e('Loading...', 'fusion-core'); ?> </div> <div <?php echo FusionCore_Plugin::attributes('fusion-slider-container'); ?> > <ul class="slides"> <?php while ($query->have_posts()) { $query->the_post(); $metadata = get_metadata('post', get_the_ID()); $background_image = ''; $background_class = ''; $img_width = ''; if (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'image' && has_post_thumbnail()) { $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id, 'full', true); $background_image = 'background-image: url(' . $image_url[0] . ');'; $background_class = 'background-image'; $img_width = $image_url[1]; } $video_attributes = ''; $youtube_attributes = ''; $vimeo_attributes = ''; $data_mute = 'no'; $data_loop = 'no'; $data_autoplay = 'no'; if (isset($metadata['pyre_mute_video'][0]) && $metadata['pyre_mute_video'][0] == 'yes') { $video_attributes = 'muted'; $data_mute = 'yes'; } if (isset($metadata['pyre_autoplay_video'][0]) && $metadata['pyre_autoplay_video'][0] == 'yes') { $video_attributes .= ' autoplay'; $youtube_attributes .= '&autoplay=0'; $vimeo_attributes .= '&autoplay=0'; $data_autoplay = 'yes'; } if (isset($metadata['pyre_loop_video'][0]) && $metadata['pyre_loop_video'][0] == 'yes') { $video_attributes .= ' loop'; $youtube_attributes .= '&loop=1&playlist=' . $metadata['pyre_youtube_id'][0]; $vimeo_attributes .= '&loop=1'; $data_loop = 'yes'; } if (isset($metadata['pyre_hide_video_controls'][0]) && $metadata['pyre_hide_video_controls'][0] == 'no') { $video_attributes .= ' controls'; $youtube_attributes .= '&controls=1'; $video_zindex = 'z-index: 1;'; } else { $youtube_attributes .= '&controls=0'; $video_zindex = 'z-index: -99;'; } $heading_color = ''; if (isset($metadata['pyre_heading_color'][0]) && $metadata['pyre_heading_color'][0]) { $heading_color = 'color:' . $metadata['pyre_heading_color'][0] . ';'; } $heading_bg = ''; if (isset($metadata['pyre_heading_bg'][0]) && $metadata['pyre_heading_bg'][0] == 'yes') { $heading_bg = 'background-color: rgba(0,0,0, 0.4);'; } $caption_color = ''; if (isset($metadata['pyre_caption_color'][0]) && $metadata['pyre_caption_color'][0]) { $caption_color = 'color:' . $metadata['pyre_caption_color'][0] . ';'; } $caption_bg = ''; if (isset($metadata['pyre_caption_bg'][0]) && $metadata['pyre_caption_bg'][0] == 'yes') { $caption_bg = 'background-color: rgba(0, 0, 0, 0.4);'; } $video_bg_color = ''; if (isset($metadata['pyre_video_bg_color'][0]) && $metadata['pyre_video_bg_color'][0]) { $video_bg_color_hex = FusionCore_Plugin::hex2rgb($metadata['pyre_video_bg_color'][0]); $video_bg_color = 'background-color: rgba(' . $video_bg_color_hex[0] . ', ' . $video_bg_color_hex[1] . ', ' . $video_bg_color_hex[2] . ', 0.4);'; } $video = false; if (isset($metadata['pyre_type'][0])) { if (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'self-hosted-video' || $metadata['pyre_type'][0] == 'youtube' || $metadata['pyre_type'][0] == 'vimeo') { $video = true; } } if (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'self-hosted-video') { $background_class = 'self-hosted-video-bg'; } $heading_font_size = 'font-size:60px;line-height:80px;'; if (isset($metadata['pyre_heading_font_size'][0]) && $metadata['pyre_heading_font_size'][0]) { $line_height = $metadata['pyre_heading_font_size'][0] * 1.4; $heading_font_size = 'font-size:' . $metadata['pyre_heading_font_size'][0] . 'px;line-height:' . $line_height . 'px;'; } $caption_font_size = 'font-size: 24px;line-height:38px;'; if (isset($metadata['pyre_caption_font_size'][0]) && $metadata['pyre_caption_font_size'][0]) { $line_height = $metadata['pyre_caption_font_size'][0] * 1.4; $caption_font_size = 'font-size:' . $metadata['pyre_caption_font_size'][0] . 'px;line-height:' . $line_height . 'px;'; } ?> <li data-mute="<?php echo $data_mute; ?> " data-loop="<?php echo $data_loop; ?> " data-autoplay="<?php echo $data_autoplay; ?> "> <div class="slide-content-container slide-content-<?php echo $metadata['pyre_content_alignment'][0]; ?> "> <div class="slide-content"> <?php if (isset($metadata['pyre_heading'][0]) && $metadata['pyre_heading'][0]) { ?> <div class="heading animated fadeInUp <?php if ($heading_bg) { echo 'with-bg'; } ?> " data-animationtype="fadeInUp" data-animationduration="1"><h2 style="<?php echo $heading_bg; echo $heading_color; echo $heading_font_size; ?> "><?php echo $metadata['pyre_heading'][0]; ?> </h2></div> <?php } ?> <?php if (isset($metadata['pyre_caption'][0]) && $metadata['pyre_caption'][0]) { ?> <div class="caption animated fadeInUp <?php if ($caption_bg) { echo 'with-bg'; } ?> " data-animationtype="fadeInUp" data-animationduration="1"><h3 style="<?php echo $caption_bg; echo $caption_color; echo $caption_font_size; ?> "><?php echo $metadata['pyre_caption'][0]; ?> </h3></div> <?php } ?> <?php if (isset($metadata['pyre_link_type'][0]) && $metadata['pyre_link_type'][0] == 'button') { ?> <div class="buttons animated fadeInUp" data-animationtype="fadeInUp" data-animationduration="1"> <?php if (isset($metadata['pyre_button_1'][0]) && $metadata['pyre_button_1'][0]) { echo '<div class="tfs-button-1">' . do_shortcode($metadata['pyre_button_1'][0]) . '</div>'; } if (isset($metadata['pyre_button_2'][0]) && $metadata['pyre_button_2'][0]) { echo '<div class="tfs-button-2">' . do_shortcode($metadata['pyre_button_2'][0]) . '</div>'; } ?> </div> <?php } ?> </div> </div> <?php if (isset($metadata['pyre_link_type'][0]) && $metadata['pyre_link_type'][0] == 'full' && isset($metadata['pyre_slide_link'][0]) && $metadata['pyre_slide_link'][0]) { ?> <a href="<?php echo $metadata['pyre_slide_link'][0]; ?> " class="overlay-link"></a> <?php } ?> <?php if (isset($metadata['pyre_preview_image'][0]) && $metadata['pyre_preview_image'][0]) { ?> <div class="mobile_video_image" style="background-image: url(<?php echo $metadata['pyre_preview_image'][0]; ?> );"></div> <?php } elseif (isset($metadata['pyre_type'][0]) && $metadata['pyre_type'][0] == 'self-hosted-video') { ?> <div class="mobile_video_image" style="background-image: url(<?php echo bloginfo('template_directory'); ?> /images/video_preview.jpg);"></div> <?php } ?> <?php if ($video_bg_color && $video == true) { ?> <div class="overlay" style="<?php echo $video_bg_color; ?> "></div> <?php } ?> <div class="background <?php echo $background_class; ?> " style="<?php echo $background_image; ?> width:<?php echo $slider_settings['slider_width']; ?> ;height:<?php echo $slider_settings['slider_height']; ?> ;" data-imgwidth="<?php echo $img_width; ?> "> <?php if (isset($metadata['pyre_type'][0])) { if ($metadata['pyre_type'][0] == 'self-hosted-video' && ($metadata['pyre_webm'][0] || $metadata['pyre_mp4'][0] || $metadata['pyre_ogg'][0])) { ?> <video width="1800" height="700" <?php echo $video_attributes; ?> preload="auto"> <?php if ($metadata['pyre_mp4'][0]) { ?> <source src="<?php echo $metadata['pyre_mp4'][0]; ?> " type="video/mp4"> <?php } ?> <?php if ($metadata['pyre_ogg'][0]) { ?> <source src="<?php echo $metadata['pyre_ogg'][0]; ?> " type="video/ogg"> <?php } ?> <?php if ($metadata['pyre_webm'][0]) { ?> <source src="<?php echo $metadata['pyre_webm'][0]; ?> " type="video/webm"> <?php } ?> </video> <?php } } ?> <?php if (isset($metadata['pyre_type'][0]) && isset($metadata['pyre_youtube_id'][0]) && $metadata['pyre_type'][0] == 'youtube' && $metadata['pyre_youtube_id'][0]) { ?> <div style="position: absolute; top: 0; left: 0; <?php echo $video_zindex; ?> width: 100%; height: 100%"> <iframe frameborder="0" height="100%" width="100%" src="http<?php echo is_ssl() ? 's' : ''; ?> ://www.youtube.com/embed/<?php echo $metadata['pyre_youtube_id'][0]; ?> ?modestbranding=1&showinfo=0&autohide=1&enablejsapi=1&rel=0<?php echo $youtube_attributes; ?> "></iframe> </div> <?php } ?> <?php if (isset($metadata['pyre_type'][0]) && isset($metadata['pyre_vimeo_id'][0]) && $metadata['pyre_type'][0] == 'vimeo' && $metadata['pyre_vimeo_id'][0]) { ?> <div style="position: absolute; top: 0; left: 0; <?php echo $video_zindex; ?> width: 100%; height: 100%"> <iframe src="https://player.vimeo.com/video/<?php echo $metadata['pyre_vimeo_id'][0]; ?> ?title=0&byline=0&portrait=0&color=ffffff&badge=0&title=0<?php echo $vimeo_attributes; ?> " height="100%" width="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> <?php } ?> </div> </li> <?php } wp_reset_query(); ?> </ul> </div> </div> <?php } $html = ob_get_clean(); return $html; }
/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'align' => '', 'bordercolor' => '', 'borderradius' => $smof_data['imageframe_border_radius'], 'bordersize' => $smof_data['imageframe_border_size'], 'lightbox' => 'no', 'link' => '', 'linktarget' => '_self', 'style' => '', 'style_type' => 'none', 'stylecolor' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args); if (!$defaults['style']) { $defaults['style'] = $defaults['style_type']; } if ($defaults['borderradius'] && $defaults['style'] == 'bottomshadow') { $defaults['borderradius'] = '0'; } if ($defaults['borderradius'] == 'round') { $defaults['borderradius'] = '50%'; } extract($defaults); self::$args = $defaults; if (!$bordercolor) { $bordercolor = $smof_data['imgframe_border_color']; } if (!$stylecolor) { $stylecolor = $smof_data['imgframe_style_color']; } $rgb = FusionCore_Plugin::hex2rgb($stylecolor); $styles = ''; if ($bordersize != '0' && $bordersize != '0px') { $styles .= ".imageframe-{$this->imageframe_counter} img{border:{$bordersize} solid {$bordercolor};}"; } if ($borderradius != '0' && $borderradius != '0px') { $styles .= ".imageframe-{$this->imageframe_counter} img{-webkit-border-radius:{$borderradius};-moz-border-radius:{$borderradius};border-radius:{$borderradius};}"; } if ($style == 'glow') { $styles .= ".imageframe-{$this->imageframe_counter}.imageframe-glow img{\n\t\t\t\t-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t}"; } if ($style == 'dropshadow') { $styles .= ".imageframe-{$this->imageframe_counter}.imageframe-dropshadow img{\n\t\t\t\t-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\t-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t\tbox-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\n\t\t\t}"; } if ($styles) { $styles = sprintf('<style type="text/css">%s</style>', $styles); } else { $styles = ''; } $html = sprintf('%s<span %s>', $styles, FusionCore_Plugin::attributes('imageframe-shortcode')); preg_match('/(class=["\'](.*?)["\'])/', $content, $classes); $class_style = ''; if ($style == 'circle') { $class_style = ' img-circle'; } if ($classes) { $content = str_replace($classes[0], sprintf('class="img-responsive %s%s"', $classes[2], $class_style), $content); } else { $content = str_replace('/>', sprintf('class="img-responsive%s" />', $class_style), $content); } $alt_tag = $image_url = ''; preg_match('/(src=["\'](.*?)["\'])/', $content, $src); $image_url = self::$args['pic_link'] = $src[2]; $image_id = FusionCore_Plugin::get_attachment_id_from_url($image_url); if (isset($image_id) && $image_id) { $alt_tag = sprintf('alt="%s"', get_post_meta($image_id, '_wp_attachment_image_alt', true)); } if (strpos($content, 'alt=""') !== false && $alt_tag) { $content = str_replace('alt=""', $alt_tag, $content); } elseif (strpos($content, 'alt') === false && $alt_tag) { $content = str_replace('/> ', $alt_tag . ' />', $content); } $output = do_shortcode($content); if ($lightbox == 'yes') { self::$args['title_attr'] = ''; if ($image_id) { self::$args['title_attr'] = get_post_field('post_excerpt', $image_id); } $output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content)); } elseif ($link) { $output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content)); } $html .= $output . '</span>'; if ($align == 'center') { $html = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('imageframe-align-center'), $html); } $this->imageframe_counter++; return $html; }
/** * Render the shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'align' => '', 'bordercolor' => '', 'borderradius' => $smof_data['imageframe_border_radius'], 'bordersize' => $smof_data['imageframe_border_size'], 'hide_on_mobile' => 'no', 'lightbox' => 'no', 'lightbox_image' => '', 'link' => '', 'linktarget' => '_self', 'style' => '', 'style_type' => 'none', 'stylecolor' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args); if (!$defaults['style']) { $defaults['style'] = $defaults['style_type']; } if ($defaults['borderradius'] && $defaults['style'] == 'bottomshadow') { $defaults['borderradius'] = '0'; } if ($defaults['borderradius'] == 'round') { $defaults['borderradius'] = '50%'; } extract($defaults); self::$args = $defaults; // Add the needed styles to the img tag if (!$bordercolor) { $bordercolor = $smof_data['imgframe_border_color']; } if (!$stylecolor) { $stylecolor = $smof_data['imgframe_style_color']; } $rgb = FusionCore_Plugin::hex2rgb($stylecolor); $img_styles = ''; if ($bordersize != '0' && $bordersize != '0px') { $img_styles .= "border:{$bordersize} solid {$bordercolor};"; } if ($borderradius != '0' && $borderradius != '0px') { $img_styles .= "-webkit-border-radius:{$borderradius};-moz-border-radius:{$borderradius};border-radius:{$borderradius};"; } if ($style == 'glow') { $img_styles .= "-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } if ($style == 'dropshadow') { $img_styles .= "-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } if ($img_styles) { $img_styles = sprintf(' style="%s"', $img_styles); } $img_classes = 'img-responsive'; // Get custom classes from the img tag preg_match('/(class=["\'](.*?)["\'])/', $content, $classes); if (!empty($classes)) { $img_classes .= ' ' . $classes[2]; } $img_classes = sprintf('class="%s"', $img_classes); // Add custom and responsive class and the needed styles to the img tag if (!empty($classes)) { $content = str_replace($classes[0], $img_classes . $img_styles, $content); } else { $content = str_replace('/>', $img_classes . $img_styles . '/>', $content); } // Alt tag $alt_tag = $image_url = ''; preg_match('/(src=["\'](.*?)["\'])/', $content, $src); if (array_key_exists('2', $src)) { $image_url = self::$args['pic_link'] = $src[2]; $image_id = FusionCore_Plugin::get_attachment_id_from_url($image_url); if (isset($image_id) && $image_id) { $alt_tag = sprintf('alt="%s"', get_post_field('_wp_attachment_image_alt', $image_id)); } if (strpos($content, 'alt=""') !== false && $alt_tag) { $content = str_replace('alt=""', $alt_tag, $content); } elseif (strpos($content, 'alt') === false && $alt_tag) { $content = str_replace('/> ', $alt_tag . ' />', $content); } } // Set the lightbox image to the dedicated linkm if it is set if ($lightbox_image) { self::$args['pic_link'] = $lightbox_image; } $output = do_shortcode($content); if ($lightbox == 'yes') { self::$args['data_caption'] = ''; self::$args['data_title'] = ''; if ($image_id) { self::$args['data_caption'] = get_post_field('post_excerpt', $image_id); self::$args['data_title'] = get_post_field('post_title', $image_id); } $output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content)); } elseif ($link) { $output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content)); } $html = sprintf('<span %s>%s</span>', FusionCore_Plugin::attributes('imageframe-shortcode'), $output); if ($align == 'center') { $html = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('imageframe-align-center'), $html); } $this->imageframe_counter++; return $html; }
function attr() { global $smof_data; $attr = array(); $attr['style'] = ''; $bordercolor = self::$args['bordercolor']; $stylecolor = self::$args['stylecolor']; $bordersize = self::$args['bordersize']; $borderradius = self::$args['borderradius']; $style = self::$args['style']; // Add the needed styles to the img tag if (!$bordercolor) { $bordercolor = $smof_data['imgframe_border_color']; } if (!$stylecolor) { $stylecolor = $smof_data['imgframe_style_color']; } $rgb = FusionCore_Plugin::hex2rgb($stylecolor); $img_styles = ''; if ($bordersize != '0' && $bordersize != '0px') { $img_styles .= "border:{$bordersize} solid {$bordercolor};"; } if ($borderradius != '0' && $borderradius != '0px') { $img_styles .= "-webkit-border-radius:{$borderradius};-moz-border-radius:{$borderradius};border-radius:{$borderradius};"; } if ($style == 'glow') { $img_styles .= "-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } if ($style == 'dropshadow') { $img_styles .= "-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);"; } if ($img_styles) { $attr['style'] .= $img_styles; } $attr['class'] = sprintf('fusion-imageframe imageframe-%s imageframe-%s', self::$args['style'], $this->imageframe_counter); if (self::$args['style'] == 'bottomshadow') { $attr['class'] .= ' element-bottomshadow'; } if (self::$args['align'] == 'left') { $attr['style'] .= 'margin-right:25px;float:left;'; } elseif (self::$args['align'] == 'right') { $attr['style'] .= 'margin-left:25px;float:right;'; } if (self::$args['hover_type'] != 'liftup') { $attr['class'] .= ' hover-type-' . self::$args['hover_type']; } if (self::$args['class']) { $attr['class'] .= ' ' . self::$args['class']; } if (self::$args['id']) { $attr['id'] = self::$args['id']; } if (self::$args['animation_type']) { $animations = FusionCore_Plugin::animations(array('type' => self::$args['animation_type'], 'direction' => self::$args['animation_direction'], 'speed' => self::$args['animation_speed'])); $attr = array_merge($attr, $animations); $attr['class'] .= ' ' . $attr['animation_class']; unset($attr['animation_class']); } if (self::$args['hide_on_mobile'] == 'yes') { $attr['class'] .= ' fusion-hide-on-mobile'; } return $attr; }