Exemple #1
0
    function render_frame_contents($i, $frame)
    {
        // Clear out any empty background videos
        if (!empty($frame['background_videos']) && is_array($frame['background_videos'])) {
            for ($i = 0; $i < count($frame['background_videos']); $i++) {
                if (empty($frame['background_videos'][$i]['file']) && empty($frame['background_videos'][$i]['url'])) {
                    unset($frame['background_videos'][$i]);
                }
            }
        }
        $foreground_src = siteorigin_widgets_get_attachment_image_src($frame['foreground_image'], 'full', !empty($frame['foreground_image_fallback']) ? $frame['foreground_image_fallback'] : '');
        if (!empty($foreground_src)) {
            ?>
			<div class="sow-slider-image-container">
				<div class="sow-slider-image-wrapper" style="<?php 
            if (!empty($foreground_src[1])) {
                echo 'max-width: ' . intval($foreground_src[1]) . 'px';
            }
            ?>
">
					<?php 
            if (!empty($frame['url'])) {
                echo '<a href="' . sow_esc_url($frame['url']) . '" ' . (!empty($frame['new_window']) ? 'target="_blank"' : '') . '>';
            }
            echo siteorigin_widgets_get_attachment_image($frame['foreground_image'], 'full', !empty($frame['foreground_image_fallback']) ? $frame['foreground_image_fallback'] : '');
            if (!empty($frame['url'])) {
                echo '</a>';
            }
            ?>
				</div>
			</div>
			<?php 
        } else {
            if (empty($frame['background_videos'])) {
                // We need to find another background
                if (!empty($frame['url'])) {
                    echo '<a href="' . sow_esc_url($frame['url']) . '" ' . (!empty($frame['new_window']) ? 'target="_blank"' : '') . '>';
                }
                // Lets use the background image
                echo siteorigin_widgets_get_attachment_image($frame['background_image'], 'full', !empty($frame['background_image_fallback']) ? $frame['background_image_fallback'] : '');
                if (!empty($frame['url'])) {
                    echo '</a>';
                }
            }
        }
    }
Exemple #2
0
function siteorigin_widgets_get_attachment_image($attachment, $size, $fallback)
{
    if (!empty($attachment)) {
        return wp_get_attachment_image($attachment, $size);
    } else {
        $src = siteorigin_widgets_get_attachment_image_src($attachment, $size, $fallback);
        if (empty($src[0])) {
            return '';
        }
        $atts = array('src' => $src[0]);
        if (!empty($src[1])) {
            $atts['width'] = $src[1];
        }
        if (!empty($src[2])) {
            $atts['height'] = $src[2];
        }
        $return = '<img ';
        foreach ($atts as $id => $val) {
            $return .= $id . '="' . esc_attr($val) . '" ';
        }
        return $return;
    }
}
Exemple #3
0
 /**
  * Get everything necessary for the background image.
  *
  * @param $i
  * @param $frame
  *
  * @return array
  */
 function get_frame_background($i, $frame)
 {
     $background_image = siteorigin_widgets_get_attachment_image_src($frame['background']['image'], 'full', !empty($frame['background']['image_fallback']) ? $frame['background']['image_fallback'] : '');
     return array('color' => !empty($frame['background']['color']) ? $frame['background']['color'] : false, 'image' => !empty($background_image[0]) ? $background_image[0] : false, 'image-width' => !empty($background_image[1]) ? $background_image[1] : 0, 'image-height' => !empty($background_image[2]) ? $background_image[2] : 0, 'image-sizing' => $frame['background']['image_type'], 'url' => !empty($frame['background']['url']) ? $frame['background']['url'] : false, 'new_window' => !empty($frame['background']['new_window']), 'videos' => $frame['background']['videos'], 'video-sizing' => 'background', 'opacity' => intval($frame['background']['opacity']) / 100);
 }
 * @var $alt
 * @var $url
 * @var $new_window
 */
?>

<?php 
if ($title_position == 'above') {
    ?>
	<?php 
    echo $args['before_title'] . wp_kses_post($title) . $args['after_title'];
}
?>

