PHP Функция esc_attr - примеры использования

На этой странице представлены лучшие примеры PHP кода для метода esc_attr, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
Показать файл Файл: text.php Проект: gjaya79/urdailynews
0
 function create_field($field)
 {
     // vars
     $o = array('id', 'class', 'name', 'value', 'placeholder');
     $e = '';
     // maxlength
     if ($field['maxlength'] !== "") {
         $o[] = 'maxlength';
     }
     // prepend
     if ($field['prepend'] !== "") {
         $field['class'] .= ' acf-is-prepended';
         $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>';
     }
     // append
     if ($field['append'] !== "") {
         $field['class'] .= ' acf-is-appended';
         $e .= '<div class="acf-input-append">' . $field['append'] . '</div>';
     }
     $e .= '<div class="acf-input-wrap">';
     $e .= '<input type="text"';
     foreach ($o as $k) {
         $e .= ' ' . $k . '="' . esc_attr($field[$k]) . '"';
     }
     $e .= ' />';
     $e .= '</div>';
     // return
     echo $e;
 }
Пример #2
Показать файл Файл: custom_walker.php Проект: hamaianhnhi/shopkeeper148
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     global $wp_query;
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
     $class_names = ' class="' . esc_attr($class_names) . '"';
     $output .= $indent . '<li id="shopkeeper-menu-item-' . $item->ID . '"' . $value . $class_names . '>';
     $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
     $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
     $prepend = '';
     $append = '';
     //$description  = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
     if ($depth != 0) {
         $description = $append = $prepend = "";
     }
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . $prepend . apply_filters('the_title', $item->title, $item->ID) . $append;
     //$item_output .= $description.$args->link_after;
     //$item_output .= ' '.$item->background_url.'</a>';
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
     apply_filters('walker_nav_menu_start_lvl', $item_output, $depth, $args->background_url = $item->background_url);
 }
Пример #3
Показать файл Файл: default_params.php Проект: severnrescue/web
0
/**
 * Dropdown(select with options) shortcode attribute type generator.
 *
 * @param $settings
 * @param $value
 *
 * @since 4.4
 * @return string - html string.
 */
function vc_dropdown_form_field($settings, $value)
{
    $output = '';
    $css_option = str_replace('#', 'hash-', vc_get_dropdown_option($settings, $value));
    $output .= '<select name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-input wpb-select ' . $settings['param_name'] . ' ' . $settings['type'] . ' ' . $css_option . '" data-option="' . $css_option . '">';
    if (is_array($value)) {
        $value = isset($value['value']) ? $value['value'] : array_shift($value);
    }
    if (!empty($settings['value'])) {
        foreach ($settings['value'] as $index => $data) {
            if (is_numeric($index) && (is_string($data) || is_numeric($data))) {
                $option_label = $data;
                $option_value = $data;
            } elseif (is_numeric($index) && is_array($data)) {
                $option_label = isset($data['label']) ? $data['label'] : array_pop($data);
                $option_value = isset($data['value']) ? $data['value'] : array_pop($data);
            } else {
                $option_value = $data;
                $option_label = $index;
            }
            $selected = '';
            $option_value_string = (string) $option_value;
            $value_string = (string) $value;
            if ('' !== $value && $option_value_string === $value_string) {
                $selected = ' selected="selected"';
            }
            $option_class = str_replace('#', 'hash-', $option_value);
            $output .= '<option class="' . esc_attr($option_class) . '" value="' . esc_attr($option_value) . '"' . $selected . '>' . htmlspecialchars($option_label) . '</option>';
        }
    }
    $output .= '</select>';
    return $output;
}
Пример #4
Показать файл Файл: class-popup-rule-popup.php Проект: nullality/FEWD-SEA-7
0
    /**
     * Output the Admin-Form for the active rule.
     *
     * @since  4.6
     * @param  mixed $data Rule-data which was saved via the save_() handler.
     */
    protected function form_count($data)
    {
        $count = absint($data);
        if ($count < 1) {
            $count = 1;
        }
        ?>
		<label for="po-max-count">
			<?php 
        _e('Display PopUp this often:', PO_LANG);
        ?>
		</label>
		<input type="number"
			id="po-max-count"
			class="inp-small"
			name="po_rule_data[count]"
			min="1"
			max="999"
			maxlength="3"
			placeholder="10"
			value="<?php 
        echo esc_attr(absint($count));
        ?>
" />
		<?php 
    }
