本文整理汇总了PHP中dt_is_hd_device函数的典型用法代码示例。如果您正苦于以下问题:PHP dt_is_hd_device函数的具体用法?PHP dt_is_hd_device怎么用?PHP dt_is_hd_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_is_hd_device函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presscore_get_logo_src
function presscore_get_logo_src($logos = array())
{
$default_logo = '';
$r_logo = $logos['logo_retina'];
$logo = $logos['logo'];
// get default logo
foreach ($logos as $logo) {
if ($logo) {
$default_logo = $logo;
break;
}
}
if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) {
$logos = array('1x' => $logo, '2x' => $r_logo);
$srcset = array();
foreach ($logos as $xx => $_logo) {
if (!empty($_logo)) {
$srcset[] = "{$_logo[0]} {$xx}";
}
}
$srcset = implode(', ', $srcset);
$logo = $default_logo;
$logo[0] = $logo_src = $srcset;
} else {
if ($logo && !$r_logo) {
$r_logo = $logo;
} elseif ($r_logo && !$logo) {
$logo = $r_logo;
} elseif (!$r_logo && !$logo) {
$logo = $r_logo = $default_logo;
}
if (dt_retina_on() && dt_is_hd_device()) {
$logo = $r_logo;
}
$logo_src = isset($logo[0]) ? $logo[0] : '';
}
$w = isset($logo[1]) ? $logo[1] : '';
$h = isset($logo[2]) ? $logo[2] : '';
return array($logo_src, $w, $h);
}
示例2: presscore_choose_right_image_based_on_device_pixel_ratio
/**
* Chooses what src to use, based on device pixel ratio and theme settings
* @param string $regular_img_src Regular image src
* @param string $hd_img_src Hd image src
* @return string Best suitable src
*/
function presscore_choose_right_image_based_on_device_pixel_ratio($regular_img_src, $hd_img_src = '')
{
$output_src = '';
if (!$regular_img_src && !$hd_img_src) {
} elseif (!$regular_img_src) {
$output_src = $hd_img_src;
} elseif (!$hd_img_src) {
$output_src = $regular_img_src;
} else {
if (dt_retina_on()) {
$output_src = dt_is_hd_device() ? $hd_img_src : $regular_img_src;
} else {
$output_src = $regular_img_src;
}
}
return $output_src;
}
示例3: shortcode
public function shortcode($atts, $content = null)
{
$default_atts = array('style' => '1', 'image' => '', 'image_alt' => '', 'hd_image' => '', 'media' => '', 'padding' => '0', 'align' => '', 'animation' => 'none', 'width' => '');
$attributes = shortcode_atts($default_atts, $atts);
// $attributes['type'] = in_array( $attributes['type'], array('image', 'video') ) ? $attributes['type'] : $default_atts['type'];
$attributes['animation'] = in_array($attributes['animation'], array('none', 'scale', 'fade', 'left', 'right', 'bottom', 'top')) ? $attributes['animation'] : $default_atts['animation'];
$attributes['style'] = in_array($attributes['style'], array('1', '2', '3')) ? $attributes['style'] : $default_atts['style'];
$attributes['align'] = in_array($attributes['align'], array('center', 'centre', 'left', 'right')) ? $attributes['align'] : $default_atts['align'];
$attributes['padding'] = intval($attributes['padding']);
$attributes['width'] = absint($attributes['width']);
$attributes['image'] = esc_url($attributes['image']);
$attributes['image_alt'] = esc_attr($attributes['image_alt']);
$attributes['hd_image'] = esc_url($attributes['hd_image']);
$attributes['media'] = esc_url($attributes['media']);
// $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']);
$container_classes = array('shortcode-single-image-wrap');
$media_classes = array('shortcode-single-image');
$container_style = array();
$media = '';
$content_block = '';
$content = strip_shortcodes($content);
$attributes['type'] = 'video';
$attributes['lightbox'] = 1;
switch ($attributes['style']) {
case '3':
$container_classes[] = 'br-standard';
case '2':
$container_classes[] = 'borderframe';
$style = ' style="padding: ' . esc_attr($attributes['padding']) . 'px"';
break;
default:
$style = '';
}
switch ($attributes['align']) {
case 'left':
$container_classes[] = 'alignleft';
break;
case 'right':
$container_classes[] = 'alignright';
break;
case 'centre':
case 'center':
$container_classes[] = 'alignnone';
break;
}
if ('none' != $attributes['animation']) {
switch ($attributes['animation']) {
case 'scale':
$container_classes[] = 'scale-up';
break;
case 'fade':
$container_classes[] = 'fade-in';
break;
case 'left':
$container_classes[] = 'right-to-left';
break;
case 'right':
$container_classes[] = 'left-to-right';
break;
case 'bottom':
$container_classes[] = 'top-to-bottom';
break;
case 'top':
$container_classes[] = 'bottom-to-top';
break;
}
$container_classes[] = 'animate-element';
}
if ($content) {
$container_classes[] = 'caption-on';
$content_block = '<div class="shortcode-single-caption">' . $content . '</div>';
}
$default_image_src = $attributes['image'] ? $attributes['image'] : $attributes['hd_image'];
if (dt_retina_on()) {
$image_src = dt_is_hd_device() ? $attributes['hd_image'] : $attributes['image'];
} else {
$image_src = $attributes['image'];
}
if (empty($image_src)) {
$image_src = $default_image_src;
}
$media = sprintf('<img src="%s" alt="%s" />', $image_src, $attributes['image_alt']);
$media = sprintf('<div class="rollover-video">%s<a class="video-icon dt-single-mfp-popup dt-mfp-item mfp-iframe" href="%s" title="%s" data-dt-img-description="%s"></a></div>', $media, $attributes['media'], $attributes['image_alt'], esc_attr($content));
if ($media) {
$media = sprintf('<div class="%s"%s><div class="fancy-media-wrap">%s</div></div>', esc_attr(implode(' ', $media_classes)), $style, $media);
}
if ($attributes['width']) {
$container_style[] = 'width: ' . $attributes['width'] . 'px';
}
$output = sprintf('<div class="%s"%s>%s</div>', esc_attr(implode(' ', $container_classes)), $container_style ? ' style="' . esc_attr(implode(';', $container_style)) . '"' : '', $media . $content_block);
return $output;
}
示例4: dt_get_retina_sensible_image
/**
* Get image based on devicePixelRatio coocie and theme options.
*
* @param $logo array Regular logo.
* @param $r_logo array Retina logo.
* @param $default array Default logo.
* @param $custom string Custom img attributes.
*
* @return string.
*/
function dt_get_retina_sensible_image ( $logo, $r_logo, $default, $custom = '', $class = '' ) {
if ( empty( $default ) ) { return ''; }
if ( $logo && !$r_logo ) { $r_logo = $logo; }
elseif ( $r_logo && !$logo ) { $logo = $r_logo; }
elseif ( !$r_logo && !$logo ) { $logo = $r_logo = $default; }
if ( dt_retina_on() ) {
$img_meta = dt_is_hd_device() ? $r_logo : $logo;
} else {
$img_meta = $logo;
}
if ( ! isset( $img_meta['size'] ) && isset( $img_meta[1], $img_meta[2] ) ) { $img_meta['size'] = image_hwstring( $img_meta[1], $img_meta[2] ); }
$output = dt_get_thumb_img( array(
'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %CUSTOM% />',
'img_class' => $class,
'img_meta' => $img_meta,
'custom' => $custom,
'echo' => false,
// TODO: add alt if it's possible
'alt' => '',
) );
return $output;
}
示例5: render_logo
public function render_logo($attributes = array())
{
$post_id = get_the_ID();
if (!$post_id) {
return '';
}
$html = '';
$images = array('normal' => null, 'retina' => null);
$image_classes = array();
$esc_title = esc_attr(get_the_title());
$thumb_id = 0;
// get featured image
if (has_post_thumbnail($post_id)) {
$thumb_id = get_post_thumbnail_id($post_id);
$images['normal'] = wp_get_attachment_image_src($thumb_id, 'full');
}
// get retina image
$retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true);
if ($retina_logo_id) {
$images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina');
}
// default image
$default_img = null;
foreach ($images as $image) {
if ($image) {
$default_img = $image;
break;
}
}
if (!$default_img) {
return '';
}
if (presscore_shortcode_animation_on($attributes['animation'])) {
$image_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']);
}
// ninjaaaa!
$image_classes = implode(' ', $image_classes);
// final image
if (presscore_is_srcset_based_retina()) {
$image = presscore_get_image_with_srcset($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
} else {
$image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
}
// if link not empty - wrap image with it
$link = get_post_meta($post_id, '_dt_logo_options_link', true);
if ($link) {
$image_id = dt_is_hd_device() && isset($retina_logo_id[0]) ? $retina_logo_id[0] : $thumb_id;
$esc_caption = '';
$attachment = dt_get_attachment($image_id);
if ($attachment) {
$esc_caption = esc_attr($attachment['description']);
}
$link = esc_attr($link);
$image = '<a href="' . $link . '" target="_blank" title="' . $esc_caption . '" >' . $image . '</a>';
}
// get it all togeather
return $image;
}
示例6: render_benefit
public function render_benefit($attributes, $content = null)
{
$image = '';
if ($attributes['icon_code']) {
$image = wp_kses($attributes['icon_code'], array('i' => array('class' => array())));
} else {
$default_image = null;
$images = array($attributes['image'], $attributes['hd_image']);
// get default logo
foreach ($images as $img) {
if ($img) {
$default_image = $img;
break;
}
}
if (!empty($default_image)) {
if (dt_retina_on()) {
$image = dt_is_hd_device() ? $images[1] : $images[0];
} else {
$image = $images[0];
}
if (empty($image)) {
$image = $default_image;
}
// ssl support
$image = dt_make_image_src_ssl_friendly($image);
$image_size = '';
if (!empty($attributes['image_size'])) {
$image_size = image_hwstring($attributes['image_size'][0], $attributes['image_size'][1]);
}
$image = sprintf('<img src="%s" %s alt="%s" />', $image, $image_size, esc_attr($attributes['image_alt']));
}
}
if ($image) {
$image_classes = array('benefits-grid-ico');
if (presscore_shortcode_animation_on($attributes['animation'])) {
$image_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']);
}
// ninjaaaa!
$image_classes = esc_attr(implode(' ', $image_classes));
if ($attributes['image_link']) {
$image = sprintf('<a href="%s" class="%s"%s>%s</a>', $attributes['image_link'], $image_classes, $attributes['target_blank'] ? ' target="_blank"' : '', $image);
} else {
$image = sprintf('<span class="%s">%s</span>', $image_classes, $image);
}
}
$style = empty($attributes['style']) ? '1' : $attributes['style'];
$title = '';
if ($attributes['title']) {
if ($attributes['image_link']) {
$title = sprintf('<%1$s class="benefit-title"><a href="%2$s"%3$s>%4$s</a></%1$s>', $attributes['header_size'], $attributes['image_link'], $attributes['target_blank'] ? ' target="_blank"' : '', $attributes['title']);
} else {
$title = sprintf('<%1$s>%2$s</%1$s>', $attributes['header_size'], $attributes['title']);
}
}
$output = '';
switch ($style) {
case '2':
$output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="wf-table">' . '<div class="wf-td">' . $image . '</div>' . '<div class="wf-td">' . $title . '</div>' . '</div>' . $content . '</div>' . '</div>' . '</div>';
break;
case '3':
$output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="wf-table">' . '<div class="wf-td">' . $image . '</div>' . '<div class="wf-td benefits-inner">' . $title . $content . '</div>' . '</div>' . '</div>' . '</div>' . '</div>';
break;
default:
$output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="line-decoration">' . $image . $title . '</div>' . $content . '</div>' . '</div>' . '</div>';
}
return $output;
}
示例7: shortcode_benefit
public function shortcode_benefit($atts, $content = null)
{
$attributes = shortcode_atts(array('image_link' => '', 'target_blank' => 'true', 'image' => '', 'hd_image' => '', 'header_size' => 'h4', 'title' => '', 'content_size' => 'normal'), $atts);
$attributes['image_link'] = esc_url($attributes['image_link']);
$attributes['image'] = esc_url($attributes['image']);
$attributes['hd_image'] = esc_url($attributes['hd_image']);
$attributes['header_size'] = in_array($attributes['header_size'], array('h2', 'h3', 'h4', 'h5', 'h6')) ? $attributes['header_size'] : 'h4';
$attributes['content_size'] = in_array($attributes['content_size'], array('normal', 'small', 'big')) ? $attributes['content_size'] : 'normal';
$attributes['title'] = wp_kses($attributes['title'], array());
$attributes['target_blank'] = apply_filters('dt_sanitize_flag', $attributes['target_blank']);
$image = '';
$title = '';
$output = '';
$default_image = null;
$images = array($attributes['image'], $attributes['hd_image']);
// get default logo
foreach ($images as $img) {
if ($img) {
$default_image = $img;
break;
}
}
if (!empty($default_image)) {
if (dt_retina_on()) {
$image = dt_is_hd_device() ? $images[1] : $images[0];
} else {
$image = $images[0];
}
if (empty($image)) {
$image = $default_image;
}
// ssl support
$image = dt_make_image_src_ssl_friendly($image);
$image = sprintf('<img src="%s" alt="" />', $image);
$image_classes = array('benefits-grid-ico');
if (isset(self::$atts['animation']) && 'none' != self::$atts['animation']) {
switch (self::$atts['animation']) {
case 'scale':
$image_classes[] = 'scale-up';
break;
case 'fade':
$image_classes[] = 'fade-in';
break;
case 'left':
$image_classes[] = 'right-to-left';
break;
case 'right':
$image_classes[] = 'left-to-right';
break;
case 'bottom':
$image_classes[] = 'top-to-bottom';
break;
case 'top':
$image_classes[] = 'bottom-to-top';
break;
}
$image_classes[] = 'animate-element';
}
// ninjaaaa!
$image_classes = esc_attr(implode(' ', $image_classes));
if ($attributes['image_link']) {
$image = sprintf('<a href="%s" class="%s"%s>%s</a>', $attributes['image_link'], $image_classes, $attributes['target_blank'] ? ' target="_blank"' : '', $image);
} else {
$image = sprintf('<span class="%s">%s</span>', $image_classes, $image);
}
}
if ($attributes['title']) {
$title = sprintf('<%1$s>%2$s</%1$s>', $attributes['header_size'], $attributes['title']);
}
$style = '1';
$column = '4';
$dividers = ' class="borders"';
if (!empty(self::$atts)) {
$style = self::$atts['style'];
$column = self::$atts['columns'];
$dividers = !self::$atts['dividers'] ? $dividers = '' : $dividers;
}
switch ($column) {
case '1':
$column_class = 'wf-1';
break;
case '2':
$column_class = 'wf-1-2';
break;
case '3':
$column_class = 'wf-1-3';
break;
case '5':
$column_class = 'wf-1-5';
break;
default:
$column_class = 'wf-1-4';
}
switch ($style) {
case '2':
$output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td">%s</div></div>%s</div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title, do_shortcode(wpautop($content)));
break;
case '3':
$output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td benefits-inner">%s</div></div></div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title . do_shortcode(wpautop($content)));
break;
//.........这里部分代码省略.........
示例8: presscore_setup_floating_menu
/**
* Set some javascript globals for floating menu and logo.
*
*/
function presscore_setup_floating_menu()
{
$show_logo = of_get_option('general-floating_menu_show_logo', false);
$show_menu = of_get_option('header-show_floating_menu', true);
$logo_src = '';
$w = '';
$h = '';
if ($show_menu && $show_logo) {
$logos = presscore_get_floating_menu_logos_meta();
$default_logo = '';
$r_logo = $logos['logo_retina'];
$logo = $logos['logo'];
// get default logo
foreach ($logos as $logo) {
if ($logo) {
$default_logo = $logo;
break;
}
}
if (presscore_is_srcset_based_retina() || presscore_is_logos_only_retina()) {
$logos = array('1x' => $logo, '2x' => $r_logo);
$srcset = array();
foreach ($logos as $xx => $_logo) {
if (!empty($_logo)) {
$srcset[] = "{$_logo[0]} {$xx}";
}
}
$srcset = implode(', ', $srcset);
$logo = $default_logo;
$logo[0] = $logo_src = $srcset;
$logo_src = esc_attr($logo_src);
} else {
if ($logo && !$r_logo) {
$r_logo = $logo;
} elseif ($r_logo && !$logo) {
$logo = $r_logo;
} elseif (!$r_logo && !$logo) {
$logo = $r_logo = $default_logo;
}
if (dt_retina_on() && dt_is_hd_device()) {
$logo = $r_logo;
}
$logo_src = isset($logo[0]) ? $logo[0] : '';
$logo_src = esc_url($logo_src);
}
$w = isset($logo[1]) ? $logo[1] : '';
$h = isset($logo[2]) ? $logo[2] : '';
}
?>
<script type="text/javascript">
dtGlobals.logoEnabled = <?php
echo absint($show_logo);
?>
;
dtGlobals.logoURL = '<?php
echo $logo_src;
?>
';
dtGlobals.logoW = '<?php
echo absint($w);
?>
';
dtGlobals.logoH = '<?php
echo absint($h);
?>
';
smartMenu = <?php
echo absint($show_menu);
?>
;
</script>
<?php
}
示例9: choose_src_responsively
protected function choose_src_responsively($img, $hd_img = '')
{
$default_img = $img ? $img : $hd_img;
if (dt_retina_on()) {
$image_src = dt_is_hd_device() ? $hd_img : $img;
} else {
$image_src = $img;
}
if (empty($image_src)) {
$image_src = $default_img;
}
return $image_src;
}
示例10: render_benefit
public function render_benefit($attributes, $content = null)
{
$image = '';
$title = '';
$output = '';
if ($attributes['icon_code']) {
$image = wp_kses($attributes['icon_code'], array('i' => array('class' => array())));
} else {
$default_image = null;
$images = array($attributes['image'], $attributes['hd_image']);
// get default logo
foreach ($images as $img) {
if ($img) {
$default_image = $img;
break;
}
}
if (!empty($default_image)) {
if (dt_retina_on()) {
$image = dt_is_hd_device() ? $images[1] : $images[0];
} else {
$image = $images[0];
}
if (empty($image)) {
$image = $default_image;
}
$image_size = '';
if (!empty($attributes['image_size'])) {
$image_size = image_hwstring($attributes['image_size'][0], $attributes['image_size'][1]);
}
$image = sprintf('<img src="%s" %s alt="" />', $image, $image_size);
}
}
if ($image) {
$image_classes = array('benefits-grid-ico');
if (isset($attributes['animation']) && 'none' != $attributes['animation']) {
switch ($attributes['animation']) {
case 'scale':
$image_classes[] = 'scale-up';
break;
case 'fade':
$image_classes[] = 'fade-in';
break;
case 'left':
$image_classes[] = 'right-to-left';
break;
case 'right':
$image_classes[] = 'left-to-right';
break;
case 'bottom':
$image_classes[] = 'top-to-bottom';
break;
case 'top':
$image_classes[] = 'bottom-to-top';
break;
}
$image_classes[] = 'animate-element';
}
// ninjaaaa!
$image_classes = esc_attr(implode(' ', $image_classes));
if ($attributes['image_link']) {
$image = sprintf('<a href="%s" class="%s"%s>%s</a>', $attributes['image_link'], $image_classes, $attributes['target_blank'] ? ' target="_blank"' : '', $image);
} else {
$image = sprintf('<span class="%s">%s</span>', $image_classes, $image);
}
}
if ($attributes['title']) {
$title = sprintf('<%1$s>%2$s</%1$s>', $attributes['header_size'], $attributes['title']);
}
$style = '1';
$column = '4';
$dividers = ' class="borders"';
if (!empty($attributes)) {
$style = $attributes['style'];
$column = $attributes['columns'];
$dividers = !$attributes['dividers'] ? $dividers = '' : $dividers;
}
switch ($column) {
case '1':
$column_class = 'wf-1';
break;
case '2':
$column_class = 'wf-1-2';
break;
case '3':
$column_class = 'wf-1-3';
break;
case '5':
$column_class = 'wf-1-5';
break;
default:
$column_class = 'wf-1-4';
}
switch ($style) {
case '2':
$output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td">%s</div></div>%s</div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title, $content);
break;
case '3':
$output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td benefits-inner">%s</div></div></div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title . $content);
break;
//.........这里部分代码省略.........
示例11: render_logo
public function render_logo($attributes = array())
{
$post_id = get_the_ID();
if (!$post_id) {
return '';
}
$html = '';
$images = array('normal' => null, 'retina' => null);
$image_classes = array();
$esc_title = esc_attr(get_the_title());
$thumb_id = 0;
// get featured image
if (has_post_thumbnail($post_id)) {
$thumb_id = get_post_thumbnail_id($post_id);
$images['normal'] = wp_get_attachment_image_src($thumb_id, 'full');
}
// get retina image
$retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true);
if ($retina_logo_id) {
$images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina');
}
// default image
$default_img = null;
foreach ($images as $image) {
if ($image) {
$default_img = $image;
break;
}
}
if (!$default_img) {
return '';
}
if (isset($attributes['animation']) && 'none' != $attributes['animation']) {
switch ($attributes['animation']) {
case 'scale':
$image_classes[] = 'scale-up';
break;
case 'fade':
$image_classes[] = 'fade-in';
break;
case 'left':
$image_classes[] = 'right-to-left';
break;
case 'right':
$image_classes[] = 'left-to-right';
break;
case 'bottom':
$image_classes[] = 'top-to-bottom';
break;
case 'top':
$image_classes[] = 'bottom-to-top';
break;
}
$image_classes[] = 'animate-element';
}
// ninjaaaa!
$image_classes = implode(' ', $image_classes);
// final image
$image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes));
// if link not empty - wrap image with it
$link = get_post_meta($post_id, '_dt_logo_options_link', true);
if ($link) {
$image_id = dt_is_hd_device() && isset($retina_logo_id[0]) ? $retina_logo_id[0] : $thumb_id;
$esc_caption = '';
$attachment = dt_get_attachment($image_id);
if ($attachment) {
$esc_caption = esc_attr($attachment['description']);
}
$link = esc_attr($link);
$image = '<a href="' . $link . '" target="_blank" title="' . $esc_caption . '" >' . $image . '</a>';
}
// get it all togeather
return $image;
}
示例12: presscore_setup_floating_menu
/**
* Set some javascript globals for floating menu and logo.
*
*/
function presscore_setup_floating_menu()
{
$show_logo = of_get_option('general-floating_menu_show_logo', false);
$show_menu = of_get_option('header-show_floating_menu', true);
$logo_src = '';
$w = '';
$h = '';
if ($show_menu && $show_logo) {
$logos = presscore_get_floating_menu_logos_meta();
$default_logo = '';
$r_logo = $logos['logo_retina'];
$logo = $logos['logo'];
// get default logo
foreach ($logos as $logo) {
if ($logo) {
$default_logo = $logo;
break;
}
}
if ($logo && !$r_logo) {
$r_logo = $logo;
} elseif ($r_logo && !$logo) {
$logo = $r_logo;
} elseif (!$r_logo && !$logo) {
$logo = $r_logo = $default_logo;
}
if (dt_retina_on() && dt_is_hd_device()) {
$logo = $r_logo;
}
$logo_src = isset($logo[0]) ? $logo[0] : '';
$w = isset($logo[1]) ? $logo[1] : '';
$h = isset($logo[2]) ? $logo[2] : '';
}
?>
<script type="text/javascript">
dtGlobals.logoEnabled = <?php
echo absint($show_logo);
?>
;
dtGlobals.logoURL = '<?php
echo esc_url($logo_src);
?>
';
dtGlobals.logoW = '<?php
echo absint($w);
?>
';
dtGlobals.logoH = '<?php
echo absint($h);
?>
';
smartMenu = <?php
echo absint($show_menu);
?>
;
</script>
<?php
}