Plugin Directory

Changeset 995942


Ignore:
Timestamp:
09/24/2014 09:57:27 AM (12 years ago)
Author:
Clear_Code
Message:

Fixes Edit Mix Error, Adds more post type labels, fixes incorrect metabox titles, makes the tracklist
easier to use, adds screenshots

Location:
djpress
Files:
2 edited
5 copied

Legend:

Unmodified
Added
Removed
  • djpress/tags/1.2/DjPress.php

    r995917 r995942  
    44 * Plugin URI: http://clearcode.info
    55 * Description: A simple WordPress plugin for displaying Mixes.
    6  * Version: 1.1
     6 * Version: 1.2
    77 * Author: Mike Flynn <mike@clearcode.info>
    88 * Author URI: http://clearcode.info
     
    2121}
    2222function djpress_admin_scripts(){ wp_enqueue_script( 'admin', plugins_url('js/admin.js', __FILE__), array('jquery'), '1.0.0', true ); }
    23 function djpress_post_type() { register_post_type( 'mix', array( 'labels' => array( 'name' => __( 'Mixes' ), 'singular_name' => __( 'Mix' ) ), 'public' => true, 'has_archive' => true, ) ); }
    24 function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Mix File', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); }
     23function djpress_post_type() {
     24
     25    $labels = array(
     26        'name'               => _x( 'Mixes', 'post type general name', 'djpress_textdomain' ),
     27        'singular_name'      => _x( 'Mix', 'post type singular name', 'djpress_textdomain' ),
     28        'menu_name'          => _x( 'Mixes', 'admin menu', 'djpress_textdomain' ),
     29        'name_admin_bar'     => _x( 'Mix', 'add new on admin bar', 'djpress_textdomain' ),
     30        'add_new'            => _x( 'Add New', 'mix', 'djpress_textdomain' ),
     31        'add_new_item'       => __( 'Add New Mix', 'djpress_textdomain' ),
     32        'new_item'           => __( 'New Mix', 'djpress_textdomain' ),
     33        'edit_item'          => __( 'Edit Mix', 'djpress_textdomain' ),
     34        'view_item'          => __( 'View Mix', 'djpress_textdomain' ),
     35        'all_items'          => __( 'All Mixes', 'djpress_textdomain' ),
     36        'search_items'       => __( 'Search Mixes', 'djpress_textdomain' ),
     37        'parent_item_colon'  => __( 'Parent Mixes:', 'djpress_textdomain' ),
     38        'not_found'          => __( 'No mixes found.', 'djpress_textdomain' ),
     39        'not_found_in_trash' => __( 'No mixes found in Trash.', 'djpress_textdomain' )
     40    );   
     41   
     42    register_post_type( 'mix', array( 'labels' => $labels, 'public' => true, 'has_archive' => true, ) );
     43}
     44
     45function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Tracklist', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); }
     46function djpress_add_mix_file_meta_box() { add_meta_box( 'djpress_mix_file', __( 'Upload Mix', 'djpress_textdomain' ), 'djpress_mix_file_meta_box_callback', 'mix' ); }
     47
     48
    2549function djpress_tracklist_meta_box_callback( $post ) {
    2650    $tracklist = get_post_meta( $post->ID, 'djpress_tracklist', true );
     
    2852    if(!$tracklist) $tracklist = array();
    2953    else if(!is_array($tracklist)) $tracklist = unserialize($tracklist);
    30     echo '<table class="tracklist"><tr><th></th><th>Song</th><th>Artist</th></tr>';
     54    echo '<table class="tracklist" style="width: 100%;"><tr><th></th><th>Song</th><th>Artist</th></tr>';
    3155    $id = 1;
    3256    foreach((array)$tracklist as $track){
    33         echo "<tr><td>{$id}</td><td><input type='text' name='djpress_tracklist[{$id}][song]' placeholder='Song Title' value='{$track['song']}'></td><td><input type='text' name='djpress_tracklist[{$id}][artist]' placeholder='Artist' value='{$track['artist']}'></td><td><a href='#' class='removetrack'>Remove</a></td>";
     57        echo "<tr><td>{$id}</td><td><input type='text' name='djpress_tracklist[{$id}][song]' placeholder='Song Title' value='{$track['song']}' style='width:100%'></td><td><input type='text' name='djpress_tracklist[{$id}][artist]' placeholder='Artist' value='{$track['artist']}' style='width:100%'></td><td><a href='#' class='removetrack'>Remove</a></td>";
    3458        $id++;
    3559    }
    3660    echo '</table><p><a href="#" class="addtrack">Add New</a></p>';
    37 }
    38 function djpress_save_tracklist_meta_box_data( $post_id ) {
    39     if(!djpress_user_can_save($post_id)) return false;
    40     $tracklist = [];
    41     $tracklist2 = empty($_POST['djpress_tracklist']) ? array() : $_POST['djpress_tracklist'];
    42     if(!$tracklist2) $tracklist2 = array();
    43     foreach((array)$tracklist2 as $track){ if($track['song'] && $track['artist']) $tracklist[] = $track; }
    44     update_post_meta( $post_id, 'djpress_tracklist', serialize($tracklist) ); }
    45 
    46 function djpress_add_mix_file_meta_box() {
    47     add_meta_box( 'djpress_mix_file', __( 'Mix', 'djpress_textdomain' ), 'djpress_mix_file_meta_box_callback', 'mix' );
    4861}
    4962
     
    5366}
    5467
     68function djpress_save_tracklist_meta_box_data( $post_id ) {
     69    if(!djpress_user_can_save($post_id)) return false;
     70    $tracklist = [];
     71    $tracklist2 = empty($_POST['djpress_tracklist']) ? array() : $_POST['djpress_tracklist'];
     72    if(!$tracklist2) $tracklist2 = array();
     73    foreach((array)$tracklist2 as $track){ if($track['song'] && $track['artist']) $tracklist[] = $track; }
     74    update_post_meta( $post_id, 'djpress_tracklist', serialize($tracklist) );
     75}
     76
    5577function djpress_save_mix_file_meta_box_data( $post_id ) {
    5678    if(!djpress_user_can_save($post_id)) return;
    5779    if( ! empty( $_FILES ) && isset( $_FILES['djpress_file'] ) ) {
     80        if(!file_exists($_FILES['djpress_file']['tmp_name'])) return;
    5881        $rg = file_get_contents( $_FILES['djpress_file']['tmp_name'] );
    5982        $file = wp_upload_bits( $_FILES['djpress_file']['name'], null, $rg );
     
    78101    }
    79102    $tl .=  '</table>';
    80 
    81103    return "<div class='djpress_wave' id='".get_the_ID()."' pls='{$plays}' dls='{$downloads}' ></div>" . $tl . $content;
    82104}
     
    126148    if(!is_numeric($listens)) $listens = 0;
    127149    $f = ABSPATH.str_replace(get_site_url(),'',$file);
    128 
    129150    if(file_exists($f)){
    130151        $listens++;
    131152        update_post_meta($id, $count, $listens);
    132 
    133153        header('Content-Description: File Transfer');
    134154        header('Content-type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3');
  • djpress/tags/1.2/readme.txt

    r995917 r995942  
    44Requires at least: 3.0.1
    55Tested up to: 4.0
    6 Stable tag: 1.1
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    24241. Addition of timestamps for the tracklist, which would place markers on the waveform
    25251. Creation of full description with screenshots, logo, etc.
     261. Addition of album cover image
     271. Addition of math logic to make the waveform width fit the screen
     281. The same as above, but on resize.
     291. creation of default styling. *currently the plugin is designed to be completely styled by the end user* **Pro version will include several themes - Dark, Light, perhaps even a custom one where you choose the colors with some colorpickers**
     30
     31== Screenshots ==
     32
     331. Just so you can get a basic Idea of how it displays.  This is on a theme with a black background.
     342. A screenshot of the admin panel
     353. The tracklist in action.
     36
     37== Changelog ==
     38
     39= 1.2 =
     40Added Screenshots
     41Fixed Bugs:
     42* Edit Mix Error
     43* Incorrect Labels on Edit Mix page.
     44* Incorrect titles on Edit Mix metaboxes
     45* Larger display for tracklist metabox table
     46
     47
     48= 1.1 =
     49Added documentation
     50
     51== Upgrade Notice ==
     52
     53= 1.2 =
     54Fixes several usability bugs.
  • djpress/trunk/DjPress.php

    r995917 r995942  
    44 * Plugin URI: http://clearcode.info
    55 * Description: A simple WordPress plugin for displaying Mixes.
    6  * Version: 1.1
     6 * Version: 1.2
    77 * Author: Mike Flynn <mike@clearcode.info>
    88 * Author URI: http://clearcode.info
     
    2121}
    2222function djpress_admin_scripts(){ wp_enqueue_script( 'admin', plugins_url('js/admin.js', __FILE__), array('jquery'), '1.0.0', true ); }
    23 function djpress_post_type() { register_post_type( 'mix', array( 'labels' => array( 'name' => __( 'Mixes' ), 'singular_name' => __( 'Mix' ) ), 'public' => true, 'has_archive' => true, ) ); }
    24 function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Mix File', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); }
     23function djpress_post_type() {
     24
     25    $labels = array(
     26        'name'               => _x( 'Mixes', 'post type general name', 'djpress_textdomain' ),
     27        'singular_name'      => _x( 'Mix', 'post type singular name', 'djpress_textdomain' ),
     28        'menu_name'          => _x( 'Mixes', 'admin menu', 'djpress_textdomain' ),
     29        'name_admin_bar'     => _x( 'Mix', 'add new on admin bar', 'djpress_textdomain' ),
     30        'add_new'            => _x( 'Add New', 'mix', 'djpress_textdomain' ),
     31        'add_new_item'       => __( 'Add New Mix', 'djpress_textdomain' ),
     32        'new_item'           => __( 'New Mix', 'djpress_textdomain' ),
     33        'edit_item'          => __( 'Edit Mix', 'djpress_textdomain' ),
     34        'view_item'          => __( 'View Mix', 'djpress_textdomain' ),
     35        'all_items'          => __( 'All Mixes', 'djpress_textdomain' ),
     36        'search_items'       => __( 'Search Mixes', 'djpress_textdomain' ),
     37        'parent_item_colon'  => __( 'Parent Mixes:', 'djpress_textdomain' ),
     38        'not_found'          => __( 'No mixes found.', 'djpress_textdomain' ),
     39        'not_found_in_trash' => __( 'No mixes found in Trash.', 'djpress_textdomain' )
     40    );   
     41   
     42    register_post_type( 'mix', array( 'labels' => $labels, 'public' => true, 'has_archive' => true, ) );
     43}
     44
     45function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Tracklist', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); }
     46function djpress_add_mix_file_meta_box() { add_meta_box( 'djpress_mix_file', __( 'Upload Mix', 'djpress_textdomain' ), 'djpress_mix_file_meta_box_callback', 'mix' ); }
     47
     48
    2549function djpress_tracklist_meta_box_callback( $post ) {
    2650    $tracklist = get_post_meta( $post->ID, 'djpress_tracklist', true );
     
    2852    if(!$tracklist) $tracklist = array();
    2953    else if(!is_array($tracklist)) $tracklist = unserialize($tracklist);
    30     echo '<table class="tracklist"><tr><th></th><th>Song</th><th>Artist</th></tr>';
     54    echo '<table class="tracklist" style="width: 100%;"><tr><th></th><th>Song</th><th>Artist</th></tr>';
    3155    $id = 1;
    3256    foreach((array)$tracklist as $track){
    33         echo "<tr><td>{$id}</td><td><input type='text' name='djpress_tracklist[{$id}][song]' placeholder='Song Title' value='{$track['song']}'></td><td><input type='text' name='djpress_tracklist[{$id}][artist]' placeholder='Artist' value='{$track['artist']}'></td><td><a href='#' class='removetrack'>Remove</a></td>";
     57        echo "<tr><td>{$id}</td><td><input type='text' name='djpress_tracklist[{$id}][song]' placeholder='Song Title' value='{$track['song']}' style='width:100%'></td><td><input type='text' name='djpress_tracklist[{$id}][artist]' placeholder='Artist' value='{$track['artist']}' style='width:100%'></td><td><a href='#' class='removetrack'>Remove</a></td>";
    3458        $id++;
    3559    }
    3660    echo '</table><p><a href="#" class="addtrack">Add New</a></p>';
    37 }
    38 function djpress_save_tracklist_meta_box_data( $post_id ) {
    39     if(!djpress_user_can_save($post_id)) return false;
    40     $tracklist = [];
    41     $tracklist2 = empty($_POST['djpress_tracklist']) ? array() : $_POST['djpress_tracklist'];
    42     if(!$tracklist2) $tracklist2 = array();
    43     foreach((array)$tracklist2 as $track){ if($track['song'] && $track['artist']) $tracklist[] = $track; }
    44     update_post_meta( $post_id, 'djpress_tracklist', serialize($tracklist) ); }
    45 
    46 function djpress_add_mix_file_meta_box() {
    47     add_meta_box( 'djpress_mix_file', __( 'Mix', 'djpress_textdomain' ), 'djpress_mix_file_meta_box_callback', 'mix' );
    4861}
    4962
     
    5366}
    5467
     68function djpress_save_tracklist_meta_box_data( $post_id ) {
     69    if(!djpress_user_can_save($post_id)) return false;
     70    $tracklist = [];
     71    $tracklist2 = empty($_POST['djpress_tracklist']) ? array() : $_POST['djpress_tracklist'];
     72    if(!$tracklist2) $tracklist2 = array();
     73    foreach((array)$tracklist2 as $track){ if($track['song'] && $track['artist']) $tracklist[] = $track; }
     74    update_post_meta( $post_id, 'djpress_tracklist', serialize($tracklist) );
     75}
     76
    5577function djpress_save_mix_file_meta_box_data( $post_id ) {
    5678    if(!djpress_user_can_save($post_id)) return;
    5779    if( ! empty( $_FILES ) && isset( $_FILES['djpress_file'] ) ) {
     80        if(!file_exists($_FILES['djpress_file']['tmp_name'])) return;
    5881        $rg = file_get_contents( $_FILES['djpress_file']['tmp_name'] );
    5982        $file = wp_upload_bits( $_FILES['djpress_file']['name'], null, $rg );
     
    78101    }
    79102    $tl .=  '</table>';
    80 
    81103    return "<div class='djpress_wave' id='".get_the_ID()."' pls='{$plays}' dls='{$downloads}' ></div>" . $tl . $content;
    82104}
     
    126148    if(!is_numeric($listens)) $listens = 0;
    127149    $f = ABSPATH.str_replace(get_site_url(),'',$file);
    128 
    129150    if(file_exists($f)){
    130151        $listens++;
    131152        update_post_meta($id, $count, $listens);
    132 
    133153        header('Content-Description: File Transfer');
    134154        header('Content-type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3');
  • djpress/trunk/readme.txt

    r995917 r995942  
    44Requires at least: 3.0.1
    55Tested up to: 4.0
    6 Stable tag: 1.1
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    24241. Addition of timestamps for the tracklist, which would place markers on the waveform
    25251. Creation of full description with screenshots, logo, etc.
     261. Addition of album cover image
     271. Addition of math logic to make the waveform width fit the screen
     281. The same as above, but on resize.
     291. creation of default styling. *currently the plugin is designed to be completely styled by the end user* **Pro version will include several themes - Dark, Light, perhaps even a custom one where you choose the colors with some colorpickers**
     30
     31== Screenshots ==
     32
     331. Just so you can get a basic Idea of how it displays.  This is on a theme with a black background.
     342. A screenshot of the admin panel
     353. The tracklist in action.
     36
     37== Changelog ==
     38
     39= 1.2 =
     40Added Screenshots
     41Fixed Bugs:
     42* Edit Mix Error
     43* Incorrect Labels on Edit Mix page.
     44* Incorrect titles on Edit Mix metaboxes
     45* Larger display for tracklist metabox table
     46
     47
     48= 1.1 =
     49Added documentation
     50
     51== Upgrade Notice ==
     52
     53= 1.2 =
     54Fixes several usability bugs.
Note: See TracChangeset for help on using the changeset viewer.