Пример #5
Показать файл Файл: wpmenucart-jigoshop-pro.php Проект: Atlas-Solutions-Group/wp-menu-cart-pro
0
 /**
  * Add Menu Cart to menu
  * 
  * @return menu items including cart
  */
 public function submenu_items()
 {
     $get_cart = jigoshop_cart::get_cart();
     $submenu_items = '';
     //see jigoshop/widgets/cart.php
     if (count($get_cart) > 0) {
         foreach ($get_cart as $cart_item_key => $values) {
             $_product = $values['data'];
             if ($_product->exists() && $values['quantity'] > 0) {
                 $item_thumbnail = has_post_thumbnail($_product->id) ? get_the_post_thumbnail($_product->id, 'shop_tiny') : jigoshop_get_image_placeholder('shop_tiny');
                 $item_name = $_product->get_title();
                 // Not used: Displays variations and cart item meta
                 $item_meta = jigoshop_cart::get_item_data($values);
                 $item_quantity = esc_attr($values['quantity']);
                 $item_price = $_product->get_price_html();
                 // Item permalink
                 $item_permalink = esc_attr(get_permalink($_product->id));
                 $submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink);
             }
         }
     } else {
         $submenu_items = '';
     }
     return $submenu_items;
 }
Пример #6
Показать файл Файл: offcanvas-walker.class.php Проект: andrewcroce/TPL
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'menu-item-' . $item->ID;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
     /**
      * Change WP's default classes to match Foundation's required classes
      */
     $class_names = str_replace(array('menu-item-has-children'), array('has-submenu'), $class_names);
     // ==========================
     $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth);
     $id = $id ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $class_names . '>';
     $atts = array();
     $atts['title'] = !empty($item->attr_title) ? $item->attr_title : '';
     $atts['target'] = !empty($item->target) ? $item->target : '';
     $atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
     $atts['href'] = !empty($item->url) ? $item->url : '';
     $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args, $depth);
     $attributes = '';
     foreach ($atts as $attr => $value) {
         if (!empty($value)) {
             $value = 'href' === $attr ? esc_url($value) : esc_attr($value);
             $attributes .= ' ' . $attr . '="' . $value . '"';
         }
     }
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
Пример #7
Показать файл Файл: class-wp-widget-area-customize-control.php Проект: SayenkoDesign/ividf
0
    /**
     * Renders the control's content.
     *
     * @since 3.9.0
     * @access public
     */
    public function render_content()
    {
        $id = 'reorder-widgets-desc-' . str_replace(array('[', ']'), array('-', ''), $this->id);
        ?>
		<button type="button" class="button-secondary add-new-widget" aria-expanded="false" aria-controls="available-widgets">
			<?php 
        _e('Add a Widget');
        ?>
		</button>
		<button type="button" class="button-link reorder-toggle" aria-label="<?php 
        esc_attr_e('Reorder widgets');
        ?>
" aria-describedby="<?php 
        echo esc_attr($id);
        ?>
">
			<span class="reorder"><?php 
        _ex('Reorder', 'Reorder widgets in Customizer');
        ?>
</span>
			<span class="reorder-done"><?php 
        _ex('Done', 'Cancel reordering widgets in Customizer');
        ?>
</span>
		</button>
		<p class="screen-reader-text" id="<?php 
        echo esc_attr($id);
        ?>
"><?php 
        _e('When in reorder mode, additional controls to reorder widgets will be available in the widgets list above.');
        ?>
</p>
		<?php 
    }
Пример #8
Показать файл Файл: template-tags.php Проект: jgcopple/drgaryschwantz
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function square_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = get_comments_number();
     // get_comments_number returns only a numeric value
     if (comments_open()) {
         if ($comment_count == 0) {
             $comments = __('No Comments', 'square');
         } elseif ($comment_count > 1) {
             $comments = $comment_count . __(' Comments', 'square');
         } else {
             $comments = __('1 Comment', 'square');
         }
         $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
     } else {
         $comment_link = __(' Comment Closed', 'square');
     }
     echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
     // WPCS: XSS OK.
 }