<?php 
$src = siteorigin_widgets_get_attachment_image_src($image, $size, $image_fallback);
$attr = array();
if (!empty($src)) {
    $attr = array('src' => $src[0]);
    if (!empty($src[1])) {
        $attr['width'] = $src[1];
    }
    if (!empty($src[2])) {
        $attr['height'] = $src[2];
    }
    if (function_exists('wp_get_attachment_image_srcset')) {
        $attr['srcset'] = wp_get_attachment_image_srcset($image, $size);
    }
}
$attr = apply_filters('siteorigin_widgets_image_attr', $attr, $instance, $this);
$classes = array('so-widget-image');
<?php

$src = siteorigin_widgets_get_attachment_image_src($background, 'full', $background_fallback);
if ($height && $src) {
    echo '<div class="lrw-promote-box has-bg promote-align-' . $align . '" style="background-image: url( ' . $src[0] . ' );">';
} else {
    echo '<div class="lrw-promote-box promote-align-' . $align . '">';
    if ($src) {
        echo '<img src="' . $src[0] . '" class="lrw-promote-image">';
    }
}
echo '<div class="lrw-promote-overlay"></div>';
echo '<div class="lrw-promote-infos">';
if ($title) {
    echo '<' . $title_type . ' class="lrw-promote-title">' . $title . '</' . $title_type . '>';
}
if ($content) {
    echo '<div class="lrw-promote-content">' . wp_kses_post($content) . '</div>';
}
if (!empty($buttons)) {
    echo '<div class="lrw-promote-button">';
    foreach ($buttons as $button) {
        $this->sub_widget('SiteOrigin_Widget_Button_Widget', $args, $button['button']);
    }
    echo '</div>';
}
echo '</div>';
echo '</div>';
Exemple #6
0
<?php

$src = siteorigin_widgets_get_attachment_image_src($instance['image'], $instance['size'], !empty($instance['image_fallback']) ? $instance['image_fallback'] : false);
if (!empty($src)) {
    $attr = array('src' => $src[0]);
    if (!empty($src[1])) {
        $attr['width'] = $src[1];
    }
    if (!empty($src[2])) {
        $attr['height'] = $src[2];
    }
}
$styles = array();
$classes = array('so-widget-image');
if (!empty($instance['title'])) {
    $attr['title'] = $instance['title'];
}
if (!empty($instance['alt'])) {
    $attr['alt'] = $instance['alt'];
}
if (!empty($instance['bound'])) {
    $styles[] = 'max-width:100%';
    $styles[] = 'height:auto';
}
if (!empty($instance['full_width'])) {
    $styles[] = 'width:100%';
}
$styles[] = 'display:block';
?>

<?php 
<?php

$photo = $instance['photo_settings']['photo'];
$photo_size = $instance['photo_settings']['photo_size'];
$photo_fallback = $instance['photo_settings']['photo_fallback'];
$photo_shape = $instance['photo_settings']['photo_shape'];
$name = $instance['name_settings']['name'];
$name_type = $instance['name_settings']['name_type'];
$role = $instance['role_settings']['role'];
$role_type = $instance['role_settings']['role_type'];
$resume = $instance['resume_settings']['resume'];
$profiles = $instance['social']['profiles'];
$align = $instance['member_align'];
$src = siteorigin_widgets_get_attachment_image_src($photo, $photo_size, !empty($photo_fallback) ? $photo_fallback : false);
echo '<div class="lrw-member person-align-' . $align . '">';
// Define shape type
$image_shape_type = array();
$image_shape_type[] = $photo_shape !== 'none' ? 'image-shape-' . $photo_shape : '';
echo '<figure class="image-wrapper"><img src="' . $src[0] . '"' . (!empty($src[1]) ? ' width="' . $src[1] . '"' : '') . (!empty($src[2]) ? ' height="' . $src[2] . '"' : '') . 'class="' . esc_attr(implode(' ', $image_shape_type)) . '" title="' . $name . '"></figure>';
echo '<' . $name_type . ' class="member-name">' . wp_kses_post($name) . '</' . $name_type . '>';
echo '<' . $role_type . ' class="member-role">' . wp_kses_post($role) . '</' . $role_type . '>';
echo '<ul class="person-social-profiles">';
foreach ($profiles as $i => $profile) {
    $title = $profile['title'];
    $icon_shape = $profile['icon_shape'];
    $shape_color = $profile['shape_color'];
    $icon = $profile['icon'];
    $icon_size = $profile['icon_size'];
    $icon_color = $profile['icon_color'];
    $url = $profile['url'];
    $new_window = $profile['new_window'];