function filter_css_object($css, $panels_data, $post_id)
 {
     foreach ($panels_data['grids'] as $gi => $grid) {
         $grid_id = !empty($grid['style']['id']) ? (string) sanitize_html_class($grid['style']['id']) : intval($gi);
         $top_padding = isset($grid['style']['top_padding']) ? $grid['style']['top_padding'] : null;
         $bottom_padding = isset($grid['style']['bottom_padding']) ? $grid['style']['bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 1920);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 1920);
         }
         $top_padding = isset($grid['style']['tablet_top_padding']) ? $grid['style']['tablet_top_padding'] : null;
         $bottom_padding = isset($grid['style']['tablet_bottom_padding']) ? $grid['style']['tablet_bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 960);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 960);
         }
         $top_padding = isset($grid['style']['mobile_top_padding']) ? $grid['style']['mobile_top_padding'] : null;
         $bottom_padding = isset($grid['style']['mobile_bottom_padding']) ? $grid['style']['mobile_bottom_padding'] : null;
         // Filter the bottom margin for this row with the arguments
         if ($top_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-top' => $top_padding), 478);
         }
         if ($bottom_padding) {
             $css->add_row_css($post_id, $grid_id, '.lsow-row', array('padding-bottom' => $bottom_padding), 478);
         }
     }
     return $css;
 }
/**
 * Descriptions.
 *
 * Display a description icon + tooltip on hover.
 *
 * @since 1.0.0
 *
 * @param  string  $condition  Current condition to display the description for.
 */