Пример #9
Показать файл Файл: product_tag.php Проект: ashik968/digiplot
0
function jigoshop_product_tag($attributes)
{
    global $paged;
    $jigoshop_options = Jigoshop_Base::get_options();
    $attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
    if (isset($_REQUEST['tag'])) {
        $attributes['tag'] = $_REQUEST['tag'];
    }
    /** Operator validation. */
    if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
        $tax_operator = 'IN';
    }
    /** Multiple category values. */
    if (!empty($slug)) {
        $slug = explode(',', esc_attr($slug));
        $slug = array_map('trim', $slug);
    }
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
    query_posts($args);
    ob_start();
    jigoshop_get_template_part('loop', 'shop');
    if ($attributes['pagination']) {
        do_action('jigoshop_pagination');
    }
    wp_reset_query();
    return ob_get_clean();
}
Пример #10
Показать файл Файл: class-fonts-control.php Проект: tchataigner/palette
0
    /**
     * Display the font control.
     *
     * @since 1.0.0
     */
    function render_content()
    {
        $v = $this->value();
        $values = json_decode($v);
        wp_enqueue_script('json2');
        $font_options = isset($this->font_options) ? $this->font_options : array();
        ?>

		<?php 
        if ($this->show_label && !empty($this->label)) {
            ?>
			<span class="customize-control-title themify-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
		<?php 
        }
        ?>

		<?php 
        $this->render_fonts($values, $font_options);
        ?>

		<input <?php 
        $this->link();
        ?>
 value='<?php 
        echo esc_attr($v);
        ?>
' type="hidden" class="<?php 
        echo esc_attr($this->type);
        ?>
_control themify-customizer-value-field"/>
	<?php 
    }
Пример #11
Показать файл Файл: base.php Проект: spielhoelle/amnesty
0
/**
 * @param $icon_value
 * @param bool $icon_styles
 *
 * @return bool|string
 */
function siteorigin_widget_get_icon($icon_value, $icon_styles = false)
{
    if (empty($icon_value)) {
        return false;
    }
    list($family, $icon) = explode('-', $icon_value, 2);
    if (empty($family) || empty($icon)) {
        return false;
    }
    static $widget_icon_families;
    static $widget_icons_enqueued = array();
    if (empty($widget_icon_families)) {
        $widget_icon_families = apply_filters('siteorigin_widgets_icon_families', array());
    }
    if (empty($widget_icon_families[$family]) || empty($widget_icon_families[$family]['icons'][$icon])) {
        return false;
    }
    if (empty($widget_icons_enqueued[$family]) && !empty($widget_icon_families[$family]['style_uri'])) {
        if (!wp_style_is('siteorigin-widget-icon-font-' . $family)) {
            wp_enqueue_style('siteorigin-widget-icon-font-' . $family, $widget_icon_families[$family]['style_uri']);
        }
        return '<span class="sow-icon-' . esc_attr($family) . '" data-sow-icon="' . $widget_icon_families[$family]['icons'][$icon] . '" ' . (!empty($icon_styles) ? 'style="' . implode('; ', $icon_styles) . '"' : '') . '></span>';
    } else {
        return false;
    }
}
Пример #12
Показать файл Файл: class-rss-feed.php Проект: JasonAJames/jasonajamescom
0
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     $defaults = Magee_Core::set_shortcode_defaults(array('url' => '', 'number' => 3, 'class' => '', 'id' => ''), $args);
     extract($defaults);
     self::$args = $defaults;
     $html = '';
     //$html = '<h2>'._e( 'Recent news from Some-Other Blog:', 'my-text-domain' ).'<h2>';
     if ($url !== '') {
         include_once ABSPATH . WPINC . '/feed.php';
         $rss = fetch_feed(esc_url($url));
         $maxitems = 0;
         if (!is_wp_error($rss)) {
             $maxitems = $rss->get_item_quantity(esc_attr($number));
             $rss_items = $rss->get_items(0, $maxitems);
         }
         $html = '<ul class="' . esc_attr($class) . '" id="' . esc_attr($id) . '">';
         if ($maxitems == 0) {
             $html .= '<li>' . _e('No items', 'magee-shortcodes') . '</li>';
         } else {
             foreach ($rss_items as $item) {
                 $html .= '<li>';
                 $html .= '<a target="_blank" href="' . esc_url($item->get_permalink()) . '" ';
                 $html .= 'title="' . __('Posted ' . $item->get_date('j F Y | g:i a'), 'magee-shortcodes') . '">';
                 $html .= $item->get_title();
                 $html .= '</a>';
                 $html .= '</li>';
             }
         }
         $html .= '</ul>';
     }
     return $html;
 }
