Changeset 995942
- Timestamp:
- 09/24/2014 09:57:27 AM (12 years ago)
- Location:
- djpress
- Files:
-
- 2 edited
- 5 copied
-
tags/1.2 (copied) (copied from djpress/trunk)
-
tags/1.2/DjPress.php (copied) (copied from djpress/trunk/DjPress.php) (6 diffs)
-
tags/1.2/js (copied) (copied from djpress/trunk/js)
-
tags/1.2/readme.txt (copied) (copied from djpress/trunk/readme.txt) (2 diffs)
-
tags/1.2/stylesheet.css (copied) (copied from djpress/trunk/stylesheet.css)
-
trunk/DjPress.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
djpress/tags/1.2/DjPress.php
r995917 r995942 4 4 * Plugin URI: http://clearcode.info 5 5 * Description: A simple WordPress plugin for displaying Mixes. 6 * Version: 1. 16 * Version: 1.2 7 7 * Author: Mike Flynn <mike@clearcode.info> 8 8 * Author URI: http://clearcode.info … … 21 21 } 22 22 function 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' ); } 23 function 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 45 function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Tracklist', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); } 46 function 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 25 49 function djpress_tracklist_meta_box_callback( $post ) { 26 50 $tracklist = get_post_meta( $post->ID, 'djpress_tracklist', true ); … … 28 52 if(!$tracklist) $tracklist = array(); 29 53 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>'; 31 55 $id = 1; 32 56 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>"; 34 58 $id++; 35 59 } 36 60 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' );48 61 } 49 62 … … 53 66 } 54 67 68 function 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 55 77 function djpress_save_mix_file_meta_box_data( $post_id ) { 56 78 if(!djpress_user_can_save($post_id)) return; 57 79 if( ! empty( $_FILES ) && isset( $_FILES['djpress_file'] ) ) { 80 if(!file_exists($_FILES['djpress_file']['tmp_name'])) return; 58 81 $rg = file_get_contents( $_FILES['djpress_file']['tmp_name'] ); 59 82 $file = wp_upload_bits( $_FILES['djpress_file']['name'], null, $rg ); … … 78 101 } 79 102 $tl .= '</table>'; 80 81 103 return "<div class='djpress_wave' id='".get_the_ID()."' pls='{$plays}' dls='{$downloads}' ></div>" . $tl . $content; 82 104 } … … 126 148 if(!is_numeric($listens)) $listens = 0; 127 149 $f = ABSPATH.str_replace(get_site_url(),'',$file); 128 129 150 if(file_exists($f)){ 130 151 $listens++; 131 152 update_post_meta($id, $count, $listens); 132 133 153 header('Content-Description: File Transfer'); 134 154 header('Content-type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3'); -
djpress/tags/1.2/readme.txt
r995917 r995942 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.0 6 Stable tag: 1. 16 Stable tag: 1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 1. Addition of timestamps for the tracklist, which would place markers on the waveform 25 25 1. Creation of full description with screenshots, logo, etc. 26 1. Addition of album cover image 27 1. Addition of math logic to make the waveform width fit the screen 28 1. The same as above, but on resize. 29 1. 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 33 1. Just so you can get a basic Idea of how it displays. This is on a theme with a black background. 34 2. A screenshot of the admin panel 35 3. The tracklist in action. 36 37 == Changelog == 38 39 = 1.2 = 40 Added Screenshots 41 Fixed 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 = 49 Added documentation 50 51 == Upgrade Notice == 52 53 = 1.2 = 54 Fixes several usability bugs. -
djpress/trunk/DjPress.php
r995917 r995942 4 4 * Plugin URI: http://clearcode.info 5 5 * Description: A simple WordPress plugin for displaying Mixes. 6 * Version: 1. 16 * Version: 1.2 7 7 * Author: Mike Flynn <mike@clearcode.info> 8 8 * Author URI: http://clearcode.info … … 21 21 } 22 22 function 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' ); } 23 function 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 45 function djpress_add_tracklist_meta_box() {add_meta_box( plugin_basename( __FILE__ ), __( 'Tracklist', 'djpress_textdomain' ), 'djpress_tracklist_meta_box_callback', 'mix' ); } 46 function 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 25 49 function djpress_tracklist_meta_box_callback( $post ) { 26 50 $tracklist = get_post_meta( $post->ID, 'djpress_tracklist', true ); … … 28 52 if(!$tracklist) $tracklist = array(); 29 53 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>'; 31 55 $id = 1; 32 56 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>"; 34 58 $id++; 35 59 } 36 60 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' );48 61 } 49 62 … … 53 66 } 54 67 68 function 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 55 77 function djpress_save_mix_file_meta_box_data( $post_id ) { 56 78 if(!djpress_user_can_save($post_id)) return; 57 79 if( ! empty( $_FILES ) && isset( $_FILES['djpress_file'] ) ) { 80 if(!file_exists($_FILES['djpress_file']['tmp_name'])) return; 58 81 $rg = file_get_contents( $_FILES['djpress_file']['tmp_name'] ); 59 82 $file = wp_upload_bits( $_FILES['djpress_file']['name'], null, $rg ); … … 78 101 } 79 102 $tl .= '</table>'; 80 81 103 return "<div class='djpress_wave' id='".get_the_ID()."' pls='{$plays}' dls='{$downloads}' ></div>" . $tl . $content; 82 104 } … … 126 148 if(!is_numeric($listens)) $listens = 0; 127 149 $f = ABSPATH.str_replace(get_site_url(),'',$file); 128 129 150 if(file_exists($f)){ 130 151 $listens++; 131 152 update_post_meta($id, $count, $listens); 132 133 153 header('Content-Description: File Transfer'); 134 154 header('Content-type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3'); -
djpress/trunk/readme.txt
r995917 r995942 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.0 6 Stable tag: 1. 16 Stable tag: 1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 1. Addition of timestamps for the tracklist, which would place markers on the waveform 25 25 1. Creation of full description with screenshots, logo, etc. 26 1. Addition of album cover image 27 1. Addition of math logic to make the waveform width fit the screen 28 1. The same as above, but on resize. 29 1. 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 33 1. Just so you can get a basic Idea of how it displays. This is on a theme with a black background. 34 2. A screenshot of the admin panel 35 3. The tracklist in action. 36 37 == Changelog == 38 39 = 1.2 = 40 Added Screenshots 41 Fixed 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 = 49 Added documentation 50 51 == Upgrade Notice == 52 53 = 1.2 = 54 Fixes several usability bugs.
Note: See TracChangeset
for help on using the changeset viewer.