PluginProbe
wpForo Forum / 3.1.6
wpForo Forum v3.1.6
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
← All changes | includes/functions-template.php +31 -6 3.1.13.1.6 View file →
@@ -656,12 +656,12 @@
656 656 $tag = ( $var == 'item' ) ? [] : null;
657 657 if( ! $tagid ) return $tag;
658 658
659 659 if( $var === 'url' && wpfval( $tag, 'tag' ) ) {
660 - $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
660 + $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag['tag'] );
661 661 } else {
662 662 $tag = WPF()->topic->get_tag( $tagid );
663 - if( ! empty( $tag ) ) $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
663 + if( ! empty( $tag ) ) $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag['tag'] );
664 664 }
665 665
666 666 if( $var !== 'item' ) $tag = wpfval( $tag, $var );
667 667
@@ -677,13 +677,13 @@
677 677
678 678 if( empty( $tag ) ) {
679 679 $tag = [];
680 680 if( ! $cache && $var == 'url' && wpfval( $tag, 'tag' ) ) {
681 - $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
681 + $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag['tag'] );
682 682 } else {
683 683 $tag = WPF()->topic->get_tag( $tagid );
684 684 if( ! empty( $tag ) ) {
685 - $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag['tag'];
685 + $tag['url'] = wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag['tag'] );
686 686 if( ! empty( $tag ) ) {
687 687 $cache_item = [ md5( $tagid ) => $tag ];
688 688 WPF()->cache->create( 'item', $cache_item, 'tag' );
689 689 }
@@ -1558,9 +1558,9 @@
1558 1558 ); ?>:&nbsp; <?php endif; ?></span>
1559 1559 <?php foreach( $tags as $tag ): ?>
1560 1560 <?php $item = wpforo_tag( $tag ) ?>
1561 1561 <tag wpf-tooltip="<?php echo esc_attr( wpforo_phrase( 'Topic Tag', false ) ); ?>">
1562 - <a href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>">
1562 + <a href="<?php echo esc_url( wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag ) ) ?>">
1563 1563 <?php if( is_rtl() ): ?>
1564 1564 <?php if( $count && wpfval(
1565 1565 $item,
1566 1566 'count'
@@ -1590,9 +1590,9 @@
1590 1590 <div class="<?php if( $type != 'text' ) echo 'wpf-tags'; ?> wpf-tags-<?php echo esc_attr( $type ) ?>">
1591 1591 <?php foreach( $tags as $tag ): ?>
1592 1592 <?php $item = wpforo_tag( $tag ) ?>
1593 1593 <tag wpf-tooltip="<?php echo esc_attr( wpforo_phrase( 'Topic Tag', false ) ); ?>"><a
1594 - href="<?php echo wpforo_home_url() . '?wpfin=tag&wpfs=' . $tag ?>"><?php echo esc_html(
1594 + href="<?php echo esc_url( wpforo_home_url() . '?wpfin=tag&wpfs=' . urlencode( $tag ) ) ?>"><?php echo esc_html(
1595 1595 $tag
1596 1596 ); ?><?php if( $count && wpfval(
1597 1597 $item,
1598 1598 'count'
@@ -2098,8 +2098,33 @@
2098 2098 }
2099 2099
2100 2100 function wpforo_template_pagenavi( $class = '', $permalink = true, $paged = null, $items_count = null, $items_per_page = null ) {
2101 2101 WPF()->tpl->pagenavi( $paged, $items_count, $items_per_page, $permalink, $class );
2102 +}
2103 +
2104 +function wpforo_tags_sort() {
2105 + if( ! wpforo_is_module_enabled( 'tags' ) ) return;
2106 + $active = wpfval( WPF()->current_object, 'tag_sort' ) ?: 'count';
2107 + $base_url = wpforo_home_url( wpforo_settings_get_slug( 'tags' ) );
2108 + // Inline stroke SVG icons. Layout lives in theme style.css, colors in styles/matrix.css. Static, trusted markup.
2109 + $icons = [
2110 + 'count' => '<svg viewBox="0 0 20 20" focusable="false"><path d="M3 17V11h3v6M8.5 17V7h3v10M14 17V3h3v14M2 17.5h16"/></svg>',
2111 + 'az' => '<svg viewBox="0 0 20 20" focusable="false"><path d="M6 3v13M3.5 13.5 6 16l2.5-2.5"/><path d="M11 5h6M11 5l5-2M11 10h6M11 15h6"/></svg>',
2112 + 'za' => '<svg viewBox="0 0 20 20" focusable="false"><path d="M6 17V4M3.5 6.5 6 4l2.5 2.5"/><path d="M11 5h6M11 10h6M11 15h6M11 15l5 2"/></svg>',
2113 + ];
2114 + $labels = [ 'count' => 'Frequency', 'az' => 'A-Z', 'za' => 'Z-A' ];
2115 + ?>
2116 + <div class="wpf-tags-sort" aria-label="<?php echo esc_attr( wpforo_phrase( 'Sort tags', false ) ) ?>">
2117 + <span class="wpf-tags-sort__label"><?php echo esc_html( wpforo_phrase( 'Sort by', false ) ) ?>:</span>
2118 + <?php foreach( $labels as $key => $label ):
2119 + $url = ( $key === 'count' ) ? $base_url : add_query_arg( 'wpf_tag_sort', $key, $base_url );
2120 + // Jump back to the forum wrapper on reload so the view is not stuck at the page top.
2121 + $url .= '#wpforo';
2122 + $cls = ( $active === $key ) ? ' is-active' : ''; ?>
2123 + <a href="<?php echo esc_url( $url ) ?>" class="wpf-tags-sort__button<?php echo $cls ?>"<?php echo ( $active === $key ) ? ' aria-current="page"' : '' ?>><?php echo $icons[ $key ] ?><span><?php echo esc_html( wpforo_phrase( $label, false ) ) ?></span></a>
2124 + <?php endforeach; ?>
2125 + </div>
2126 + <?php
2102 2127 }
2103 2128
2104 2129 function wpforo_template_add_topic_button( $forumid = null ) {
2105 2130 if( ! wpforo_is_bot() ) WPF()->tpl->add_topic_button( $forumid );