Пример #13
Показать файл Файл: autocomplete.php Проект: zruiz/NG
0
      /**
       * Get field HTML
       *
       * @param mixed $meta
       * @param array $field
       *
       * @return string
       */
      static function html($meta, $field)
      {
          if (!is_array($meta)) {
              $meta = array($meta);
          }
          $options = array();
          foreach ($field['options'] as $value => $label) {
              $options[] = array('value' => $value, 'label' => $label);
          }
          // Input field that triggers autocomplete.
          // This field doesn't store field values, so it doesn't have "name" attribute.
          // The value(s) of the field is store in hidden input(s). See below.
          $html = sprintf('<input type="text" class="rwmb-autocomplete" id="%s" data-name="%s" data-options="%s" size="%s">', $field['id'], $field['field_name'], esc_attr(json_encode($options)), $field['size']);
          $html .= '<div class="rwmb-autocomplete-results">';
          // Each value is displayed with label and 'Delete' option
          // The hidden input has to have ".rwmb-*" class to make clone work
          $tpl = '
		<div class="rwmb-autocomplete-result">
			<div class="label">%s</div>
			<div class="actions">%s</div>
			<input type="hidden" class="rwmb-autocomplete-value" name="%s" value="%s">
		</div>
	';
          foreach ($field['options'] as $value => $label) {
              if (in_array($value, $meta)) {
                  $html .= sprintf($tpl, $label, __('Delete', 'meta-box'), $field['field_name'], $value);
              }
          }
          $html .= '</div>';
          // .rwmb-autocomplete-results
          return $html;
      }
Пример #14
Показать файл Файл: woocommerce-config.php Проект: renatodex/submundo-blogstore
0
    function cg_woocommerce_size_guide()
    {
        global $cg_options;
        $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https:" : "http:";
        $size_guide_title = '';
        if (isset($cg_options['product_size_guide_title'])) {
            $size_guide_title = $cg_options['product_size_guide_title'];
        }
        ?>

        <?php 
        if ($size_guide_title) {
            $cg_options['product_size_guide']['url'] = $protocol . str_replace(array('http:', 'https:'), '', $cg_options['product_size_guide']['url']);
            ?>
            <div class="cg-size-guide-wrap">
                <div class="icon cg-icon-cloth-hanger"></div>
                <div class="cg-size-guide">
                    <a href="<?php 
            echo esc_url($cg_options['product_size_guide']['url']);
            ?>
">
            <?php 
            echo esc_attr($size_guide_title);
            ?>
                    </a>
                </div>
            </div>


        <?php 
        }
    }
Пример #15
Показать файл Файл: ChamameGuiAdmin.php Проект: al-mamun/chamame-live-chat
0
    public function addOperatorNameField($user)
    {
        if (!user_can($user, 'chamame_chat_with_visitor')) {
            return;
        }
        $name = esc_attr(get_user_meta($user->ID, 'chamameOperatorName', true));
        $textDomain = $this->config->getTextDomain();
        $header = esc_html(__('Chat Settings', $textDomain));
        $label = esc_html(__('Operator Name', $textDomain));
        $description = esc_html(__('Input operator name. If this item is empty, "Display name publicly as" is displayed as operator name.', $textDomain));
        echo <<<EOM
<h3>{$header}</h3>
<table class="form-table">
  <tr>
    <th scope="row">
      <label for="chamameOperatorName">{$label}</label>
    </th>
    <td>
      <input type="text" id="chamameOperatorName" name="chamameOperatorName" value="{$name}" class="regular-text" />
      <br />
      <span class="description">{$description}</span>
    </td>
  </tr>
</table>
EOM;
    }
