Plugin Directory

Changeset 1811413


Ignore:
Timestamp:
01/29/2018 07:38:56 PM (8 years ago)
Author:
xnicoco
Message:

fixed torrent filetype, fixed default torrent title

Location:
katracker/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • katracker/trunk/katracker.php

    r1455925 r1811413  
    22/**
    33 * Plugin Name: KaTracker
    4  * Plugin URI: kateam.org/tracker
    54 * Description: The only full and all powerful, complete bittorrent tracker integration for wordpress.
    65 * Author: nicoco
    7  * Version: 1.0.9
    8  * Author URI: kateam.org
     6 * Version: 1.1.0
    97 * License: GPL2
    108 * Text Domain: katracker
  • katracker/trunk/torrent/torrent-init.php

    r1398530 r1811413  
    3737    return $attachment;
    3838} );
     39
     40// Allow uploading torrent file type
     41add_filter('upload_mimes', function($mimes) {
     42    $mimes['torrent'] = 'torrent/torrent';
     43    return $mimes;
     44}, 10, 4 );
     45
     46add_filter('wp_check_filetype_and_ext', function($info, $tmpfile, $filename, $mimes) {
     47    // extra checks to handle situations where "finfo mimetype" is different from "user mimetype"
     48    global $wp_version;
     49
     50    $filetype = wp_check_filetype( $filename, $mimes );
     51
     52    return [
     53        'ext'             => $filetype['ext'],
     54        'type'            => $filetype['type'],
     55        'proper_filename' => $data['proper_filename']
     56    ];
     57    return $ret;
     58}, 10, 4 );
     59
    3960
    4061/**
Note: See TracChangeset for help on using the changeset viewer.