function wcasv_condition_description($condition)
{
    $descriptions = array('shipping_cost' => __('Shipping cost is based on the shipping package cost (taxes not counted)', 'woocommerce-advanced-shipping-validation'), 'state' => __('States must be installed in WC', 'woocommerce-advanced-shipping-validation'), 'zipcode' => __('Zipcodes can be separated by comma. Will match when user zipcode \'starts with\' any of the provided zipcodes.', 'woocommerce-advanced-shipping-validation'), 'city' => __('City can be separated by comma. Case incentive', 'woocommerce-advanced-shipping-validation'), 'weight' => __('Weight calculated on all the cart contents', 'woocommerce-advanced-shipping-validation'), 'length' => __('Compared to lengthiest product in cart', 'woocommerce-advanced-shipping-validation'), 'width' => __('Compared to widest product in cart', 'woocommerce-advanced-shipping-validation'), 'height' => __('Compared to highest product in cart', 'woocommerce-advanced-shipping-validation'), 'stock_status' => __('All products in cart must match stock status', 'woocommerce-advanced-shipping-validation'), 'contains_category' => __('Cart must contain least one product with the selected category', 'woocommerce-advanced-shipping-validation'), 'contains_product' => __('Cart must contain one of this product', 'woocommerce-advanced-shipping-validation'), 'contains_shipping_class' => __('Cart must contain at least one product with the selected shipping class', 'woocommerce-advanced-shipping-validation'));
    $descriptions = apply_filters('woocommerce_Advanced_Shipping_Validation_descriptions', $descriptions);
    // Display description
    if (!isset($descriptions[$condition])) {
        ?>
<span class='wcasv-description no-description'></span><?php 
        return;
    }
    ?>
<span class='wcasv-description <?php 
    echo sanitize_html_class($condition);
    ?>
-description'>

		<div class='description'>

			<img class='wcasv-tip' src='<?php 
    echo WC()->plugin_url();
    ?>
/assets/images/help.png' height='24' width='24' />

			<div class='wcasv-desc'><?php 
    echo wp_kses_post($descriptions[$condition]);
    ?>
</div>

		</div>

	</span><?php 
}
Example #3
0
function wpcf7_acceptance_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
    }
    if ($tag->has_option('invert')) {
        $class .= ' wpcf7-invert';
    }
    $atts = array();
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_id_option();
    $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
    if ($tag->has_option('default:on')) {
        $atts['checked'] = 'checked';
    }
    $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
    $atts['type'] = 'checkbox';
    $atts['name'] = $tag->name;
    $atts['value'] = '1';
    $atts = wpcf7_format_atts($atts);
    $html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
    return $html;
}
 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since  0.1.0
  * @access public
  * @param  array  $sidebar
  * @param  array  $instance
  * @return void
  */
 function widget($sidebar, $instance)
 {
     $instance = wp_parse_args($instance, $this->defaults);
     // Set up the arguments for get_users().
     $args = array('role' => $instance['role'], 'meta_key' => $instance['meta_key'], 'meta_value' => $instance['meta_value'], 'include' => !empty($instance['include']) ? explode(',', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? explode(',', $instance['exclude']) : '', 'search' => $instance['search'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'offset' => !empty($instance['offset']) ? intval($instance['offset']) : '', 'number' => !empty($instance['number']) ? intval($instance['number']) : '');
     // Output the theme's $before_widget wrapper.
     echo $sidebar['before_widget'];
     // If a title was input by the user, display it.
     if ($instance['title']) {
         echo $sidebar['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $sidebar['after_title'];
     }
     // Get users.
     $users = get_users($args);
     // If users were found.
     if (!empty($users)) {
         echo '<ul class="xoxo users">';
         // Loop through each available user, creating a list item with a link to the user's archive.
         foreach ($users as $user) {
             $class = sanitize_html_class("user-{$user->ID}");
             if (is_author($user->ID)) {
                 $class .= ' current-user';
             }
             printf('<li class="%s"><a href="%s">%s</a>', esc_attr($class), esc_url(get_author_posts_url($user->ID, $user->user_nicename)), esc_html($user->display_name));
         }
         echo '</ul>';
     }
     // Close the theme's widget wrapper.
     echo $sidebar['after_widget'];
 }
 function smashing_save_post_class_meta($post_id, $post)
 {
     /* Verify the nonce before proceeding. */
     if (!isset($_POST['smashing_post_class_nonce']) || !wp_verify_nonce($_POST['smashing_post_class_nonce'], basename(__FILE__))) {
         return $post_id;
     }
     /* Get the post type object. */
     $post_type = get_post_type_object($post->post_type);
     /* Check if the current user has permission to edit the post. */
     if (!current_user_can($post_type->cap->edit_post, $post_id)) {
         return $post_id;
     }
     /* Get the posted data and sanitize it for use as an HTML class. */
     $new_meta_value = isset($_POST['smashing-post-class']) ? sanitize_html_class($_POST['smashing-post-class']) : '';
     /* Get the meta key. */
     $meta_key = 'smashing_post_class';
     /* Get the meta value of the custom field key. */
     $meta_value = get_post_meta($post_id, $meta_key, true);
     /* If a new meta value was added and there was no previous value, add it. */
     if ($new_meta_value && '' == $meta_value) {
         add_post_meta($post_id, $meta_key, $new_meta_value, true);
     } elseif ($new_meta_value && $new_meta_value != $meta_value) {
         update_post_meta($post_id, $meta_key, $new_meta_value);
     } elseif ('' == $new_meta_value && $meta_value) {
         delete_post_meta($post_id, $meta_key, $meta_value);
     }
 }
    /**
     * Display meta in a formatted list
     *
     * @access public
     * @param bool $flat (default: false)
     * @param bool $return (default: false)
     * @param string $hideprefix (default: _)
     * @return string
     */
    public function display($flat = false, $return = false, $hideprefix = '_')
    {
        $output = '';
        $formatted_meta = $this->get_formatted($hideprefix);
        if (!empty($formatted_meta)) {
            $meta_list = array();
            foreach ($formatted_meta as $meta_key => $meta) {
                if ($flat) {
                    $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
                } else {
                    $meta_list[] = '
							<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post($meta['label']) . ':</dt>
							<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wpautop($meta['value'])) . '</dd>
						';
                }
            }
            if (!empty($meta_list)) {
                if ($flat) {
                    $output .= implode(", \n", $meta_list);
                } else {
                    $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
                }
            }
        }
        if ($return) {
            return $output;
        } else {
            echo $output;
        }
    }
function photoline_modified_post_gallery($output, $attr)
{
    global $post;
    static $instance = 0;
    $instance++;
    //disable all filter
    if (empty($attr['type']) || $attr['type'] != 'slider') {
        return;
    }
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'photoline-featured', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $selector = "gallery-{$instance}";
    $size_class = sanitize_html_class($size);
    $gallery_div = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-size-{$size_class} flexslider'>";
    $output = apply_filters('gallery_style', $gallery_div);
    $output .= '<ul class="slides">';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $caption = !empty($attachment->post_excerpt) ? '<p class="flex-caption wp-caption-text gallery-caption">' . wptexturize($attachment->post_excerpt) . '</p>' : '';
        $image = wp_get_attachment_image($id, $size);
        $output .= '<li>';
        $output .= $image;
        $output .= $caption;
        $output .= '</li>';
    }
    $output .= "\r\n            </ul><!-- .slides -->\r\n        </div>\n";
    return $output;
}
/**
 * Filters the body classes to add the proper style-specific class.
 *
 */
function associate_style_body_class($classes)
{
    if ($style = genesis_get_option('style_selection')) {
        $classes[] = esc_attr(sanitize_html_class($style));
    }
    return $classes;
}
 /**
  * Class constructor
  *
  * @since 2.0.5
  * @author jkudish
  * @param string $id the field id
  * @param array $field the field settings
  * @param null|mixed $value the field's current value
  * @return void
  */
 public function __construct($id, $field, $value = null)
 {
     // setup the defaults
     $this->defaults = array('type' => 'html', 'name' => $id, 'attributes' => array(), 'class' => null, 'label' => null, 'tooltip' => null, 'size' => 'medium', 'html' => null, 'error' => false, 'value' => $value, 'options' => null, 'conditional' => true, 'display_callback' => null, 'if_empty' => null, 'can_be_empty' => false, 'clear_after' => true);
     // a list of valid field types, to prevent screwy behaviour
     $this->valid_field_types = array('heading', 'html', 'text', 'textarea', 'wysiwyg', 'radio', 'checkbox_bool', 'checkbox_list', 'dropdown', 'dropdown_chosen', 'dropdown_select2', 'license_key');
     $this->valid_field_types = apply_filters('tribe_valid_field_types', $this->valid_field_types);
     // parse args with defaults and extract them
     $args = wp_parse_args($field, $this->defaults);
     extract($args);
     // sanitize the values just to be safe
     $id = esc_attr($id);
     $type = esc_attr($type);
     $name = esc_attr($name);
     $class = sanitize_html_class($class);
     $label = wp_kses($label, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array())));
     $tooltip = wp_kses($tooltip, array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(), 'i' => array(), 'u' => array(), 'img' => array('title' => array(), 'src' => array(), 'alt' => array()), 'code' => array('span' => array()), 'span' => array()));
     $size = esc_attr($size);
     $html = $html;
     $error = (bool) $error;
     $value = $value;
     $conditional = $conditional;
     $display_callback = $display_callback;
     $clear_after = (bool) $clear_after;
     // set the ID
     $this->id = apply_filters('tribe_field_id', $id);
     // set each instance variable and filter
     foreach ($this->defaults as $key => $value) {
         $this->{$key} = apply_filters('tribe_field_' . $key, ${$key}, $this->id);
     }
     // epicness
     $this->doField();
 }
 public function shortcode($args = array(), $content = '')
 {
     $original_arguments = $args;
     $codec = new Eab_Codec_ArgumentsCodec();
     $args = $codec->parse_arguments($args, array('format' => 'H:i T l', 'class' => '', 'add' => 0, 'expired' => __('Closed', Eab_EventsHub::TEXT_DOMAIN), 'legacy' => false, 'category' => false, 'categories' => false));
     if (!empty($args['legacy'])) {
         return $this->_legacy_shortcode($original_arguments);
     }
     $class = !empty($args['class']) ? 'class="' . sanitize_html_class($args['class']) . '"' : '';
     $format = "<div {$class}>%s</div>";
     $output = '';
     $additional = 0;
     if (!empty($args['add']) && (int) $args['add']) {
         $additional = (int) $args['add'] * 60;
     }
     $query = $codec->get_query_args($args);
     $now = eab_current_time() + $additional;
     $events = Eab_CollectionFactory::get_upcoming_events($now, $query);
     $ret = array();
     foreach ($events as $event) {
         $ts = $event->get_start_timestamp();
         if ($ts < $now) {
             continue;
         }
         $ret[$ts] = $event;
     }
     ksort($ret);
     $next = reset($ret);
     if ($next) {
         $output = date_i18n($args['format'], $next->get_start_timestamp());
     } else {
         $output = !empty($args['expired']) ? esc_html($args['expired']) : $content;
     }
     return sprintf($format, $output);
 }
 public function __construct($args)
 {
     if (!is_array($args)) {
         return;
     }
     $this->post_id = null === $args['post_id'] ? null : (int) $args['post_id'];
     $this->size = isset($args['size']) ? sanitize_key($args['size']) : false;
     $this->crop = isset($args['crop']) ? wp_validate_boolean($args['crop']) : (bool) 0;
     $this->img_class = isset($args['img_class']) ? sanitize_html_class($args['img_class']) : '';
     $this->img_default = isset($args['default']) ? esc_url_raw($args['default']) : '';
     $this->img_src = isset($args['src']) && '' != $args['src'] ? esc_url_raw($args['src']) : '';
     $this->img_src = isset($args['full_src']) ? esc_url_raw($args['full_src']) : $this->img_src;
     $this->direct_src_external = '' != $this->img_src ? $this->img_src : '';
     $this->post = get_post($this->post_id);
     $this->attachment_id = intval(get_post_thumbnail_id($this->post_id));
     if (!is_admin()) {
         $image = $this->thumbnail_meta_data();
         if (0 == $this->attachment_id) {
             $this->attachment_id = $image['attachment_id'];
             if (!is_admin()) {
                 $this->img_src = $image['src'];
             }
             if (-1 == $this->attachment_id) {
                 $this->img_src_ext = $image['src'];
             }
         }
     }
     $this->attachment = get_post($this->attachment_id);
     add_filter('icon_dir', array($this, 'filter_icon_dir'));
 }