Пример #16
Показать файл Файл: Walker_nav_menu.php Проект: alispx/calibrefx
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0)
 {
     global $wp_query;
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = 'menu-item-' . $item->ID;
     if ($args->has_children) {
         $classes[] = 'dropdown';
     }
     $icon_html = '';
     if (isset($item->custom_icon) && !empty($item->custom_icon)) {
         $icon_html = '<i class="' . $item->custom_icon . '"></i><span>&nbsp;&nbsp;</span>';
     }
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     $class_names = ' class="' . esc_attr($class_names) . '"';
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
     $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $value . $class_names . '>';
     $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
     $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . $icon_html . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
Пример #17
Показать файл Файл: avatar.php Проект: billyprice1/bdApi
0
function xfac_get_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = '')
{
    if (is_numeric($id_or_email)) {
        $wpUserId = (int) $id_or_email;
    } elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
        $wpUserId = $user->ID;
    } elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
        $wpUserId = (int) $id_or_email->user_id;
    }
    if (empty($wpUserId)) {
        // cannot figure out the user id...
        return $avatar;
    }
    $apiRecords = xfac_user_getRecordsByUserId($wpUserId);
    if (empty($apiRecords)) {
        // no api records
        return $avatar;
    }
    $apiRecord = reset($apiRecords);
    if (empty($apiRecord->profile['links']['avatar'])) {
        // no avatar?
        return $avatar;
    }
    $avatar = $apiRecord->profile['links']['avatar'];
    $size = (int) $size;
    if (empty($alt)) {
        $alt = get_the_author_meta('display_name', $wpUserId);
    }
    $author_class = is_author($wpUserId) ? ' current-author' : '';
    $avatar = "<img alt='" . esc_attr($alt) . "' src='" . esc_url($avatar) . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
    return $avatar;
}
Пример #18
Показать файл Файл: highlights.php Проект: samfu1994/personalWeb
0
function aaron_highlights()
{
    /* 
    * Frontpage Highlights
    */
    if (get_theme_mod('aaron_hide_highlight') == "") {
        for ($i = 1; $i < 10; $i++) {
            if (get_theme_mod('aaron_highlight' . $i . '_headline') or get_theme_mod('aaron_highlight' . $i . '_text') or get_theme_mod('aaron_highlight' . $i . '_icon') and get_theme_mod('aaron_highlight' . $i . '_icon') != "no-icon" or get_theme_mod('aaron_highlight' . $i . '_image')) {
                echo '<div class="highlights" style="background:' . get_theme_mod('aaron_highlight' . $i . '_bgcolor', '#fafafa') . ';">';
                if (get_theme_mod('aaron_highlight' . $i . '_icon') != "" and get_theme_mod('aaron_highlight' . $i . '_icon') != "no-icon" and get_theme_mod('aaron_highlight' . $i . '_image') == "") {
                    echo '<i aria-hidden="true" class="dashicons ' . esc_attr(get_theme_mod('aaron_highlight' . $i . '_icon')) . '"  style="color:' . get_theme_mod('aaron_highlight' . $i . '_textcolor', '#333333') . ';"></i>';
                }
                if (get_theme_mod('aaron_highlight' . $i . '_image') != "") {
                    echo '<img src="' . esc_url(get_theme_mod('aaron_highlight' . $i . '_image')) . '">';
                }
                if (get_theme_mod('aaron_highlight' . $i . '_link') != "") {
                    echo '<a href="' . esc_url(get_theme_mod('aaron_highlight' . $i . '_link')) . '">';
                }
                if (get_theme_mod('aaron_highlight' . $i . '_headline') != "") {
                    echo '<h2 style="color:' . get_theme_mod('aaron_highlight' . $i . '_textcolor', '#333333') . ';">' . esc_html(get_theme_mod('aaron_highlight' . $i . '_headline')) . '</h2>';
                }
                if (get_theme_mod('aaron_highlight' . $i . '_text') != "") {
                    echo '<p style="color:' . get_theme_mod('aaron_highlight' . $i . '_textcolor', '#333333') . ';">' . esc_html(get_theme_mod('aaron_highlight' . $i . '_text')) . '</p>';
                }
                if (get_theme_mod('aaron_highlight' . $i . '_link') != "") {
                    echo '</a>';
                }
                echo '</div>';
            }
        }
    }
}
Пример #19
Показать файл Файл: subpages.php Проект: petrfaitl/wordpress-event-theme
0
 function form($instance)
 {
     $instance = wp_parse_args((array) $instance, array('sortby' => 'menu_order', 'title' => '', 'exclude' => ''));
     $title = esc_attr($instance['title']);
     $exclude = esc_attr($instance['exclude']);
     include locate_template('templates/widgets/conf/subpages.php');
 }
