Changeset 44178
- Timestamp:
- 05/04/08 05:38:14 (2 months ago)
- Files:
-
- add-from-server/trunk/add-from-server.php (modified) (7 diffs)
- add-from-server/trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
add-from-server/trunk/add-from-server.php
r40733 r44178 28 28 add_action('init', 'frmsvr_init'); 29 29 function 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/')); 32 31 } 33 32 … … 44 43 return; 45 44 add_action('admin_head', 'media_admin_css'); 45 wp_enqueue_script('admin-forms'); 46 46 return wp_iframe('frmsvr_mainform'); 47 47 } … … 95 95 $return = "<form action='$folderurl$base' method='POST'><table>"; 96 96 $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>'; 100 100 $parent = realpath($base . '/..'); 101 101 … … 122 122 } 123 123 } 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>'; 124 127 $return .= '</table>'; 125 128 … … 128 131 $ret = pu_checkbox(false); 129 132 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>'; 133 139 134 140 $return .= ' … … 142 148 if( empty($files) ) 143 149 return; 150 $gallery = isset($_POST['no-gallery']) && $_POST['no-gallery'] ? false : true; 151 144 152 foreach($files as $file){ 145 153 $file = realpath($file); 146 $id = frmsvr_handle_file($file );154 $id = frmsvr_handle_file($file, $gallery); 147 155 if( $id ){ 148 156 echo "<script type='text/javascript'>jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);</script>"; … … 152 160 } 153 161 154 function frmsvr_handle_file($file){ 155 $post_id = $_REQUEST['post_id']; 162 function 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. 156 165 157 166 $wp_filetype = wp_check_filetype( $file, null ); add-from-server/trunk/readme.txt
r36539 r44178 24 24 * Added a check to see if the file exists in the Media library allready 25 25 * 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 26 31 27 32 == Future Features ==
