/** * @dataProvider data_attributes_with_entities */ function test_gp_esc_attr_with_entities($expected, $attribute) { $this->assertEquals($expected, gp_esc_attr_with_entities($attribute)); }
<p><label for="filters[term]"><?php _e('Term:', 'glotpress'); ?> </label></p> <p><label for="filters[user_login]"><?php _e('User:'******'glotpress'); ?> </label></p> </dt> <dd> <p><input type="text" value="<?php echo gp_esc_attr_with_entities(gp_array_get($filters, 'term')); ?> " name="filters[term]" id="filters[term]" /></p> <p><input type="text" value="<?php echo gp_esc_attr_with_entities(gp_array_get($filters, 'user_login')); ?> " name="filters[user_login]" id="filters[user_login]" /></p> </dd> <dt><label><?php _e('Status:', 'glotpress'); ?> </label></dt> <dd> <?php echo gp_radio_buttons('filters[status]', array('current_or_waiting_or_fuzzy_or_untranslated' => __('Current/waiting/fuzzy + untranslated (All)', 'glotpress'), 'current' => __('Current only', 'glotpress'), 'old' => __('Approved, but obsoleted by another string', 'glotpress'), 'waiting' => __('Waiting approval', 'glotpress'), 'rejected' => __('Rejected', 'glotpress'), 'untranslated' => __('Without current translation', 'glotpress'), 'either' => __('Any', 'glotpress')), gp_array_get($filters, 'status', 'current_or_waiting_or_fuzzy_or_untranslated')); ?> </dd> <dd> <input type="checkbox" name="filters[with_comment]" value="yes" id="filters[with_comment][yes]" <?php gp_checked('yes' == gp_array_get($filters, 'with_comment'));
<?php $filter_links = array(); $filter_links[] = gp_link_get($url, 'All'); $filter_links[] = gp_link_get(add_query_arg(array('filters[translated]' => 'no', 'sort[by]' => 'random', 'filters[status]' => 'either'), $url), 'Random Untranslated'); if ($can_approve) { $filter_links[] = gp_link_get(add_query_arg(array('filters[translated]' => 'yes', 'filters[status]' => 'waiting'), $url), 'Waiting'); $filter_links[] = gp_link_get(add_query_arg(array('filters[warnings]' => 'yes', 'filters[status]' => 'current_or_waiting', 'sort[by]' => 'translation_date_added'), $url), 'Warnings'); } // TODO: with warnings // TODO: saved searches echo implode(' <span class="separator">•</span> ', $filter_links); ?> <dl class="filters-expanded filters hidden clearfix"> <dt><label for="filters[term]">Term:</label></dt> <dd><input type="text" value="<?php echo gp_esc_attr_with_entities(gp_array_get($filters, 'term')); ?> " name="filters[term]" id="filters[term]" /></dd> <dt><label for="filters[translated]">With translation:</label></dt> <dd> <?php echo gp_radio_buttons('filters[translated]', array('yes' => 'Yes', 'no' => 'No', 'either' => 'Either'), gp_array_get($filters, 'translated', 'either')); ?> </dd> <dt><label for="filters[status]">Status:</label></dt> <dd> <?php echo gp_radio_buttons('filters[status]', array('current_or_waiting' => 'Current or waiting', 'current' => 'Current only', 'old' => 'Approved, but obsoleted by another string', 'waiting' => 'Waiting approval', 'rejected' => 'Rejected', 'either' => 'Any'), gp_array_get($filters, 'status', 'current_or_waiting')); ?>