function video_code($videos, $classes = array()) { if (empty($videos)) { return; } $video_element = '<video class="' . esc_attr(implode(',', $classes)) . '" autoplay loop muted>'; foreach ($videos as $video) { if (empty($video['file']) && empty($video['url'])) { continue; } if (empty($video['url'])) { $video_file = wp_get_attachment_url($video['file']); $video_element .= '<source src="' . sow_esc_url($video_file) . '" type="' . esc_attr($video['format']) . '">'; } else { $args = ''; if (!empty($video['height'])) { $args['height'] = $video['height']; } echo wp_oembed_get($video['url'], $args); } } if (strpos($video_element, 'source') !== false) { $video_element .= '</video>'; echo $video_element; } }
function sow_carousel_get_next_posts_page() { if (empty($_REQUEST['_widgets_nonce']) || !wp_verify_nonce($_REQUEST['_widgets_nonce'], 'widgets_action')) { return; } $query = wp_parse_args(siteorigin_widget_post_selector_process_query($_GET['query']), array('post_status' => 'publish', 'posts_per_page' => 10, 'paged' => empty($_GET['paged']) ? 1 : $_GET['paged'])); $posts = new WP_Query($query); ob_start(); while ($posts->have_posts()) { $posts->the_post(); ?> <li class="sow-carousel-item"> <div class="sow-carousel-thumbnail"> <?php if (has_post_thumbnail()) { $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default'); ?> <a href="<?php the_permalink(); ?> " style="background-image: url(<?php echo sow_esc_url($img[0]); ?> )"> <span class="overlay"></span> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " class="sow-carousel-default-thumbnail"><span class="overlay"></span></a> <?php } ?> </div> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> </li> <?php } wp_reset_postdata(); $result = array('html' => ob_get_clean()); header('content-type: application/json'); echo json_encode($result); exit; }
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]); } } } if (!empty($frame['foreground_image'])) { $foreground_image = wp_get_attachment_image_src($frame['foreground_image'], 'full'); ?> <div class="sow-slider-image-container"> <div class="sow-slider-image-wrapper" style="<?php if (!empty($foreground_image[1])) { echo 'max-width: ' . intval($foreground_image[1]) . 'px'; } ?> "> <?php if (!empty($frame['url'])) { echo '<a href="' . sow_esc_url($frame['url']) . '">'; } echo wp_get_attachment_image($frame['foreground_image'], 'full'); 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 wp_get_attachment_image($frame['background_image'], 'full'); if (!empty($frame['url'])) { echo '</a>'; } } } }
function get_template_variables($instance, $args) { if (empty($instance)) { return array(); } $settings = $instance['settings']; $mrkr_src = wp_get_attachment_image_src($instance['markers']['marker_icon']); $styles = $this->get_styles($instance); if ($settings['map_type'] == 'static') { $src_url = $this->get_static_image_src($instance, $settings['width'], $settings['height'], !empty($styles) ? $styles['styles'] : array()); return array('src_url' => sow_esc_url($src_url)); } else { $markers = $instance['markers']; $directions_json = ''; if (!empty($instance['directions']['origin']) && !empty($instance['directions']['destination'])) { if (empty($instance['directions']['waypoints'])) { unset($instance['directions']['waypoints']); } $directions_json = json_encode(siteorigin_widgets_underscores_to_camel_case($instance['directions'])); } return array('map_id' => md5($instance['map_center']), 'height' => $settings['height'], 'map_data' => array('address' => $instance['map_center'], 'zoom' => $settings['zoom'], 'scroll-zoom' => $settings['scroll_zoom'], 'draggable' => $settings['draggable'], 'marker-icon' => !empty($mrkr_src) ? $mrkr_src[0] : '', 'markers-draggable' => isset($markers['markers_draggable']) ? $markers['markers_draggable'] : '', 'marker-at-center' => $markers['marker_at_center'], 'marker-positions' => isset($markers['marker_positions']) ? json_encode($markers['marker_positions']) : '', 'map-name' => !empty($styles) ? $styles['map_name'] : '', 'map-styles' => !empty($styles) ? json_encode($styles['styles']) : '', 'directions' => $directions_json, 'api-key' => $instance['api_key_section']['api_key'])); } }
$styles[] = 'height:auto'; } if (!empty($instance['featured_full_width'])) { $styles[] = 'width:100%'; } $styles[] = 'display:block'; $post_title = wp_kses_post($instance['featured_title']); $post_link = wp_kses_post($instance['featured_link_text']); ?> <?php if (!empty($instance['featured_image'])) { ?> <div class="featured-block"> <a href="<?php echo sow_esc_url($instance['featured_url']); ?> " class="img-thumbnail" <?php if ($instance['featured_new_window']) { echo 'target="_blank"'; } ?> ><?php } ?> <img <?php foreach ($attr as $n => $v) { echo $n . '="' . esc_attr($v) . '" '; } ?> class="<?php
<?php $classes = array('iw-so-button'); if (!empty($instance['styling']['hover'])) { $classes[] = 'iw-so-button-hover'; } if (!empty($instance['styling']['click'])) { $classes[] = 'iw-so-button-click'; } $button_attributes = array('class' => esc_attr(implode(' ', $classes))); if (!empty($instance['new_window'])) { $button_attributes['target'] = '_blank'; } if (!empty($instance['url'])) { $button_attributes['href'] = sow_esc_url($instance['url']); } if (!empty($instance['attributes']['id'])) { $button_attributes['id'] = esc_attr($instance['attributes']['id']); } if (!empty($instance['attributes']['title'])) { $button_attributes['title'] = esc_attr($instance['attributes']['title']); } if (!empty($instance['attributes']['onclick'])) { $button_attributes['onclick'] = esc_attr($instance['attributes']['onclick']); } $icon_styles = array(); ?> <div class="iw-so-button-base"> <a <?php foreach ($button_attributes as $name => $val) {
} $attr = apply_filters('siteorigin_widgets_image_attr', $attr, $instance, $this); $classes = array('so-widget-image'); if (!empty($title)) { $attr['title'] = $title; } if (!empty($alt)) { $attr['alt'] = $alt; } ?> <div class="sow-image-container"> <?php if (!empty($url)) { ?> <a href="<?php echo sow_esc_url($url); ?> " <?php if ($new_window) { echo 'target="_blank"'; } ?> ><?php } ?> <img <?php foreach ($attr as $n => $v) { echo $n . '="' . esc_attr($v) . '" '; } ?> class="<?php
echo $numberPosts; ?> " data-items-desktop-small="3" data-items-tablet="2" data-items-mobile="1"> <?php foreach ($instance['images'] as $i => $image) { if (!empty($image['icon_image'])) { $src = wp_get_attachment_image_src($image['icon_image'], $image['icon_size']); if (!empty($src)) { $attr = array('src' => $src[0], 'width' => $src[1], 'height' => $src[2]); } ?> <li class="item"><?php if (!empty($image['more_url'])) { ?> <a href="<?php echo sow_esc_url($image['more_url']); ?> " <?php echo $image['new_window'] ? 'target="_blank"' : ''; ?> ><?php } ?> <img <?php foreach ($attr as $n => $v) { echo $n . '="' . esc_attr($v) . '" '; } ?> alt=""><?php if (!empty($image['more_url'])) { ?>
<div class="social-media-button-container"> <?php foreach ($networks as $network) { $classes = array(); if (!empty($instance['design']['hover'])) { $classes[] = 'ow-button-hover'; } $classes[] = "sow-social-media-button-" . sanitize_html_class($network['name']); $classes[] = "sow-social-media-button"; $button_attributes = array('class' => esc_attr(implode(' ', $classes)), 'title' => sprintf(__('%s on %s', 'so-widgets-bundle'), get_bloginfo('name'), ucwords(str_replace('-', ' ', $network['name'])))); if (!empty($instance['design']['new_window'])) { $button_attributes['target'] = '_blank'; } if (!empty($network['url'])) { $button_attributes['href'] = sow_esc_url($network['url']); } ?> <a <?php foreach ($button_attributes as $name => $val) { echo $name . '="' . esc_attr($val) . '" '; } ?> > <span> <?php if (!empty($network['is_custom'])) { echo '<!-- premium-' . $network['name'] . ' -->'; } ?> <?php
$button_attributes['onclick'] = esc_attr($instance['attributes']['onclick']); } ?> <a <?php foreach ($button_attributes as $name => $val) { echo $name . '="' . $val . '" '; } ?> > <span> <?php if (!empty($instance['button_icon']['icon'])) { $attachment = wp_get_attachment_image_src($instance['button_icon']['icon']); if (!empty($attachment)) { $icon_styles[] = 'background-image: url(' . sow_esc_url($attachment[0]) . ')'; ?> <div class="sow-icon-image" style="<?php echo implode('; ', $icon_styles); ?> "></div><?php } } else { $icon_styles = array(); if (!empty($instance['button_icon']['icon_color'])) { $icon_styles[] = 'color: ' . $instance['button_icon']['icon_color']; } echo siteorigin_widget_get_icon($instance['button_icon']['icon_selected'], $icon_styles); } ?>
<?php echo '<div class="lrw-heading"> <' . $instance['heading_type'] . ' class="custom-heading heading-align' . ($instance['url_active'] == 'yes' && !empty($instance['url_settings']['hover']) ? ' has-hover' : '') . '">' . ($instance['url_active'] == 'yes' && $instance['url_settings']['url'] ? '<a class="heading-link" href="' . sow_esc_url($instance['url_settings']['url']) . '" ' . ($instance['url_settings']['new_window'] ? 'target="_blank"' : '') . '>' : '') . wp_kses_post($instance['title']) . ($instance['url_active'] == 'yes' && $instance['url_settings']['url'] ? '</a>' : '') . '</' . $instance['heading_type'] . '>' . '</div>';
/** * Display the widget form. * * @param array $instance * @return string|void */ public function form($instance) { $this->enqueue_scripts(); $instance = $this->modify_instance($instance); $instance = $this->add_defaults($this->form_options(), $instance); // Filter the instance specifically for the form $instance = apply_filters('siteorigin_widgets_form_instance_' . $this->id_base, $instance, $this); $form_id = 'siteorigin_widget_form_' . md5(uniqid(rand(), true)); $class_name = str_replace('_', '-', strtolower(get_class($this))); if (empty($instance['_sow_form_id'])) { $instance['_sow_form_id'] = uniqid(); } ?> <div class="siteorigin-widget-form siteorigin-widget-form-main siteorigin-widget-form-main-<?php echo esc_attr($class_name); ?> " id="<?php echo $form_id; ?> " data-class="<?php echo get_class($this); ?> " style="display: none"> <?php /* @var $field_factory SiteOrigin_Widget_Field_Factory */ $field_factory = SiteOrigin_Widget_Field_Factory::getInstance(); $fields_javascript_variables = array(); foreach ($this->form_options() as $field_name => $field_options) { /* @var $field SiteOrigin_Widget_Field_Base */ $field = $field_factory->create_field($field_name, $field_options, $this); $field->render(isset($instance[$field_name]) ? $instance[$field_name] : null, $instance); $field_js_vars = $field->get_javascript_variables(); if (!empty($field_js_vars)) { $fields_javascript_variables[$field_name] = $field_js_vars; } $field->enqueue_scripts(); $this->fields[$field_name] = $field; } ?> <input type="hidden" name="<?php echo $this->get_field_name('_sow_form_id'); ?> " value="<?php echo esc_attr($instance['_sow_form_id']); ?> " class="siteorigin-widgets-form-id" /> </div> <div class="siteorigin-widget-form-no-styles"> <p><strong><?php _e('This widget has scripts and styles that need to be loaded before you can use it. Please save and reload your current page.', 'so-widgets-bundle'); ?> </strong></p> <p><strong><?php _e('You will only need to do this once.', 'so-widgets-bundle'); ?> </strong></p> </div> <?php if ($this->widget_options['has_preview'] && !$this->is_customize_preview()) { ?> <div class="siteorigin-widget-preview" style="display: none"> <a href="#" class="siteorigin-widget-preview-button button-secondary"><?php _e('Preview', 'so-widgets-bundle'); ?> </a> </div> <?php } ?> <?php if (!empty($this->widget_options['help'])) { ?> <a href="<?php echo sow_esc_url($this->widget_options['help']); ?> " class="siteorigin-widget-help-link siteorigin-panels-help-link" target="_blank"><?php _e('Help', 'so-widgets-bundle'); ?> </a> <?php } ?> <script type="text/javascript"> ( function($) { if(typeof window.sow_field_javascript_variables == 'undefined') window.sow_field_javascript_variables = {}; window.sow_field_javascript_variables["<?php echo get_class($this); ?> "] = <?php echo json_encode($fields_javascript_variables); ?> ; if(typeof $.fn.sowSetupForm != 'undefined') { $('#<?php echo $form_id; ?> ').sowSetupForm(); } else { // Init once admin scripts have been loaded $( document).on('sowadminloaded', function(){ $('#<?php echo $form_id; ?> ').sowSetupForm(); }); } } )( jQuery ); </script> <?php }
/** * Render a form field * * @param string $name The field name * @param string $field The field attributes * @param mixed $value The current field value * @param array $all_values An array of all values at the same level as this field * @param array $repeater * @param bool $is_template */ function render_field($name, $field, $value, $all_values, $repeater = array(), $is_template = false) { if (is_null($value) && isset($field['default'])) { $value = $field['default']; } $wrapper_attributes = array('class' => array('siteorigin-widget-field', 'siteorigin-widget-field-type-' . $field['type'], 'siteorigin-widget-field-' . $name)); if (!empty($field['state_name'])) { $wrapper_attributes['class'][] = 'siteorigin-widget-field-state-' . $field['state_name']; } if (!empty($field['hidden'])) { $wrapper_attributes['class'][] = 'siteorigin-widget-field-is-hidden'; } if (!empty($field['optional'])) { $wrapper_attributes['class'][] = 'siteorigin-widget-field-is-optional'; } $wrapper_attributes['class'] = implode(' ', array_map('sanitize_html_class', $wrapper_attributes['class'])); if (!empty($field['state_emitter'])) { // State emitters create new states for the form $wrapper_attributes['data-state-emitter'] = json_encode($field['state_emitter']); } if (!empty($field['state_handler'])) { // State handlers decide what to do with form states $wrapper_attributes['data-state-handler'] = json_encode($field['state_handler']); } if (!empty($field['state_handler_initial'])) { // Initial state handlers are only run when the form is first loaded $wrapper_attributes['data-state-handler-initial'] = json_encode($field['state_handler_initial']); } ?> <div <?php foreach ($wrapper_attributes as $attr => $attr_val) { echo $attr . '="' . esc_attr($attr_val) . '" '; } ?> ><?php $field_id = $this->so_get_field_id($name, $repeater, $is_template); if ($field['type'] != 'repeater' && $field['type'] != 'checkbox' && $field['type'] != 'separator' && !empty($field['label'])) { ?> <label for="<?php echo $field_id; ?> " class="siteorigin-widget-field-label <?php if (empty($field['hide'])) { echo 'siteorigin-widget-section-visible'; } ?> "> <?php echo $field['label']; if (!empty($field['optional'])) { echo ' <span class="field-optional">(' . __('Optional', 'siteorigin-panels') . ')</span>'; } ?> </label> <?php } switch ($field['type']) { case 'text': ?> <input type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo esc_attr($value); ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input" <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> /><?php break; case 'link': ?> <a href="#" class="select-content-button button-secondary"><?php _e('Select Content', 'siteorigin-widgets'); ?> </a> <div class="existing-content-selector"> <input type="text" placeholder="<?php esc_attr_e('Search Content', 'siteorigin-widgets'); ?> " class="content-text-search" /> <ul class="posts"></ul> <div class="buttons"> <a href="#" class="button-close button-secondary"><?php _e('Close', 'siteorigin-widgets'); ?> </a> </div> </div> <div class="url-input-wrapper"> <input type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo esc_attr($value); ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input" <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> /> </div> <?php break; case 'color': ?> <input type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo esc_attr($value); ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input siteorigin-widget-input-color" /><?php break; case 'number': ?> <input type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo esc_attr($value); ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input siteorigin-widget-input-number" <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> /><?php break; case 'textarea': ?> <textarea type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input" rows="<?php echo !empty($field['rows']) ? intval($field['rows']) : 4; ?> " <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> ><?php echo esc_textarea($value); ?> </textarea><?php break; case 'editor': // The editor field doesn't actually work yet, this is just a placeholder ?> <textarea type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " <?php if (!empty($field['placeholder'])) { echo 'placeholder="' . $field['placeholder'] . '"'; } ?> class="widefat siteorigin-widget-input siteorigin-widget-input-editor" rows="<?php echo !empty($field['rows']) ? intval($field['rows']) : 4; ?> " <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> ><?php echo esc_textarea($value); ?> </textarea><?php break; case 'slider': ?> <div class="siteorigin-widget-slider-value"><?php echo !empty($value) ? $value : 0; ?> </div> <div class="siteorigin-widget-slider-wrapper"> <div class="siteorigin-widget-value-slider"></div> </div> <input type="number" class="siteorigin-widget-input" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo !empty($value) ? esc_attr($value) : 0; ?> " min="<?php echo isset($field['min']) ? intval($field['min']) : 0; ?> " max="<?php echo isset($field['max']) ? intval($field['max']) : 100; ?> " /> <?php break; case 'select': ?> <select name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " class="siteorigin-widget-input"> <?php if (isset($field['prompt'])) { ?> <option value="default" disabled="disabled" selected="selected"><?php echo esc_html($field['prompt']); ?> </option> <?php } ?> <?php if (isset($field['options']) && !empty($field['options'])) { ?> <?php foreach ($field['options'] as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $value); ?> ><?php echo esc_html($val); ?> </option> <?php } ?> <?php } ?> </select> <?php break; case 'checkbox': ?> <label for="<?php echo $field_id; ?> "> <input type="checkbox" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " class="siteorigin-widget-input" <?php checked(!empty($value)); ?> /> <?php echo $field['label']; ?> </label> <?php break; case 'radio': ?> <?php if (!isset($field['options']) || empty($field['options'])) { return; } ?> <?php foreach ($field['options'] as $k => $v) { ?> <label for="<?php echo $field_id . '-' . $k; ?> "> <input type="radio" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id . '-' . $k; ?> " class="siteorigin-widget-input" value="<?php echo esc_attr($k); ?> " <?php checked($k, $value); ?> > <?php echo esc_html($v); ?> </label> <?php } ?> <?php break; case 'media': if (version_compare(get_bloginfo('version'), '3.5', '<')) { printf(__('You need to <a href="%s">upgrade</a> to WordPress 3.5 to use media fields', 'siteorigin-widgets'), admin_url('update-core.php')); break; } if (!empty($value)) { if (is_array($value)) { $src = $value; } else { $post = get_post($value); $src = wp_get_attachment_image_src($value, 'thumbnail'); if (empty($src)) { $src = wp_get_attachment_image_src($value, 'thumbnail', true); } } } else { $src = array('', 0, 0); } $choose_title = empty($field['choose']) ? __('Choose Media', 'siteorigin-widgets') : $field['choose']; $update_button = empty($field['update']) ? __('Set Media', 'siteorigin-widgets') : $field['update']; $library = empty($field['library']) ? 'image' : $field['library']; ?> <div class="media-field-wrapper"> <div class="current"> <div class="thumbnail-wrapper"> <img src="<?php echo sow_esc_url($src[0]); ?> " class="thumbnail" <?php if (empty($src[0])) { echo "style='display:none'"; } ?> /> </div> <div class="title"><?php if (!empty($post)) { echo esc_attr($post->post_title); } ?> </div> </div> <a href="#" class="media-upload-button" data-choose="<?php echo esc_attr($choose_title); ?> " data-update="<?php echo esc_attr($update_button); ?> " data-library="<?php echo esc_attr($library); ?> "> <?php echo esc_html($choose_title); ?> </a> </div> <a href="#" class="media-remove-button <?php if (empty($value)) { echo 'remove-hide'; } ?> "><?php esc_html_e('Remove', 'siteorigin-widgets'); ?> </a> <?php if (!empty($field['fallback'])) { $v_name = $name; if (strpos($v_name, '][') !== false) { // Remove this splitter $v_name = substr($v_name, strpos($v_name, '][') + 2); } $fallback_url = !empty($all_values[$v_name . '_fallback']) ? $all_values[$v_name . '_fallback'] : ''; ?> <input type="text" value="<?php echo esc_url($fallback_url); ?> " placeholder="<?php esc_attr_e('External URL', 'siteorigin-widgets'); ?> " name="<?php echo $this->so_get_field_name($name . '_fallback', $repeater); ?> " class="media-fallback-external siteorigin-widget-input" /><?php } ?> <div class="clear"></div> <input type="hidden" value="<?php echo esc_attr(is_array($value) ? '-1' : $value); ?> " name="<?php echo $this->so_get_field_name($name, $repeater); ?> " class="siteorigin-widget-input" /> <?php break; case 'posts': siteorigin_widget_post_selector_admin_form_field(is_array($value) ? '' : $value, $this->so_get_field_name($name, $repeater)); break; case 'repeater': if (!isset($field['fields']) || empty($field['fields'])) { return; } ob_start(); $repeater[] = $name; foreach ($field['fields'] as $sub_field_name => $sub_field) { $this->render_field($sub_field_name, $sub_field, isset($value[$sub_field_name]) ? $value[$sub_field_name] : null, $value, $repeater, true); } $html = ob_get_clean(); $this->repeater_html[$name] = $html; $item_label = isset($field['item_label']) ? $field['item_label'] : null; if (!empty($item_label)) { // convert underscore naming convention to camelCase for javascript // and encode as json string $item_label = $this->underscores_to_camel_case($item_label); $item_label = json_encode($item_label); } $item_name = !empty($field['item_name']) ? $field['item_name'] : __('Item', 'siteorigin-widgets'); ?> <div class="siteorigin-widget-field-repeater" data-item-name="<?php echo esc_attr($item_name); ?> " data-repeater-name="<?php echo esc_attr($name); ?> " <?php echo !empty($item_label) ? 'data-item-label="' . esc_attr($item_label) . '"' : ''; ?> <?php echo !empty($field['scroll_count']) ? 'data-scroll-count="' . esc_attr($field['scroll_count']) . '"' : ''; ?> <?php if (!empty($field['readonly'])) { echo 'readonly'; } ?> > <div class="siteorigin-widget-field-repeater-top"> <div class="siteorigin-widget-field-repeater-expend"></div> <h3><?php echo $field['label']; ?> </h3> </div> <div class="siteorigin-widget-field-repeater-items"> <?php if (!empty($value)) { foreach ($value as $v) { ?> <div class="siteorigin-widget-field-repeater-item ui-draggable"> <div class="siteorigin-widget-field-repeater-item-top"> <div class="siteorigin-widget-field-expand"></div> <?php if (empty($field['readonly'])) { ?> <div class="siteorigin-widget-field-remove"></div> <?php } ?> <h4><?php echo esc_html($item_name); ?> </h4> </div> <div class="siteorigin-widget-field-repeater-item-form"> <?php foreach ($field['fields'] as $sub_field_name => $sub_field) { $this->render_field($sub_field_name, $sub_field, isset($v[$sub_field_name]) ? $v[$sub_field_name] : null, $v, $repeater); } ?> </div> </div> <?php } } ?> </div> <?php if (empty($field['readonly'])) { ?> <div class="siteorigin-widget-field-repeater-add"><?php _e('Add', 'siteorigin-widgets'); ?> </div> <?php } ?> </div> <?php break; case 'widget': // Create the extra form entries ?> <div class="siteorigin-widget-section <?php if (!empty($field['hide'])) { echo 'siteorigin-widget-section-hide'; } ?> "><?php if (!class_exists($field['class'])) { printf(__('%s does not exist', 'siteorigin-widgets'), $field['class']); echo '</div>'; break; } $sub_widget = new $field['class'](); if (!is_a($sub_widget, 'SiteOrigin_Widget')) { printf(__('%s is not a SiteOrigin Widget', 'siteorigin-widgets'), $field['class']); echo '</div>'; break; } foreach ($sub_widget->form_options($this) as $sub_name => $sub_field) { $this->render_field($name . '][' . $sub_name, $sub_field, isset($value[$sub_name]) ? $value[$sub_name] : null, $value, $repeater); } ?> </div><?php break; case 'icon': static $widget_icon_families; if (empty($widget_icon_families)) { $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array()); } list($value_family, $null) = !empty($value) ? explode('-', $value, 2) : array('fontawesome', ''); ?> <div class="siteorigin-widget-icon-selector siteorigin-widget-field-subcontainer"> <select class="siteorigin-widget-icon-family" > <?php foreach ($widget_icon_families as $family_id => $family_info) { ?> <option value="<?php echo esc_attr($family_id); ?> " <?php selected($value_family, $family_id); ?> ><?php echo esc_html($family_info['name']); ?> (<?php echo count($family_info['icons']); ?> )</option> <?php } ?> </select> <input type="hidden" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " value="<?php echo esc_attr($value); ?> " class="siteorigin-widget-icon-icon siteorigin-widget-input" /> <div class="siteorigin-widget-icon-icons"></div> </div> <?php break; case 'font': static $widget_font_families; if (empty($widget_font_families)) { $widget_font_families = siteorigin_widgets_font_families(); } ?> <div class="siteorigin-widget-font-selector siteorigin-widget-field-subcontainer"> <select name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " class="siteorigin-widget-input"> <option value="default" selected="selected"><?php _e('Use theme font', 'siteorigin-widgets'); ?> </option> <?php foreach ($widget_font_families as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $value); ?> ><?php echo esc_html($val); ?> </option> <?php } ?> </select> </div> <?php break; case 'section': ?> <div class="siteorigin-widget-section <?php if (!empty($field['hide'])) { echo 'siteorigin-widget-section-hide'; } ?> "><?php if (!isset($field['fields']) || empty($field['fields'])) { return; } foreach ((array) $field['fields'] as $sub_name => $sub_field) { $this->render_field($name . '][' . $sub_name, $sub_field, isset($value[$sub_name]) ? $value[$sub_name] : null, $value, $repeater); } ?> </div><?php break; case 'bucket': // A bucket select and explore field ?> <input type="text" name="<?php echo $this->so_get_field_name($name, $repeater); ?> " id="<?php echo $field_id; ?> " value="<?php echo esc_attr($value); ?> " class="widefat siteorigin-widget-input" /><?php break; default: // We couldn't find the field, so lets give other plugins a chance to provide it echo apply_filters('siteorigin_widget_missing_field', __('Unknown Field', 'siteorigin-widgets'), $field, $value, $this); break; } if (!empty($field['description'])) { ?> <div class="siteorigin-widget-field-description"><?php echo wp_kses_post($field['description']); ?> </div><?php } ?> </div><?php }
echo $column_style; ?> lsow-zero-margin"> <?php echo wp_get_attachment_image($client['image'], 'full', false, array('class' => 'lsow-image full', 'alt' => $client['name'])); ?> <div class="lsow-client-name"> <?php if (!empty($client['link'])) { ?> <a href="<?php echo sow_esc_url($client['link']); ?> " title="<?php echo esc_html($client['name']); ?> " target="_blank"><?php echo esc_html($client['name']); ?> </a> <?php } else { ?> <?php echo esc_html($client['name']);
} ?> <?php echo wp_kses_post($feature['more_text']); ?> <?php if (!empty($feature['more_url'])) { echo '</a>'; } ?> </p> <?php } ?> </div> </div> <?php } ?> <?php $callout_section = $instance['callout_section']; if ($callout_section['cta_link']) { $callout_styles = array(); $btn_position = $callout_section['cta_alignment']; $icon = siteorigin_widget_get_icon($callout_section['cta_icon'], ['font-size: 18px', 'color: #fff']); $callout_styles[] = "float: {$btn_position}"; printf('<a class="read-more" href="%1$s" style="%3$s">' . $icon . '%2$s</a>', sow_esc_url($callout_section['cta_link']), $callout_section['cta_text'], implode('; ', $callout_styles)); } ?> </div>
if (!empty($instance['images'])) { ?> <div class="sow-image-grid-wrapper" <?php if (!empty($instance['display']['max_width'])) { echo 'data-max-width="' . intval($instance['display']['max_width']) . '"'; } ?> <?php if (!empty($instance['display']['max_height'])) { echo 'data-max-height="' . intval($instance['display']['max_height']) . '"'; } ?> > <?php foreach ($instance['images'] as $image) { echo '<div class="sow-image-grid-image">'; if (!empty($image['url'])) { echo '<a href="' . sow_esc_url($image['url']) . '">'; } echo wp_get_attachment_image($image['image'], $image['display']['image_size'], false, array('title' => $image['title'])); if (!empty($image['url'])) { echo '</a>'; } echo '</div>'; } ?> </div> <?php }
} if (!empty($instance['bound'])) { $styles[] = 'max-width:100%'; $styles[] = 'height:auto'; } if (!empty($instance['full_width'])) { $styles[] = 'width:100%'; } $styles[] = 'display:block'; ?> <?php if (!empty($instance['url'])) { ?> <a href="<?php echo sow_esc_url($instance['url']); ?> " <?php if ($instance['new_window']) { echo 'target="_blank"'; } ?> ><?php } ?> <img <?php foreach ($attr as $n => $v) { echo $n . '="' . esc_attr($v) . '" '; } ?> class="<?php
<?php echo '<a href="' . sow_esc_url($instance['button_url']) . '" ' . ($instance['new_window'] ? 'target="_blank"' : '') . ' class="' . $instance['button_class'] . '">'; echo wp_kses_post($instance['button_text']); echo '</a>';
} ?> <?php $column_style = lsow_get_column_class(intval($settings['per_line'])); ?> <div class="lsow-pricing-table lsow-container"> <?php foreach ($pricing_plans as $pricing_plan) { $pricing_title = esc_html($pricing_plan['pricing_title']); $tagline = esc_html($pricing_plan['tagline']); $price_tag = htmlspecialchars_decode(wp_kses_post($pricing_plan['price_tag'])); $pricing_img = $pricing_plan['image']; $pricing_url = empty($pricing_plan['url']) ? '#' : sow_esc_url($pricing_plan['url']); $pricing_button_text = esc_html($pricing_plan['button_text']); $button_new_window = esc_html($pricing_plan['button_new_window']); $highlight = esc_html($pricing_plan['highlight']); $price_tag = empty($price_tag) ? '' : $price_tag; ?> <div class="lsow-pricing-plan <?php echo !empty($highlight) ? ' lsow-highlight' : ''; ?> <?php echo $column_style; ?> ">
if (!empty($attachment)) { ?> <li class="item"><?php if (!empty($image['more_url'])) { ?> <a href="<?php echo sow_esc_url($image['more_url']); ?> " <?php echo $image['new_window'] ? 'target="_blank"' : ''; ?> ><?php } ?> <img src="<?php echo sow_esc_url($attachment[0]); ?> " alt=""><?php if (!empty($image['more_url'])) { ?> </a><?php } ?> <?php if (!empty($image['icon_title'])) { ?> <h5> <?php echo wp_kses_post($image['icon_title']); ?> </h5>
echo '<a href="' . sow_esc_url($frame['url']) . '">'; } echo wp_get_attachment_image($frame['foreground_image'], 'full'); if (!empty($frame['url'])) { echo '</a>'; } ?> </div> </div> <?php // Render the background videos $this->video_code($frame['background_videos'], array('sow-background-element')); } else { // We need to find another background if (!empty($frame['url'])) { echo '<a href="' . sow_esc_url($frame['url']) . '" ' . (!empty($frame['new_window']) ? 'target="_blank"' : '') . '>'; } if (!empty($frame['background_videos'])) { $this->video_code($frame['background_videos'], array('sow-full-element')); } else { // Lets use the background image echo wp_get_attachment_image($frame['background_image'], 'full'); } if (!empty($frame['url'])) { echo '</a>'; } } ?> </li> <?php }
<ul class="sow-carousel-items"> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <li class="sow-carousel-item"> <div class="sow-carousel-thumbnail"> <?php if (has_post_thumbnail()) { $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default'); ?> <a href="<?php the_permalink(); ?> " style="background-image: url(<?php echo sow_esc_url($img[0]); ?> )"> <span class="overlay"></span> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " class="sow-carousel-default-thumbnail"><span class="overlay"></span></a> <?php } ?> </div>
<?php $the_categories = wp_kses_post($instance['categories']); $post_title = wp_kses_post($instance['title']); $numberPosts = !empty($instance['number_of_posts']) ? $instance['number_of_posts'] : 4; $read_more_text = wp_kses_post($instance['read_more_text']); $allpostsbtn = wp_kses_post($instance['allpostsbtn']); $allpostsurl = sow_esc_url($instance['allpostsurl']); query_posts(array('post_type' => 'post', 'category_name' => '' . $the_categories . '', 'posts_per_page' => $numberPosts)); if (have_posts()) { if (!empty($instance['title'])) { if (!empty($instance['allpostsurl'])) { ?> <a href="<?php echo $allpostsurl; ?> " class="btn btn-default pull-right"><?php echo $allpostsbtn; ?> </a><?php } ?> <h3 class="panel-title"> <?php echo $post_title; ?> </h3> <?php } ?> <div class="row">
?> <p><?php echo wp_kses_post($feature['text']); ?> </p> <?php } ?> <?php if (!empty($feature['more_text'])) { ?> <p class="sow-more-text"> <?php if (!empty($feature['more_url'])) { echo '<a href="' . sow_esc_url($feature['more_url']) . '" ' . ($instance['new_window'] ? 'target="_blank"' : '') . '>'; } ?> <?php echo wp_kses_post($feature['more_text']); ?> <?php if (!empty($feature['more_url'])) { echo '</a>'; } ?> </p> <?php } ?> </div>
$type = ' lsow-' . esc_attr($type); } $rounded = !empty($rounded) ? ' lsow-rounded' : ''; if (!empty($target)) { $target = ' target="_blank"'; } else { $target = ''; } if ($color == 'default' || $color == 'custom' && empty($custom_color)) { $options = get_option('lsow_settings'); if ($options && isset($options['lsow_theme_color'])) { $custom_color = $options['lsow_theme_color']; } else { $custom_color = '#f94213'; // default button color if none set in theme options } } $style = $style ? ' style="' . esc_attr($style) . '"' : ''; // Use the custom color only if user wants to use the custom color set $color_attr = $color == 'custom' ? ' data-color=' . esc_html($custom_color) : ''; $hover_color_attr = $hover_color ? ' data-hover-color=' . esc_html($hover_color) : ''; if ($icon_type == 'icon_image') { $icon_html = wp_get_attachment_image($icon_image, 'thumbnail', false, array('class' => 'lsow-image lsow-thumbnail')); } elseif ($icon_type == 'icon') { $icon_html = siteorigin_widget_get_icon($icon); } $button_content = '<a' . $id . ' class= "lsow-button ' . (!empty($icon_html) ? ' lsow-with-icon' : '') . esc_attr($class) . $color_class . $type . $rounded . '"' . $style . $color_attr . $hover_color_attr . ' href="' . sow_esc_url($href) . '"' . esc_html($target) . '>' . $icon_html . esc_html($text) . '</a>'; if ($align != 'none') { $button_content = '<div class="lsow-button-wrap" style="text-align:' . esc_attr($align) . ';float:' . esc_attr($align) . ';">' . $button_content . '</div>'; } echo $button_content;
<?php $icon_wrapper = array(); $icon_wrapper[] = 'element-' . (!empty($image) ? 'shape_image' : 'shape_icon'); $icon_classes = array(); $icon_classes[] = $shape_format ? 'icon-shape-' . $shape_format : ''; $icon_classes[] = !empty($icon_size) ? 'icon-size-' . $icon_size : ''; $icon_classes[] = ($shape_format == 'outline-circle' or $shape_format == 'outline-square' or $shape_format == 'outline-rounded') ? 'icon-element-outline' : 'icon-element-background'; $icon_classes[] = $icon_type == 'type_image' && $image_overflow == false ? 'overflow-hidden' : ''; $icon_classes[] = !empty($hover) ? 'has-hover' : ''; $url_target = $new_window ? 'target="_blank"' : ''; $markup = !empty($url) ? 'a href="' . sow_esc_url($url) . '"' . $url_target : 'div'; $src = wp_get_attachment_image($image, $image_size); echo '<div class="lrw-icon"> <div class="lrw-icon-element ' . esc_attr(implode(' ', array_filter($icon_wrapper))) . '">'; if ($icon_type == 'type_icon') { echo '<' . $markup . ' class="icon-inner ' . esc_attr(implode(' ', array_filter($icon_classes))) . '">' . siteorigin_widget_get_icon($icon) . '</' . $markup . '>'; } elseif ($icon_type == 'type_image') { echo '<' . $markup . ' class="image-wrapper ' . esc_attr(implode(' ', array_filter($icon_classes))) . '">' . $src . '</' . $markup . '>'; } echo '</div> </div>';
if (!empty($instance['styling']['icon-clr'])) { $icon_styles[] = 'color: ' . $instance['styling']['icon-clr']; } $classes = array('iw-so-imgbox-btn'); if (!empty($instance['styling']['btn-hover'])) { $classes[] = 'iw-so-imgbox-btn-hover'; } if (!empty($instance['styling']['btn-click'])) { $classes[] = 'iw-so-imgbox-btn-click'; } $button_attributes = array('class' => esc_attr(implode(' ', $classes))); if (!empty($instance['box']['btn-window'])) { $button_attributes['target'] = '_blank'; } if (!empty($instance['box']['btn-url'])) { $button_attributes['href'] = sow_esc_url($instance['box']['btn-url']); } if (!empty($instance['box']['btn-id'])) { $button_attributes['id'] = esc_attr($instance['box']['btn-id']); } if (!empty($instance['box']['btn-title'])) { $button_attributes['title'] = esc_attr($instance['box']['btn-title']); } if (!empty($instance['box']['btn-onclick'])) { $button_attributes['onclick'] = esc_attr($instance['box']['btn-onclick']); } ?> <div class="iw-row iw-collapse iw-so-imgbox"> <div class="iw-small-12 iw-cols"> <?php
protected function render_field($value, $instance) { if (version_compare(get_bloginfo('version'), '3.5', '<')) { printf(__('You need to <a href="%s">upgrade</a> to WordPress 3.5 to use media fields', 'so-widgets-bundle'), admin_url('update-core.php')); return; } if (!empty($value)) { if (is_array($value)) { $src = $value; } else { $post = get_post($value); $src = wp_get_attachment_image_src($value, 'thumbnail'); if (empty($src)) { $src = wp_get_attachment_image_src($value, 'thumbnail', true); } } } else { $src = array('', 0, 0); } ?> <div class="media-field-wrapper"> <div class="current"> <div class="thumbnail-wrapper"> <img src="<?php echo sow_esc_url($src[0]); ?> " class="thumbnail" <?php if (empty($src[0])) { echo "style='display:none'"; } ?> /> </div> <div class="title"><?php if (!empty($post)) { echo esc_attr($post->post_title); } ?> </div> </div> <a href="#" class="media-upload-button" data-choose="<?php echo esc_attr($this->choose); ?> " data-update="<?php echo esc_attr($this->update); ?> " data-library="<?php echo esc_attr($this->library); ?> "> <?php echo esc_html($this->choose); ?> </a> </div> <a href="#" class="media-remove-button <?php if (empty($value)) { echo 'remove-hide'; } ?> "><?php esc_html_e('Remove', 'so-widgets-bundle'); ?> </a> <input type="hidden" value="<?php echo esc_attr(is_array($value) ? '-1' : $value); ?> " name="<?php echo esc_attr($this->element_name); ?> " class="siteorigin-widget-input" /> <?php }
echo esc_attr($feature['hover']); ?> "> <?php echo wp_kses_post($feature['text']); ?> </p> </div> <?php } ?> </div> <div class="db-pt-button"> <a href='<?php echo sow_esc_url($column['url']); ?> ' class="db-pt-link" <?php if (!empty($instance['button_new_window'])) { echo 'target="_blank"'; } ?> ><?php echo esc_html($column['button']); ?> </a> </div> </div> <?php } ?>
echo wp_kses_post($feature['text']); ?> </p> <?php } ?> <?php if (!empty($feature['more_text'])) { ?> <div class="sow-more-link"> <hr> <p class="sow-more-text"> <?php if (!empty($feature['more_url'])) { echo '<a href="' . sow_esc_url($feature['more_url']) . '" ' . ($feature['new_window'] ? 'target="_blank"' : '') . ' class="btn btn-default">'; } ?> <?php echo wp_kses_post($feature['more_text']); ?> <?php if (!empty($feature['more_url'])) { echo '</a>'; } ?> </p> </div> <?php } ?>