/** * Generates the CSS output * * @since 2.0.0 */ public static function generate($output) { // Define main variables $css = ''; /*-----------------------------------------------------------------------------------*/ /* - Logo Max Widths /*-----------------------------------------------------------------------------------*/ // Desktop if ($width = wpex_get_mod('logo_max_width')) { $css .= '@media only screen and (min-width: 960px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } // Tablet Portrait if ($width = wpex_get_mod('logo_max_width_tablet_portrait')) { $css .= '@media only screen and (min-width: 768px) and (max-width: 959px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } // Phone if ($width = wpex_get_mod('logo_max_width_phone')) { $css .= '@media only screen and (max-width: 767px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } /*-----------------------------------------------------------------------------------*/ /* - Other /*-----------------------------------------------------------------------------------*/ // Fixes for full-width layout when custom background is added if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) { $css .= '.wpex-sticky-header-holder{background:none;}'; } // Fix for Fonts In the Visual Composer if (wpex_global_obj('vc_is_inline')) { $css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }'; } // Remove header border if custom color is set if (wpex_get_mod('header_background')) { $css .= '.is-sticky #site-header{border-color:transparent;}'; } // Overlay Header font size if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) { $css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}'; } /*-----------------------------------------------------------------------------------*/ /* - Return CSS /*-----------------------------------------------------------------------------------*/ if (!empty($css)) { $output .= '/*ADVANCED STYLING CSS*/' . $css; } // Return output css return $output; }
/** * Generates inline CSS for styling options * * @since 1.0.0 */ public function loop_through_inline_css($return = 'css') { // Define vars $add_css = ''; $elements_to_alter = ''; // Get customizer settings $settings = wp_list_pluck($this->sections, 'settings'); // Return if there aren't any settings if (empty($settings)) { return; } // Loop through settings and find inline_css foreach ($settings as $settings_array) { foreach ($settings_array as $setting) { // If setting shouldn't output css continue on to the next if (!isset($setting['inline_css'])) { continue; } // Get setting ID and if empty continue onto the next setting $id = isset($setting['id']) ? $setting['id'] : ''; if (!$id) { continue; } // Check if there is a default value $default = isset($setting['default']) ? $setting['default'] : false; // Get theme mod value and if empty continue onto the next setting $theme_mod = get_theme_mod($id, $default); // Return if theme mod is empty if (!$theme_mod) { continue; } // Extract vars $inline_css = $setting['inline_css']; // Make sure vars are defined $sanitize = isset($inline_css['sanitize']) ? $inline_css['sanitize'] : ''; $target = isset($inline_css['target']) ? $inline_css['target'] : ''; $alter = isset($inline_css['alter']) ? $inline_css['alter'] : ''; $important = isset($inline_css['important']) ? '!important' : false; // Target and alter vars are required, if they are empty continue onto the next setting if (!$target && !$alter) { continue; } // Sanitize data if ($sanitize) { $theme_mod = wpex_sanitize_data($theme_mod, $sanitize); } else { $theme_mod = $theme_mod; } // Save inline_css if ($theme_mod) { // Set to array if not $target = is_array($target) ? $target : array($target); // Loop through items foreach ($target as $element) { // Add to elements list if not already if (!isset($elements_to_alter[$element])) { $elements_to_alter[$element] = array('css' => ''); } // Add css to element if (is_array($alter)) { foreach ($alter as $alter_val) { $elements_to_alter[$element]['css'] .= $alter_val . ':' . $theme_mod . $important . ';'; } } else { $elements_to_alter[$element]['css'] .= $alter . ':' . $theme_mod . $important . ';'; } } } // End theme_mod check } // End settings_array } // End settings loop // No elements to alter so return null if (!$elements_to_alter) { return null; } // Loop through elements foreach ($elements_to_alter as $element => $array) { if (isset($array['css'])) { $add_css .= $element . '{' . $array['css'] . '}'; } } // Return custom CSS if ($add_css) { return $add_css; } }
// Parse lightbox dimensions $lightbox_dimensions = vcex_parse_lightbox_dims($lightbox_dimensions); // Set data attributes based on lightbox type if ('iframe' == $lightbox_type) { $button_classes[] = 'wpex-lightbox'; $data_attr[] = 'data-type="iframe"'; $data_attr[] = 'data-options="' . $lightbox_dimensions . '"'; } elseif ('image' == $lightbox_type) { $button_classes[] = 'wpex-lightbox'; $data_attr[] = 'data-type="image"'; if ($lightbox_image) { $url = wp_get_attachment_url($lightbox_image); } $inline_js[] = 'ilightbox'; } elseif ('video_embed' == $lightbox_type) { $url = wpex_sanitize_data($url, 'embed_url'); $button_classes[] = 'wpex-lightbox'; $data_attr[] = 'data-type="iframe"'; $data_attr[] = 'data-options="' . $lightbox_dimensions . '"'; } elseif ('html5' == $lightbox_type) { $lightbox_video_html5_webm = $lightbox_video_html5_webm ? $lightbox_video_html5_webm : $url; $poster = wp_get_attachment_url($lightbox_poster_image); $button_classes[] = 'wpex-lightbox'; $data_attr[] = 'data-type="video"'; $data_attr[] = 'data-options="' . $lightbox_dimensions . ', html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }"'; } elseif ('quicktime' == $lightbox_type) { $button_classes[] = 'wpex-lightbox'; $data_attr[] = 'data-type="video"'; $data_attr[] = 'data-options="' . $lightbox_dimensions . '"'; } else { $button_classes[] = 'wpex-lightbox-autodetect';
} $a_attrs = array(); // CUSTOM LIGHTBOX VIDEO - TOTAL SETTINGS if (!empty($lightbox_video)) { // Load lightbox skin wpex_enqueue_ilightbox_skin(); // Esc lightbox video $lightbox_video = esc_url($lightbox_video); // Get lightbox dims $lightbox_dimensions = vcex_parse_lightbox_dims($lightbox_dimensions); if ($lightbox_iframe_type) { // Add lightbox class $a_attrs['class'] = 'wpex-lightbox'; if ('video_embed' == $lightbox_iframe_type) { $a_attrs['class'] = 'wpex-lightbox'; $video_embed_url = wpex_sanitize_data($lightbox_video, 'embed_url'); $lightbox_video = $video_embed_url ? $video_embed_url : $lightbox_video; $a_attrs['data-type'] = 'iframe'; $a_attrs['data-options'] = $lightbox_dimensions; vcex_inline_js('ilightbox_single'); } elseif ('url' == $lightbox_iframe_type) { $a_attrs['data-type'] = 'iframe'; $a_attrs['data-options'] = $lightbox_dimensions; } elseif ('html5' == $lightbox_iframe_type) { $poster = wp_get_attachment_image_src($img_id, 'full'); $poster = $poster[0]; $a_attrs['data-type'] = 'video'; $a_attrs['data-options'] = $lightbox_dimensions . ',html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }'; } elseif ('quicktime' == $lightbox_iframe_type) { $a_attrs['data-type'] = 'video'; $a_attrs['data-options'] = $lightbox_dimensions;
/** * Loop through settings * * @since 1.6.0 */ public function loop($return = 'css') { // Define Vars $css = ''; $fonts = array(); $elements = $this->elements(); $preview_styles = ''; // Loop through each elements that need typography styling applied to them foreach ($elements as $element => $array) { // Add empty css var $add_css = ''; // Get target and current mod $target = isset($array['target']) ? $array['target'] : ''; $get_mod = wpex_get_mod($element . '_typography'); // Attributes to loop through if (!empty($array['attributes'])) { $attributes = $array['attributes']; } else { $attributes = array('font-family', 'font-weight', 'font-style', 'font-size', 'color', 'line-height', 'letter-spacing', 'text-transform', 'margin'); } // Loop through attributes foreach ($attributes as $attribute) { // Define val $default = isset($array['defaults'][$attribute]) ? $array['defaults'][$attribute] : NULL; $val = isset($get_mod[$attribute]) ? $get_mod[$attribute] : $default; // If there is a value lets do something if ($val) { // Sanitize $val = str_replace('"', '', $val); // Sanitize data $val = 'font-size' == $attribute ? wpex_sanitize_data($val, 'font_size') : $val; $val = 'letter-spacing' == $attribute ? wpex_sanitize_data($val, 'px') : $val; // Add quotes around font-family && font family to scripts array if ('font-family' == $attribute) { $fonts[] = $val; $val = $val; } // Add to inline CSS if ('css' == $return) { $add_css .= $attribute . ':' . $val . ';'; } elseif ('preview_styles' == $return) { $preview_styles['customizer-typography-' . $element . '-' . $attribute] = $target . '{' . $attribute . ':' . $val . ';}'; } } } // Front-end inline CSS if ($add_css && 'css' == $return) { $css .= $target . '{' . $add_css . '}'; } } // Return CSS if ('css' == $return && !empty($css)) { $css = '/*TYPOGRAPHY*/' . $css; return $css; } // Return styles if ('preview_styles' == $return && !empty($preview_styles)) { return $preview_styles; } // Return Fonts Array if ('fonts' == $return && !empty($fonts)) { return array_unique($fonts); // Return only 1 of each font } }
/** * Settings page output * * @since 1.6.0 */ public function create_admin_page() { ?> <div class="wrap wpex-theme-panel wpex-clr"> <h1><?php esc_attr_e('Theme Panel', 'total'); ?> </h1> <h2 class="nav-tab-wrapper"> <a href="#" class="nav-tab nav-tab-active"><?php esc_attr_e('Features', 'total'); ?> </a> <?php // Customizer url $customize_url = add_query_arg(array('return' => urlencode(wp_unslash($_SERVER['REQUEST_URI']))), 'customize.php'); ?> <a href="<?php echo esc_url($customize_url); ?> " class="nav-tab"><?php esc_attr_e('Customize', 'total'); ?> </a> </h2> <div class="wpex-theme-panel-updated updated" style="border-color: #f0821e;display:none;"> <p> <?php echo wpex_sanitize_data(__('Don\'t forget to <a href="#">save your changes</a>', 'total'), 'html'); ?> </p> </div> <form id="wpex-theme-panel-form" method="post" action="options.php"> <?php settings_fields('wpex_tweaks'); ?> <div class="manage-right"> <!-- Branding --> <h4><?php esc_attr_e('Theme Branding', 'total'); ?> </h4> <?php // Get theme branding value $value = wpex_get_mod('theme_branding', 'Total'); $value = 'disabled' == $value || !$value ? '' : $value; ?> <input type="text" name="wpex_tweaks[theme_branding]" value="<?php echo esc_attr($value); ?> " placeholder="<?php esc_attr_e('Used in widgets and builder blocks...', 'total'); ?> "> <!-- View --> <h4><?php esc_attr_e('View', 'total'); ?> </h4> <div class="button-group wpex-filter-active"> <button type="button" class="button active"><?php esc_attr_e('All', 'total'); ?> </button> <button type="button" class="button" data-filter-by="active"><?php esc_attr_e('Active', 'total'); ?> </button> <button type="button" class="button" data-filter-by="inactive"><?php esc_attr_e('Inactive', 'total'); ?> </button> </div> <!-- Sort --> <h4><?php esc_attr_e('Sort', 'total'); ?> </h4> <?php // Categories $categories = wp_list_pluck($this->theme_addons, 'category'); $categories = array_unique($categories); asort($categories); ?> <ul class="wpex-theme-panel-sort"> <li><a href="#" data-category="all" class="wpex-active-category"><?php esc_attr_e('All', 'total'); ?> </a></li> <?php // Loop through cats foreach ($categories as $key => $category) { // Check condition $display = true; if (isset($this->theme_addons[$key]['condition'])) { $display = $this->theme_addons[$key]['condition']; } // Show cat if ($display) { $sanitize_category = strtolower(str_replace(' ', '_', $category)); ?> <li><a href="#" data-category="<?php echo esc_attr($sanitize_category); ?> " title="<?php echo esc_attr($category); ?> "><?php echo strip_tags($category); ?> </a></li> <?php } ?> <?php } ?> </ul> </div><!-- manage-right --> <div class="manage-left"> <table class="table table-bordered wp-list-table widefat fixed wpex-modules"> <tbody id="the-list"> <?php $count = 0; // Loop through theme pars and add checkboxes foreach ($this->theme_addons as $key => $val) { $count++; // Display setting? $display = true; if (isset($val['condition'])) { $display = $val['condition']; } // Sanitize vars $default = isset($val['disabled']) ? false : true; $label = isset($val['label']) ? $val['label'] : ''; $icon = isset($val['icon']) ? $val['icon'] : ''; // Label if ($icon) { $label = '<i class="' . $icon . '"></i>' . $label; } // Set id if (isset($val['custom_id'])) { $key = $key; } else { $key = $key . '_enable'; } // Get theme option $theme_mod = wpex_get_mod($key, $default); // Get category and sanitize $category = isset($val['category']) ? $val['category'] : ' other'; $category = strtolower(str_replace(' ', '_', $category)); // Sanitize category $category = strtolower(str_replace(' ', '_', $category)); // Classes $classes = 'wpex-module'; $classes .= $theme_mod ? ' wpex-active' : ' wpex-disabled'; $classes .= !$display ? ' wpex-hidden' : ''; $classes .= ' wpex-category-' . $category; if ($count = 2) { $classes .= ' alternative'; $count = 0; } ?> <tr id="<?php echo esc_attr($key); ?> " class="<?php echo esc_attr($classes); ?> "> <th scope="row" class="check-column"> <input type="checkbox" name="wpex_tweaks[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($theme_mod); ?> " <?php checked($theme_mod, true); ?> class="wpex-checkbox"> </th> <td class="name column-name"> <span class="info"><a href="#<?php echo esc_attr($key); ?> " class="wpex-theme-panel-module-link"><?php echo wpex_sanitize_data($label, 'html'); ?> </a></span> <?php if (isset($val['desc'])) { ?> <div class="wpex-module-description"> <small><?php echo wpex_sanitize_data($val['desc'], 'html'); ?> </small> </div> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> <?php submit_button(); ?> </div><!-- .manage-left --> </form> </div> <script> ( function( $ ) { "use strict"; $( document ).ready( function() { // Show notice $( '.wpex-checkbox' ).click( function() { $( '.wpex-theme-panel-updated' ).show(); } ); $( '.wpex-theme-panel .manage-right input[type="text"]' ).change( function() { $( '.wpex-theme-panel-updated' ).show(); } ); // Save on link click $( '.wpex-theme-panel-updated a' ).click( function( e ) { e.preventDefault(); $( "#wpex-theme-panel-form #submit" ).click(); } ); // Module on click $( '.wpex-theme-panel-module-link' ).click( function() { $( '.wpex-theme-panel-updated' ).show(); var $ref = $(this).attr( 'href' ), $checkbox = $($ref).find( '.wpex-checkbox' ); if ( $checkbox.is( ":checked" ) ) { $checkbox.attr( 'checked', false ); } else { $checkbox.attr( 'checked', true ); } return false; } ); // Filter var $filter_buttons = $( '.wpex-filter-active button' ); $filter_buttons.click( function() { var $filterBy = $( this ).data( 'filter-by' ); $filter_buttons.removeClass( 'active' ); $( this ).addClass( 'active' ); $( '.wpex-module' ).removeClass( 'wpex-filterby-hide' ); if ( 'active' == $filterBy ) { $( '.wpex-module' ).each( function() { if ( $( this ).hasClass( 'wpex-disabled' ) ) { $( this ).addClass( 'wpex-filterby-hide' ); } } ); } else if ( 'inactive' == $filterBy ) { $( '.wpex-module' ).each( function() { if ( ! $( this ).hasClass( 'wpex-disabled' ) ) { $( this ).addClass( 'wpex-filterby-hide' ); } } ); } return false; } ); // Sort $( '.wpex-theme-panel-sort a' ).click( function() { var $data = $( this ).data( 'category' ); $( '.wpex-theme-panel-sort a' ).removeClass( 'wpex-active-category' ); $( this ).addClass( 'wpex-active-category' ); if ( 'all' == $data ) { $( '.wpex-module' ).removeClass( 'wpex-sort-hide' ); } else { $( '.wpex-module' ).addClass( 'wpex-sort-hide' ); $( '.wpex-category-'+ $data ).each( function() { $( this ).removeClass( 'wpex-sort-hide' ); } ); } return false; } ); } ); } ) ( jQuery ); </script> <?php }
/** * Outputs correct schema HTML for sections of the site * * @since 3.0.0 */ function wpex_schema_markup($location) { echo wpex_sanitize_data(wpex_get_schema_markup($location), 'html'); }
$wrap_attributes[] = 'data-height-animation-duration="' . intval($height_animation) . '"'; } // Caption attributes if ('true' == $caption) { // Caption attributes if ($caption_position) { $caption_attributes[] = ' data-position="' . $caption_position . '"'; } if ($caption_show_transition) { $caption_attributes[] = ' data-show-transition="' . $caption_show_transition . '"'; } if ($caption_hide_transition) { $caption_attributes[] = ' data-hide-transition="' . $caption_hide_transition . '"'; } if ($caption_width) { $caption_attributes[] = ' data-width="' . wpex_sanitize_data($caption_width, 'px-pct') . '"'; } if ($caption_horizontal) { $caption_attributes[] = ' data-horizontal="' . intval($caption_horizontal) . '"'; } if ($caption_vertical) { $caption_attributes[] = ' data-vertical="' . intval($caption_vertical) . '"'; } if ($caption_delay) { $caption_attributes[] = ' data-show-delay="' . intval($caption_delay) . '"'; } if (empty($caption_show_transition) && empty($caption_hide_transition)) { $caption_attributes[] = ' data-sp-static="false"'; } $caption_attributes = implode(' ', $caption_attributes); // Caption classes
?> > <?php } ?> <?php // define inner output $inner_output = ''; // Add icon if defined if ($icon) { // Icon classes $icon_wrap_classes = 'vcex-icon-wrap'; // Icon inline style $icon_style = vcex_inline_style(array('background' => $icon_background, 'width' => $icon_width, 'border_radius' => $icon_border_radius, 'height' => $icon_height, 'line_height' => wpex_sanitize_data($icon_height, 'px'), 'margin_right' => $margin_right, 'font_size' => $icon_size, 'color' => $color)); // Add icon to output $inner_output .= '<div class="' . $icon_wrap_classes . '"' . $icon_style . '><span class="' . $icon . '"></span></div>'; } // Add content to output if ($content) { $inner_output .= do_shortcode($content); } // Echo inner content (icon_content) echo $inner_output; // Close link tag if ($url) { echo '</a>'; } ?>
?> "> <?php echo strip_tags($author_name); ?> </a> </h4><!-- .author-bio-title --> <?php // Outputs the author description if one exists if ($description) { ?> <div class="author-bio-description clr"> <?php echo wpautop(do_shortcode(wpex_sanitize_data($description, 'html'))); ?> </div><!-- author-bio-description --> <?php } ?> <?php // Display author social links if there are social links defined if (wpex_author_has_social()) { ?> <div class="author-bio-social clr"> <?php // Display twitter url
exit; } // Not needed in admin ever if (is_admin()) { return; } // Get and extract shortcode attributes extract(vc_map_get_attributes($this->getShortcode(), $atts)); // Core class $classes = 'vcex-spacing'; // Custom Class if ($class) { $classes .= $this->getExtraClass($class); } // Visiblity Class if ($visibility) { $classes .= ' ' . $visibility; } // Front-end composer class if (vc_is_inline()) { $classes .= ' vc-spacing-shortcode'; } ?> <div class="<?php echo $classes; ?> " style="height:<?php echo wpex_sanitize_data($size, 'px-pct'); ?> "></div>
$wrap_classes[] = 'vcex-divider-custom-icon-width'; } if ($icon_bg) { $wrap_classes[] = 'vcex-divider-icon-has-bg'; } if ('dotted' == $style & !$icon) { $wrap_classes[] = 'repeat-bg'; } // If icon exists if ($icon) { // Add special class to wrapper $wrap_classes[] = 'vcex-divider-w-icon'; // Load icon font family vc_icon_element_fonts_enqueue($icon_type); // Icon style $icon_style = vcex_inline_style(array('font_size' => $icon_size, 'border_radius' => $icon_border_radius, 'color' => $icon_color, 'background' => $icon_bg, 'padding' => $icon_padding, 'height' => $icon_height, 'line_height' => wpex_sanitize_data($icon_height, 'px'), 'width' => $icon_width)); // Border style $vcex_inner_border_style = ''; if ('dotted' != $style) { $border_top_width = 'double' == $style ? $height : ''; $top_margin = $height ? $height / 2 : ''; $top_margin = $height && 'double' == $style ? ($height * 2 + 4) / 2 : $top_margin; $vcex_inner_border_style = vcex_inline_style(array('border_color' => $color, 'border_bottom_width' => $height, 'border_top_width' => $border_top_width, 'margin_top' => -$top_margin)); } // Reset vars if icon is defined so styles aren't duplicated in main wrapper $height = $color = ''; } // Main style $botttom_height = 'double' == $style ? $height : ''; $wrap_style = vcex_inline_style(array('height' => $dotted_height, 'width' => $width, 'margin_top' => $margin_top, 'margin_bottom' => $margin_bottom, 'border_top_width' => $height, 'border_bottom_width' => $botttom_height, 'border_color' => $color)); // Turn wrap classes into a string
/** * Sanitize widget form values as they are saved. * * @see WP_Widget::update() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * * @return array Updated safe values to be saved. */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = isset($new_instance['title']) ? strip_tags($new_instance['title']) : ''; $instance['description'] = isset($new_instance['description']) ? wpex_sanitize_data($new_instance['description'], 'html') : ''; $instance['embed_code'] = isset($new_instance['embed_code']) ? $new_instance['embed_code'] : ''; $instance['height'] = !empty($new_instance['height']) ? intval($new_instance['height']) : ''; return $instance; }
/** * Back-end widget form. * * @see WP_Widget::form() * @since 1.0.0 * * @param array $instance Previously saved values from database. */ public function form($instance) { extract(wp_parse_args((array) $instance, array('title' => '', 'heading' => esc_html__('NEWSLETTER', 'total'), 'description' => '', 'form_action' => 'http://wpexplorer.us1.list-manage1.com/subscribe/post?u=9b7568b7c032f9a6738a9cf4d&id=7056c37ddf', 'placeholder_text' => esc_html__('Your email address', 'total'), 'button_text' => esc_html__('Subscribe', 'total'), 'name_placeholder_text' => esc_html__('First name', 'total'), 'name_field' => 0))); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php esc_html_e('Title', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('heading')); ?> "><?php esc_html_e('Heading', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('heading')); ?> " name="<?php echo esc_attr($this->get_field_name('heading')); ?> " type="text" value="<?php echo esc_attr($heading); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('form_action')); ?> "><?php esc_html_e('Form Action', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('form_action')); ?> " name="<?php echo esc_attr($this->get_field_name('form_action')); ?> " type="text" value="<?php echo esc_attr($form_action); ?> " /> <span style="display:block;padding:5px 0" class="description"> <a href="//docs.shopify.com/support/configuration/store-customization/where-do-i-get-my-mailchimp-form-action?ref=wpexplorer" target="_blank"><?php esc_html_e('Learn more', 'total'); ?> →</a> </span> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('description')); ?> "><?php esc_html_e('Description:', 'total'); ?> </label> <textarea class="widefat" rows="5" cols="20" id="<?php echo esc_attr($this->get_field_id('description')); ?> " name="<?php echo esc_attr($this->get_field_name('description')); ?> "><?php echo wpex_sanitize_data($instance['description'], 'html'); ?> </textarea> </p> <p> <input id="<?php echo esc_attr($this->get_field_id('name_field')); ?> " name="<?php echo esc_attr($this->get_field_name('name_field')); ?> " <?php checked($name_field, 1, true); ?> type="checkbox" /> <label for="<?php echo esc_attr($this->get_field_id('name_field')); ?> "><?php esc_html_e('Display Name Field?', 'total'); ?> </label> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('name_placeholder_text')); ?> "><?php esc_html_e('Name Input Placeholder Text', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('name_placeholder_text')); ?> " name="<?php echo esc_attr($this->get_field_name('name_placeholder_text')); ?> " type="text" value="<?php echo esc_attr($name_placeholder_text); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('placeholder_text')); ?> "><?php esc_html_e('Email Input Placeholder Text', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('placeholder_text')); ?> " name="<?php echo esc_attr($this->get_field_name('placeholder_text')); ?> " type="text" value="<?php echo esc_attr($placeholder_text); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('button_text')); ?> "><?php esc_html_e('Button Text', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('button_text')); ?> " name="<?php echo esc_attr($this->get_field_name('button_text')); ?> " type="text" value="<?php echo esc_attr($button_text); ?> " /> </p> <?php }
<?php /** * Returns the post title * * @package Total WordPress theme * @subpackage Partials * @version 3.3.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Define title args $args = array(); // Single post markup if (is_singular('post') && 'custom_text' == wpex_get_mod('blog_single_header', 'custom_text')) { $args['html_tag'] = 'span'; $args['schema_markup'] = ''; } elseif (is_singular() && (!is_singular('page') && !is_singular('attachment'))) { $args['html_tag'] = 'span'; $args['schema_markup'] = ''; } // Apply filters $args = apply_filters('wpex_page_header_title_args', $args); // Parse args to prevent empty attributes and extract extract(wp_parse_args($args, array('html_tag' => 'h1', 'string' => wpex_title(), 'schema_markup' => wpex_get_schema_markup('headline')))); // Display title if (!empty($string)) { echo '<' . strip_tags($html_tag) . ' class="page-header-title wpex-clr"' . $schema_markup . '>' . wpex_sanitize_data($string, 'html') . '</' . strip_tags($html_tag) . '>'; }
/** * Position: Left * * @since 2.0.0 */ private function parse_left($value) { $this->style[] = 'left:' . wpex_sanitize_data($value, 'px-pct') . ';'; }
/** * Generates inline CSS for styling options * * @since 1.0.0 */ public function loop_through_inline_css($return = 'css') { // Define vars $add_css = ''; $elements_to_alter = ''; $preview_styles = ''; // Get customizer settings $settings = wp_list_pluck($this->sections, 'settings'); // Return if there aren't any settings if (empty($settings)) { return; } // Loop through settings and find inline_css foreach ($settings as $settings_array) { foreach ($settings_array as $setting) { // Store setting ID and default value $setting_id = $setting['id']; // no need to check cause it's required $default = isset($setting['default']) ? $setting['default'] : false; $inline_css = isset($setting['inline_css']) ? $setting['inline_css'] : null; $theme_mod = wpex_get_mod($setting_id, $default); // If mod is equal to default and part of the mods let's remove it // This is a good place since we are looping through all settings anyway if ($this->remove_default_mods) { $get_all_mods = wpex_get_mods(); if ($theme_mod == $default && $get_all_mods && isset($get_all_mods[$setting_id])) { remove_theme_mod($setting_id); } } // These are required for outputting custom CSS if (!$theme_mod || !$inline_css) { continue; } // Get inline_css params $sanitize = isset($inline_css['sanitize']) ? $inline_css['sanitize'] : ''; $target = isset($inline_css['target']) ? $inline_css['target'] : ''; $alter = isset($inline_css['alter']) ? $inline_css['alter'] : ''; $important = isset($inline_css['important']) ? '!important' : false; $media_query = isset($inline_css['media_query']) ? $inline_css['media_query'] : false; // Add to preview_styles array if ('preview_styles' == $return) { $preview_styles['customizer-' . $setting_id] = ''; } // Target and alter vars are required, if they are empty continue onto the next setting if (!$target || !$alter) { continue; } // Sanitize data if ($sanitize) { $theme_mod = wpex_sanitize_data($theme_mod, $sanitize); } else { $theme_mod = $theme_mod; } // Set to array if not $target = is_array($target) ? $target : array($target); // Loop through items foreach ($target as $element) { // Add to elements list if not already for CSS output only if ('css' == $return && !isset($elements_to_alter[$element])) { $elements_to_alter[$element] = array('css' => ''); } // Return CSS or js if (is_array($alter)) { // Loop through elements to alter foreach ($alter as $alter_val) { // Inline CSS if ('css' == $return) { // If it has a media query it's its own thing if ($media_query) { $add_css .= '@media only screen and ' . $media_query . '{' . $element . '{ ' . $alter_val . ':' . $theme_mod . $important . '; }}'; } else { $elements_to_alter[$element]['css'] .= $alter_val . ':' . $theme_mod . $important . ';'; } } elseif ('preview_styles' == $return) { // If it has a media query it's its own thing if ($media_query) { $preview_styles['customizer-' . $setting_id] .= '@media only screen and ' . $media_query . '{' . $element . '{ ' . $alter_val . ':' . $theme_mod . $important . '; }}'; } else { $preview_styles['customizer-' . $setting_id] .= $element . '{ ' . $alter_val . ':' . $theme_mod . $important . '; }'; } } } } else { // Inline CSS if ('css' == $return) { // If it has a media query it's its own thing if ($media_query) { $add_css .= '@media only screen and ' . $media_query . '{' . $element . '{ ' . $alter . ':' . $theme_mod . $important . '; }}'; } else { $elements_to_alter[$element]['css'] .= $alter . ':' . $theme_mod . $important . ';'; } } elseif ('preview_styles' == $return) { // If it has a media query it's its own thing if ($media_query) { $preview_styles['customizer-' . $setting_id] .= '@media only screen and ' . $media_query . '{' . $element . '{ ' . $alter . ':' . $theme_mod . $important . '; }}'; } else { $preview_styles['customizer-' . $setting_id] .= $element . '{ ' . $alter . ':' . $theme_mod . $important . '; }'; } } } } } // End settings_array } // End settings loop // Loop through elements for CSS only if ('css' == $return && $elements_to_alter) { foreach ($elements_to_alter as $element => $array) { if (isset($array['css'])) { $add_css .= $element . '{' . $array['css'] . '}'; } } } // Return inline css if ('css' == $return) { return $add_css; } // Return preview styles if ('preview_styles' == $return) { return $preview_styles; } }
/** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form($instance) { extract(wp_parse_args($instance, array('title' => esc_html__('Business Info', 'total'), 'address' => '', 'phone_number' => '', 'fax_number' => '', 'email' => ''))); ?> <?php /* Title */ ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php esc_attr_e('Title', 'total'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('title')); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </p> <?php /* Address */ ?> <p> <label for="<?php echo esc_attr($this->get_field_id('address')); ?> "> <?php esc_attr_e('Address', 'total'); ?> </label> <textarea rows="5" class="widefat" name="<?php echo esc_attr($this->get_field_name('address')); ?> " type="text"><?php echo wpex_sanitize_data($address, 'html'); ?> </textarea> </p> <?php /* Phone Number */ ?> <p> <label for="<?php echo esc_attr($this->get_field_id('phone_number')); ?> "><?php esc_attr_e('Phone Number', 'total'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('phone_number')); ?> " type="text" value="<?php echo esc_attr($phone_number); ?> " /> </p> <?php /* Fax Number */ ?> <p> <label for="<?php echo esc_attr($this->get_field_id('fax_number')); ?> "><?php esc_attr_e('Fax Number', 'total'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('fax_number')); ?> " type="text" value="<?php echo esc_attr($fax_number); ?> " /> </p> <?php /* Email */ ?> <p> <label for="<?php echo esc_attr($this->get_field_id('email')); ?> "><?php esc_attr_e('Email', 'total'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('email')); ?> " type="text" value="<?php echo esc_attr($email); ?> " /> </p> <?php }
// Caption attributes and classes if ('true' == $caption) { // Sanitize vars $caption_width = $caption_width ? $caption_width : '100%'; // Caption attributes if ($caption_position) { $caption_data[] = 'data-position="' . $caption_position . '"'; } if ($caption_show_transition) { $caption_data[] = 'data-show-transition="' . $caption_show_transition . '"'; } if ($caption_hide_transition) { $caption_data[] = 'data-hide-transition="' . $caption_hide_transition . '"'; } if ($caption_width) { $caption_data[] = 'data-width="' . wpex_sanitize_data($caption_width, 'px-pct') . '"'; } if ($caption_horizontal) { $caption_data[] = 'data-horizontal="' . intval($caption_horizontal) . '"'; } if ($caption_vertical) { $caption_data[] = 'data-vertical="' . intval($caption_vertical) . '"'; } if ($caption_delay) { $caption_data[] = 'data-show-delay="' . intval($caption_delay) . '"'; } if (empty($caption_show_transition) && empty($caption_hide_transition)) { $caption_data[] = 'data-sp-static="false"'; } $caption_data = implode(' ', $caption_data); // Caption classes
if ('false' != $lightbox_title) { if ('title' == $lightbox_title) { $atts['lightbox_data'][] = ' data-title="' . strip_tags(get_the_title($post->id)) . '"'; } else { $atts['lightbox_data'][] = ' data-title="' . $post->alt . '"'; } } // Caption data if ('false' != $lightbox_caption) { if ($attachment_caption = get_post_field('post_excerpt', $post->id)) { $atts['lightbox_data'][] = ' data-caption="' . str_replace('"', "'", $attachment_caption) . '"'; } } // Video data if ($video_url) { $video_embed_url = wpex_sanitize_data($video_url, 'embed_url'); $lightbox_url = $video_embed_url ? $video_embed_url : $video_url; if ($video_embed_url) { $atts['lightbox_data'][] = ' data-type="iframe"'; $smart_recognition = ''; } else { $smart_recognition = ',smartRecognition:true'; } $atts['lightbox_data'][] = ' data-options="thumbnail:\'' . $lightbox_image . '\',width:1920,height:1080' . $smart_recognition . '"'; } else { $atts['lightbox_data'][] = ' data-type="image"'; } // Convert data attributes to array $atts['lightbox_data'] = ' ' . implode(' ', $atts['lightbox_data']); ?>
/** * Outputs Custom CSS for the page title * * @since 1.5.3 */ function wpex_page_header_css($output) { // Get global object $obj = wpex_global_obj(); // Return output if page header is disabled if (!isset($obj->has_page_header) || !$obj->has_page_header) { return $output; } // Return if there isn't a page header style defined if (!$obj->page_header_style) { return $output; } // Define var $css = ''; // Check if a header style is defined and make header style dependent tweaks if ($obj->page_header_style) { // Customize background color if ($obj->page_header_style == 'solid-color' || $obj->page_header_style == 'background-image') { $bg_color = get_post_meta($obj->post_id, 'wpex_post_title_background_color', true); if ($bg_color) { $css .= 'background-color: ' . $bg_color . ' !important;'; } } // Background image Style if ($obj->page_header_style == 'background-image') { // Add background image $bg_img = wpex_page_header_background_image($obj->post_id); if ($bg_img) { // Add css for background image $css .= 'background-image: url(' . $bg_img . ' ) !important; background-position: 50% 0; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;'; // Custom height $title_height = get_post_meta($obj->post_id, 'wpex_post_title_height', true); $title_height = $title_height ? $title_height : '400'; $title_height = apply_filters('wpex_post_title_height', $title_height); if ($title_height) { $css .= 'height:' . wpex_sanitize_data($title_height, 'px') . ' !important;'; } } } } // Apply all css to the page-header class if (!empty($css)) { $css = '.page-header { ' . $css . ' }'; } // Overlay Color if (!empty($bg_img)) { $overlay_color = get_post_meta($obj->post_id, 'wpex_post_title_background_overlay', true); if ('bg_color' == $overlay_color && $obj->page_header_style == 'background-image' && isset($bg_color)) { $css .= '.background-image-page-header-overlay { background-color: ' . $bg_color . ' !important; }'; } } // If css var isn't empty add to custom css output if (!empty($css)) { $output .= $css; } // Return output return $output; }
$link_title = vcex_get_link_data('title', $link_url_temp, $link_title); $link_title = vcex_html('title_attr', $link_title); $link_target = vcex_get_link_data('target', $link_url_temp, $link_target); // Link wrap_classes $link_wrap_classes = array('vcex-icon-link'); // Local links if ('true' == $link_local_scroll || 'local' == $link_target) { $link_target = 'local'; $link_wrap_classes[] = 'local-scroll-link'; } else { $link_target = vcex_html('target_attr', $link_target); } } } // Add styling $icon_style = vcex_inline_style(array('font_size' => $custom_size, 'color' => $color, 'padding' => $padding, 'background_color' => $background, 'border_radius' => $border_radius, 'height' => $height, 'line_height' => wpex_sanitize_data($height, 'px'), 'width' => $width, 'border' => $border)); // Icon Classes $wrap_classes = array('vcex-icon', 'clr'); if ($style) { $wrap_classes[] = 'vcex-icon-' . $style; } if ($size) { $wrap_classes[] = 'vcex-icon-' . $size; } if ($float) { $wrap_classes[] = 'vcex-icon-float-' . $float; } if ($custom_size) { $wrap_classes[] = 'custom-size'; } if ($background) {
function wpex_get_staff_social($atts = NULL) { // Extract staff social args extract(shortcode_atts(array('link_target' => 'blank', 'post_id' => '', 'style' => 'minimal-round', 'font_size' => '', 'css' => ''), $atts)); ob_start(); // Get social profiles array $profiles = wpex_staff_social_array(); // Define post_id $post_id = $post_id ? $post_id : get_the_ID(); // Parse style to return correct classname $style = wpex_get_social_button_class($style); // Wrap classes $wrap_classes = 'staff-social wpex-social-btns clr'; if ($css) { $wrap_classes .= ' ' . vc_shortcode_custom_css_class($css); } // Font size $font_size = $font_size ? wpex_sanitize_data($font_size, 'font_size') : ''; $font_size = $font_size ? 'style="font-size:' . $font_size . '"' : ''; $tooltip = apply_filters('wpex_tooltips_enabled', false); $tooltip = $tooltip ? ' tooltip-up' : ''; ?> <div class="<?php echo esc_attr($wrap_classes); ?> "<?php echo $font_size; ?> > <?php // Loop through social options foreach ($profiles as $profile) { // Get meta $meta = $profile['meta']; // Display link if one exists if ($url = get_post_meta($post_id, $meta, true)) { // Add "mailto" for emails if ('wpex_staff_email' == $meta && is_email($url)) { $url = 'mailto:' . $url; } elseif ('wpex_staff_skype' == $meta) { if (strpos($url, 'skype') === false) { $url = str_replace('callto:', '', $url); $url = 'callto:' . $url; } } elseif ('wpex_staff_phone_number' === $meta) { if (strpos($url, 'callto') === false) { $url = str_replace('tel:', '', $url); $url = 'tel:' . $url; } } else { $url = esc_url($url); } ?> <a href="<?php echo $url; ?> " title="<?php echo esc_attr($profile['label']); ?> " class="wpex-<?php echo esc_attr(str_replace('_', '-', $profile['key'])); ?> <?php echo $style; echo $tooltip; ?> " target="_<?php echo $link_target; ?> "> <span class="<?php echo $profile['icon_class']; ?> "></span> </a> <?php } } ?> </div><!-- .staff-social --> <?php return ob_get_clean(); }
/** * Outputs the CSS for the custom login page * * @since 1.6.0 */ public function output_css() { // Get options $options = $this->options; // Do nothing if disabled if (empty($options['enabled'])) { return; } // Sanitize data $logo = $this->parseOption('logo'); $logo_height = $this->parseOption('logo_height', '84px'); $logo_height = intval($logo_height) . 'px'; $background_img = $this->parseOption('background_img'); $background_style = $this->parseOption('background_style'); $background_color = $this->parseOption('background_color'); $form_background_color = $this->parseOption('form_background_color'); $form_background_opacity = $this->parseOption('form_background_opacity'); $form_text_color = $this->parseOption('form_text_color'); $form_top = $this->parseOption('form_top', '150px'); $form_input_bg = $this->parseOption('form_input_bg'); $form_input_color = $this->parseOption('form_input_color'); $form_border_radius = $this->parseOption('form_border_radius'); $form_button_bg = $this->parseOption('form_button_bg'); $form_button_bg_hover = $this->parseOption('form_button_bg_hover'); $form_button_color = $this->parseOption('form_button_color'); // Convert image ID's to urls if (is_numeric($logo)) { $logo = wp_get_attachment_image_src($logo, 'full'); $logo = $logo[0]; } if (is_numeric($background_img)) { $background_img = wp_get_attachment_image_src($background_img, 'full'); $background_img = $background_img[0]; } // Output Styles $output = ''; // Logo if ($logo) { $output .= 'body.login div#login h1 a {'; $output .= 'background: url("' . $logo . '") center center no-repeat;'; $output .= 'height: ' . intval($logo_height) . 'px;'; $output .= 'width: 100%;'; $output .= 'display: block;'; $output .= 'margin: 0 auto 30px;'; $output .= '}'; } // Background image if ($background_img) { if ('stretched' == $background_style) { $output .= 'body.login { background: url(' . $background_img . ') no-repeat center center fixed; -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover; }'; } elseif ('repeat' == $background_style) { $output .= 'body.login { background: url(' . $background_img . ') repeat; }'; } elseif ('fixed' == $background_style) { $output .= 'body.login { background: url(' . $background_img . ') center top fixed no-repeat; }'; } } // Background color if ($background_color) { $output .= 'body.login { background-color: ' . $background_color . '; }'; } // Form top if ($form_top) { $output .= 'body.login div#login { padding-top: 0; position: relative; top:' . wpex_sanitize_data($form_top, 'px_pct') . '; }'; } // Form Background Color if ($form_background_color) { $form_bg_color_rgba = self::hex2rgba($form_background_color, $form_background_opacity); $output .= '.login form { background: none; -webkit-box-shadow: none; box-shadow: none; padding: 0 0 20px; } #backtoblog { display: none; } .login #nav { text-align: center; }'; $output .= 'body.login div#login { background: ' . $form_background_color . '; background: ' . $form_bg_color_rgba . ';height:auto;left:50%;margin: 0 0 0 -200px;padding:40px;position:absolute;width:320px; max-width:90%; border-radius: 5px; }'; } else { $output .= 'body.login div#login { opacity:' . $form_background_opacity . '; }'; } // Form top if ($form_border_radius) { if ($form_background_color) { $output .= 'body.login div#login { border-radius:' . intval($form_border_radius) . 'px; }'; } else { $output .= 'body.login div#login #loginform { border-radius:' . intval($form_border_radius) . 'px; }'; } } // Form input if ($form_input_bg) { $output .= 'body.login div#login input.input { background: ' . $form_input_bg . '; border: 0; box-shadow: none; }'; } if ($form_input_color) { $output .= 'body.login form .input { color: ' . $form_input_color . '; }'; } // Text Color if ($form_text_color) { $output .= '.login label, .login #nav a, .login #backtoblog a, .login #nav { color: ' . $form_text_color . '; }'; } // Button background if ($form_button_bg) { $output .= 'body.login div#login .button { background: ' . $form_button_bg . '; border:0; outline: 0; box-shadow: none !important; }'; } // Button background if ($form_button_color) { $output .= 'body.login div#login .button { color: ' . $form_button_color . '; }'; } // Button background Hover if ($form_button_bg_hover) { $output .= 'body.login div#login .button:hover { background: ' . $form_button_bg_hover . '; border:0; outline: 0; box-shadow: none !important; }'; } // Echo output if ($output) { echo '<style type="text/css">' . wp_strip_all_tags($output) . '</style>'; } }
echo esc_attr($media_classes); ?> "> <?php // Open link tag if thumblink does not equal nowhere if ('nowhere' != $thumb_link) { ?> <?php // Lightbox Links if ($thumb_link == 'lightbox') { // Video lightbox link if ('video' == $post->format) { // Try and convert video URL into embed URL $embed_url = wpex_sanitize_data($post->video, 'embed_url'); $atts['lightbox_link'] = $embed_url ? $embed_url : $post->video; // Data options $data_options = 'width:1920,height:1080'; // Add smart recognition if we can't generate an embed_url if (!$embed_url) { $data_options .= ',smartRecognition:true'; } ?> <a href="<?php echo $atts['lightbox_link']; ?> " title="<?php wpex_esc_title(); ?>
/** * Back-end widget form. * * @see WP_Widget::form() * @since 3.2.0 * * @param array $instance Previously saved values from database. */ public function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => esc_html__('About Me', 'total'), 'image' => '', 'img_style' => 'plain', 'description' => '')); extract($instance); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php esc_html_e('Title', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('image')); ?> "><?php esc_html_e('Image URL', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('image')); ?> " name="<?php echo esc_attr($this->get_field_name('image')); ?> " type="text" value="<?php echo esc_attr($image); ?> " style="margin-bottom:10px;" /> <input class="wpex-widget-upload-button button button-secondary" type="button" value="<?php esc_html_e('Upload Image', 'total'); ?> " /> </p> <p><label for="<?php echo esc_attr($this->get_field_id('img_style')); ?> "><?php esc_html_e('Image Style', 'total'); ?> :</label> <select id="<?php echo esc_attr($this->get_field_id('img_style')); ?> " name="<?php echo esc_attr($this->get_field_name('img_style')); ?> " class="widefat"> <option value="plain" <?php selected($img_style, 'plain'); ?> ><?php esc_html_e('Plain', 'total'); ?> </option> <option value="rounded" <?php selected($img_style, 'rounded'); ?> ><?php esc_html_e('Rounded', 'total'); ?> </option> <option value="round" <?php selected($img_style, 'round'); ?> ><?php esc_html_e('Round', 'total'); ?> </option> </select> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('description')); ?> "><?php esc_html_e('Description:', 'total'); ?> </label> <textarea class="widefat" rows="5" cols="20" id="<?php echo esc_attr($this->get_field_id('description')); ?> " name="<?php echo esc_attr($this->get_field_name('description')); ?> "><?php echo wpex_sanitize_data($instance['description'], 'html'); ?> </textarea> </p> <script type="text/javascript"> (function($) { "use strict"; $( document ).ready( function() { var _custom_media = true, _orig_send_attachment = wp.media.editor.send.attachment; $( '.wpex-widget-upload-button' ).click(function(e) { var send_attachment_bkp = wp.media.editor.send.attachment, button = $(this), id = button.prev(); _custom_media = true; wp.media.editor.send.attachment = function( props, attachment ) { if ( _custom_media ) { $( id ).val( attachment.url ); } else { return _orig_send_attachment.apply( this, [props, attachment] ); }; } wp.media.editor.open( button ); return false; } ); $( '.add_media').on('click', function() { _custom_media = false; } ); } ); } ) ( jQuery ); </script> <?php }
/** * Parses deprecated css fields into new css_editor field * * @since 3.0.0 */ function vcex_parse_deprecated_row_css($atts, $return = 'temp_class') { // Parse CSS if empty and enabled $parse_css = apply_filters('vcex_parse_deprecated_row_css', true); // Return if disabled if (!$parse_css) { return; } $new_css = ''; // Margin top if (!empty($atts['margin_top'])) { $new_css .= 'margin-top: ' . wpex_sanitize_data($atts['margin_top'], 'px-pct') . ';'; } // Margin bottom if (!empty($atts['margin_bottom'])) { $new_css .= 'margin-bottom: ' . wpex_sanitize_data($atts['margin_bottom'], 'px-pct') . ';'; } // Margin right if (!empty($atts['margin_right'])) { $new_css .= 'margin-right: ' . wpex_sanitize_data($atts['margin_right'], 'px-pct') . ';'; } // Margin left if (!empty($atts['margin_left'])) { $new_css .= 'margin-left: ' . wpex_sanitize_data($atts['margin_left'], 'px-pct') . ';'; } // Padding top if (!empty($atts['padding_top'])) { $new_css .= 'padding-top: ' . wpex_sanitize_data($atts['padding_top'], 'px-pct') . ';'; } // Padding bottom if (!empty($atts['padding_bottom'])) { $new_css .= 'padding-bottom: ' . wpex_sanitize_data($atts['padding_bottom'], 'px-pct') . ';'; } // Padding right if (!empty($atts['padding_right'])) { $new_css .= 'padding-right: ' . wpex_sanitize_data($atts['padding_right'], 'px-pct') . ';'; } // Padding left if (!empty($atts['padding_left'])) { $new_css .= 'padding-left: ' . wpex_sanitize_data($atts['padding_left'], 'px-pct') . ';'; } // Border if (!empty($atts['border_width']) && !empty($atts['border_color'])) { $border_width = explode(' ', $atts['border_width']); $border_style = isset($atts['border_style']) ? $atts['border_style'] : 'solid'; $bcount = count($border_width); if ('1' == $bcount) { $new_css .= 'border: ' . $border_width[0] . ' ' . $border_style . ' ' . $atts['border_color'] . ';'; } else { $new_css .= 'border-color: ' . $atts['border_color'] . ';'; $new_css .= 'border-style: ' . $border_style . ';'; if ('2' == $bcount) { $new_css .= 'border-top-width: ' . $border_width[0] . ';'; $new_css .= 'border-bottom-width: ' . $border_width[0] . ';'; $bw = isset($border_width[1]) ? $border_width[1] : '0px'; $new_css .= 'border-left-width: ' . $bw . ';'; $new_css .= 'border-right-width: ' . $bw . ';'; } else { $new_css .= 'border-top-width: ' . $border_width[0] . ';'; $bw = isset($border_width[1]) ? $border_width[1] : '0px'; $new_css .= 'border-right-width: ' . $bw . ';'; $bw = isset($border_width[2]) ? $border_width[2] : '0px'; $new_css .= 'border-bottom-width: ' . $bw . ';'; $bw = isset($border_width[3]) ? $border_width[3] : '0px'; $new_css .= 'border-left-width: ' . $bw . ';'; } } } // Background image if (!empty($atts['bg_image'])) { if ('temp_class' == $return) { $bg_image = wp_get_attachment_url($atts['bg_image']) . '?id=' . $atts['bg_image']; } elseif ('inline_css' == $return) { if (is_numeric($atts['bg_image'])) { $bg_image = wp_get_attachment_url($atts['bg_image']); } else { $bg_image = $atts['bg_image']; } } } // Background Image & Color if (!empty($bg_image) && !empty($atts['bg_color'])) { $style = !empty($atts['bg_style']) ? $atts['bg_style'] : 'stretch'; $position = ''; $repeat = ''; $size = ''; if ('stretch' == $style) { $position = 'center'; $repeat = 'no-repeat'; $size = 'cover'; } if ('fixed' == $style) { $position = '0 0'; $repeat = 'no-repeat'; } if ('repeat' == $style) { $position = '0 0'; $repeat = 'repeat'; } $new_css .= 'background: ' . $atts['bg_color'] . ' url(' . $bg_image . ');'; if ($position) { $new_css .= 'background-position: ' . $position . ';'; } if ($repeat) { $new_css .= 'background-repeat: ' . $repeat . ';'; } if ($size) { $new_css .= 'background-size: ' . $size . ';'; } } // Background Image - No Color if (!empty($bg_image) && empty($atts['bg_color'])) { $new_css .= 'background-image: url(' . $bg_image . ');'; // Add image $style = !empty($atts['bg_style']) ? $atts['bg_style'] : 'stretch'; // Generate style $position = ''; $repeat = ''; $size = ''; if ('stretch' == $style) { $position = 'center'; $repeat = 'no-repeat'; $size = 'cover'; } if ('fixed' == $style) { $position = '0 0'; $repeat = 'no-repeat'; } if ('repeat' == $style) { $position = '0 0'; $repeat = 'repeat'; } if ($position) { $new_css .= 'background-position: ' . $position . ';'; } if ($repeat) { $new_css .= 'background-repeat: ' . $repeat . ';'; } if ($size) { $new_css .= 'background-size: ' . $size . ';'; } } // Background Color - No Image if (!empty($atts['bg_color']) && empty($bg_image)) { $new_css .= 'background-color: ' . $atts['bg_color'] . ';'; } // Return new css if ($new_css) { if ('temp_class' == $return) { return '.temp{' . $new_css . '}'; } elseif ('inline_css' == $return) { return $new_css; } } }
/** * Back-end widget form. * * @see WP_Widget::form() * @since 1.0.0 * * @param array $instance Previously saved values from database. */ public function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => esc_attr__('Follow Us', 'total'), 'description' => '', 'style' => 'flat-color', 'type' => '', 'font_size' => '', 'border_radius' => '', 'target' => 'blank', 'size' => '', 'social_services' => $this->social_services_array)); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php esc_html_e('Title', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " type="text" value="<?php echo esc_attr($instance['title']); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('description')); ?> "><?php esc_html_e('Description', 'total'); ?> :</label> <textarea class="widefat" rows="5" cols="20" id="<?php echo esc_attr($this->get_field_id('description')); ?> " name="<?php echo esc_attr($this->get_field_name('description')); ?> "><?php echo wpex_sanitize_data($instance['description'], 'html'); ?> </textarea> </p> <?php // Styles $social_styles = wpex_social_button_styles(); // Parse style $style = $this->parse_style($instance['style'], $instance['type']); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('style')); ?> "><?php esc_html_e('Style', 'total'); ?> :</label> <br /> <select class="wpex-widget-select" name="<?php echo esc_attr($this->get_field_name('style')); ?> " id="<?php echo esc_attr($this->get_field_id('style')); ?> "> <?php foreach ($social_styles as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($style, $key); ?> ><?php echo strip_tags($val); ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('target')); ?> "><?php esc_html_e('Link Target', 'total'); ?> :</label> <br /> <select class="wpex-widget-select" name="<?php echo esc_attr($this->get_field_name('target')); ?> " id="<?php echo esc_attr($this->get_field_id('target')); ?> "> <option value="blank" <?php selected($instance['target'], 'blank'); ?> ><?php esc_html_e('Blank', 'total'); ?> </option> <option value="self" <?php selected($instance['target'], 'select'); ?> ><?php esc_html_e('Self', 'total'); ?> </option> </select> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('size')); ?> "><?php esc_html_e('Dimensions', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('size')); ?> " name="<?php echo esc_attr($this->get_field_name('size')); ?> " type="text" value="<?php echo esc_attr($instance['size']); ?> " /> <small><?php esc_html_e('Example:', 'total'); ?> 40px</small> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('font_size')); ?> "><?php esc_html_e('Font Size', 'total'); ?> :</label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('font_size')); ?> " name="<?php echo esc_attr($this->get_field_name('font_size')); ?> " type="text" value="<?php echo esc_attr($instance['font_size']); ?> " /> <small><?php esc_html_e('Example:', 'total'); ?> 18px</small> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('border_radius')); ?> "><?php esc_html_e('Border Radius', 'total'); ?> </label> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('border_radius')); ?> " name="<?php echo esc_attr($this->get_field_name('border_radius')); ?> " type="text" value="<?php echo esc_attr($instance['border_radius']); ?> " /> <small><?php esc_html_e('Example:', 'total'); ?> 4px</small> </p> <?php $field_id_services = $this->get_field_id('social_services'); $field_name_services = $this->get_field_name('social_services'); ?> <h3 style="margin-top:20px;margin-bottom:0;"><?php esc_html_e('Social Links', 'total'); ?> </h3> <ul id="<?php echo esc_attr($field_id_services); ?> " class="wpex-social-widget-services-list"> <input type="hidden" id="<?php echo esc_attr($field_name_services); ?> " value="<?php echo esc_attr($field_name_services); ?> "> <input type="hidden" id="<?php echo esc_attr(wp_create_nonce('wpex_fontawesome_social_widget_nonce')); ?> "> <?php // Social array $social_services_array = $this->social_services_array; // Get current services display $display_services = isset($instance['social_services']) ? $instance['social_services'] : ''; // Loop through social services to display inputs foreach ($display_services as $key => $val) { $url = !empty($display_services[$key]['url']) ? esc_url($display_services[$key]['url']) : null; $name = $social_services_array[$key]['name']; // Set icon $icon = 'vimeo-square' == $key ? 'vimeo' : $key; $icon = 'youtube' == $key ? 'youtube-play' : $icon; $icon = 'vimeo-square' == $key ? 'vimeo' : $icon; ?> <li id="<?php echo esc_attr($field_id_services); ?> _0<?php echo esc_attr($key); ?> "> <p> <label for="<?php echo esc_attr($field_id_services); ?> -<?php echo esc_attr($key); ?> -name"><span class="fa fa-<?php echo esc_attr($icon); ?> "></span><?php echo strip_tags($name); ?> :</label> <input type="hidden" id="<?php echo esc_attr($field_id_services); ?> -<?php echo esc_attr($key); ?> -url" name="<?php echo esc_attr($field_name_services . '[' . $key . '][name]'); ?> " value="<?php echo esc_attr($name); ?> "> <input type="url" class="widefat" id="<?php echo esc_attr($field_id_services); ?> -<?php echo esc_attr($key); ?> -url" name="<?php echo esc_attr($field_name_services . '[' . $key . '][url]'); ?> " value="<?php echo esc_attr($url); ?> " /> </p> </li> <?php } ?> </ul> <?php }
/** * Back-end widget form. * * @see WP_Widget::form() * @since 1.0.0 * * @param array $instance Previously saved values from database. */ function form($instance) { // Parse arguments extract(wp_parse_args((array) $instance, array('title' => esc_attr__('Video', 'total'), 'id' => '', 'video_url' => '', 'video_description' => ''))); ?> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php esc_html_e('Title', 'total'); ?> :</label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('title')); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('video_url')); ?> "> <?php esc_html_e('Video URL ', 'total'); ?> </label> <input class="widefat" name="<?php echo esc_attr($this->get_field_name('video_url')); ?> " type="text" value="<?php echo esc_attr(esc_url($video_url)); ?> " /> <span style="display:block;padding:5px 0" class="description"><?php esc_html_e('Enter in a video URL that is compatible with WordPress\'s built-in oEmbed feature.', 'total'); ?> <a href="http://codex.wordpress.org/Embeds" target="_blank"><?php esc_html_e('Learn More', 'total'); ?> </a></span> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('video_description')); ?> "> <?php esc_html_e('Description', 'total'); ?> </label> <textarea rows="5" class="widefat" name="<?php echo esc_attr($this->get_field_name('video_description')); ?> " type="text"><?php echo wpex_sanitize_data($instance['video_description'], 'html'); ?> </textarea> </p> <?php }
// Image lightbox $data_attributes = ''; if ($image_lightbox) { vcex_enque_style('ilightbox'); vcex_inline_js('ilightbox'); if ('image' == $image_lightbox) { $image_classes[] = 'wpex-lightbox'; $data_attributes .= ' data-type="image"'; } elseif ('url' == $image_lightbox) { $image_classes[] = ' wpex-lightbox'; $data_attributes .= ' data-type="iframe"'; $data_attributes .= ' data-options="width:1920,height:1080"'; } elseif ('auto-detect' == $image_lightbox) { $image_classes[] = ' wpex-lightbox-autodetect'; } elseif ('video_embed' == $image_lightbox) { $a_href = wpex_sanitize_data($a_href, 'embed_url'); $image_classes[] = ' wpex-lightbox'; $data_attributes .= ' data-type="iframe"'; $data_attributes .= ' data-options="width:1920,height:1080"'; } elseif ('html5' == $image_lightbox) { $poster = wp_get_attachment_image_src($img_id, 'large'); $poster = $poster[0]; $image_classes[] = ' wpex-lightbox'; $data_attributes .= ' data-type="video"'; $data_attributes .= ' data-options="width:848, height:480, html5video: { webm: \'' . $lightbox_video_html5_webm . '\', poster: \'' . $poster . '\' }"'; } elseif ('quicktime' == $image_lightbox) { $image_classes[] = ' wpex-lightbox'; $data_attributes .= ' data-type="video"'; $data_attributes .= ' data-options="width:1920,height:1080"'; } else { $data_attributes .= ' data-options="smartRecognition:true,width:1920,height:1080"';