Changeset 44178

Show
Ignore:
Timestamp:
05/04/08 05:38:14 (2 months ago)
Author:
dd32
Message:

Select all files
Translatable strings
Allow non-gallery import

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • add-from-server/trunk/add-from-server.php

    r40733 r44178  
    2828add_action('init', 'frmsvr_init'); 
    2929function frmsvr_init(){ 
    30       var_dump(PLUGINDIR . '/' . dirname(plugin_basename(__FILE__))); 
    31     load_plugin_textdomain('add-from-server', PLUGINDIR . '/' . dirname(plugin_basename(__FILE__))); 
     30    load_plugin_textdomain('add-from-server', ABSPATH . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__) . '/langs/')); 
    3231} 
    3332 
     
    4443            return; 
    4544      add_action('admin_head', 'media_admin_css'); 
     45      wp_enqueue_script('admin-forms'); 
    4646      return wp_iframe('frmsvr_mainform'); 
    4747} 
     
    9595      $return = "<form action='$folderurl$base' method='POST'><table>"; 
    9696      $return .= "<tr> 
    97                               <th>" . __('Import', 'add-from-server') . "</th> 
    98                               <th>" . __('Filename', 'add-from-server') . "</th> 
    99                         </tr>"
     97                              <th>" . __('Import', 'add-from-server') . '</th> 
     98                              <th>' . __('Filename', 'add-from-server') . '</th> 
     99                        </tr>'
    100100      $parent = realpath($base . '/..'); 
    101101 
     
    122122            } 
    123123      } 
     124      $return .= '<tr> 
     125                              <th colspan="2" style="text-align: left;"><a href="javascript:checkAll(document.getElementById(\'add-from-server-form\'));">' . __('Toggle All', 'add-from-server') . '</a></th> 
     126                        </tr>'; 
    124127      $return .= '</table>'; 
    125128 
     
    128131            $ret = pu_checkbox(false); 
    129132            if( $ret ) 
    130                   $ret .= sprintf('(<em>%s</em>)<br />', __('Note: Will not take effect if selected file is within an upload folder at present', 'add-from-server')); 
    131             $return .= $ret; 
    132       } 
     133                  $ret .= sprintf('(<em>%s</em>)', __('Note: Will not take effect if selected file is within an upload folder at present', 'add-from-server')); 
     134            $return .= '<p>' . $ret . '</p>'; 
     135      } 
     136       
     137      //Offer to not assoc. with this post. 
     138      $return .= '<p><input type="checkbox" name="no-gallery" />' . __('Do not add selected files to current post Gallery', 'add-from-server') . '</p>'; 
    133139 
    134140      $return .= ' 
     
    142148      if( empty($files) ) 
    143149            return; 
     150      $gallery = isset($_POST['no-gallery']) && $_POST['no-gallery'] ? false : true; 
     151 
    144152      foreach($files as $file){ 
    145153            $file = realpath($file); 
    146             $id = frmsvr_handle_file($file); 
     154            $id = frmsvr_handle_file($file, $gallery); 
    147155            if( $id ){ 
    148156                  echo "<script type='text/javascript'>jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);</script>"; 
     
    152160} 
    153161 
    154 function frmsvr_handle_file($file){ 
    155       $post_id = $_REQUEST['post_id']; 
     162function frmsvr_handle_file($file, $gallery = true){ 
     163 
     164      $post_id = $gallery && isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : 0; //If the post id is set and we're adding to a gallery. 
    156165       
    157166      $wp_filetype = wp_check_filetype( $file, null ); 
  • add-from-server/trunk/readme.txt

    r36539 r44178  
    2424 * Added a check to see if the file exists in the Media library allready 
    2525 * Added a check to see if the file is allready in the uploads folder before importing, and if so, simply add it to the database, do not mash the filesystem 
     26= 1.3 = 
     27 * Internationalisation; Partial French translation 
     28 * Internationalisation; Partial Spanish translation 
     29 * Checkbox select all 
     30 * Import into non-post attachment 
    2631 
    2732== Future Features ==