PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / widgets / usces_search.php

usces_search.php in Welcart e-Commerce 2.12.4, at widgets/usces_search.php

95 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Welcart Search Widget
4 *
5 * @package Welcart
6 */
7
8 /**
9 * Welcart_search Class
10 *
11 * @see WP_Widget
12 */
13 class Welcart_search extends WP_Widget {
14
15 /**
16 * Constructor.
17 */
18 public function __construct() {
19 $widget_ops = array(
20 'classname' => 'widget_welcart_search',
21 'description' => __( 'Display item search form.', 'usces' ),
22 );
23 parent::__construct( 'welcart_search', 'Welcart ' . __( 'keyword search', 'usces' ), $widget_ops );
24 }
25
26 /**
27 * Echoes the widget content.
28 *
29 * @see WP_Widget::widget
30 * @param array $args Display arguments including 'before_title', 'after_title',
31 * 'before_widget', and 'after_widget'.
32 * @param array $instance The settings for the particular instance of the widget.
33 */
34 public function widget( $args, $instance ) {
35 global $usces;
36 extract( $args );
37 $title = $instance['title'];
38 $icon = ( ! isset( $instance['icon'] ) || WCUtils::is_blank( $instance['icon'] ) ) ? 1 : (int) $instance['icon'];
39 $img_path = file_exists( get_stylesheet_directory() . '/images/search.png' ) ? get_stylesheet_directory_uri() . '/images/search.png' : USCES_FRONT_PLUGIN_URL . '/images/search.png';
40 if ( 1 === $icon ) {
41 $before_title .= '<img src="' . $img_path . '" alt="' . $title . '" />';
42 }
43
44 wel_esc_script_e( $before_widget );
45 if ( ! empty( $title ) ) {
46 wel_esc_script_e( $before_title . esc_html( $title ) . $after_title );
47 }
48 ?>
49
50 <ul class="ucart_search_body ucart_widget_body"><li>
51 <form method="get" id="searchform" action="<?php echo esc_url( home_url() ); ?>" >
52 <input type="text" value="" name="s" id="s" class="searchtext" /><input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'usces' ); ?>" />
53 <?php
54 $search_form = '<div><a href="' . ( USCES_CART_URL . $usces->delim ) . 'usces_page=search_item">' . __( "'AND' search by categories", 'usces' ) . '&gt;</a></div>';
55 echo apply_filters( 'usces_filter_search_widget_form', $search_form );
56 ?>
57 </form>
58 </li></ul>
59
60 <?php
61 wel_esc_script_e( $after_widget );
62 }
63
64 /**
65 * Updates a particular instance of a widget.
66 *
67 * @see WP_Widget::update
68 * @param array $new_instance New settings for this instance as input by the user via
69 * WP_Widget::form().
70 * @param array $old_instance Old settings for this instance.
71 * @return array Settings to save or bool false to cancel saving.
72 */
73 public function update( $new_instance, $old_instance ) {
74 return $new_instance;
75 }
76
77 /**
78 * Outputs the settings update form.
79 *
80 * @see WP_Widget::form
81 * @param array $instance Current settings.
82 */
83 public function form( $instance ) {
84 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
85 $icon = ( ! isset( $instance['icon'] ) || WCUtils::is_blank( $instance['icon'] ) ) ? 1 : (int) $instance['icon'];
86 ?>
87 <p><label for="<?php wel_esc_script_e( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'usces' ); ?> <input class="widefat" id="<?php wel_esc_script_e( $this->get_field_id( 'title' ) ); ?>" name="<?php wel_esc_script_e( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php wel_esc_script_e( $title ); ?>" /></label></p>
88 <p><label for="<?php wel_esc_script_e( $this->get_field_id( 'icon' ) ); ?>"><?php esc_html_e( 'display of icon', 'usces' ); ?>: <select class="widefat" id="<?php wel_esc_script_e( $this->get_field_id( 'icon' ) ); ?>" name="<?php wel_esc_script_e( $this->get_field_name( 'icon' ) ); ?>">
89 <option value="1"<?php selected( $icon, 1 ); ?>><?php esc_html_e( 'Indication', 'usces' ); ?></option>
90 <option value="2"<?php selected( $icon, 2 ); ?>><?php esc_html_e( 'Non-indication', 'usces' ); ?></option></select></label>
91 </p>
92 <?php
93 }
94 }
95