Example #12
0
 /**
  * @todo Should probably be checking publicly_queryable instead of public.
  */
 public function shortcode_handler($atts, $content = null, $tag = '')
 {
     $post_types = get_post_types(['public' => true]);
     $r = [];
     foreach ($post_types as $post_type) {
         // Skip attachments.
         if (in_array($post_type, ['attachment'])) {
             continue;
         }
         $object = get_post_type_object($post_type);
         $args = ['order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => $post_type, 'posts_per_page' => 20];
         $query = new WP_Query($args);
         if ($query->have_posts()) {
             $type = str_replace('_', '-', $post_type);
             $classes = ['hestia-wrap', 'hestia-sitemap', sprintf('post-type-%s', sanitize_html_class($type))];
             $r[] = sprintf('<div class="%s">', implode(' ', $classes));
             $r[] = sprintf('<h2>Recent %s</h2>', $object->labels->name);
             $r[] = '<ul>';
             while ($query->have_posts()) {
                 $query->the_post();
                 $r[] = sprintf('<li><a href="%s">%s</a></li>', esc_url(get_permalink()), esc_html(get_the_title()));
             }
             $r[] = '</ul>';
             $r[] = '</div>';
         }
         wp_reset_postdata();
     }
     return implode("\n", $r);
 }
function bfg_nav_menu_markup_filter($html, $args)
{
    // only add additional Bootstrap markup to
    // primary and secondary nav locations
    if ('primary' !== $args->theme_location && 'secondary' !== $args->theme_location) {
        return $html;
    }
    $data_target = "nav-collapse" . sanitize_html_class('-' . $args->theme_location);
    $output = <<<EOT
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#{$data_target}">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
EOT;
    // only include blog name and description in the nav
    // if it is the primary nav location
    if ('primary' === $args->theme_location) {
        $output .= apply_filters('bfg_navbar_brand', bfg_navbar_brand_markup());
    }
    $output .= '</div>';
    // .navbar-header
    $output .= "<div class=\"collapse navbar-collapse\" id=\"{$data_target}\">";
    $output .= $html;
    if (get_theme_mod('navextra', false)) {
        $output .= apply_filters('bfg_navbar_content', bfg_navbar_content_markup());
    }
    $output .= '</div>';
    // .collapse .navbar-collapse
    return $output;
}
 /**
  * sanitize useragent list
  *
  * @since 1.1
  *
  */
 public function useragent($array)
 {
     global $wp_filter;
     $localhost = false;
     $array = wp_unslash($array);
     if (!is_array($array)) {
         $array = array($array);
     }
     if (isset($array['localhost']) && 's' == sanitize_html_class($array['localhost']) && isset($wp_filter['stt2extat_allow_localhost'])) {
         $localhost = true;
     }
     $array_unique = array_unique(array_map('trim', array_keys($array)));
     $new_array = array();
     foreach ($array_unique as $k) {
         $v = $array[$k];
         if (isset($array[$k]) && '' != $v) {
             $k = stt2extat_parse_url(sanitize_text_field($k));
             $v = sanitize_html_class($v);
             if ('' != $k && '' != $v) {
                 $new_array[$k['host']] = $v;
             }
         }
     }
     if ($localhost) {
         $new_array = wp_parse_args(array('localhost' => 's'), $new_array);
     }
     $new_array = array_filter(array_map('trim', $new_array));
     uksort($new_array, 'strcasecmp');
     return $new_array;
 }
 /**
  * Custom markup for the ouput of tabs.
  *
  * @since  0.1
  * @access public
  * @param  array   $whistles
  * @return string
  */
 public function set_markup($whistles)
 {
     /* Set up an empty string to return. */
     $output = '';
     /* If we have whistles, let's roll! */
     if (!empty($whistles)) {
         /* Generate random ID. */
         $rand = mt_rand();
         /* Inject the choosen style from the shortcode popup window as CSS class. */
         $style = isset($this->args['style']) ? ' ' . sanitize_html_class($this->args['style']) : '';
         /* Open tabs wrapper. */
         $output .= '<div class="whistles whistles-tabs' . $style . '">';
         /* Open tabs nav. */
         $output .= '<ul class="whistles-tabs-nav">';
         /* Loop through each whistle title and format it into a list item. */
         foreach ($whistles as $whistle) {
             $id = sanitize_html_class('whistle-' . $this->args['group'] . '-' . $whistle['id'] . '-' . $rand);
             $output .= '<li class="whistle-title"><a href="#' . $id . '">' . $whistle['title'] . '</a></li>';
         }
         /* Close tabs nav. */
         $output .= '</ul><!-- whistles-tabs-nav -->';
         /* Open tabs content wrapper. */
         $output .= '<div class="whistles-tabs-wrap">';
         /* Loop through each whistle and format its content into a tab content block. */
         foreach ($whistles as $whistle) {
             $id = sanitize_html_class('whistle-' . $this->args['group'] . '-' . $whistle['id'] . '-' . $rand);
             $output .= '<div id="' . $id . '" class="whistle-content">' . $whistle['content'] . '</div>';
         }
         /* Close tabs and tabs content wrappers. */
         $output .= '</div><!-- .whistles-tabs-wrap -->';
         $output .= '</div><!-- .whistles-tabs -->';
     }
     /* Return the formatted output. */
     return $output;
 }
Example #16
0
/**
 * Numeric slider / Range
 *
 * @since    1.0
 * @version  1.2.2
 */
function wma_field_slider($field, $page_template = null)
{
    // Helper variables
    // Definition
    $field = wp_parse_args((array) $field, array('type' => 'slider', 'id' => 'id', 'label' => '', 'description' => '', 'class' => '', 'default' => '', 'min' => 0, 'max' => 10, 'step' => 1, 'zero' => true, 'conditional' => ''));
    // Value processing
    $value = wma_meta_option($field['id']);
    if ($value || $field['zero'] && 0 === intval($value)) {
        $value = esc_attr(intval($value));
    } else {
        $value = esc_attr(intval($field['default']));
    }
    // Field ID setup
    $field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
    // Output
    $output = "\r\n\t" . '<tr class="option range-wrap option-' . esc_attr(trim(sanitize_html_class($field['id']) . ' ' . $field['class'])) . '" data-option="' . esc_attr($field['id']) . '"><th>';
    // Label
    $output .= "\r\n\t\t" . '<label for="' . esc_attr($field['id']) . '">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</label>';
    $output .= "\r\n\t" . '</th><td>';
    // Input field
    $output .= "\r\n\t\t" . '<input type="number" name="' . esc_attr($field['id']) . '" id="' . esc_attr($field['id']) . '" value="' . esc_attr($value) . '" size="5" maxlength="5" />';
    $output .= "\r\n\t\t" . '<span class="fieldtype-range"><span id="' . esc_attr($field['id']) . '-slider" data-min="' . esc_attr(intval($field['min'])) . '" data-max="' . esc_attr(intval($field['max'])) . '" data-step="' . esc_attr(intval($field['step'])) . '" data-value="' . esc_attr($value) . '"></span></span>';
    // Description
    if (trim($field['description'])) {
        $output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
    }
    // Reset default value button
    if (trim($field['default'])) {
        $output .= "\r\n\t\t" . '<a data-option="' . esc_attr($field['id']) . '" class="button-default-value default-slider" title="' . esc_attr__('Use a default value', 'webman-amplifier') . '"><span>' . esc_attr($field['default']) . '</span></a>';
    }
    echo $output;
    // Conditional display
    do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
    echo "\r\n\t" . '</td></tr>';
}
 public static function save_post_meta_data($post_id, $post)
 {
     /* Verify the nonce before proceeding. */
     if (!isset($_POST['rating_form_meta_box_nonce']) || !wp_verify_nonce($_POST['rating_form_meta_box_nonce'], basename(__FILE__))) {
         return $post_id;
     }
     /* Get the post type object. */
     $post_type = get_post_type_object($post->post_type);
     /* Check if the current user has permission to edit the post. */
     if (!current_user_can($post_type->cap->edit_post, $post_id)) {
         return $post_id;
     }
     //echo '<pre>'; print_r($_POST); echo '</pre>'; die();
     /* Get the posted data and sanitize it for use as an HTML class. */
     $new_meta_enable_value = (isset($_POST['enable_ratingForm']) and $_POST['enable_ratingForm'] == 1) ? $_POST['enable_ratingForm'] : '0';
     $new_meta_default_ratingForm_value = (isset($_POST['is_default_ratingForm']) and $_POST['is_default_ratingForm'] == 1) ? $_POST['is_default_ratingForm'] : '0';
     $new_meta_listing_value = (isset($_POST['listing_ratingForm']) and $_POST['listing_ratingForm'] != '#NONE#') ? sanitize_html_class($_POST['listing_ratingForm']) : '';
     /* Get the meta key. */
     $meta_keys['_cbrating_enable_ratingForm'] = $new_meta_enable_value;
     $meta_keys['_cbrating_is_default_ratingForm'] = $new_meta_default_ratingForm_value;
     $meta_keys['_cbrating_listing_ratingForm'] = $new_meta_listing_value;
     foreach ($meta_keys as $meta_key => $new_meta_value) {
         $success = update_post_meta($post_id, $meta_key, $new_meta_value);
     }
 }
function wpcf7_file_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
    }
    $atts = array();
    $atts['size'] = $tag->get_size_option('40');
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_id_option();
    $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
    if ($tag->is_required()) {
        $atts['aria-required'] = 'true';
    }
    $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
    $atts['type'] = 'file';
    $atts['name'] = $tag->name;
    $atts = wpcf7_format_atts($atts);
    $html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
    return $html;
}
    /**
     * Display meta in a formatted list.
     *
     * @param bool $flat (default: false)
     * @param bool $return (default: false)
     * @param string $hideprefix (default: _)
     * @param  string $delimiter Delimiter used to separate items when $flat is true
     * @return string|void
     */
    public function display($flat = false, $return = false, $hideprefix = '_', $delimiter = ", \n")
    {
        $output = '';
        $formatted_meta = $this->get_formatted($hideprefix);
        if (!empty($formatted_meta)) {
            $meta_list = array();
            foreach ($formatted_meta as $meta) {
                if ($flat) {
                    $meta_list[] = wp_kses_post($meta['label'] . ': ' . $meta['value']);
                } else {
                    $meta_list[] = '
						<dt class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post($meta['label']) . ':</dt>
						<dd class="variation-' . sanitize_html_class(sanitize_text_field($meta['key'])) . '">' . wp_kses_post(wpautop(make_clickable($meta['value']))) . '</dd>
					';
                }
            }
            if (!empty($meta_list)) {
                if ($flat) {
                    $output .= implode($delimiter, $meta_list);
                } else {
                    $output .= '<dl class="variation">' . implode('', $meta_list) . '</dl>';
                }
            }
        }
        $output = apply_filters('woocommerce_order_items_meta_display', $output, $this);
        if ($return) {
            return $output;
        } else {
            echo $output;
        }
    }
