/** * Widget settings * @param $instance */ function form($instance) { //$this->skin->saveCallbackJs4SkinChangeEvent('console.log(skin);'); //$this->skin->saveCallbackJs4SkinChangeEvent('console.log("jkehrerdgb");'); //for showing/hiding advanced options; wordpress moves this script to where it needs to go wp_enqueue_script('jquery'); //create feature tog if (class_exists('HW_ButtonToggle_widget')) { $btn_tog = new HW_ButtonToggle_widget($this, $instance); } ?> <?php $terms_data = array(); // instance exist? if not set defaults if ($instance) { $title = $instance['title']; $this_taxonomy = $instance['taxonomy']; $orderby = $instance['orderby']; $ascdsc = $instance['ascdsc']; $exclude = $instance['exclude']; $childof = $instance['childof']; $showcount = isset($instance['count']) ? (bool) $instance['count'] : false; $hierarchical = isset($instance['hierarchical']) ? (bool) $instance['hierarchical'] : false; $dropdown = isset($instance['dropdown']) ? (bool) $instance['dropdown'] : false; $childof_current_term = isset($instance['childof_current_term']) ? (bool) $instance['childof_current_term'] : false; $show_subcat_by_parent = isset($instance['show_subcat_by_parent']) ? (bool) $instance['show_subcat_by_parent'] : false; $categories_by_current_post = isset($instance['categories_by_current_post']) ? (bool) $instance['categories_by_current_post'] : false; $hide_empty = isset($instance['hide_empty']) ? (bool) $instance['hide_empty'] : false; $depth = isset($instance['depth']) ? $instance['depth'] : 0; $use_skin = isset($instance['use_skin']) ? (bool) $instance['use_skin'] : false; $extend_skin_options = isset($instance['extend_skin_options']) ? (bool) $instance['extend_skin_options'] : false; $skin = isset($instance['skin']) ? $instance['skin'] : ''; //saved active hash skin //total skin setting $skin_setting = isset($instance['skin_settings']) ? $instance['skin_settings'] : ''; $skin_condition = isset($instance['skin_condition']) ? $instance['skin_condition'] : ''; $show_option_none = isset($instance['show_option_none']) ? $instance['show_option_none'] : ''; //get terms by select tax if (!empty($this_taxonomy)) { $terms_data = HW_POST::list_tax_terms($this_taxonomy); } } else { //These are our defaults $title = ''; $orderby = 'count'; $ascdsc = 'desc'; $exclude = ''; $childof = ''; $this_taxonomy = 'category'; //this will display the category taxonomy, which is used for normal, built-in posts $hierarchical = true; $showcount = true; $dropdown = false; $childof_current_term = false; $show_subcat_by_parent = false; $categories_by_current_post = false; $hide_empty = false; //default hide if empty $depth = 0; //unlimit nested level $use_skin = false; $skin = ''; $skin_setting = ''; $skin_condition = ''; $extend_skin_options = false; $show_option_none = ''; } // The widget form $terms_holder_id = 'holder-' . $this->get_field_id('terms'); $exclude_terms_holder_id = 'holder-' . $this->get_field_id('exclude_terms'); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php echo __('Tiêu đề:'); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " class="widefat" /> </p> <p> <label for="<?php echo $this->get_field_id('taxonomy'); ?> "><?php echo __('Chọn Taxonomy:'); ?> </label> <select name="<?php echo $this->get_field_name('taxonomy'); ?> " id="<?php echo $this->get_field_id('taxonomy'); ?> " class="widefat" style="height: auto;" size="4" onchange="__hwlct_object.change_taxonomy(this, '#<?php echo $terms_holder_id; ?> ', 'hwlct_change_taxonomy_cbs','<?php //echo $link ?> ')"> <?php $args = array('public' => true, '_builtin' => false); $output = 'names'; // or objects $operator = 'and'; // 'and' or 'or' $taxonomies = get_taxonomies($args, $output, $operator); $taxonomies[] = 'category'; $taxonomies[] = 'post_tag'; $taxonomies[] = 'post_format'; foreach ($taxonomies as $taxonomy) { ?> <option value="<?php echo $taxonomy; ?> " <?php if ($taxonomy == $this_taxonomy) { echo 'selected="selected"'; } ?> ><?php echo $taxonomy; ?> </option> <?php } ?> </select> </p> <?php if (class_exists('HW_SKIN')) { ?> <p><?php //echo $this->skin->get_skins_select_tag('skin'); //$this->skin->get_skins_listview('skin1',$instance['skin1']); //$this->skin->get_skin_instance('t1')->get_skins_select_tag('skin2',null,array('class'=>'widefat'),HW_SKIN::DROPDOWN_DDSSLICK_THEME,HW_SKIN::SKIN_LINKS); ?> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name('use_skin'); ?> " id="<?php echo $this->get_field_id('use_skin'); ?> " <?php checked($use_skin); ?> /> <label for="<?php echo $this->get_field_id('use_skin'); ?> "><?php _e('Kích hoạt Giao diện'); ?> </label> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name('extend_skin_options'); ?> " id="<?php echo $this->get_field_id('extend_skin_options'); ?> " <?php selected($extend_skin_options ? 1 : 0); ?> /> <label for="<?php echo $this->get_field_id('extend_skin_options'); ?> "><?php _e('Cho phép sử dụng skin options'); ?> </label> <br/> <span><em>Cho phép sử dụng skin options mặc dù không kích hoạt sử dụng giao diện riêng.</em></span> </p> <p> <label for="<?php echo $this->get_field_id('skin'); ?> "><strong><?php _e('Giao diện'); ?> </strong></label> <?php echo $this->skin->get_skins_select_tag('skin', null, array('class' => 'widefat'), false); #$this->skin->addCallbackSkinChangeEvent('console.log(3);'); ?> <!-- show skin options,skin condition field if exists --> <?php echo $this->skin->get_skin_template_condition_selector('skin_condition', $skin_condition); echo $this->skin->prepare_skin_options_fields('skin_settings', $skin_setting, $skin); /*echo $this->skin->create_total_skin_selector('skin', array('hash_skin' => $skin, 'skin_settings' => $skin_setting), null,array( 'show_main_skin' =>0, 'show_condition_field'=>1, 'show_skin_options' => 1 ));*/ ?> </p> <?php } ?> <?php if (isset($btn_tog)) { $btn_tog->set_button_toggle_start_wrapper('Nâng cao...'); } ?> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?> " name="<?php echo $this->get_field_name('count'); ?> "<?php checked($showcount); ?> /> <label for="<?php echo $this->get_field_id('count'); ?> "><?php _e('Hiển thị số lượng posts bên cạnh'); ?> </label><br /> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?> " name="<?php echo $this->get_field_name('hierarchical'); ?> "<?php checked($hierarchical); ?> /> <label for="<?php echo $this->get_field_id('hierarchical'); ?> "><?php _e('Hiển thị đa tầng'); ?> </label><br/> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?> " name="<?php echo $this->get_field_name('dropdown'); ?> "<?php checked($dropdown); ?> /> <label for="<?php echo $this->get_field_id('dropdown'); ?> "><?php _e('Hiển thị dạng Dropdown'); ?> </label><br/> <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?> " name="<?php echo $this->get_field_name('hide_empty'); ?> " <?php checked($hide_empty); ?> /> <label for="<?php echo $this->get_field_id('hide_empty'); ?> "><?php _e('Ẩn mục không có posts'); ?> </label><br/> <input type="text" class="text" size="5" id="<?php echo $this->get_field_id('depth'); ?> " name="<?php echo $this->get_field_name('depth'); ?> " value="<?php echo isset($instance['depth']) ? $instance['depth'] : '0'; ?> " /> <label for="<?php echo $this->get_field_id('depth'); ?> "><?php _e('depth'); ?> </label><br/> <span><em>=1: Nếu chỉ muốn hiện tất cả những danh mục chính.</em></span><br/> <span><em>Yêu cầu: bật tùy chọn "Hiển thị đa tầng".</em></span> <p> <label for="<?php echo $this->get_field_id('orderby'); ?> "><?php echo __('Xắp xếp:'); ?> </label> <select name="<?php echo $this->get_field_name('orderby'); ?> " id="<?php echo $this->get_field_id('orderby'); ?> " class="widefat" > <option value="ID" <?php if ($orderby == 'ID') { echo 'selected="selected"'; } ?> >ID</option> <option value="name" <?php if ($orderby == 'name') { echo 'selected="selected"'; } ?> >Name</option> <option value="slug" <?php if ($orderby == 'slug') { echo 'selected="selected"'; } ?> >Slug</option> <option value="count" <?php if ($orderby == 'count') { echo 'selected="selected"'; } ?> >Count</option> <option value="term_group" <?php if ($orderby == 'term_group') { echo 'selected="selected"'; } ?> >Term Group</option> </select> </p> <p> <label><input type="radio" name="<?php echo $this->get_field_name('ascdsc'); ?> " value="asc" <?php if ($ascdsc == 'asc') { echo 'checked'; } ?> /> Tăng dần</label><br/> <label><input type="radio" name="<?php echo $this->get_field_name('ascdsc'); ?> " value="desc" <?php if ($ascdsc == 'desc') { echo 'checked'; } ?> /> Giảm dần</label> </p> <p id="<?php echo $exclude_terms_holder_id; ?> "> <label for="<?php echo $this->get_field_id('exclude'); ?> ">Loại trừ ID (danh sách IDs ngăn cách dấu phẩy)</label><br/> <select multiple class="widefat" name="<?php echo $this->get_field_name('exclude'); ?> []" > <?php if (!empty($terms_data)) { foreach ($terms_data as $id => $name) { $selected = in_array($id, $exclude) ? 'selected="selected"' : ''; printf('<option %s value="%s">%s</option>', $selected, $id, $name); } } ?> </select> </p> <hr/> <p id="<?php echo $terms_holder_id; ?> "> <label for="<?php echo $this->get_field_id('childof'); ?> ">Chỉ hiển thị sub-category của category mẹ (category id)</label><br/> <?php //echo $childof; ?> <select class="widefat" data-id="<?php echo $this->number; ?> " name="<?php echo $this->get_field_name('childof'); ?> " id="<?php echo $this->get_field_id('childof'); ?> "> <option value="">---- Chọn ----</option> <?php if (!empty($terms_data)) { foreach ($terms_data as $id => $name) { printf('<option %s value="%s">%s</option>', selected($id, $childof, false), $id, $name); } } ?> </select> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name('childof_current_term'); ?> " id="<?php echo $this->get_field_id('childof_current_term'); ?> " <?php checked($childof_current_term ? 1 : 0); ?> /> <label for="<?php echo $this->get_field_id('childof_current_term'); ?> "><?php _e('Lấy category mẹ hiện tại(category id)'); ?> </label><br/> <span><em>Chỉ hiển thị sub-category của category hiện tại.</em></span> </p> <hr/> <p> <input type="checkbox" name="<?php echo $this->get_field_name('show_subcat_by_parent'); ?> " id="<?php echo $this->get_field_id('show_subcat_by_parent'); ?> " <?php checked($show_subcat_by_parent ? 1 : 0); ?> /> <label for="<?php echo $this->get_field_id('show_subcat_by_parent'); ?> " style="text-decoration: line-through;"><?php _e('Hiển thị sub-category khi vào trang mẹ'); ?> </label><br/> <span><em>Hiển thị sub-category con của trang category mẹ nhưng vẫn dữ toàn bộ danh mục</em></span> </p> <hr/> <p> <label for="<?php echo $this->get_field_id('show_option_none'); ?> "><strong><?php _e('Nội dung không có dữ liệu'); ?> </strong></label><br/> <input type="text" name="<?php echo $this->get_field_name('show_option_none'); ?> " id="<?php echo $this->get_field_id('show_option_none'); ?> " value="<?php echo $show_option_none; ?> "/> </p> <p> <input type="checkbox" name="<?php echo $this->get_field_name('categories_by_current_post'); ?> " id="<?php echo $this->get_field_id('categories_by_current_post'); ?> " <?php checked($categories_by_current_post ? 1 : 0); ?> /> <label for="<?php echo $this->get_field_id('categories_by_current_post'); ?> "><?php _e('Hiển thị cho post hiện tại'); ?> </label><br/> <span><em>Hiển thị tất cả những taxonomies, taxonomies nào thuộc về post hiện tại.</em></span> </p> <script> /** * hwlct_change_taxonomy_cbs callbacks */ if(typeof __hwlct_object.add_callback == 'function') __hwlct_object.add_callback('<?php echo $this->number; ?> ', 'hwlct_change_taxonomy_cbs', { before_ajax : function() { var select_tag = jQuery('#<?php echo $this->get_field_id('childof'); ?> :eq(0)'), exclude_select_tag = jQuery('#<?php echo $this->get_field_id('exclude'); ?> :eq(0)'); select_tag.html(' ').append(jQuery('<option>', {value:'',text : 'Loading..'})); exclude_select_tag.html(' ').append(jQuery('<option>', {value:'',text : 'Loading..'})); }, after_ajax : function(data) { var select_tag = jQuery('#<?php echo $this->get_field_id('childof'); ?> :eq(0)'), exclude_select_tag = jQuery('#<?php echo $this->get_field_id('exclude'); ?> :eq(0)'); jQuery(select_tag).add(exclude_select_tag).html(' ').append(jQuery('<option>', { value: "", text: "------Select------" //.data[value] })); if(data.posts) jQuery.each(data.terms, function(value, text) { jQuery(select_tag).add(exclude_select_tag).append(jQuery('<option>', { value: value, text: text //.data[value] })); }); } }); </script> <?php if (isset($btn_tog)) { $btn_tog->set_button_toggle_end_wrapper(); } //close feature tog }
/** * The configuration form. * * @param array $instance of widget to display already stored value . * */ public function form($instance) { $displayFields = array(); $displayFields = isset($instance['display']) ? $instance['display'] : 'title'; $display = isset($instance['display']) ? $instance['display'] : array(); $arrExlpodeFields = explode(',', $displayFields); $instance["widget_w"] = isset($instance["widget_w"]) ? $instance["widget_w"] : '220'; $instance["widget_h"] = isset($instance["widget_h"]) ? $instance["widget_h"] : '300'; $instance["excerpt_length"] = isset($instance["excerpt_length"]) ? $instance["excerpt_length"] : '50'; $instance["scroll_by"] = isset($instance["scroll_by"]) ? $instance["scroll_by"] : '3'; $instance["date_format"] = isset($instance["date_format"]) ? $instance["date_format"] : 'F j, Y'; $instance["effects_time"] = isset($instance["effects_time"]) ? $instance["effects_time"] : '3000'; $instance["sort_order"] = isset($instance["sort_order"]) ? $instance["sort_order"] : 'desc'; $instance["view_all_link"] = isset($instance["view_all_link"]) ? $instance["view_all_link"] : ''; $instance["view_all_pos"] = isset($instance["view_all_pos"]) ? $instance["view_all_pos"] : ''; $instance["view_all_text"] = isset($instance["view_all_text"]) ? $instance["view_all_text"] : 'Xem thêm'; $instance["num"] = isset($instance["num"]) ? $instance["num"] : '50'; $instance['sort_by'] = isset($instance['sort_by']) ? $instance['sort_by'] : ''; $taxonomy = isset($instance['tax']) ? esc_attr($instance['tax']) : ''; $current_pt = isset($instance['posttype']) ? esc_attr($instance['posttype']) : 'page,post'; $current_pt = explode(',', $current_pt); if (!isset($instance['nav_posts_num'])) { $instance['nav_posts_num'] = get_option('posts_per_page'); } if (!isset($instance['page_cat_link'])) { $instance['page_cat_link'] = ''; } /** * scrolling option */ $instance['scroll_type'] = isset($instance['scroll_type']) ? $instance['scroll_type'] : ''; //carousel type //direction $instance['scroll_direction'] = isset($instance['scroll_direction']) ? $instance['scroll_direction'] : 'endlessloopbottom'; $instance['scroll_interval'] = isset($instance['scroll_interval']) ? $instance['scroll_interval'] : '10'; //scrollinh interval //dimention $instance['scroll_height'] = isset($instance['scroll_height']) ? $instance['scroll_height'] : '200'; //scroll height area //restrict post title characters $instance["post_title_leng"] = isset($instance['post_title_leng']) ? $instance['post_title_leng'] : '60'; //valid if (!isset($instance["widget_title"])) { $instance["widget_title"] = ''; } $expandoptions = isset($instance['expandoptions']) ? $instance['expandoptions'] : 'contract'; //get visible status and hide default //create feature tog if (class_exists('HW_ButtonToggle_widget')) { $btn_tog = new HW_ButtonToggle_widget($this, $instance); } include HWTPL_PLUGIN_PATH . '/includes/templates/widget-form.php'; //form template //close feature tog if (isset($btn_tog)) { $btn_tog->set_button_toggle_end_wrapper(); } }
/** * extra fields to any widget * @param object $t: widget class object * @param $return * @param array $instance: widget instance */ public function _hw_awc_in_widget_form($t, $return, $instance) { /*begin custom sidebar format*/ static $sw_list; if (!$sw_list) { $sw_list = get_option('sidebars_widgets'); } //get all widgets global $wp_registered_sidebars; foreach ($sw_list as $sidebar => $widgets) { //get sidebar where widget nested on it if (is_array($widgets) && in_array($t->id, $widgets)) { //make sure you ignore the key 'array_version' $found_sidebar = true; break; } } if ($sidebar == 'array_version' || !isset($found_sidebar) || !isset($wp_registered_sidebars[$sidebar])) { echo '<div style="background:#fafafa;border:1px solid #dadada;padding:5px;"><p>Nhấn nút Lưu để hiển thị công cụ tùy chỉnh widget này hoặc nếu không thấy thì xóa widget và thêm lại.</p></div>'; return; } //first check if (isset($wp_registered_sidebars[$sidebar]['old_id'])) { $old_sidebar = $wp_registered_sidebars[$sidebar]['old_id']; } else { $old_sidebar = $sidebar; } if (!HW_AWC_Sidebar_Settings::check_valid_sidebar_name($old_sidebar)) { echo "<div class='hwawc-message'>Do Sidebar cũ có ID ({$old_sidebar}) không hợp lệ, nên tạo mới sidebar với tên: ({$sidebar})"; echo '<br/>Hiển thị sidebar:<code>dynamic_sidebar("' . $sidebar . '")</code>'; echo '</div>'; // return; //fixed from callback '_hw_awc_init' } $params = $wp_registered_sidebars[$sidebar]; //get sidebar param where widget nested on it //create feature tog if (class_exists('HW_ButtonToggle_widget')) { $btn_tog = new HW_ButtonToggle_widget($t, $instance); } //instance HW_SKIN for widget box title $skin = new HW_SKIN($t, HW_AWC_PATH, 'hw_awc_skins', 'hwawc-skin.php', 'skins'); $skin->plugin_url = HW_AWC_URL; $skin->external_callback = false; $skin->init(); //seem no longer use ?> <?php if (isset($btn_tog)) { $btn_tog->set_button_toggle_start_wrapper('Tùy chỉnh widget'); } ?> <div style="background:#fafafa;border:1px solid #dadada;padding:5px;"> <!-- show widget ID on each widget in admin. --> <p> <div id="<?php echo $t->get_field_id('show_widget_id'); ?> " style="padding:5px;background:pink;border:1px solid red;" name="<?php echo $t->get_field_name('show_widget_id'); ?> " > ID: <strong><?php echo $t->id; ?> </strong><br/> <?php if (is_plugin_active('amr-shortcode-any-widget/amr-shortcode-any-widget.php')) { echo 'Hiển thị nội dung widget này bởi shortcode:<br/>'; echo '<code>[do_widget id=' . $t->id . ']</code>'; echo '<a href="' . HW_AWC_URL . '/docs/amr-shortcode-any-widget.html' . '" target="_blank">Hướng dẫn</a>'; } else { echo hw_install_plugin_link('amr-shortcode-any-widget', 'Nhúng widget này bằng shortcode'); } //display widget content with feature "shortcode_params" if (!HW_AWC_WidgetFeatures::check_widget_feature($t, 'shortcode_params') && class_exists('HW_HOANGWEB_Settings')) { echo '<p>Kích hoạt feature "<a target="_blank" href="' . admin_url('options-general.php?page=' . HW_HOANGWEB_Settings::HW_SETTINGS_PAGE) . '">Tạo shortcode widget</a>" để hiển thị nội dung của widget này.</p>'; } ?> </div> </p> <!-- widget features --> <?php $this->load_widget_features($t, $instance); ?> <p> </p> <hr/> <!-- sidebar custom after_title & before_title --> <?php if (isset($params['before_title'])) { ?> <p> <label for="<?php echo $t->get_field_id('awc_clear_widget_title'); ?> "><strong><?php _e('Xóa tiêu đề widget'); ?> </strong></label><br/> <input type="checkbox" name="<?php echo $t->get_field_name('awc_clear_widget_title'); ?> " id="<?php echo $t->get_field_id('awc_clear_widget_title'); ?> " <?php checked(isset($instance['awc_clear_widget_title']) && $instance['awc_clear_widget_title'] ? 1 : 0); ?> /><?php _e('Xóa before_title & after_title'); ?> <br/> <span style="font-size:12px">Nếu xóa tiêu đề (xóa before_title & after_title) thì check vào đây. <i>(Tùy chọn này sẽ xóa thẻ HTML có trong before_title & after_title và cả before_widget,after_widget nếu cần thiết để có thể hiển thị tốt widget mà không có title.)</i></span> <br/> </p><hr/> <p> <label><strong><?php _e('Sửa before_title'); ?> </strong></label><br/> <em>Hiện tại: (<font color="blue"><?php echo htmlentities($params['before_title']); ?> </font>)</em><br/> <em><?php if (!preg_match('#%\\d\\$s#', $params['before_title'])) { echo '<font color="red">Cảnh báo: before_title chưa sẵn sàng.</font>'; } ?> </em><br/> <input <?php ?> type="text" name="<?php echo $t->get_field_name('format_before_title'); ?> " id="<?php echo $t->get_field_id('format_before_title'); ?> " value="<?php echo isset($instance['format_before_title']) ? $instance['format_before_title'] : ''; ?> "><br/> <span style="font-size:12px"><i>(mỗi ID or chuỗi class ngăn cách bởi '|')</i></span> <br/> <span><em>ie: before_title=>"<?php echo htmlentities('<h2 id="%1$s" class="%2$s" style="%3$s">'); ?> "</em></span> </p><hr/> <?php } ?> <p> <label><strong><?php _e('Sửa after_title'); ?> </strong></label><br/> <em>Hiện tại: (<font color="blue"><?php echo htmlentities($params['after_title']); ?> </font>)</em><br/> <em><?php if (!preg_match('#%\\d\\$s#', $params['after_title'])) { echo '<font color="red">Cảnh báo: after_title chưa sẵn sàng.</font>'; } ?> </em><br/> <input <?php ?> type="text" name="<?php echo $t->get_field_name('format_after_title'); ?> " id="<?php echo $t->get_field_id('format_after_title'); ?> " value="<?php echo isset($instance['format_after_title']) ? $instance['format_after_title'] : ''; ?> "><br/> <span style="font-size:12px"><i>(mỗi ID or chuỗi class ngăn cách bởi '|')</i></span> <br/> <span><em>ie: after_title=>"<?php echo htmlentities('</h2><div id="%1$s" class="%2$s" style="%3$s">'); ?> "</em></span> </p><hr/> <p> <label><strong><?php _e('Sửa before_widget'); ?> </strong></label><br/> <em>Thêm class theo thứ tự bằng cách chèn tag (*1,*2,..) vào tham số before_widget: <br/>(Hiện tại:<font color="blue"><?php echo htmlentities($params['before_widget']); ?> </font>)</em><br/> <em><?php if (!preg_match('#\\*\\d+#', $params['before_widget'])) { echo '<font color="red">Cảnh báo: before_widget chưa sẵn sàng.</font>'; } ?> </em> <input type="text" name="<?php echo $t->get_field_name('preclasses_before_widget'); ?> " id="<?php echo $t->get_field_id('preclasses_before_widget'); ?> " value="<?php echo isset($instance['preclasses_before_widget']) ? $instance['preclasses_before_widget'] : ''; ?> "><br/> <span style="font-size:12px"><i>(mỗi chuỗi class tương ứng với *1|*2.. ngăn cách bởi '|'. VD: class1 class2|class3 class4 class5)</i></span> </p> <hr/> <p> <label for="<?php echo $t->get_field_id('widget_skin'); ?> "><strong><?php _e('Giao diện widget'); ?> </strong></label> <div> <select name="<?php echo $t->get_field_name('widget_skin'); ?> " id="<?php echo $t->get_field_id('widget_skin'); ?> "> <?php foreach (HW_AWC_Sidebar_Settings::available_widget_skins() as $name => $field) { ?> <option <?php selected(isset($instance['widget_skin']) && $name == $instance['widget_skin'] ? 1 : 0); ?> value="<?php echo $name; ?> "><?php echo isset($field['title']) ? $field['title'] : $name; ?> </option> <?php } ?> </select><br/> <span>Quản lý skins, nhấn <a target="_blank" href="<?php echo HW_AWC_Sidebar_Settings::get_edit_sidebar_setting_page_link($sidebar); ?> ">vào đây</a>.</span> </div> </p> <p> <strong>Mầu sắc</strong><br/> <em>Lưu ý: TH nếu xóa mầu và khi load lại trang cần xóa lại vì mầu khởi đầu là #FFFFFF.<br/> Nếu không xuất hiện hộp chọn mầu thì tự điền mã mầu và lưu lại để khởi tạo lại trình chọn mã mầu.</em> </p> <p> <input type="text" size="5" class="color {hash:true}" name="<?php echo $t->get_field_name('bgcolor_widget'); ?> " id="<?php echo $t->get_field_id('bgcolor_widget'); ?> " value="<?php echo isset($instance['bgcolor_widget']) ? $instance['bgcolor_widget'] : ''; ?> "/> <label for="<?php echo $t->get_field_id('bgcolor_widget'); ?> ">Mầu nền widget</label> <a class="clear-jscolor button" href="javascript:void(0)">Xóa</a> </p> <p> <input type="text" size="5" class="color {hash:true}" name="<?php echo $t->get_field_name('bgcolor_title'); ?> " id="<?php echo $t->get_field_id('bgcolor_title'); ?> " value="<?php echo isset($instance['bgcolor_title']) ? $instance['bgcolor_title'] : ''; ?> "/> <label for="<?php echo $t->get_field_id('bgcolor_title'); ?> ">Mầu nền tiêu đề</label> <a class="clear-jscolor button" href="javascript:void(0)" onclick="">Xóa</a> </p> <p> <input type="text" size="5" class="color {hash:true}" name="<?php echo $t->get_field_name('bgcolor_box'); ?> " id="<?php echo $t->get_field_id('bgcolor_box'); ?> " value="<?php echo isset($instance['bgcolor_box']) ? $instance['bgcolor_box'] : ''; ?> "/> <label for="<?php echo $t->get_field_id('bgcolor_box'); ?> ">Mầu nền nội dung</label> <a class="clear-jscolor button" href="javascript:void(0)">Xóa</a> </p> <!-- bg title --> <p> <label><strong><?php _e('Ảnh nền cho tiêu đề widget'); ?> </strong></label> <div> <?php if (strpos($params['before_title'], '{css_title}') === false) { echo '<font color="red">Warning: không tìm thấy {css_title} tag trong tham số <em>before_title</em>. Để sử dụng trường này bạn cần thêm tag này vào tham số <em>before_title</em> cho sidebar hiện tại.</font>'; } ?> <?php if (isset($instance['bgimg_title'])) { ?> <img class="user-preview-image" style="max-width:100%;" src="<?php echo $instance['bgimg_title']; ?> "><!-- display image --> <?php } ?> <input type="hidden" name="<?php echo $t->get_field_name('bgimg_title'); ?> " id="<?php echo $t->get_field_id('bgimg_title'); ?> " value="<?php echo isset($instance['bgimg_title']) ? $instance['bgimg_title'] : ''; ?> " class="regular-text" /><!-- show image url --> <input type='button' class="button-primary" value="Upload" id="<?php echo $t->get_field_id('hw_awc_uploadimage'); ?> "/><br /><!-- upload button --> <script type="text/javascript"> jQuery(function( $ ) { if(typeof hw_awc_btn_upload_image == 'function') { hw_awc_btn_upload_image($( '#<?php echo $t->get_field_id('hw_awc_uploadimage'); ?> ' ), $( '#<?php echo $t->get_field_id('bgimg_title'); ?> ' )); } }); </script> <p> <input type="checkbox" name="<?php echo $t->get_field_name('bgimg_title_css'); ?> " id="<?php echo $t->get_field_id('bgimg_title_css'); ?> " onlick="this.value = this.checked" <?php checked(isset($instance['bgimg_title_css']) ? 1 : 0); ?> /> <label for="<?php echo $t->get_field_id('bgimg_title_css'); ?> "><?php _e('Hiển thị ảnh nền cho tiêu đề widget'); ?> </label> </p> </div> </p> <!-- bg box --> <p> <label for="<?php echo $t->get_field_id('hw_awc_upload_bgimg_box'); ?> "><strong><?php _e('Ảnh nền cho nội dung widget'); ?> </strong></label><br/> <?php if (strpos($params['after_title'], '{css_box}') === false && strpos($params['before_widget'], '{css_box}') === false) { echo '<div><font color="red">Warning: không tìm thấy {css_box} tag trong tham số <em>after_title</em> hoặc <em>before_widget</em>. Để sử dụng trường này bạn cần thêm tag này cho sidebar hiện tại.</font></div>'; } ?> <?php if (isset($instance['bgimg_box'])) { ?> <img class="user-preview-image" style="max-width:100%;" src="<?php echo $instance['bgimg_box']; ?> "><!-- display image --> <?php } ?> <input type="hidden" name="<?php echo $t->get_field_name('bgimg_box'); ?> " id="<?php echo $t->get_field_id('bgimg_box'); ?> " value="<?php echo isset($instance['bgimg_box']) ? $instance['bgimg_box'] : ''; ?> " class="regular-text" /><!-- show image url --> <input type='button' class="button-primary" value="Upload" id="<?php echo $t->get_field_id('hw_awc_upload_bgimg_box'); ?> "/><br /><!-- upload button --> </p> <script type="text/javascript"> jQuery(function( $ ) { if(typeof hw_awc_btn_upload_image == 'function') { hw_awc_btn_upload_image($( '#<?php echo $t->get_field_id('hw_awc_upload_bgimg_box'); ?> ' ),$('#<?php echo $t->get_field_id('bgimg_box'); ?> ')); } }); jQuery(function($){ //empty color input var empty_color_input = function(obj){ $(obj).attr('value','').css({background:'#fff'}); $(obj).empty(); //remove color from input //HW_AWC.jscolor_set(obj,'');//wrong it will reset to white color }; //init jscolor when ajax response for all input field has 'color' class $('input.color').each(function(i,obj){ var color = $(obj).val(), clear_btn = $($(obj).next().next()); $(obj).data('clear_btn', clear_btn); //bind clear color button if(!$(obj).data('clear_color_btn')){ $(obj).data({ clear_color_btn:function(){ empty_color_input(obj); //remove color from input //HW_AWC.jscolor_set(obj,'');//wrong it will reset to white color } }); } clear_btn.bind('click',$(obj).data('clear_color_btn')); //update color if(color && $(obj).attr('value')){ HW_AWC.jscolor_set(obj,color); //resume color in input tag } else { setTimeout(function(){ empty_color_input(obj); //clear default white color $(obj).data('clear_btn').trigger('click'); },1000); } }); }); </script> </div> <?php if (isset($btn_tog)) { $btn_tog->set_button_toggle_end_wrapper(); } //close feature tog }