Пример #20
Показать файл Файл: shortcode-columns.php Проект: estrategasdigitales/dictobas
0
 /**
  * Columns shortcode
  *
  * @param array $atts
  * @param string $content
  * @return string
  */
 function wolf_columns_shortcode($atts, $content = null)
 {
     // if ( class_exists( 'Vc_Manager' ) && function_exists( 'vc_map_get_attributes' ) ) {
     // 	$atts = vc_map_get_attributes( 'wolf_column', $atts );
     // }
     extract(shortcode_atts(array('col' => 'col-6', 'class' => '', 'first' => '', 'last' => '', 'inline_style' => ''), $atts));
     $col = esc_attr($col);
     $first = esc_attr($first);
     $last = esc_attr($last);
     $col = esc_attr($col);
     $inline_style = sanitize_text_field($inline_style);
     $output = '';
     $style = '';
     $class = $class ? "{$class} " : '';
     // add space
     if ($inline_style) {
         $style .= $inline_style;
     }
     $style = $style ? " style='{$style}'" : '';
     if ($first) {
         $class = 'first';
     } elseif ($last) {
         $class = 'last';
     }
     if ($class == 'first') {
         $output .= '<div class="clear"></div>';
     }
     $output .= '<div class="' . $col . ' ' . $class . '"' . $style . '>' . do_shortcode($content) . '</div>';
     if ($class == 'last') {
         $output .= '<div class="clear"></div>';
     }
     return $output;
 }
Пример #21
Показать файл Файл: class-Upbootwp_Walker_Nav_Menu.php Проект: quinntron/greendot
0
 /**
  * start_el function.
  * 
  * @access public
  * @param mixed &$output
  * @param mixed $item
  * @param int $depth (default: 0)
  * @param array $args (default: array())
  * @param int $id (default: 0)
  * @return void
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $li_attributes = '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $classes[] = $args->has_children ? 'dropdown' : '';
     $classes[] = $item->current || $item->current_item_ancestor ? 'active' : '';
     $classes[] = 'menu-item-' . $item->ID;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
     $class_names = ' class="' . esc_attr($class_names) . '"';
     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
     $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';
     $output .= $indent . '<li' . $id . $value . $class_names . $li_attributes . '>';
     $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
     $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
     $attributes .= $args->has_children ? ' class="dropdown-toggle" data-toggle="dropdown"' : '';
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= $args->has_children ? ' <b class="caret"></b></a>' : '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
Пример #22
Показать файл Файл: class-eml-media-list-table.php Проект: vanlong200880/uni
0
 protected function get_views()
 {
     global $wpdb, $post_mime_types, $avail_post_mime_types;
     $type_links = array();
     $_num_posts = (array) wp_count_attachments();
     $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     $total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $selected = empty($_GET['attachment-filter']) ? ' selected="selected"' : '';
     $type_links['all'] = "<option value=''{$selected}>" . sprintf(_nx('All (%s)', 'All (%s)', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</option>';
     foreach ($post_mime_types as $mime_type => $label) {
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         $selected = '';
         if (!empty($_GET['attachment-filter']) && strpos($_GET['attachment-filter'], 'post_mime_type:') === 0 && wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $_GET['attachment-filter']))) {
             $selected = ' selected="selected"';
         }
         if (!empty($num_posts[$mime_type])) {
             $type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr($mime_type) . '"' . $selected . '>' . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])) . '</option>';
         }
     }
     $type_links['detached'] = '<option value="detached"' . ($this->detached ? ' selected="selected"' : '') . '>' . sprintf(_nx('Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files'), number_format_i18n($total_orphans)) . '</option>';
     $type_links['uncategorized'] = '<option value="uncategorized"' . ($this->uncategorized ? ' selected="selected"' : '') . '>' . __('All Uncategorized', 'eml') . '</option>';
     if (!empty($_num_posts['trash'])) {
         $type_links['trash'] = '<option value="trash"' . (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ? ' selected="selected"' : '') . '>' . sprintf(_nx('Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])) . '</option>';
     }
     return $type_links;
 }
Пример #23
Показать файл Файл: template-tags.php Проект: carrieforde/School
0
/**
 * Output the menu post type content.
 *
 * @since 1.0.0
 */