Example #20
0
    function get_gallery_images($attr = array())
    {
        global $omnigallery, $SCFlickr, $post;
        static $instance = 0;
        $instance++;
        $attr = array_merge(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'width' => '150', 'height' => '150'), $attr);
        extract($attr);
        $id = intval($id);
        $f = $SCFlickr;
        $recent = $f->people_getPublicPhotos(get_option('sc_username_flickr'), NULL, NULL, get_option('sc_piccount_flickr'), NULL);
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
        $float = is_rtl() ? 'right' : 'left';
        $selector = "sc_gallery_flickr-{$instance}";
        $return = '';
        $size_class = sanitize_html_class($size);
        $return .= "\r\n\t\t<style type='text/css'>\r\n\t\t\t#{$selector} {\r\n\t\t\t\tmargin: auto;\r\n                display: block\r\n\t\t\t}\r\n\t\t\t#{$selector}:after {\r\n                width: 0;\r\n                height: 0;\r\n                clear: both;\r\n                content: ' ';\r\n                display: block;\r\n                overflow: hidden;\r\n                visibility: hidden;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-item {\r\n\t\t\t\tfloat: {$float};\r\n\t\t\t\tmargin-top: 10px;\r\n\t\t\t\ttext-align: center;\r\n\t\t\t\twidth: {$itemwidth}%;\r\n\t\t\t}\r\n\t\t\t#{$selector} img {\r\n\t\t\t\tborder: 2px solid #cfcfcf;\r\n\t\t\t}\r\n\t\t\t#{$selector} .gallery-caption {\r\n\t\t\t\tmargin-left: 0;\r\n\t\t\t}\r\n\t\t</style>";
        $return .= "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
        foreach ($recent['photos']['photo'] as $photo) {
            $urlimg = $f->buildPhotoURL($photo, "small");
            $urlimgori = $f->buildPhotoURL($photo, "large");
            $return .= '
            <dl class="gallery-item">
                <dt class="gallery-icon">
					<a href="' . $urlimgori . '" title="' . $photo['title'] . '" rel="lightbox-" target="_blank">
						<img src="' . $omnigallery->plugin_url . '/includes/timthumb.php?src=' . $urlimg . '&amp;w=' . $width . '&amp;h=' . $height . '&amp;zc=1&amp;q=90" alt="Flickr Gallery" class="sc-image" width="' . $width . '" height="' . $height . '"/>
					</a>
                </dt>
            </dl>';
        }
        $return .= '</div><!--/#gallery-->';
        return $return;
    }
