Changeset 35984
- Timestamp:
- 12/17/2015 04:26:06 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r35850 r35984 905 905 // generate the output links array 906 906 foreach ( $tags_data as $key => $tag_data ) { 907 $a[] = "<a href='" . esc_url( $tag_data['url'] ) . "' class='" . esc_attr( $tag_data['class'] ) . "' title='" . esc_attr( $tag_data['title'] ) . "' style='font-size: " . esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ) . ";'>" . esc_html( $tag_data['name'] ) . "</a>"; 907 $class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 ); 908 $a[] = "<a href='" . esc_url( $tag_data['url'] ) . "' class='" . esc_attr( $class ) . "' title='" . esc_attr( $tag_data['title'] ) . "' style='font-size: " . esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ) . ";'>" . esc_html( $tag_data['name'] ) . "</a>"; 908 909 } 909 910 -
trunk/tests/phpunit/tests/term/wpGenerateTagCloud.php
r35242 r35984 79 79 'hide_empty' => false, 80 80 ) ); 81 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 ' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>";81 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 tag-link-position-1' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>"; 82 82 $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( 83 83 'hide_empty' => false, … … 95 95 ) ); 96 96 97 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 ' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>";97 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 tag-link-position-1' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>"; 98 98 $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( 99 99 'hide_empty' => false, … … 110 110 ) ); 111 111 112 $expected = "<ul class='wp-tag-cloud'>\n\t<li><a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 ' title='0 topics' style='font-size: 8pt;'>{$term->name}</a></li>\n</ul>\n";112 $expected = "<ul class='wp-tag-cloud'>\n\t<li><a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0 tag-link-position-1' title='0 topics' style='font-size: 8pt;'>{$term->name}</a></li>\n</ul>\n"; 113 113 $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( 114 114 'hide_empty' => false, … … 130 130 ) ); 131 131 132 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0 ' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a>\n".133 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1 ' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a>\n".134 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2 ' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a>\n".135 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3 ' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>";132 $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0 tag-link-position-1' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a>\n". 133 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1 tag-link-position-2' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a>\n". 134 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2 tag-link-position-3' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a>\n". 135 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3 tag-link-position-4' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>"; 136 136 $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array( 137 137 'hide_empty' => false, … … 153 153 154 154 $expected = "<ul class='wp-tag-cloud'>\n\t<li>". 155 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0 ' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a></li>\n\t<li>".156 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1 ' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a></li>\n\t<li>".157 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2 ' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a></li>\n\t<li>".158 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3 ' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>".155 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0 tag-link-position-1' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a></li>\n\t<li>". 156 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1 tag-link-position-2' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a></li>\n\t<li>". 157 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2 tag-link-position-3' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a></li>\n\t<li>". 158 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3 tag-link-position-4' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>". 159 159 "</li>\n</ul>\n"; 160 160 … … 221 221 222 222 /** 223 * @ticket 5172 224 */ 225 public function test_should_include_tag_link_position_class() { 226 register_taxonomy( 'wptests_tax', 'post' ); 227 $term_ids = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 228 229 $p = self::factory()->post->create(); 230 wp_set_post_terms( $p, $term_ids, 'wptests_tax' ); 231 232 $term_objects = get_terms( 'wptests_tax', array( 233 'include' => $term_ids, 234 ) ); 235 236 $cloud = wp_generate_tag_cloud( $term_objects ); 237 preg_match_all( '|tag\-link\-position-([0-9]+)|', $cloud, $matches ); 238 239 $this->assertSame( array( 1, 2, 3 ), array_map( 'intval', $matches[1] ) ); 240 } 241 242 /** 223 243 * Helper method retrieve the created terms. 224 244 *
Note: See TracChangeset
for help on using the changeset viewer.