function school_menu_output()
{
    $menus = get_post_meta(get_the_id(), 'menus', true);
    if ($menus) {
        echo '<div class="school-menu-wrapper">';
        for ($i = 0; $i < $menus; $i++) {
            $course = get_post_meta(get_the_id(), 'menus_' . $i . '_course', true);
            $menu_item = get_post_meta(get_the_id(), 'menus_' . $i . '_menu_item_name', true);
            $price = get_post_meta(get_the_id(), 'menus_' . $i . '_price', true);
            $source = get_post_meta(get_the_id(), 'menus_' . $i . '_source', true);
            $description = get_post_meta(get_the_id(), 'menus_' . $i . '_menu_item_description', true);
            if (!empty($course)) {
                echo '<h2 class="school-menu-course">' . esc_attr($course) . '</h2>';
            }
            echo '<h3 class="school-menu-item-heading">';
            echo '<span class"school-menu-item">' . esc_attr($menu_item) . '</span>';
            echo '<span class="school-menu-price">' . esc_attr($price) . '</span>';
            echo '</h3>';
            if (!empty($source)) {
                echo '<p class="school-menu-source">' . esc_attr($source) . '</p>';
            }
            echo '<p class="school-menu-description">' . esc_attr($description) . '</p>';
        }
        echo '</div>';
    }
}
Пример #24
Показать файл Файл: field_text_sortable.php Проект: tiankwx/docker-wordpress
0
 /**
  * Field Render Function.
  *
  * Takes the vars and outputs the HTML for the field in the settings
  *
  * @since Themonic_Options 2.0.1
  */
 function render()
 {
     $class = isset($this->field['class']) ? $this->field['class'] : '';
     $options = $this->field['options'];
     echo '<ul class="text_sortable ' . $class . '">';
     if (isset($this->value) && is_array($this->value)) {
         foreach ($this->value as $k => $nicename) {
             $value_display = isset($this->value[$k]) ? $this->value[$k] : '';
             echo '<li>';
             echo '<label for="' . $this->field['id'] . '[' . $k . ']"><strong>' . $options[$k] . ':</strong></label>';
             echo '<input type="text" id="' . $this->field['id'] . '[' . $k . ']" name="' . $this->args['opt_name'] . '[' . $this->field['id'] . '][' . $k . ']" value="' . esc_attr($value_display) . '" placeholder="' . $nicename . '" />';
             echo '<span class="compact drag"><i class="icon-move icon-large"></i></span>';
             echo '</li>';
         }
     } else {
         foreach ($options as $k => $nicename) {
             $value_display = isset($this->value[$k]) ? $this->value[$k] : '';
             echo '<li>';
             echo '<label for="' . $this->field['id'] . '[' . $k . ']"><strong>' . $nicename . ':</strong></label>';
             echo '<input type="text" id="' . $this->field['id'] . '[' . $k . ']" name="' . $this->args['opt_name'] . '[' . $this->field['id'] . '][' . $k . ']" value="' . esc_attr($value_display) . '" placeholder="' . $nicename . '" />';
             echo '<span class="drag"><i class="icon-move icon-large"></i></span>';
             echo '</li>';
         }
     }
     echo '</ul>';
     echo isset($this->field['desc']) && !empty($this->field['desc']) ? ' <span class="description">' . $this->field['desc'] . '</span>' : '';
 }