Example #21
0
 /**
  * Updates the widget control options for the particular instance of the widget.
  *
  * @since  0.0.1
  */
 function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['title'] = strip_tags($new_instance['title']);
     $instance['title_url'] = esc_url($new_instance['title_url']);
     $instance['offset'] = (int) $new_instance['offset'];
     $instance['limit'] = (int) $new_instance['limit'];
     $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? (bool) $new_instance['ignore_sticky'] : 0;
     $instance['post_type'] = esc_attr($new_instance['post_type']);
     $instance['post_status'] = esc_attr($new_instance['post_status']);
     $instance['taxonomy'] = esc_attr($new_instance['taxonomy']);
     $instance['cat'] = $new_instance['cat'];
     $instance['tag'] = $new_instance['tag'];
     $instance['thumbnail'] = isset($new_instance['thumbnail']) ? (bool) $new_instance['thumbnail'] : false;
     $instance['thumbnail_size'] = esc_attr($new_instance['thumbnail_size']);
     $instance['thumbnail_align'] = esc_attr($new_instance['thumbnail_align']);
     $instance['thumbnail_custom'] = isset($new_instance['thumbnail_custom']) ? (bool) $new_instance['thumbnail_custom'] : false;
     $instance['thumbnail_width'] = (int) $new_instance['thumbnail_width'];
     $instance['thumbnail_height'] = (int) $new_instance['thumbnail_height'];
     $instance['excerpt'] = isset($new_instance['excerpt']) ? (bool) $new_instance['excerpt'] : false;
     $instance['excerpt_length'] = (int) $new_instance['excerpt_length'];
     $instance['date'] = isset($new_instance['date']) ? (bool) $new_instance['date'] : false;
     $instance['date_relative'] = isset($new_instance['date_relative']) ? (bool) $new_instance['date_relative'] : false;
     $instance['css_class'] = sanitize_html_class($new_instance['css_class']);
     $instance['before'] = wp_filter_post_kses($new_instance['before']);
     $instance['after'] = wp_filter_post_kses($new_instance['after']);
     return $instance;
 }
