function themify_favicon_action($data = array()) { $data = themify_get_data(); if (isset($data['setting-favicon']) && $data['setting-favicon'] != '') { $favurl = themify_https_esc($data['setting-favicon']); echo "\n\n" . '<link href="' . $favurl . '" rel="shortcut icon" /> '; } }
/** * Make IE behave like a standards-compliant browser */ function themify_ie_standards_compliant() { echo ' <!--[if lt IE 9]> <script src="' . themify_https_esc('http://s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js') . '"></script> <script type="text/javascript" src="' . themify_https_esc('http://cdnjs.cloudflare.com/ajax/libs/selectivizr/1.0.2/selectivizr-min.js') . '"></script> <![endif]--> '; }
function enqueue_google_fonts() { if ('' == $this->google_fonts) { return; } $this->google_fonts = substr($this->google_fonts, 0, -1); wp_enqueue_style('section-styling-google-fonts', themify_https_esc('http://fonts.googleapis.com/css') . '?family=' . $this->google_fonts); }
/** * Enqueues Google Fonts * * @since 2.2.6 */ function enqueue_fonts() { $entry_google_fonts = get_option('themify_builder_google_fonts'); if (isset($entry_google_fonts) && !empty($entry_google_fonts) && is_array($entry_google_fonts)) { $entry_id = get_the_ID(); if (isset($entry_google_fonts[$entry_id])) { wp_enqueue_style('builder-google-fonts', themify_https_esc('http://fonts.googleapis.com/css') . '?family=' . $entry_google_fonts[$entry_id]); } } }
/** * Add wmode transparent and post-video container for responsive purpose * @param string $html The embed markup. * @param string $url The URL embedded. * @return string The modified embed markup. */ function themify_parse_video_embed_vars($html, $url) { $services = array('youtube.com', 'youtu.be', 'blip.tv', 'vimeo.com', 'dailymotion.com', 'hulu.com', 'viddler.com', 'qik.com', 'revision3.com', 'wordpress.tv', 'wordpress.com', 'funnyordie.com'); $video_embed = false; foreach ($services as $service) { if (stripos($html, $service)) { $video_embed = true; break; } } if ($video_embed) { $html = '<div class="post-video">' . $html . '</div>'; if (strpos($html, "<embed src=") !== false) { $html = str_replace('</param><embed', '</param><param name="wmode" value="transparent"></param><embed wmode="transparent" ', $html); return $html; } else { if (strpos($html, 'wmode=transparent') == false) { if (stripos($url, 'youtube') || stripos($url, 'youtu.be')) { if (stripos($url, 'youtu.be')) { $parsed = parse_url($url); $ytq = isset($parsed['query']) ? $parsed['query'] : ''; $url = 'http://www.youtube.com/embed' . $parsed['path'] . '?wmode=transparent&fs=1' . $ytq; } else { $parsed = parse_url($url); parse_str($parsed['query'], $query); $parsed['scheme'] .= '://'; if (isset($query['v']) && '' != $query['v']) { $parsed['path'] = '/embed/' . $query['v']; unset($query['v']); } else { $parsed['path'] = '/embed/'; } $query['wmode'] = 'transparent'; $query['fs'] = '1'; $parsed['query'] = '?'; foreach ($query as $param => $value) { $parsed['query'] .= $param . '=' . $value . '&'; } $parsed['query'] = substr($parsed['query'], 0, -1); $url = implode('', $parsed); } return preg_replace('/src="(.*)" (frameborder)/i', 'src="' . esc_url(themify_https_esc($url)) . '" $2', $html); } else { if (is_ssl() && false !== stripos($html, 'http:')) { $html = str_replace('http:', 'https:', $html); } $search = array('?fs=1', '?fs=0'); $replace = array('?fs=1&wmode=transparent', '?fs=0&wmode=transparent'); $html = str_replace($search, $replace, $html); return $html; } } else { return $html; } } } else { return '<div class="post-embed">' . $html . '</div>'; } }
/** * Enqueue Google Fonts * @since 1.0.0 */ function themify_theme_enqueue_google_fonts() { global $themify; if (!isset($themify->google_fonts) || '' == $themify->google_fonts) { return; } $themify->google_fonts = substr($themify->google_fonts, 0, -1); wp_enqueue_style('section-styling-google-fonts', themify_https_esc('http://fonts.googleapis.com/css') . '?family=' . $themify->google_fonts); }
/** * Insert Flickr Gallery by user, set or group * @param Object $atts * @param String $content * @return String */ function themify_shortcode_flickr($atts, $content = null) { extract(shortcode_atts(array('user' => '', 'set' => '', 'group' => '', 'limit' => '8', 'size' => 's', 'display' => 'latest'), $atts, 'themify_flickr')); $flickrstr = ''; if ($user) { $flickrstr = '<!-- shortcode Flickr --> <div class="shortcode clearfix flickr"><script defer type="text/javascript" src="' . esc_url(themify_https_esc('//www.flickr.com/badge_code_v2.gne') . '?count=' . $limit . '&display=' . $display . '&size=' . $size . '&layout=x&source=user&user='******'"></script></div>'; } elseif ($set && '' == $flickrstr) { $flickrstr = '<div class="shortcode clearfix flickr"><script defer type="text/javascript" src="' . esc_url(themify_https_esc('//www.flickr.com/badge_code_v2.gne') . '?count=' . $limit . '&display=' . $display . '&size=' . $size . '&layout=x&source=user_set&set=' . $set) . '"></script></div>'; } elseif ($group && $flickrstr == '') { $flickrstr = '<div class="shortcode clearfix flickr"><script defer type="text/javascript" src="' . esc_url(themify_https_esc('//www.flickr.com/badge_code_v2.gne') . '?count=' . $limit . '&display=' . $display . '&size=' . $size . '&layout=x&source=group&group=' . $group) . '"></script></div> <!-- /shortcode Flickr -->'; } return $flickrstr; }
function widget($args, $instance) { extract($args); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title']); $username = isset($instance['username']) ? $instance['username'] : ''; $show_count = isset($instance['show_count']) ? $instance['show_count'] : '10'; $show_link = isset($instance['show_link']) ? $instance['show_link'] : false; /* Before widget (defined by themes). */ echo $before_widget; /* Title of widget (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } echo '<div id="flickr_badge_wrapper" class="clearfix"> <script type="text/javascript" src="' . themify_https_esc('http://www.flickr.com/badge_code_v2.gne') . '?count=' . $show_count . '.&display=latest&size=s&layout=x&source=user&user='******'"></script> </div>'; if ($show_link) { echo '<a href="http://www.flickr.com/photos/' . $username . '/">' . __('View my Flickr photostream', 'themify') . '</a>'; } /* After widget (defined by themes). */ echo $after_widget; }
/** * Inserts image in site description or hides it. * * @param string $site_desc Site tagline. * @param string $location * @return string */ function site_description($site_desc = '', $location = 'site-tagline') { $desc = json_decode($this->get_cached_mod($location)); $has_image_src = isset($desc->src) && '' != $desc->src; $is_image_mode = isset($desc->mode) && 'image' == $desc->mode; $html = ''; if (isset($this->settings[$location]) && $has_image_src && $is_image_mode) { $html .= '<img src="' . esc_url(themify_https_esc($desc->src)) . '" alt="' . esc_attr($site_desc) . '" title="' . esc_attr($site_desc) . '" />'; $html .= '<span style="display: none;">' . esc_html($site_desc) . '</span>'; } else { $html .= '<span>' . esc_html($site_desc) . '</span>'; } return $html; }
/** * Vimeo / Youtube Thumbnail grab * * @param $url * * @return string */ function themify_video_image($url) { $image_url = parse_url($url); $return_url = ''; if ($image_url['host'] == 'www.youtube.com' || $image_url['host'] == 'youtube.com') { parse_str($image_url['query'], $query); if (isset($query['v']) && $query['v'] != "") { $id = $query['v']; } else { $path = explode("/", $image_url['path']); $id = $path[count($path) - 1]; } $return_url = themify_https_esc('http://img.youtube.com/vi/') . $id . "/hqdefault.jpg"; } else { if ($image_url['host'] == 'www.vimeo.com' || $image_url['host'] == 'vimeo.com' || $image_url['host'] == 'player.vimeo.com') { parse_str($image_url['query'], $query); if (isset($query['clip_id']) && $query['clip_id'] != "") { $id = $query['clip_id']; } else { $path = explode("/", $image_url['path']); $id = $path[count($path) - 1]; } if (!function_exists('WP_Filesystem')) { require_once ABSPATH . 'wp-admin/includes/file.php'; } WP_Filesystem(); global $wp_filesystem; $hash = unserialize($wp_filesystem->get_contents(themify_https_esc('http://vimeo.com/api/v2/video/') . $id . ".php")); if (isset($hash[0]) && $hash[0] != '') { $return_url = $hash[0]["thumbnail_large"]; } } } return $return_url; }
echo esc_js($type_map); ?> ", <?php echo 'enable' != $scrollwheel_map ? 'false' : 'true'; ?> , <?php echo 'enable' != $draggable_map ? 'false' : 'true'; ?> ); } jQuery(document).ready(function() { if( typeof google === 'undefined' ) { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "<?php echo themify_https_esc('http://maps.google.com/maps/api/js') . '?sensor=false&callback=themify_builder_create_map'; ?> "; document.body.appendChild(script); } else { ThemifyBuilderModuleJs.initialize("<?php echo esc_js($geo_address); ?> ", <?php echo esc_js($num); ?> , <?php echo esc_js($zoom_map); ?> , "<?php echo esc_js($type_map);
function themify_get_css() { $data = themify_get_data(); $output = ''; /** * Stores CSS rules * @var string */ $module_styling = ''; if ($data['skin'] != "") { $output .= '<link href="' . themify_https_esc($data['skin']) . '" rel="stylesheet" type="text/css" />' . "\n"; } if (is_file(THEME_DIR . "/custom_style.css")) { $output .= '<link href="' . get_template_directory_uri() . '/custom_style.css" rel="stylesheet" type="text/css" />' . "\n"; } if (is_array($data)) { foreach ($data as $name => $value) { $array = explode('-', $name); $path = ""; foreach ($array as $part) { $path .= "['{$part}']"; } eval("\$config" . $path . " = \$value;"); } if (is_array($config['styling'])) { foreach ($config['styling'] as $nav => $value) { foreach ($value as $element => $val) { $temp = ""; foreach ($val as $attribute => $v) { $attribute = str_replace("_", "-", $attribute); if ($v['value'] != '' && isset($v['value'])) { switch ($attribute) { case "border": foreach ($v['value'] as $key => $val) { if ($val == '') { if (strpos($key, "style") === false) { if (strpos($key, "color") === false) { $v['value'][$key] = 0; } else { $v['value'][$key] = '000000'; } } else { $v['value'][$key] = 'solid'; } } } if ($v['value']['checkbox']) { $temp .= "border: " . $v['value']['same'] . "px " . $v['value']['same_style'] . " #" . $v['value']['same_color'] . ";\n"; } else { if ($v['value']['top'] != '' && $v['value']['top_style'] != '' && $v['value']['top_color'] != '') { $temp .= "border-top: " . $v['value']['top'] . "px " . $v['value']['top_style'] . " #" . $v['value']['top_color'] . ";\n"; } if ($v['value']['right'] != '' && $v['value']['right_style'] != '' && $v['value']['right_color'] != '') { $temp .= "border-right: " . $v['value']['right'] . "px " . $v['value']['right_style'] . " #" . $v['value']['right_color'] . ";\n"; } if ($v['value']['bottom'] != '' && $v['value']['bottom_style'] != '' && $v['value']['bottom_color'] != '') { $temp .= "border-bottom: " . $v['value']['bottom'] . "px " . $v['value']['bottom_style'] . " #" . $v['value']['bottom_color'] . ";\n"; } if ($v['value']['left'] != '' && $v['value']['left_style'] != '' && $v['value']['left_color'] != '') { $temp .= "border-left: " . $v['value']['left'] . "px " . $v['value']['left_style'] . " #" . $v['value']['left_color'] . ";\n"; } } break; case "background-position": if ($v['value']['x'] != '' && $v['value']['y']) { foreach ($v['value'] as $key => $val) { if ($val == '') { $v['value'][$key] = 0; } } $temp .= $attribute . ": "; $temp .= $v['value']['x'] . " " . $v['value']['y'] . ";\n"; } break; case "padding": if ($v['value']['checkbox']) { $temp .= $attribute . ": "; $temp .= $v['value']['same'] . "px" . ";\n"; } else { if ($v['value']['top'] != '' || $v['value']['right'] != '' || $v['value']['bottom'] != '' || $v['value']['left'] != '') { if ($v['value']['top'] != '') { $temp .= "padding-top: " . $v['value']['top'] . "px;\n"; } if ($v['value']['right'] != '') { $temp .= "padding-right: " . $v['value']['right'] . "px;\n"; } if ($v['value']['bottom'] != '') { $temp .= "padding-bottom: " . $v['value']['bottom'] . "px;\n"; } if ($v['value']['left'] != '') { $temp .= "padding-left: " . $v['value']['left'] . "px;\n"; } } } break; case "margin": if ($v['value']['checkbox']) { $temp .= $attribute . ": "; $temp .= $v['value']['same'] . "px" . ";\n"; } else { if ($v['value']['top'] != '' || $v['value']['right'] != '' || $v['value']['bottom'] != '' || $v['value']['left'] != '') { if ($v['value']['top'] != '') { $temp .= "margin-top: " . $v['value']['top'] . "px;\n"; } if ($v['value']['right'] != '') { $temp .= "margin-right: " . $v['value']['right'] . "px;\n"; } if ($v['value']['bottom'] != '') { $temp .= "margin-bottom: " . $v['value']['bottom'] . "px;\n"; } if ($v['value']['left'] != '') { $temp .= "margin-left: " . $v['value']['left'] . "px;\n"; } } } break; case "color": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= "#" . $v['value']['value'] . ";\n"; } break; case "background-color": if ($v['value']['transparent']) { $temp .= $attribute . ": transparent;\n"; } else { if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= "#" . $v['value']['value'] . ";\n"; } } break; case "background-image": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= "url(" . $v['value']['value'] . ")" . ";\n"; } else { if ($v['value']['none'] == "on") { $temp .= $attribute . ": "; $temp .= "none;\n"; } } break; case "background-repeat": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= $v['value']['value'] . ";\n"; } break; case "font-family": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= $v['value']['value'] . ";\n"; } break; case "line-height": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= $v['value']['value'] . $v['value']['unit'] . ";\n"; } break; case "position": if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= $v['value']['value'] . ";\n"; if ($v['value']['value'] == 'absolute' || $v['value']['value'] == 'fixed') { if ($v['value']['x_value'] != '' && $v['value']['x_value'] != ' ') { $temp .= $v['value']['x'] . ": " . $v['value']['x_value'] . "px;\n"; } if ($v['value']['y_value'] != '' && $v['value']['y_value'] != ' ') { $temp .= $v['value']['y'] . ": " . $v['value']['y_value'] . "px;\n"; } } } break; default: if ($v['value']['value'] != '' && $v['value']['value'] != ' ') { $temp .= $attribute . ": "; $temp .= $v['value']['value']; if (isset($v['value']['unit'])) { $temp .= $v['value']['unit']; } $temp .= ";\n"; } break; } } } if ($temp != '' && $temp != ' ') { $module_styling .= urldecode(themify_scrub_decode($element)) . " {\n"; $module_styling .= $temp; $module_styling .= "}\n\n"; } } } } } else { $output = '<style type="text/css">/* ' . __('No Values in the Database', 'themify') . ' */</style>'; } $module_styling_before = "<!-- modules styling -->\n<style type='text/css'>\n"; $module_styling_after = "</style>"; if ('' != $module_styling) { $output .= $module_styling_before . $module_styling . $module_styling_after; } echo "\n\n" . $output; }
/** * Build a CSS rule. * * @param string $selector CSS selector. * @param string $style CSS property to write. * @param string $mod_name The 'theme_mod' option to fetch. * @param string $prefix Prefix for CSS property value. * @param string $suffix Suffix for CSS property value. * @return string CSS rule: selector, property and property value. Empty if 'theme_mod' option specified is empty. */ function build_css_rule($selector, $style, $mod_name, $prefix = '', $suffix = '') { $mod = get_theme_mod($mod_name); $out = ''; if (!empty($mod)) { if ('font' == $style || 'logo' == $style || 'tagline' == $style || 'decoration' == $style) { // Font Rule $font = json_decode($mod); if (isset($font->family->name) && '' != $font->family->name) { if (isset($font->family->fonttype) && 'google' == $font->family->fonttype) { $user_subsets = themify_check('setting-webfonts_subsets') ? themify_get('setting-webfonts_subsets') : array('latin'); $font_hash = $font->family->name . $font->family->variant . $user_subsets; wp_enqueue_style('custom-google-fonts-' . md5($font_hash), themify_https_esc('http://fonts.googleapis.com/css') . '?family=' . str_replace(' ', '+', $font->family->name) . ':' . $font->family->variant . '&subset=' . implode(',', $user_subsets)); } $out .= sprintf("\n\tfont-family:%s;", $prefix . $font->family->name . $suffix); } if (!isset($font->nostyle) || '' == $font->nostyle) { if (isset($font->italic) && '' != $font->italic) { $out .= sprintf("\tfont-style:%s;\n", $prefix . $font->italic . $suffix); } if (isset($font->bold) && '' != $font->bold) { $out .= sprintf("\tfont-weight:%s;\n", $prefix . $font->bold . $suffix); } if (isset($font->underline) && '' != $font->underline) { $out .= sprintf("\ttext-decoration:%s;\n", $prefix . $font->underline . $suffix); } elseif (isset($font->linethrough) && '' != $font->linethrough) { $out .= sprintf("\ttext-decoration:%s;\n", $prefix . $font->linethrough . $suffix); } } else { $out .= sprintf("\tfont-style:%s;\n", $prefix . 'normal' . $suffix); $out .= sprintf("\tfont-weight:%s;\n", $prefix . 'normal' . $suffix); $out .= sprintf("\ttext-decoration:%s;\n", $prefix . 'none' . $suffix); } if (isset($font->sizenum) && '' != $font->sizenum) { $unit = isset($font->sizeunit) && '' != $font->sizeunit ? $font->sizeunit : 'px'; $out .= sprintf("\tfont-size:%s;\n", $prefix . $font->sizenum . $unit . $suffix); } if (isset($font->linenum) && '' != $font->linenum) { $unit = isset($font->lineunit) && '' != $font->lineunit ? $font->lineunit : 'px'; $out .= sprintf("\tline-height:%s;\n", $prefix . $font->linenum . $unit . $suffix); } if (isset($font->texttransform) && '' != $font->texttransform) { if (isset($font->notexttransform) && 'notexttransform' == $font->notexttransform) { $out .= sprintf("\ttext-transform:%s;", $prefix . 'none' . $suffix); } else { $out .= sprintf("\ttext-transform:%s;", $prefix . $font->texttransform . $suffix); } } if (isset($font->align) && '' != $font->align) { if ('noalign' != $font->align) { $out .= sprintf("\ttext-align:%s;", $prefix . $font->align . $suffix); } else { if ('' == is_rtl()) { $out .= sprintf("\ttext-align:%s;", $prefix . 'left' . $suffix); } else { $out .= sprintf("\ttext-align:%s;", $prefix . 'right' . $suffix); } } } if (isset($font->color) && '' != $font->color) { $out .= "\n\tcolor: #{$font->color};"; $opacity = isset($font->opacity) && '' != $font->opacity ? $font->opacity : '1'; $out .= "\n\tcolor: rgba(" . $this->hex2rgb($font->color) . ',' . $opacity . ');'; } } if ('logo' == $style || 'tagline' == $style) { // Logo/description Rule $element = json_decode($mod); if (isset($element->mode)) { if ('none' == $element->mode) { $out .= 'display: none;'; } } } elseif ('color' == $style) { // Color Rule $color = json_decode($mod); if (isset($color->color) && '' != $color->color) { $out .= "\n\tcolor: #{$color->color};"; $opacity = isset($color->opacity) && '' != $color->opacity ? $color->opacity : '1'; $out .= "\n\tcolor: rgba(" . $this->hex2rgb($color->color) . ',' . $opacity . ');'; } } elseif ('background' == $style) { // Background Rule $bg = json_decode($mod); if (isset($bg->noimage) && 'noimage' == $bg->noimage) { $out .= 'background-image: none;'; } elseif (isset($bg->src) && '' != $bg->src) { $out .= sprintf("\n\tbackground-image: url(%s);", $prefix . $bg->src . $suffix); } if (isset($bg->style) && '' != $bg->style) { if ('fullcover' == $bg->style) { $out .= "\n\tbackground-size: cover;"; } else { $out .= "\n\tbackground-repeat: {$bg->style};"; } } if (isset($bg->position) && '' != $bg->position) { $out .= "\n\tbackground-position: {$bg->position};"; } if (isset($bg->transparent) && '' != $bg->transparent) { $out .= "\n\tbackground-color: {$bg->transparent};"; } elseif (isset($bg->color) && '' != $bg->color) { $out .= "\n\tbackground-color: #{$bg->color};"; $opacity = isset($bg->opacity) && '' != $bg->opacity ? $bg->opacity : '1'; $out .= "\n\tbackground-color: rgba(" . $this->hex2rgb($bg->color) . ',' . $opacity . ');'; } } elseif ('border' == $style) { // Border Rule $border = json_decode($mod); if (isset($border->disabled) && 'disabled' == $border->disabled) { $out .= 'border: none;'; } else { $same = isset($border->same) && '' != $border->same ? 'same' : ''; if ('' == $same) { foreach (array('top', 'right', 'bottom', 'left') as $side) { if (isset($border->{$side})) { $border_side = $border->{$side}; $out .= $this->setBorder($border_side, 'border-' . $side); } } } else { $out .= $this->setBorder($border); } } } elseif ('margin' == $style || 'padding' == $style) { // Margin/Padding Rule $marginpadding = json_decode($mod); $same = isset($marginpadding->same) && '' != $marginpadding->same ? 'same' : ''; if ('' == $same) { foreach (array('top', 'right', 'bottom', 'left') as $side) { if (isset($marginpadding->{$side})) { if ('margin' == $style && isset($marginpadding->{$side}->auto) && 'auto' == $marginpadding->{$side}->auto) { $out .= $style . '-' . $side . ': auto;'; } else { $this_side = $marginpadding->{$side}; $out .= $this->setDimension($this_side, $style . '-' . $side); } } } } else { if ('margin' == $style && isset($marginpadding->auto) && 'auto' == $marginpadding->auto) { $out .= $style . ': auto;'; } else { $out .= $this->setDimension($marginpadding, $style); } } } elseif ('width' == $style || 'height' == $style) { // Width/Height Rule $widthheight = json_decode($mod); if (isset($widthheight->auto) && 'auto' == $widthheight->auto) { $out .= $style . ': auto;'; } else { $out .= $this->setDimension($widthheight, $style); } } elseif ('position' == $style) { // Position Rule $position = json_decode($mod); if (isset($position->position) && '' != $position->position) { $out .= sprintf("\tposition:%s;\n", $prefix . $position->position . $suffix); } foreach (array('top', 'right', 'bottom', 'left') as $side) { if (isset($position->{$side})) { if (isset($position->{$side}->auto) && 'auto' == $position->{$side}->auto) { $out .= $side . ': auto;'; } else { $this_side = $position->{$side}; $out .= $this->setDimension($this_side, $side); } } } } elseif ('image' == $style) { // Image Rule does nothing because it's not styling by markup injected in a php function. } } // Build rule to return if ('' != $out) { $out = "\t{$out}"; } return $out; }
/** * Switch to frontend * @param int $post_id */ function switch_frontend($post_id) { //verify post is not a revision if (!wp_is_post_revision($post_id)) { $redirect = isset($_POST['builder_switch_frontend']) ? $_POST['builder_switch_frontend'] : 0; // redirect to frontend if (1 == $redirect) { $_POST['builder_switch_frontend'] = 0; $post_url = get_permalink($post_id); wp_redirect(themify_https_esc($post_url) . '#builder_active'); exit; } } }
function themify_video_image($url) { $image_url = parse_url($url); if ($image_url['host'] == 'www.youtube.com' || $image_url['host'] == 'youtube.com') { parse_str($image_url['query'], $query); if (isset($query['v']) && $query['v'] != "") { $id = $query['v']; } else { $path = explode("/", $image_url['path']); $id = $path[count($path) - 1]; } return themify_https_esc('http://img.youtube.com/vi/') . $id . "/hqdefault.jpg"; } else { if ($image_url['host'] == 'www.vimeo.com' || $image_url['host'] == 'vimeo.com' || $image_url['host'] == 'player.vimeo.com') { parse_str($image_url['query'], $query); if (isset($query['clip_id']) && $query['clip_id'] != "") { $id = $query['clip_id']; } else { $path = explode("/", $image_url['path']); $id = $path[count($path) - 1]; } if (function_exists("file_get_contents")) { $hash = unserialize(file_get_contents(themify_https_esc('http://vimeo.com/api/v2/video/') . $id . ".php")); if (isset($hash[0]) && $hash[0] != '') { return $hash[0]["thumbnail_large"]; } } } } }
function load_map_script() { //Register map scripts wp_register_script('themify-builder-map-script', themify_https_esc('http://maps.google.com/maps/api/js') . '?sensor=false', array(), false, true); }