Пример #25
Показать файл Файл: submit.php Проект: alanhogan/contact-form-8
0
function wpcf7_submit_shortcode_handler($tag)
{
    if (!is_array($tag)) {
        return '';
    }
    $options = (array) $tag['options'];
    $values = (array) $tag['values'];
    $atts = '';
    $id_att = '';
    $class_att = '';
    foreach ($options as $option) {
        if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $id_att = $matches[1];
        } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $class_att .= ' ' . $matches[1];
        }
    }
    if ($id_att) {
        $atts .= ' id="' . trim($id_att) . '"';
    }
    if ($class_att) {
        $atts .= ' class="' . trim($class_att) . '"';
    }
    $value = $values[0];
    if (empty($value)) {
        $value = __('Send', 'wpcf7');
    }
    $ajax_loader_image_url = wpcf7_plugin_url('images/ajax-loader.gif');
    $html = '<input type="submit" value="' . esc_attr($value) . '"' . $atts . ' />';
    $html .= ' <img class="ajax-loader" style="visibility: hidden;" alt="ajax loader" src="' . $ajax_loader_image_url . '" />';
    return $html;
}
Пример #26
Показать файл Файл: lg_supper_templates.php Проект: BearsTheme/lemongrid
0
function lgShortcodeSupperTemplate($settings, $value)
{
    $shortcode = $settings['shortcode'];
    $plg_dir_temp = TB_DIR . 'templates/';
    $theme_dir_temp = get_template_directory() . '/lemongrid_templates/';
    $reg = "/^({$shortcode}\\.php|{$shortcode}--.*\\.php)/";
    $valueArr = json_decode($value, true);
    $setting_name = $settings['param_name'];
    $files = lgFileScanDirectory($plg_dir_temp, $reg);
    $files = array_merge($files, lgFileScanDirectory($theme_dir_temp, $reg));
    $output = '';
    $output .= "<select data-loadparambytemplate name=\"" . esc_attr($setting_name) . "\">";
    foreach ($files as $name_file => $dir_file) {
        $params = lgGetComments($dir_file);
        $field_HTML = isset($params['param']) ? lgFieldTemplate($params['param'], $valueArr) : '';
        $selected = $name_file == $valueArr["{$setting_name}"] ? 'selected' : '';
        $output .= sprintf('<option data-fieldhtml=\'%s\' value="%s" %s>%s</option>', $field_HTML, $name_file, $selected, isset($params['template name']) ? $params['template name'] . " ({$name_file})" : $name_file);
    }
    $output .= "</select>";
    $output .= sprintf('<div class="lg-params-container"></div>');
    return sprintf('
    	<div class="lg-shortcode-supper-template">
    		<textarea class="lg-hidden wpb_vc_param_value" name="%s" data-jsoncontent>%s</textarea>
    		<div class="lg-template-group-field">
				%s
    		</div>
    	</div>', esc_attr($settings['param_name']), $value, $output);
}
Пример #27
Показать файл Файл: SCFP_Form.class.php Проект: viralss/sunglow-solution
0
 public function submit($postData)
 {
     if (!empty($postData['form_id']) && $postData['form_id'] == $this->id) {
         do_action('scfp_form_submit_before', $this);
         foreach (SCFP()->getSettings()->getFieldsSettings() as $key => $field) {
             if (!empty($field['visibility'])) {
                 switch ($field['field_type']) {
                     case 'checkbox':
                         $this->data[$key] = !empty($postData['scfp-' . $key]) ? 1 : 0;
                         break;
                     default:
                         $this->data[$key] = !empty($postData['scfp-' . $key]) ? esc_attr($postData['scfp-' . $key]) : '';
                         break;
                 }
                 $this->data[$key] = apply_filters('scfp_form_submit_field', apply_filters('scfp_form_submit_field_' . $key, stripslashes_deep($this->data[$key]), $field, $this), $key, $field, $this);
             }
         }
         $this->data = apply_filters('scfp_form_submit_data', $this->data, $this);
         $this->notifications = array();
         if ($this->validation()) {
             if ($this->saveForm()) {
                 if ($this->notification()) {
                     $this->data = array();
                     do_action('scfp_form_submit_success', $this);
                     if (!$this->redirect()) {
                         $this->submitConfirmation();
                     }
                 }
             }
         }
     }
 }
Пример #28
Показать файл Файл: hc_widget.php Проект: shahadat014/geleyi
0
        function form($instance)
        {
            $connectorID = esc_attr($instance['connectorID']);
            global $wpdb;
            $myrows = $wpdb->get_results("SELECT IntegrationID, Name FROM wp_connectors where is_user_template=0");
            ?>
        <p>
            <label for="<?php 
            echo $this->get_field_id('connectorID');
            ?>
"><?php 
            _e('Connector Name:');
            ?>
</label>
            <select name="<?php 
            echo $this->get_field_name('connectorID');
            ?>
" class="widefat" id="<?php 
            echo $this->get_field_id('connectorID');
            ?>
">
                <?php 
            foreach ($myrows as $myrow) {
                if ($myrow->IntegrationID == $connectorID) {
                    echo '<option selected value="' . $myrow->IntegrationID . '">' . $myrow->Name . '</option>';
                } else {
                    echo '<option value="' . $myrow->IntegrationID . '">' . $myrow->Name . '</option>';
                }
            }
            ?>
            </select>
        </p>
        <?php 
        }
Пример #29
Показать файл Файл: class-theme-widget.php Проект: pedro-mendonca/Brickset-API
0
    /** 
     *	Create the necessary form to customize the widget.
     *
     *	@uses		title	@since 0.1
     *
     *	@author		Nate Jacobs
     *	@since		0.1
     *
     *	@param		array
     */
    public function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('title' => __('Brickset Themes', 'bs_api')));
        $title = esc_attr($instance['title']);
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'bs_api');
        ?>
:</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
">
		</p>
		<?php 
    }
Пример #30
Показать файл Файл: class.akismet-widget.php Проект: kanei/vantuch.cz
0
    function form($instance)
    {
        if ($instance) {
            $title = $instance['title'];
        } else {
            $title = __('Spam Blocked', 'akismet');
        }
        ?>

		<p>
		<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        esc_html_e('Title:', 'akismet');
        ?>
</label>
		<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
		</p>

<?php 
    }