Changeset 487342
- Timestamp:
- 01/10/2012 03:58:19 AM (14 years ago)
- Location:
- media-file-manager
- Files:
-
- 22 added
- 2 edited
-
tags/1.1.0 (added)
-
tags/1.1.0/images (added)
-
tags/1.1.0/images/MRL_Icons.svg (added)
-
tags/1.1.0/images/audio.png (added)
-
tags/1.1.0/images/dir.png (added)
-
tags/1.1.0/images/dir_new.png (added)
-
tags/1.1.0/images/dir_up.png (added)
-
tags/1.1.0/images/file.png (added)
-
tags/1.1.0/images/left.png (added)
-
tags/1.1.0/images/media_folder.png (added)
-
tags/1.1.0/images/no_thumb.png (added)
-
tags/1.1.0/images/right.png (added)
-
tags/1.1.0/images/video.png (added)
-
tags/1.1.0/jquery.appear-1.1.1.min.js (added)
-
tags/1.1.0/media-relocator.js (added)
-
tags/1.1.0/media-relocator.php (added)
-
tags/1.1.0/media-selector.js (added)
-
tags/1.1.0/media-selector.php (added)
-
tags/1.1.0/readme.txt (added)
-
tags/1.1.0/screenshot-1.jpg (added)
-
tags/1.1.0/set_document_root.php (added)
-
tags/1.1.0/style.css (added)
-
trunk/media-relocator.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
media-file-manager/trunk/media-relocator.php
r477345 r487342 4 4 Plugin URI: http://tempspace.net/plugins/?page_id=111 5 5 Description: You can make sub-directories in the upload directory, and move files into them. At the same time, this plugin modifies the URLs/path names in the database. Also an alternative file-selector is added in the editing post/page screen, so you can pick up media files from the subfolders easily. 6 Version: 1. 0.26 Version: 1.1.0 7 7 Author: Atsushi Ueda 8 8 Author URI: http://tempspace.net/plugins/ … … 20 20 $mrelocator_uploadurl = mrl_adjpath($mrelocator_uploaddir_t['baseurl'], true); 21 21 22 22 23 function mrelocator_init() { 23 24 wp_enqueue_script('jquery'); … … 37 38 function mrelocator_plugin_menu() 38 39 { 39 /* 設定画面の追加 */ 40 add_submenu_page('upload.php', 'Media File Manager', 'Media File Manager', 'manage_options', 'mrelocator-submenu-handle', 'mrelocator_magic_function'); 40 $current_user = wp_get_current_user(); 41 if ( !($current_user instanceof WP_User) ) return; 42 $roles = $current_user->roles; 43 $accepted_roles = get_option("mediafilemanager_accepted_roles", "administrator"); 44 $accepted = explode(",", $accepted_roles); 45 46 for ($i=0; $i<count($accepted); $i++) { 47 for ($j=0; $j<count($roles); $j++) { 48 if ($accepted[$i] == $roles[$j]) { 49 /* 設定画面の追加 */ 50 add_submenu_page('upload.php', 'Media File Manager', 'Media File Manager', $roles[$j], 'mrelocator-submenu-handle', 'mrelocator_magic_function'); 51 return; 52 } 53 } 54 } 41 55 } 42 56 … … 88 102 </div> 89 103 <div id="debug">.<br></div> 90 <div id="mrl_test" style="display:none ;">test<br></div>104 <div id="mrl_test" style="display:nonee;">test<br></div> 91 105 92 106 </div> … … 569 583 } 570 584 585 586 587 588 // Add a link to the config page on the setting menu of wordpress 589 add_action('admin_menu', 'mrelocator_admin_plugin_menu'); 590 function mrelocator_admin_plugin_menu() 591 { 592 /* Add a setting page */ 593 add_submenu_page('options-general.php', 594 'Media File Manager plugin Configuration', 595 'Media File Manager', 596 'manage_options', 597 'mrelocator_submenu-handle', 598 'mrelocator_admin_magic_function' 599 ); 600 } 601 602 function mrelocator_get_roles(&$ret) 603 { 604 global $wp_roles; 605 $i=0; 606 foreach($wp_roles->roles as $key=> $value1) { 607 $ret[$i++] = $key; 608 } 609 } 610 611 /* Display config page */ 612 function mrelocator_admin_magic_function() 613 { 614 $roles = Array(); 615 mrelocator_get_roles(&$roles); 616 617 /* Store setting information which POST has when this func is called by pressing [Save Change] btn */ 618 if ( isset($_POST['update_mrelocator_setting'] ) ) { 619 echo '<div id="message" class="updated fade"><p><strong>Options saved.</strong></p></div>'; 620 //update_option('th_linklist_vnum', $_POST['th_linklist_vnum']); 621 $roles_val = ""; 622 for ($i=0; $i<count($roles); $i++) { 623 if (!empty($_POST['roles_'.$roles[$i]])) { 624 if ($roles_val != "") $roles_val .= ","; 625 $roles_val .= $roles[$i]; 626 } 627 } 628 update_option('mediafilemanager_accepted_roles', $roles_val); 629 } 630 631 ?> 632 <div class="wrap"> 633 <h2>Media File Manager plugin configurations</h2> 634 635 <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>"> 636 <?php 637 wp_nonce_field('update-options'); 638 $accepted_roles = get_option("mediafilemanager_accepted_roles", "administrator"); 639 ?> 640 <table class="form-table"> 641 <tr> 642 <th>This plugin can be used by </th> 643 <td style="text-align: left;"> 644 <?php 645 $accepted = explode(",", $accepted_roles); 646 for($i=0; $i<count($roles); $i++) { 647 $key = $roles[$i]; 648 649 $ck = ""; 650 for ($j=0; $j<count($accepted); $j++) { 651 if ($key == $accepted[$j]) { 652 $ck = "checked"; 653 break; 654 } 655 } 656 657 echo '<input type="checkbox" name="roles_'.$key.'" id="roles_'.$key.'" '.$ck.'>'.$key.'</input><br>'; 658 } 659 ?> 660 661 </td> 662 </tr> 663 664 </table> 665 <input type="hidden" name="action" value="update" /> 666 <p class="submit"> 667 <input type="submit" name="update_mrelocator_setting" class="button-primary" value="<?php _e('Save Changes')?>" onclick="" /> 668 </p> 669 </form> 670 671 672 </div> 673 <?php 674 if ( isset($_POST['update_th_linklist_Setting'] ) ) { 675 //echo '<script type="text/javascript">alert("Options Saved.");</script>'; 676 } 677 } 678 679 680 681 682 683 684 571 685 function mrelocator_test() 572 686 { 573 687 global $wpdb; 688 global $wp_roles; 689 global $current_user; 690 //print_r($wp_roles); 691 //print_r($current_user); 692 693 694 $current_user = wp_get_current_user(); 695 if ( !($current_user instanceof WP_User) ) 696 return; 697 $roles = $current_user->roles; 698 print_r($roles); 699 700 return; 574 701 575 702 $res = wp_get_attachment_metadata( 4272); 576 703 print_r($res); 577 return;578 704 579 705 //print_r(wp_get_attachment_metadata( 2916)); -
media-file-manager/trunk/readme.txt
r477347 r487342 4 4 Tags: media,file,manager,explorer,relocate,folder,folders,files,rename,make directory,directories,organize,organizer,select,selector,database 5 5 Requires at least: 3.2.0 6 Tested up to: 3.3 7 Stable tag: 1. 0.26 Tested up to: 3.3.1 7 Stable tag: 1.1.0 8 8 9 9 You can make sub-directories in the upload directory, and move files into them. … … 56 56 == Changelog == 57 57 58 = 1.1.0 = 59 * Added user access control by role. 60 58 61 = 1.0.2 = 59 62 * Solve the problem that file manager shows root directory of your server when the upload directory is not writeable by the server.
Note: See TracChangeset
for help on using the changeset viewer.