Changeset 1434444
- Timestamp:
- 06/10/2016 12:03:15 PM (10 years ago)
- Location:
- katracker/trunk
- Files:
-
- 1 added
- 5 edited
-
README.txt (modified) (1 diff)
-
functions.php (modified) (1 diff)
-
katracker.php (modified) (1 diff)
-
shortcode/katracker-shortcode.php (modified) (1 diff)
-
shortcode/shortcode.php (modified) (3 diffs)
-
torrent/torrent-style.css (added)
Legend:
- Unmodified
- Added
- Removed
-
katracker/trunk/README.txt
r1433922 r1434444 71 71 72 72 == Changelog == 73 = 1.0.8 = 74 * Bug fixes (note to self: do not commit after 2AM) 75 73 76 = 1.0.7 = 74 77 * Simplified magnet links support -
katracker/trunk/functions.php
r1433917 r1434444 66 66 ) ) : null, 67 67 'meta_query' => array( 68 !$args['untracked'] ?68 $args['untracked'] ? 69 69 array( 70 70 'key' => KATRACKER_META_PREFIX . 'track', -
katracker/trunk/katracker.php
r1433917 r1434444 5 5 * Description: The only full and all powerful, complete bittorrent tracker integration for wordpress. 6 6 * Author: nicoco 7 * Version: 1.0. 77 * Version: 1.0.8 8 8 * Author URI: kateam.org 9 9 * License: GPL2 -
katracker/trunk/shortcode/katracker-shortcode.php
r1416926 r1434444 3 3 4 4 // for [torrent] shortcode 5 if ($single_torrent): 5 function katracker_shortcode_single( $atts ) { 6 $atts = shortcode_atts( array( 7 'id' => isset( $atts['hash'] ) ? get_torrent_id_from_hash( $atts['hash'] ) : null, 8 'title' => get_the_title( $atts['id'] ), 9 'stats' => 1, 10 'files' => 0 11 ), $atts ); 6 12 7 $atts = shortcode_atts( array( 8 'id' => isset( $atts['hash'] ) ? get_torrent_id_from_hash( $atts['hash'] ) : null, 9 'title' => get_the_title( $atts['id'] ), 10 'stats' => 1, 11 'files' => 0 12 ), $atts ); 13 14 if ( isset( $atts['id'] ) ) { 15 katracker_shortcode_print_torrent( $atts ); 13 if ( isset( $atts['id'] ) ) { 14 katracker_shortcode_print_torrent( $atts ); 15 } 16 return; 16 17 } 17 return;18 18 19 19 // for [torrents] shortcode 20 else: 21 $atts = shortcode_atts( array(22 'numtorrents' => -1,23 'project_order' => 'name',24 'torrent_order' => 'title',25 'category' => null,26 'stats' => 1,27 'files' => 128 ), $atts );20 function katracker_shortcode_many( $atts ) { 21 $atts = shortcode_atts( array( 22 'numtorrents' => -1, 23 'project_order' => 'name', 24 'torrent_order' => 'title', 25 'category' => null, 26 'stats' => 1, 27 'files' => 0 28 ), $atts ); 29 29 30 if ( isset( $atts['category'] )) {31 return katracker_shortcode_print_torrents( get_torrents( array(32 'orderby' => $atts['torrent_order'],33 'numtorrents' => $atts['numtorrents'],34 'category' => $atts['category'],35 ) ) , $atts);36 }30 if ( isset( $atts['category'] )) { 31 return katracker_shortcode_print_torrents( get_torrents( array( 32 'orderby' => $atts['torrent_order'], 33 'numtorrents' => $atts['numtorrents'], 34 'category' => $atts['category'], 35 ) ) , $atts); 36 } 37 37 38 if ( isset( $atts['id'] ))39 return katracker_shortcode_print_torrents( get_torrents( array(40 'orderby' => $atts['torrent_order'],41 'numtorrents' => $atts['numtorrents'],42 'post__in' => $atts['id']43 ) ) , $atts);38 if ( isset( $atts['id'] )) 39 return katracker_shortcode_print_torrents( get_torrents( array( 40 'orderby' => $atts['torrent_order'], 41 'numtorrents' => $atts['numtorrents'], 42 'post__in' => $atts['id'] 43 ) ) , $atts); 44 44 45 if ( $categories = get_katracker_categories() ): ?> 45 $categories = get_katracker_categories(); 46 if ( !empty( $categories ) ): 47 ?> 46 48 47 <div class="<?php echo KATRACKER_PRE . '-torrent-list'; ?>"> 48 <?php 49 $excluded = array(); 50 foreach ( $categories as $category ) { 51 $metadata = get_option( 'taxonomy_' . $category->term_id ); 52 $second_name = !empty( $metadata['second_name'] ) ? ' / ' . $metadata['second_name'] : ''; 53 $torrents = get_torrents( array( 'orderby' => $atts['torrent_order'], 'category' => $category->term_id, 'bonus' => false ) ); 54 $bonuses = get_torrents( array( 'orderby' => $atts['torrent_order'], 'category' => $category->term_id, 'bonus' => true ) ); 55 if ( !empty( $torrents ) || !empty( $bonuses ) ): ?> 49 <div class="<?php echo KATRACKER_PRE . '-torrent-list'; ?>"> 50 <?php 51 $excluded = array(); 52 foreach ( $categories as $category ) { 53 $metadata = get_option( 'taxonomy_' . $category->term_id ); 54 $second_name = !empty( $metadata['second_name'] ) ? ' / ' . $metadata['second_name'] : ''; 55 $torrents = get_torrents( array( 'orderby' => $atts['torrent_order'], 'category' => $category->term_id, 'bonus' => false ) ); 56 $bonuses = get_torrents( array( 'orderby' => $atts['torrent_order'], 'category' => $category->term_id, 'bonus' => true ) ); 57 if ( !empty( $torrents ) || !empty( $bonuses ) ): ?> 58 <div> 59 <h2><a href="<?php echo get_category_link( $category->term_id ); ?>"><?php echo $category->name . $second_name; ?></a></h2> 60 <?php 61 katracker_shortcode_print_torrents( $torrents, $atts ); 62 if ( !empty( $bonuses ) ) { 63 katracker_shortcode_print_torrents( $bonuses, array_merge( $atts, array( 'bonus' => true ) ) ); 64 $torrents = array_merge( $torrents, $bonuses ); 65 } 66 ?> 67 </div> 68 <?php 69 foreach( $torrents as $torrent ) { 70 $excluded[] = $torrent->ID; 71 } 72 endif; 73 } 74 75 $torrents = get_torrents( array( 'orderby' => $atts['torrent_order'], 'exclude' => $excluded ) ); 76 if ( !empty( $torrents ) ) { ?> 56 77 <div> 57 <h2><a href="<?php echo get_category_link( $category->term_id ); ?>"><?php echo $category->name . $second_name; ?></a></h2> 58 <?php 59 katracker_shortcode_print_torrents( $torrents, $atts ); 60 if ( !empty( $bonuses ) ) { 61 katracker_shortcode_print_torrents( $bonuses, array_merge( $atts, array( 'bonus' => true ) ) ); 62 $torrents = array_merge( $torrents, $bonuses ); 63 } 64 ?> 78 <h2><?php _e( 'Other', 'katracker' ); ?></h2> 79 <?php katracker_shortcode_print_torrents( $torrents, $atts ); ?> 65 80 </div> 66 81 <?php 67 foreach( $torrents as $torrent ) { 68 $excluded[] = $torrent->ID; 69 } 70 endif; 71 } 82 } 83 ?> 84 </div> 72 85 73 $torrents = get_torrents( array( 'orderby' => $atts['torrent_order'], 'exclude' => $excluded ) ); 74 if ( !empty( $torrents ) ) { ?> 75 <div> 76 <h2><?php _e( 'Other', 'katracker' ); ?></h2> 77 <?php katracker_shortcode_print_torrents( $torrents ); ?> 78 </div> 79 <?php 80 } 81 ?> 82 </div> 83 84 <?php endif; 85 86 endif; // single_torrent 86 <?php endif; 87 } 87 88 88 89 /** -
katracker/trunk/shortcode/shortcode.php
r1416912 r1434444 10 10 } 11 11 // Load Style 12 wp_enqueue_style( 'katracker-shortcode-style' );12 wp_enqueue_style( KATRACKER_PRE . '-shortcode-style' ); 13 13 14 14 ob_start(); 15 15 require_once $template_part; 16 katracker_shortcode_single( $atts ); 16 17 $content = ob_get_contents(); 17 18 ob_end_clean(); … … 27 28 $template_part = plugin_dir_path( __FILE__ ) . KATRACKER_PRE . '-shortcode.php'; 28 29 } 29 30 30 // Load Style 31 wp_enqueue_style( 'katracker-shortcode-style' );31 wp_enqueue_style( KATRACKER_PRE . '-shortcode-style' ); 32 32 33 33 ob_start(); 34 34 require_once $template_part; 35 katracker_shortcode_many( $atts ); 35 36 $content = ob_get_contents(); 36 37 ob_end_clean(); … … 48 49 $template_part = get_template_directory_uri() . '/' . KATRACKER_PRE . '-shortcode.css'; 49 50 } 50 wp_register_style( 'katracker-shortcode-style', $template_part );51 wp_register_style( KATRACKER_PRE . '-shortcode-style', $template_part ); 51 52 } ); 52 53
Note: See TracChangeset
for help on using the changeset viewer.