Example #22
0
 function testimonial_wrapper_class($design)
 {
     $classes = array();
     $classes[] = 'sow-user-' . sanitize_html_class($design['user_position']);
     $classes[] = 'sow-layout-' . sanitize_html_class($design['layout']);
     return str_replace('_', '-', implode(' ', $classes));
 }
Example #23
0
 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since 0.6.0
  */
 function widget($sidebar, $instance)
 {
     extract($sidebar);
     /* Set the $args for wp_tag_cloud() to the $instance array. */
     $args = $instance;
     /* Make sure empty callbacks aren't passed for custom functions. */
     $args['topic_count_text_callback'] = !empty($args['topic_count_text_callback']) ? $args['topic_count_text_callback'] : 'default_topic_count_text';
     $args['topic_count_scale_callback'] = !empty($args['topic_count_scale_callback']) ? $args['topic_count_scale_callback'] : 'default_topic_count_scale';
     /* If the separator is empty, set it to the default new line. */
     $args['separator'] = !empty($args['separator']) ? $args['separator'] : "\n";
     /* Overwrite the echo argument. */
     $args['echo'] = false;
     /* Output the theme's $before_widget wrapper. */
     echo $before_widget;
     /* If a title was input by the user, display it. */
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     /* Get the tag cloud. */
     $tags = str_replace(array("\r", "\n", "\t"), ' ', wp_tag_cloud($args));
     /* If $format should be flat, wrap it in the <p> element. */
     if ('flat' == $instance['format']) {
         $classes = array('term-cloud');
         foreach ($instance['taxonomy'] as $tax) {
             $classes[] = sanitize_html_class("{$tax}-cloud");
         }
         $tags = '<p class="' . join($classes, ' ') . '">' . $tags . '</p>';
     }
     /* Output the tag cloud. */
     echo $tags;
     /* Close the theme's widget wrapper. */
     echo $after_widget;
 }
