/** * Get the country dropdown options, presumably for the checkout or customer profile pages * * @param string|array $args * * @return string HTML representation of the dropdown */ function _wpsc_country_dropdown_options($args = '') { $defaults = array('acceptable' => null, 'acceptable_ids' => null, 'selected' => '', 'disabled' => null, 'disabled_ids' => null, 'placeholder' => __('Please select a country', 'wpsc'), 'include_invisible' => false); $args = wp_parse_args($args, $defaults); $output = ''; $countries = WPSC_Countries::get_countries($args['include_invisible']); // if the user has a choice of countries the if (count($countries) > 1 && !empty($args['placeholder'])) { $output .= "<option value=''>" . esc_html($args['placeholder']) . "</option>\n\r"; } foreach ($countries as $country) { $isocode = $country->get_isocode(); $name = $country->get_name(); // if there is only one country in the list select it if (count($countries) == 1) { $args['selected'] = $isocode; } // if we're in admin area, and the legacy country code "UK" or "TP" is selected as the // base country, we should display both this and the more proper "GB" or "TL" options // and distinguish these choices somehow if (is_admin() && 11 > wpsc_core_get_db_version()) { if (in_array($isocode, array('TP', 'UK'))) { /* translators: This string will mark the legacy isocode "UK" and "TP" in the country selection dropdown as "legacy" */ $name = sprintf(__('%s (legacy)', 'wpsc'), $name); } elseif (in_array($isocode, array('GB', 'TL'))) { /* translators: This string will mark the legacy isocode "GB" and "TL" in the country selection dropdown as "ISO 3166" */ $name = sprintf(__('%s (ISO 3166)', 'wpsc'), $name); } } $output .= sprintf('<option value="%1$s" %2$s %3$s>%4$s</option>' . "\n\r", esc_attr($isocode), selected($args['selected'], $isocode, false), disabled(_wpsc_is_country_disabled($country, $args), true, false), esc_html($name)); } return $output; }
function wc_display_yotpo_settings($success_type = false) { $yotpo_settings = get_option('yotpo_settings', wc_yotpo_get_degault_settings()); $app_key = $yotpo_settings['app_key']; $secret = $yotpo_settings['secret']; $language_code = $yotpo_settings['language_code']; $widget_tab_name = $yotpo_settings['widget_tab_name']; if (empty($yotpo_settings['app_key'])) { if ($success_type == 'b2c') { wc_yotpo_display_message('We have sent you a confirmation email. Please check and click on the link to get your app key and secret token to fill out below.', true); } else { wc_yotpo_display_message('Set your API key in order the Yotpo plugin to work correctly', false); } } $google_tracking_params = '&utm_source=yotpo_plugin_woocommerce&utm_medium=header_link&utm_campaign=woocommerce_customize_link'; if (!empty($yotpo_settings['app_key']) && !empty($yotpo_settings['secret'])) { $dashboard_link = '<a href="https://api.yotpo.com/users/b2blogin?app_key=' . $yotpo_settings['app_key'] . '&secret=' . $yotpo_settings['secret'] . $google_tracking_params . '" target="_blank">Yotpo Dashboard.</a></div>'; } else { $dashboard_link = "<a href='https://www.yotpo.com/?login=true{$google_tracking_params}' target='_blank'>Yotpo Dashboard.</a></div>"; } $read_only = isset($_POST['log_in_button']) || $success_type == 'b2c' ? '' : 'readonly'; $cradentials_location_explanation = isset($_POST['log_in_button']) ? "<tr valign='top'> \t\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t<th scope='row'><p class='description'>To get your api key and secret token <a href='https://www.yotpo.com/?login=true' target='_blank'>log in here</a> and go to your account settings.</p></th>\n\t \t\t \t\t\t\t\t\t\t </tr>" : ''; $submit_past_orders_button = $yotpo_settings['show_submit_past_orders'] ? "<input type='submit' name='yotpo_past_orders' value='Submit past orders' class='button-secondary past-orders-btn' " . disabled(true, empty($app_key) || empty($secret), false) . ">" : ''; $settings_html = "<div class='wrap'>" . screen_icon() . "<h2>Yotpo Settings</h2>\t\t\t\t\t\t \n\t\t\t <h4>To customize the look and feel of the widget, and to edit your Mail After Purchase settings, just head to the " . $dashboard_link . "</h4>\n\t\t\t <form method='post' id='yotpo_settings_form'>\n\t\t\t \t<table class='form-table'>" . wp_nonce_field('yotpo_settings_form') . "<fieldset>\n\t <tr valign='top'>\n\t \t<th scope='row'><div>If you would like to choose a set language, please type the 2-letter language code here. You can find the supported langauge codes <a class='y-href' href='http://support.yotpo.com/entries/21861473-Languages-Customization-' target='_blank'>here.</a></div></th>\n\t \t<td><div><input type='text' class='yotpo_language_code_text' name='yotpo_widget_language_code' maxlength='5' value='{$language_code}'/></div></td>\n\t </tr>\n\t\t\t \t <tr valign='top'> \t\n\t\t \t<th scope='row'><div>For multiple-language sites, mark this check box. This will choose the language according to the user's site language.</div></th>\n\t \t<td><input type='checkbox' name='yotpo_language_as_site' value='1' " . checked(1, $yotpo_settings['yotpo_language_as_site'], false) . "/></td>\t \n\t </tr>\n\t\t\t\t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><div>Disable native reviews system:</div></th>\n\t\t \t\t <td><input type='checkbox' name='disable_native_review_system' value='1' " . checked(1, $yotpo_settings['disable_native_review_system'], false) . " /></td>\n\t\t \t\t </tr>\t \t \n\t \t <tr valign='top'>\t\t\t\n\t\t\t\t <th scope='row'><div>Select widget location</div></th>\n\t\t\t\t <td>\n\t\t\t\t <select name='yotpo_widget_location' class='yotpo-widget-location'>\n\t\t\t\t \t <option value='footer' " . selected('footer', $yotpo_settings['widget_location'], false) . ">Page footer</option>\n\t\t\t \t\t <option value='tab' " . selected('tab', $yotpo_settings['widget_location'], false) . ">Tab</option>\n\t\t\t \t <option value='other' " . selected('other', $yotpo_settings['widget_location'], false) . ">Other</option>\n\t\t\t\t </select>\n\t\t \t\t </td>\n\t\t \t\t </tr>\n\t\t \t\t <tr valign='top' class='yotpo-widget-location-other-explain'>\n \t\t<th scope='row'><p class='description'>In order to locate the widget in a custome location open 'wp-content/plugins/woocommerce/templates/content-single-product.php' and add the following line <code>wc_yotpo_show_widget();</code> in the requested location.</p></th>\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t </tr>\n\t\t \t\t <tr valign='top' class='yotpo-widget-tab-name'>\n\t\t \t\t <th scope='row'><div>Select tab name:</div></th>\n\t\t \t\t <td><div><input type='text' name='yotpo_widget_tab_name' value='{$widget_tab_name}' /></div></td>\n\t\t \t\t </tr>\n\t\t \t\t {$cradentials_location_explanation}\n\t\t\t\t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><div>App key:</div></th>\n\t\t \t\t <td><div class='y-input'><input id='app_key' type='text' name='yotpo_app_key' value='{$app_key}' {$read_only} '/></div></td>\n\t\t \t\t </tr>\n\t\t\t\t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><div>Secret token:</div></th>\n\t\t \t\t <td><div class='y-input'><input id='secret' type='text' name='yotpo_oauth_token' value='{$secret}' {$read_only} '/></div></td>\n\t\t \t\t </tr>\t\n\t\t \t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><p class='description'>Yotpo's Bottom Line shows the star rating of the product and the number of reviews for the product. <a href='http://support.yotpo.com/entries/24467793-What-is-the-Yotpo-Bottomline-' target='_blank'>learn more.</a></p></th>\t\t \t\t \n\t\t \t\t </tr>\t\t\t\t \t \n\t\t\t\t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><div>Enable bottom line in product page:</div></th>\n\t\t \t\t <td><input type='checkbox' name='yotpo_bottom_line_enabled_product' value='1' " . checked(1, $yotpo_settings['bottom_line_enabled_product'], false) . " /></td>\n\t\t \t\t </tr>\t\t\t\t\t \t \n\t\t\t\t\t <tr valign='top'>\n\t\t \t\t <th scope='row'><div>Enable bottom line in category page:</div></th>\n\t\t \t\t <td><input type='checkbox' name='yotpo_bottom_line_enabled_category' value='1' " . checked(1, $yotpo_settings['bottom_line_enabled_category'], false) . " />\t\t \t\t \n\t\t \t\t </td>\n\t\t \t\t </tr>\t\t\t\t\t \t \n\t\t </fieldset>\n\t\t </table></br>\t\t\t \t\t\n\t\t <div class='buttons-container'>\n\t\t <button type='button' id='yotpo-export-reviews' class='button-secondary' " . disabled(true, empty($app_key) || empty($secret), false) . ">Export Reviews</button>\n\t\t\t\t<input type='submit' name='yotpo_settings' value='Update' class='button-primary' id='save_yotpo_settings'/>{$submit_past_orders_button}\n\t\t\t </br></br><p class='description'>*Learn <a href='http://support.yotpo.com/entries/24454261-Exporting-reviews-for-Woocommerce' target='_blank'>how to export your existing reviews</a> into Yotpo.</p>\n\t\t\t</div>\n\t\t </form>\n\t\t <iframe name='yotpo_export_reviews_frame' style='display: none;'></iframe>\n\t\t <form action='' method='get' target='yotpo_export_reviews_frame' style='display: none;'>\n\t\t\t<input type='hidden' name='download_exported_reviews' value='true' />\n\t\t\t<input type='submit' value='Export Reviews' class='button-primary' id='export_reviews_submit'/>\n\t\t </form> \n\t\t</div>"; echo $settings_html; }
public function render_content() { ?> <label> <?php if (!empty($this->label)) { ?> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <?php } if (!empty($this->description)) { ?> <span class="description customize-control-description"><?php echo $this->description; ?> </span> <?php } ?> <input type="checkbox" value="<?php echo esc_attr($this->value()); ?> " <?php $this->link(); checked($this->value()); disabled($this->disabled, true); ?> > </label> <?php }
public function display() { $this->echoOptionHeader(); ?> <select name="<?php echo $this->getID(); ?> "><?php foreach ($this->settings['options'] as $value => $label) { // this is if we have option groupings if (is_array($label)) { ?> <optgroup label="<?php echo $value; ?> "><?php foreach ($label as $subValue => $subLabel) { printf("<option value=\"%s\" %s %s>%s</option>", $subValue, selected($this->getValue(), $subValue, false), disabled(stripos($subValue, '!'), 0, false), $disabled, $subLabel); } ?> </optgroup><?php // this is for normal list of options } else { printf("<option value=\"%s\" %s %s>%s</option>", $value, selected($this->getValue(), $value, false), disabled(stripos($value, '!'), 0, false), $label); } } ?> </select><?php $this->echoOptionFooter(); }
/** * Start the element output. * * @param string $output Passed by reference. Used to append additional content. * @param object $category The current term object. * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. * @param int $id ID of the current term. */ public function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { if (empty($args['taxonomy'])) { $taxonomy = 'category'; } else { $taxonomy = $args['taxonomy']; } if ($taxonomy == 'category') { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; } $args['popular_cats'] = empty($args['popular_cats']) ? array() : $args['popular_cats']; $class = in_array($category->term_id, $args['popular_cats']) ? ' class="popular-category"' : ''; $args['selected_cats'] = empty($args['selected_cats']) ? array() : $args['selected_cats']; if (!empty($args['list_only'])) { $aria_cheched = 'false'; $inner_class = 'category'; if (in_array($category->term_id, $args['selected_cats'])) { $inner_class .= ' selected'; $aria_cheched = 'true'; } /** This filter is documented in wp-includes/category-template.php */ $output .= "\n" . '<li' . $class . '>' . '<div class="' . $inner_class . '" data-term-id=' . $category->term_id . ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' . esc_html(apply_filters('the_category', $category->description)) . '</div>'; } else { /** This filter is documented in wp-includes/category-template.php */ $output .= "\n<li id='{$taxonomy}-{$category->term_id}'{$class}>" . '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $args['selected_cats']), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->description)) . '</label>'; } }
function start_el(&$output, $term, $depth = 0, $args = array(), $id = 0) { global $post; /* $args array includes: taxonomy disabled selected_cats popular_cats has_children */ //echo '<pre>'; var_dump( $args ); echo '</pre>'; extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } $name = 'radio_tax_input[' . $taxonomy . ']'; //get first term object $current_term = !empty($selected_cats) && !is_wp_error($selected_cats) ? array_pop($selected_cats) : false; // if no term, match the 0 "no term" option $current_id = $current_term ? $current_term : 0; //small tweak so that it works for both hierarchical and non-hierarchical tax $value = is_taxonomy_hierarchical($taxonomy) ? $term->term_id : $term->slug; $class = in_array($term->term_id, $popular_cats) ? ' class="popular-category"' : ''; $output .= sprintf("\n" . '<li id="%1$s-%2$s" %3$s><label class="selectit"><input id="%4$s" type="radio" name="%5$s" value="%6$s" %7$s %8$s/> %9$s</label>', $taxonomy, $value, $class, "in-{$taxonomy}-{$term->term_id}", $name . '[]', esc_attr(trim($value)), checked($current_id, $term->term_id, false), disabled(empty($args['disabled']), false, false), esc_html(apply_filters('the_category', $term->name))); }
/** * 投稿画面にフィールドを表示 * * @param int $index インデックス番号 * @param mixed $value 保存されている値(check のときだけ配列) * @return string html */ public function get_field($index, $value) { $name = $this->get_field_name_in_editor($index); $disabled = $this->get_disable_attribute($index); $data_js = $this->get_data_js(); return sprintf('<input type="text" name="%s" value="%s" class="%s" %s data-js=\'%s\' />', esc_attr($name), esc_attr($value), esc_attr(SCF_Config::PREFIX . 'datepicker'), disabled(true, $disabled, false), $data_js); }
function cpt_navmenu_metabox_content() { $post_types = get_post_types(array('show_in_nav_menus' => true, 'has_archive' => true), 'object'); if ($post_types) { foreach ($post_types as &$post_type) { $post_type->classes = array(); $post_type->type = $post_type->name; $post_type->object_id = $post_type->name; $post_type->title = $post_type->labels->name . ' ' . __('Archive', 'andromedamedia'); $post_type->object = 'cpt-archive'; } $walker = new Walker_Nav_Menu_Checklist(array()); echo '<div id="cpt-archive" class="posttypediv">'; echo '<div id="tabs-panel-cpt-archive" class="tabs-panel tabs-panel-active">'; echo '<ul id="ctp-archive-checklist" class="categorychecklist form-no-clear">'; echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $post_types), 0, (object) array('walker' => $walker)); echo '</ul>'; echo '</div><!-- /.tabs-panel -->'; echo '</div>'; echo '<p class="button-controls">'; echo '<span class="add-to-menu">'; echo '<img class="waiting" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" alt="" />'; echo '<input type="submit"' . disabled($nav_menu_selected_id, 0) . ' class="button-secondary submit-add-to-menu" value="' . __('Add to Menu', 'andromedamedia') . '" name="add-ctp-archive-menu-item" id="submit-cpt-archive" />'; echo '</span>'; echo '</p>'; } }
public function metabox() { // Inform user no CPTs available to be shown. if (empty($this->sites)) { echo '<p>' . __('No items.') . '</p>'; return; } global $nav_menu_selected_id; $html = '<ul id="multisite-nav-list">'; foreach ($this->sites as $site) { $blog = get_blog_details($site['blog_id']); $html .= '<h4>' . $blog->blogname . ' Pages</h4>'; foreach ($site['pages'] as $pt) { $html .= sprintf('<li> <label> <input type="hidden" name="blogId" value="' . $blog->blog_id . '"> <input type="checkbox" value="%s" /> %s</label></li>', $pt->ID, $pt->post_title); } } $html .= '</ul>'; // 'Add to Menu' button $html .= '<p class="button-controls"><span class="add-to-menu">'; $html .= '<input type="submit"' . disabled($nav_menu_selected_id, 0, false) . ' class="button-secondary submit-add-to-menu right" value="' . esc_attr__('Add to Menu', 'hptal-textdomain') . '" name="add-post-type-menu-item" id="submit-post-type-archives" />'; $html .= '<span class="spinner"></span>'; $html .= '</span></p>'; print $html; }
function start_el(&$output, $term, $depth = 0, $args = [], $current_object_id = 0) { $indent = str_repeat("‐", $depth) . ' '; extract($args); $taxonomy_obj = get_taxonomy($taxonomy); $option = sprintf('<option id="%s-%d" value="%s" %s%s />%s%s</option>', esc_attr($taxonomy), esc_attr($term->term_id), $taxonomy_obj->hierarchical ? esc_attr($term->term_id) : esc_attr($term->slug), selected(in_array($term->term_id, $selected_cats), true, false), disabled(empty($args['disabled']), false, false), $indent, esc_html(apply_filters('the_category', $term->name))); $output .= "\n" . $option; }
/** * Filter the HTML markup for a particular field * @param string $input original markup (at this point, always an empty string) * @param object $field field object * @param string $value default value * @param int $lead_id lead id * @param int $form_id form id * @filter gform_field_input */ static function field($input, $field, $value, $lead_id, $form_id) { $html_id = 'input_' . (is_admin() || !$form_id ? '' : $form_id . '_') . $field->id; if (self::field_is_places($field)) { return '<div class="ginput_container"><input type="text" class="medium geo-complete"' . ' name="input_' . esc_attr($field->id) . '" id="' . esc_attr($html_id) . '" value="' . esc_attr($value) . '" ' . disabled(is_admin(), true, false) . ' data-field-id="' . esc_attr($field->id) . '"' . 'placeholder="' . esc_html($field->placeholder) . '"></div>'; } return $input; }
function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0) { extract($args); if (!is_array($categories)) { $categories = array(); } $output .= "\n<li id='{$field_id}-{$category->term_id}' >" . '<input value="' . $category->term_id . '" type="checkbox" name="' . $field_name . '[' . $category->term_id . ']" id="' . $field_id . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $categories), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . ''; }
/** * Getting the field * * @param int $index * @param int $value * @return string html */ public function get_field($index, $value) { $name = $this->get_field_name_in_editor($index); $disabled = $this->get_disable_attribute($index); $true = sprintf('<label><input type="radio" name="%s" value="1" class="widefat" %s %s />%s ( true )</label>', esc_attr($name), checked(1, $value, false), disabled(true, $disabled, false), $this->get('true_label')); $false = sprintf('<label><input type="radio" name="%s" value="0" class="widefat" %s %s />%s ( false )</label>', esc_attr($name), checked(0, $value, false), disabled(true, $disabled, false), $this->get('false_label')); return $true . $false; }
function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } $name = $this->field_name; $class = in_array($category->term_id, $popular_cats) ? ' class="popular-category"' : ''; $output .= "\n<li id='{$taxonomy}-{$category->term_id}'{$class}>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $selected_cats), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>'; }
function template_checkbox($rss = false, $trextra = '') { global $yarpp; $pre = $rss ? 'rss_' : ''; $chosen_template = yarpp_get_option("{$pre}template"); echo "<tr valign='top'{$trextra}><th colspan='2'><input type='checkbox' name='{$pre}use_template' class='{$pre}template' value='true'"; disabled(!count($yarpp->admin->get_templates()), true); checked(!!$chosen_template); echo " /> " . __("Display using a custom template file", 'yarpp') . " <a href='#' class='info'>" . __('more>', 'yarpp') . "<span>" . __("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.", 'yarpp') . "</span></a>" . "</th></tr>"; }
/** * Get field HTML * * @param string $html * @param mixed $meta * @param array $field * * @return string */ static function html($html, $meta, $field) { $std = isset($field['disabled']) ? $field['disabled'] : false; $disabled = disabled($std, true, false); $cols = isset($field['cols']) ? $field['cols'] : "60"; $rows = isset($field['rows']) ? $field['rows'] : "10"; $name = "name='{$field['field_name']}'"; $id = " id='{$field['id']}'"; $html .= "<textarea class='rwmb-textarea large-text'{$name}{$id} cols='{$cols}' rows='{$rows}'{$disabled}>{$meta}</textarea>"; return $html; }
/** * Get field HTML * * @param string $html * @param mixed $meta * @param array $field * * @return string */ static function html($html, $meta, $field) { $name = " name='{$field['field_name']}'"; $id = isset($field['clone']) && $field['clone'] ? '' : " id='{$field['id']}'"; $val = " value='{$meta}'"; $size = isset($field['size']) ? $field['size'] : '30'; $std = isset($field['disabled']) ? $field['disabled'] : false; $disabled = disabled($std, true, false); $html .= "<input type='text' class='rwmb-text'{$name}{$id}{$val}{$disabled} size='{$size}' />"; return $html; }
/** * 投稿画面にフィールドを表示 * * @param int $index インデックス番号 * @param mixed $value 保存されている値(check のときだけ配列) * @return string html */ public function get_field($index, $value) { $name = $this->get_field_name_in_editor($index); $disabled = $this->get_disable_attribute($index); $choices = SCF::choices_eol_to_array($this->get('choices')); $form_field = ''; foreach ($choices as $choice) { $choice = trim($choice); $form_field .= sprintf('<option value="%1$s" %2$s>%1$s</option>', esc_html($choice), selected($value, $choice, false)); } return sprintf('<select name="%s" %s>%s</select>', esc_attr($name), disabled(true, $disabled, false), $form_field); }
/** * Отображение подписок * @return null */ public function show() { if (!$this->state) { disabled(); } users::o()->check_perms(); $res = db::o()->p(users::o()->v('id'))->query("SELECT * FROM mailer WHERE user=?"); tpl::o()->register_modifier('get_mailer_title', array($this, "get_title")); tpl::o()->assign('mailer_res', db::o()->fetch2array($res)); tpl::o()->assign('intervals', self::$allowed_interval); tpl::o()->display('usercp/mailer.tpl'); }
/** * Generate select HTML. * @param string $field * @param mixed $data * @return string */ function ac_select_html($field, $data) { $defaults = array('disabled' => false, 'default' => '', 'class' => '', 'css' => '', 'custom_attributes' => array(), 'options' => array()); $data = wp_parse_args($data, $defaults); if (!empty($data['custom_attributes']) && is_array($data['custom_attributes'])) { foreach ($data['custom_attributes'] as $attribute => $attribute_value) { $custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"'; } } ob_start(); ?> <div class="clearfix field-container field-select"> <select class="widefat <?php echo esc_attr($data['class']); ?> " name="<?php echo esc_attr($field); ?> " id="<?php echo esc_attr($field); ?> " style="<?php echo esc_attr($data['css']); ?> " <?php disabled($data['disabled'], true); ?> <?php echo implode(' ', $custom_attributes); ?> > <?php foreach ((array) $data['options'] as $option_key => $option_value) { ?> <option value="<?php echo esc_attr($option_key); ?> " <?php selected($option_key, esc_attr($data['default'])); ?> ><?php echo esc_attr($option_value); ?> </option> <?php } ?> </select> </div> <?php return ob_get_clean(); }
public function start_el(&$output, $term, $depth = 0, $args = array(), $id = 0) { $taxonomy = empty($args['taxonomy']) ? 'category' : $args['taxonomy']; $name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']'; // input name $name = $this->hierarchical ? $name . '[]' : $name; // input value $value = $this->hierarchical ? $term->term_id : $term->slug; $selected_cats = empty($args['selected_cats']) ? array() : $args['selected_cats']; $in_selected = in_array($term->term_id, $selected_cats); $args = array('id' => $taxonomy . '-' . $term->term_id, 'name' => $name, 'value' => $value, 'checked' => checked($in_selected, true, false), 'selected' => selected($in_selected, true, false), 'disabled' => disabled(empty($args['disabled']), false, false), 'label' => esc_html(apply_filters('the_category', $term->name))); $output .= 'radio' == $this->input_element ? $this->start_el_radio($args) : $this->start_el_select($args); }
function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0) { extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } if ($taxonomy == 'category') { $name = 'category'; } else { $name = $taxonomy; } $output .= "\n<li id='{$taxonomy}-{$category->term_id}'>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $selected_cats), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>'; }
/** * 投稿画面にフィールドを表示 * * @param int $index インデックス番号 * @param mixed $value 保存されている値(check のときだけ配列) * @return string html */ public function get_field($index, $value) { $name = $this->get_field_name_in_editor($index); $disabled = $this->get_disable_attribute($index); $choices = SCF::choices_eol_to_array($this->get('choices')); $direction = $this->get('radio_direction'); $form_field = sprintf('<input type="hidden" name="%s" value="" %s />', esc_attr($name), disabled(true, $disabled, false)); foreach ($choices as $choice) { $choice = trim($choice); $form_field .= sprintf('<span class="%s"><label><input type="radio" name="%s" value="%s" %s %s /> %s</label></span>', esc_attr(SCF_Config::PREFIX . 'item-' . $direction), esc_attr($name), esc_attr($choice), checked($value, $choice, false), disabled(true, $disabled, false), esc_html($choice)); } return $form_field; }
function start_el(&$output, $category, $depth, $args) { extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } if ($taxonomy == 'category') { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; } $class = in_array($category->term_id, $popular_cats) ? ' class="popular-category"' : ''; $output .= "\n<li id='{$taxonomy}-{$category->term_id}'{$class}>" . '<label class="selectit"><input value="' . $category->slug . '" type="radio" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $selected_cats), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>'; }
/** * Get field HTML * * @param string $html * @param mixed $meta * @param array $field * * @return string */ static function html($html, $meta, $field) { $std = isset($field['disabled']) ? $field['disabled'] : false; $disabled = disabled($std, true, false); $name = " name='{$field['field_name']}'"; $id = " id='{$field['id']}'"; $value = " value='{$meta}'"; $address = isset($field['address_field']) ? $field['address_field'] : false; $html .= "<div class='rwmb-map-canvas'" . (isset($field['style']) ? " style='" . $field['style'] . "'" : "") . "></div>"; $html .= "<input type='hidden'{$name} id='rwmb-map-coordinate' {$value} />\n"; if ($address) { $html .= "<button type='button' name='rwmb-map-goto-address-button' id='rwmb-map-goto-address-button' value='" . (is_array($address) ? implode(",", $address) : $address) . "' onclick='geocodeAddress(this.value);'>Find Address</button>\n"; } return $html; }
/** * Displays a checkbox to allow the user to generate an activity * * @package Rendez Vous * @subpackage Activity * * @since Rendez Vous (1.0.0) */ function rendez_vous_activity_edit_form() { ?> <p> <label for="rendez-vous-edit-activity" class="normal"> <input type="checkbox" id="rendez-vous-edit-activity" name="_rendez_vous_edit[activity]" value="1" <?php disabled(1, rendez_vous_single_get_privacy()); ?> > <?php esc_html_e('Record an activity for all members', 'rendez-vous'); ?> </label> </p> <?php }
/** * @since 3.0 * @see /wp-includes/general-template.php */ function disabled($disabled, $current = true, $echo = true) { if (function_exists('disabled')) { return disabled($disabled, $current, $echo); } else { if (function_exists('__checked_selected_helper')) { return __checked_selected_helper($disabled, $current, $echo, 'disabled'); } } $result = $disabled == $current ? " disabled='disabled'" : ''; if ($echo) { echo $result; } return $result; }
/** * Start the element output. * * @see Walker::start_el() * * @since 0.4.1 * * @param string $output Passed by reference. Used to append additional content. * @param object $category The current term object. * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_terms_checklist() * @param int $id ID of the current term. */ public function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { // Note that Walker classes are trusting with their previously // validated object properties. $taxonomy = $args['taxonomy']; $name = 'tax_input[' . $taxonomy . ']'; // Maybe show popular categories tab $args['popular_cats'] = empty($args['popular_cats']) ? array() : $args['popular_cats']; // Maybe add popular category class $class = in_array($category->term_id, $args['popular_cats']) ? ' class="popular-category"' : ''; // Maybe use already selected categories $args['selected_cats'] = empty($args['selected_cats']) ? array() : $args['selected_cats']; /** This filter is documented in wp-includes/category-template.php */ $output .= "\n<li id='{$taxonomy}-{$category->term_id}'{$class}>" . '<label class="selectit"><input value="' . $category->name . '" type="radio" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $args['selected_cats']), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>'; }
/** * Start the element output. * * @see Walker::start_el() * * @since 2.5.1 * * @param string $output Passed by reference. Used to append additional content. * @param object $category The current term object. * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_terms_checklist() * @param int $id ID of the current term. */ function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } $name = 'radio_tax_input[' . $taxonomy . ']'; //get first term object $current_term = !empty($selected_cats) && !is_wp_error($selected_cats) ? array_pop($selected_cats) : false; // if no term, match the 0 "no term" option $current_id = $current_term ? $current_term : 0; // switching radio tags to "hierarchical" so we'll always use ID $value = $category->term_id; $class = in_array($category->term_id, $popular_cats) ? ' class="popular-category"' : ''; $output .= sprintf("\n" . '<li id="%1$s-%2$s" %3$s><label class="selectit"><input id="%4$s" type="radio" name="%5$s" value="%6$s" %7$s %8$s/> %9$s</label>', $taxonomy, $value, $class, "in-{$taxonomy}-{$category->term_id}", $name . '[]', esc_attr(trim($value)), checked($current_id, $category->term_id, false), disabled(empty($args['disabled']), false, false), esc_html(apply_filters('the_category', $category->name))); }
function start_el(&$output, $category, $depth, $args) { extract($args); if (empty($taxonomy)) { $taxonomy = 'category'; } if ($taxonomy == 'category') { $name = 'post_category'; } else { $name = 'tax_input[' . $taxonomy . ']'; } $class = in_array($category->term_id, $popular_cats) ? ' class="popular-category"' : ''; //This line is the only part I really needed to change from the original walker, and its the only reason I had to create a custom metabox //Not only that, but all i needed to do was change value="' . $category->term_id . '" to value="' . $category->slug . '" $output .= "\n<li id='{$taxonomy}-{$category->term_id}'{$class}>" . '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked(in_array($category->term_id, $selected_cats), true, false) . disabled(empty($args['disabled']), false, false) . ' /> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>'; }