Example #24
0
 /**
  * Render html UI_Radio.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     $master_class = !empty($this->settings['master']) && isset($this->settings['master']) ? esc_html($this->settings['master']) : '';
     $html .= '<div class="cherry-ui-container ' . $master_class . '">';
     if ($this->settings['options'] && !empty($this->settings['options']) && is_array($this->settings['options'])) {
         if ('' !== $this->settings['label']) {
             $html .= '<label class="cherry-label" for="' . esc_attr($this->settings['id']) . '">' . $this->settings['label'] . '</label> ';
         }
         $html .= '<div class="cherry-radio-group">';
         foreach ($this->settings['options'] as $option => $option_value) {
             $checked = $option == $this->settings['value'] ? ' checked' : '';
             $radio_id = $this->settings['id'] . '-' . $option;
             $img = isset($option_value['img_src']) && !empty($option_value['img_src']) ? '<img src="' . esc_url($option_value['img_src']) . '" alt="' . esc_html($option_value['label']) . '"><span class="check"><i class="dashicons dashicons-yes"></i></span>' : '<span class="cherry-radio-item"><i></i></span>';
             $data_slave = isset($option_value['slave']) && !empty($option_value['slave']) ? ' data-slave="' . $option_value['slave'] . '"' : '';
             $class_box = isset($option_value['img_src']) && !empty($option_value['img_src']) ? ' cherry-radio-img' . $checked : ' cherry-radio-item' . $checked;
             $html .= '<div class="' . $class_box . '">';
             $html .= '<input type="radio" id="' . esc_attr($radio_id) . '" class="cherry-radio-input ' . sanitize_html_class($this->settings['class']) . '" name="' . esc_attr($this->settings['name']) . '" ' . checked($option, $this->settings['value'], false) . ' value="' . esc_attr($option) . '"' . $data_slave . '>';
             $label_content = $img . $option_value['label'];
             $html .= '<label for="' . esc_attr($radio_id) . '">' . $label_content . '</label> ';
             $html .= '</div>';
         }
         $html .= '<div class="clear"></div>';
         $html .= '</div>';
     }
     $html .= '</div>';
     return $html;
 }
 private function _getDefaultScreenIcon()
 {
     $_oScreen = get_current_screen();
     $_sIconIDAttribute = $this->_getScreenIDAttribute($_oScreen);
     $_aAttributes = array('class' => $this->getClassAttribute($this->getAOrB(empty($_sIconIDAttribute) && $_oScreen->post_type, sanitize_html_class('icon32-posts-' . $_oScreen->post_type), ''), $this->getAOrB(empty($_sIconIDAttribute) || $_sIconIDAttribute == $this->oFactory->oProp->sClassName, 'generic', '')), 'id' => "icon-" . $_sIconIDAttribute);
     return $this->_getScreenIconByAttributes($_aAttributes);
 }
 /**
  * Get the CSS classes generated by our theme mods.
  * 
  * @param  string $output_as Output as an array or string.
  * @return mixed  The classes generated by our theme mods, either as a string or an array.
  */
 function get_classes($output_as = 'array')
 {
     // Will hold the classes.
     $classes = array();
     // Fire up our theme mods class.
     $theme_mods_class = new CSST_TMD_Theme_Mods();
     // Grab all the settings.
     $settings = $theme_mods_class->get_settings();
     // For each setting...
     foreach ($settings as $setting_id => $setting) {
         // Grab the value of that setting.
         $value = $setting['value'];
         // Make that setting into a CSS class.
         $class = sanitize_html_class(CSST_TMD . "-{$setting_id}-{$value}");
         $classes[] = $class;
     }
     // There shouldn't be any duplicates, but just in case.
     $classes = array_unique($classes);
     // Let's alphabetize them, just to be a jerk.
     sort($classes);
     // Do we want the classes as a string?
     if ($output_as == 'string') {
         $classes = implode(' ', $classes);
     }
     return $classes;
 }
    /**
     * Heading Shortcode
     * 
     * @param  array $atts
     * @param  string $content
     * @return html $heading_output
     */
    function rt_quote_function($atts, $content = null)
    {
        //defaults
        extract(shortcode_atts(array("id" => '', "class" => '', "name" => '', "position" => '', "link" => '', "link_title" => ''), $atts));
        $content = $content;
        //id attr
        $id = !empty($id) ? 'id="' . sanitize_html_class($id) . '"' : "";
        //class attr
        $class = !empty($class) ? 'class="' . sanitize_html_class($class) . '"' : "";
        //author link
        $link = esc_url($link);
        $link_output = !empty($link) && !empty($link_title) ? '<a href="' . $link . '" target="_blank" title="' . $link_title . '" class="client_link">' . $link_title . '</a>' : "";
        $link_output = !empty($link) ? '<a href="' . $link . '" target="_blank" title="" class="client_link">' . str_replace("http://", "", $link) . '</a>' : $link_output;
        //author name
        $author = !empty($name) ? '<span>' . $name . '</span>' : "";
        //position
        $author .= !empty($position) ? ", " . $position : "";
        //author output
        $author_output = !empty($author) || !empty($link_output) ? sprintf('<div class="author_info">
						%1$s %2$s
					</div>', $author, $link_output) : "";
        //output
        $output = sprintf('<div class="rt_quote" %1$s %2$s>
							<p>
								<span class="icon-quote-left"></span>
								%3$s
								<span class="icon-quote-right"></span>
							</p>
							%4$s
					</div>', $id, $class, $content, $author_output);
        return $output;
    }
Example #28
0
/**
 * Merge array of attributes with defaults, and apply contextual filter on array.
 *
 * The contextual filter is of the form `genesis_attr_{context}`.
 *
 * @since 2.0.0
 *
 * @param  string $context    The context, to build filter name.
 * @param  array  $attributes Optional. Extra attributes to merge with defaults.
 *
 * @return array Merged and filtered attributes.
 */
function genesis_parse_attr($context, $attributes = array())
{
    $defaults = array('class' => sanitize_html_class($context));
    $attributes = wp_parse_args($attributes, $defaults);
    //* Contextual filter
    return apply_filters('genesis_attr_' . $context, $attributes, $context);
}
 /**
  * Constructor.
  *
  * @since 2.7.0
  *
  * @param array $r {
  *     An array of arguments.
  *     @type string $element    The element to render. eg. 'a' for the anchor element.
  *     @type array  $attr       Optional. The element's attributes set as key/value pairs. eg.
  *                              array( 'href' => 'http://example.com', 'class' => 'my-class' )
  *     @type string $inner_html Optional. The inner HTML for the element if applicable. Please note that
  *                              this isn't sanitized, so you should use your own sanitization routine
  *                              before using this parameter.
  * }
  */
 public function __construct($r = array())
 {
     $elem = sanitize_html_class($r['element']);
     if (empty($elem)) {
         return;
     }
     // Render attributes.
     $attributes = '';
     foreach ((array) $r['attr'] as $attr => $val) {
         // If attribute is empty, skip.
         if (empty($val)) {
             continue;
         }
         if ('href' === $attr || 'formaction' === $attr || 'src' === $attr) {
             $val = esc_url($val);
         } elseif ('id' === $attr) {
             $val = sanitize_html_class($val);
         } else {
             $val = esc_attr($val);
         }
         $attributes .= sprintf('%s="%s" ', sanitize_html_class($attr), $val);
     }
     // <input> / <img> is self-closing.
     if ('input' === $elem || 'img' === $elem) {
         $this->open_tag = sprintf('<%1$s %2$s />', $elem, $attributes);
         // All other elements.
     } else {
         $this->open_tag = sprintf('<%1$s %2$s>', $elem, $attributes);
         $this->inner_html = !empty($r['inner_html']) ? $r['inner_html'] : '';
         $this->close_tag = sprintf('</%1$s>', $elem);
     }
 }
Example #30
0
 function wma_field_checkbox($field, $page_template = null)
 {
     //Field definition array
     $field = wp_parse_args((array) $field, array('type' => 'checkbox', 'id' => 'id', 'label' => '', 'description' => '', 'value' => true, 'class' => '', 'attributes' => '', 'repeater' => false, 'conditional' => ''));
     //Value processing
     $field['value'] = esc_attr($field['value']);
     if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['value'])) {
         $value = $field['repeater']['value'];
     } else {
         $value = wma_meta_option($field['id']);
     }
     $value = esc_attr($value);
     //Field ID setup
     if ($field['repeater'] && is_array($field['repeater']) && isset($field['repeater']['id'])) {
         $field['id'] = $field['repeater']['id'];
     } else {
         $field['id'] = WM_METABOX_FIELD_PREFIX . $field['id'];
     }
     //Output
     $output = "\r\n\t" . '<tr class="option checkbox-wrap option-' . trim(sanitize_html_class($field['id']) . ' ' . $field['class']) . '" data-option="' . $field['id'] . '"><th colspan="2">';
     //Input field
     $output .= "\r\n\t\t" . '<input type="' . $field['type'] . '" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $field['value'] . '" class="fieldtype-checkbox" ' . trim(checked($value, $field['value'], false) . ' ' . $field['attributes'] . ' /') . '>';
     //Label
     $output .= ' <label for="' . $field['id'] . '">' . trim(strip_tags($field['label'], WM_METABOX_LABEL_HTML)) . '</label>';
     //Description
     if (trim($field['description'])) {
         $output .= "\r\n\t\t" . '<p class="description">' . trim($field['description']) . '</p>';
     }
     echo $output;
     //Conditional display
     do_action('wmhook_metabox_' . 'conditional', $field, $field['id']);
     echo "\r\n\t" . '</th></tr>';
 }