Changeset 160717
- Timestamp:
- 10/05/2009 04:21:28 PM (16 years ago)
- Location:
- faster-image-insert/trunk
- Files:
-
- 2 added
- 3 deleted
- 2 edited
-
autosave.js (deleted)
-
faster-image-insert.php (modified) (10 diffs)
-
languages/faster-image-insert-ja.mo (added)
-
languages/faster-image-insert-ja.po (added)
-
media-upload.js (deleted)
-
quicktags.js (deleted)
-
readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
faster-image-insert/trunk/faster-image-insert.php
r140008 r160717 11 11 //forbidden direct access to plugin 12 12 if (eregi(basename(__FILE__),$_SERVER['PHP_SELF'])) { 13 if (!headers_sent()) {14 header('HTTP/1.1 403 Forbidden');15 ?>13 if (!headers_sent()) { 14 header('HTTP/1.1 403 Forbidden'); 15 ?> 16 16 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 17 17 <html><head> … … 21 21 <p>You don't have permission to access this resource.</p> 22 22 </body></html> 23 <?php24 }25 exit;23 <?php 24 } 25 exit; 26 26 } 27 27 28 28 //iframe for media manager. 29 29 function fast_insert_form() { 30 global $post_ID, $temp_ID;31 $id = (int) (0 == $post_ID ? $temp_ID : $post_ID);32 33 $load_iframe = 'faster_insert_load_iframe';30 global $post_ID, $temp_ID; 31 $id = (int) (0 == $post_ID ? $temp_ID : $post_ID); 32 33 $load_iframe = 'faster_insert_load_iframe'; 34 34 $nojquery = get_option( $load_iframe ); 35 35 36 $upload_form = 'faster_insert_upload_form';37 $noflash = get_option( $upload_form );38 39 if(!$nojquery) {36 $upload_form = 'faster_insert_upload_form'; 37 $noflash = get_option( $upload_form ); 38 39 if(!$nojquery) { 40 40 41 41 ?> 42 42 <script type="text/javascript"> 43 43 /* <![CDATA[ */ 44 jQuery(function($) { 45 //intialize 46 $('#screen-meta').ready(function() { 47 var view = $('#fastinsert-hide').is(':checked'); 48 if(view) { 49 $('#fastinsert > .inside').html('<iframe frameborder="0" name="fast_insert" id="fast_insert" src="<?php echo get_option("siteurl") ?>/wp-admin/media-upload.php?post_id=<?php if($noflash) echo $id.'&flash=0'; else echo $id; ?>&type=image&tab=type" hspace="0"> </iframe>'); 50 } 51 }); 52 //changing state 53 $('#screen-meta #fastinsert-hide').click(function() { 54 var view = $('#fastinsert-hide').is(':checked'); 55 if(view) { 56 $('#fastinsert > .inside').html('<iframe frameborder="0" name="fast_insert" id="fast_insert" src="<?php echo get_option("siteurl") ?>/wp-admin/media-upload.php?post_id=<?php if($noflash) echo $id.'&flash=0'; else echo $id; ?>&type=image&tab=type" hspace="0"> </iframe>'); 57 } 58 }); 59 }); 44 jQuery(function($) { 45 //intialize 46 $('#screen-meta').ready(function() { 47 var view = $('#fastinsert-hide').is(':checked'); 48 if(view) { 49 <?php if($id > 0) { ?> 50 $('#fastinsert > .inside').html('<iframe frameborder="0" name="fast_insert" id="fast_insert" src="<?php echo get_option("siteurl") ?>/wp-admin/media-upload.php?post_id=<?php if($noflash) echo $id.'&flash=0'; else echo $id; ?>&type=image&tab=type" hspace="0"> </iframe>'); 51 <?php } else { ?> 52 $('#fastinsert > .inside').html('<p><?php _e('Please manually save this draft before uploading any images.', 'faster-image-insert') ?></p>'); 53 <?php } ?> 54 } 55 }); 56 //changing state 57 $('#screen-meta #fastinsert-hide').click(function() { 58 var view = $('#fastinsert-hide').is(':checked'); 59 if(view) { 60 <?php if($id > 0) { ?> 61 $('#fastinsert > .inside').html('<iframe frameborder="0" name="fast_insert" id="fast_insert" src="<?php echo get_option("siteurl") ?>/wp-admin/media-upload.php?post_id=<?php if($noflash) echo $id.'&flash=0'; else echo $id; ?>&type=image&tab=type" hspace="0"> </iframe>'); 62 <?php } else { ?> 63 $('#fastinsert > .inside').html('<p><?php _e('Please manually save this draft before uploading any images.', 'faster-image-insert') ?></p>'); 64 <?php } ?> 65 } 66 }); 67 //update state 68 $('#fast_insert').load(function() { 69 if($(this).contents().find('#media-upload').text().length < 10) { 70 document.getElementById('fast_insert').contentWindow.location.href = document.getElementById('fast_insert').contentWindow.location.href; 71 } 72 }); 73 }); 60 74 /* ]]> */ 61 75 </script> 62 76 <?php 63 77 64 } else { 65 if($noflash) 66 echo '<iframe frameborder="0" name="fast_insert" id="fast_insert" src="'.get_option("siteurl").'/wp-admin/media-upload.php?post_id='.$id.'&flash=0&type=image&tab=type" hspace="0"> </iframe>'; 67 else 68 echo '<iframe frameborder="0" name="fast_insert" id="fast_insert" src="'.get_option("siteurl").'/wp-admin/media-upload.php?post_id='.$id.'&type=image&tab=type" hspace="0"> </iframe>'; 69 } 78 } else { 79 if($noflash && $id > 0) 80 echo '<iframe frameborder="0" name="fast_insert" id="fast_insert" src="'.get_option("siteurl").'/wp-admin/media-upload.php?post_id='.$id.'&flash=0&type=image&tab=type" hspace="0"> </iframe>'; 81 elseif ($id > 0) 82 echo '<iframe frameborder="0" name="fast_insert" id="fast_insert" src="'.get_option("siteurl").'/wp-admin/media-upload.php?post_id='.$id.'&type=image&tab=type" hspace="0"> </iframe>'; 83 else 84 _e('Please manually save this draft before uploading any images.', 'faster-image-insert'); 85 } 70 86 } 71 87 … … 73 89 function fast_image_insert() 74 90 { 75 76 $backcompat = 'faster_insert_backward_compat';77 $compat = get_option( $backcompat );78 91 $plugindebug = 'faster_insert_plugin_debug'; 79 92 $debug = get_option( $plugindebug ); 80 81 //add new function to autosave to update fast insert box for un-saved post. 82 if(!$debug) { 83 //wp_deregister_script('farbtastic'); 84 wp_deregister_script('autosave'); 85 wp_register_script('autosave',get_option("siteurl").'/wp-content/plugins/faster-image-insert/autosave.js', array('schedule', 'wp-ajax-response')); 86 } 87 88 //register a modified version of media upload, with auto-refresh function. 89 if(!$debug) { 90 wp_deregister_script('media-upload'); 91 wp_register_script('media-upload',get_option("siteurl").'/wp-content/plugins/faster-image-insert/media-upload.js'); 92 } 93 94 //no longer needed on wordpress 2.8 93 94 //since 1.4.0: spot wordpress 2.8+ automagically 95 global $wp_version; 96 if (version_compare($wp_version, '2.8.0', '>=')) { 97 $compat = true; 98 } else { 99 $compat = false; 100 } 95 101 if(!$compat && !$debug) { 96 //fix a quicktag bug that cause textarea scrollbar reset to top, will be removed when wp dev team fix it. 97 wp_deregister_script('quicktags');98 wp_register_script('quicktags',get_option("siteurl").'/wp-content/plugins/faster-image-insert/quicktags.js');99 } 100 101 //integrates manager into post/page edit inferface.102 add_meta_box('fastinsert', 'Fast Insert', 'fast_insert_form', 'post', 'normal', 'high');103 add_meta_box('fastinsert', 'Fast Insert', 'fast_insert_form', 'page', 'normal', 'high');102 //fix a quicktag bug that cause textarea scrollbar reset to top. It's fixed in 2.8+ 103 wp_deregister_script('quicktags'); 104 wp_register_script('quicktags',get_option("siteurl").'/wp-content/plugins/faster-image-insert/quicktags.dev.js'); 105 } 106 107 //integrates manager into post/page edit inferface. 108 add_meta_box('fastinsert', 'Fast Insert', 'fast_insert_form', 'post', 'normal', 'high'); 109 add_meta_box('fastinsert', 'Fast Insert', 'fast_insert_form', 'page', 'normal', 'high'); 104 110 } 105 111 … … 111 117 function faster_insert_local() { 112 118 113 $backcompat = 'faster_insert_backward_compat'; 114 $compat = get_option( $backcompat ); 119 //since 1.4.0: spot wordpress 2.8+ automagically 120 global $wp_version; 121 if (version_compare($wp_version, '2.8.0', '>=')) { 122 $compat = true; 123 } else { 124 $compat = false; 125 } 115 126 116 127 ?> … … 118 129 /* <![CDATA[ */ 119 130 <?php if(!$compat) { ?> 120 quicktagsL10n = {121 quickLinks: "<?php _e('(Quick Links)'); ?>",122 wordLookup: "<?php _e('Enter a word to look up:'); ?>",123 dictionaryLookup: "<?php echo attribute_escape(__('Dictionary lookup')); ?>",124 lookup: "<?php echo attribute_escape(__('lookup')); ?>",125 closeAllOpenTags: "<?php echo attribute_escape(__('Close all open tags')); ?>",126 closeTags: "<?php echo attribute_escape(__('close tags')); ?>",127 enterURL: "<?php _e('Enter the URL'); ?>",128 enterImageURL: "<?php _e('Enter the URL of the image'); ?>",129 enterImageDescription: "<?php _e('Enter a description of the image'); ?>"130 }131 try{convertEntities(quicktagsL10n);}catch(e){};131 quicktagsL10n = { 132 quickLinks: "<?php _e('(Quick Links)'); ?>", 133 wordLookup: "<?php _e('Enter a word to look up:'); ?>", 134 dictionaryLookup: "<?php echo attribute_escape(__('Dictionary lookup')); ?>", 135 lookup: "<?php echo attribute_escape(__('lookup')); ?>", 136 closeAllOpenTags: "<?php echo attribute_escape(__('Close all open tags')); ?>", 137 closeTags: "<?php echo attribute_escape(__('close tags')); ?>", 138 enterURL: "<?php _e('Enter the URL'); ?>", 139 enterImageURL: "<?php _e('Enter the URL of the image'); ?>", 140 enterImageDescription: "<?php _e('Enter a description of the image'); ?>" 141 } 142 try{convertEntities(quicktagsL10n);}catch(e){}; 132 143 <?php } ?> 133 144 134 jQuery(function($) {135 136 //$('#fastinsert').resizable();137 $('#media-items .new').each(function(e) {138 var id = $(this).parent().attr('id');139 id = id.split("-")[2];140 $(this).prepend('<input type="checkbox" class="item_selection" title="<?php _e('Select items you want to insert','faster-image-insert'); ?>" id="attachments[' + id.substring() + '][selected]" name="attachments[' + id + '][selected]" value="selected" /> ');141 });145 jQuery(function($) { 146 147 //$('#fastinsert').resizable(); 148 $('#media-items .new').each(function(e) { 149 var id = $(this).parent().attr('id'); 150 id = id.split("-")[2]; 151 $(this).prepend('<input type="checkbox" class="item_selection" title="<?php _e('Select items you want to insert','faster-image-insert'); ?>" id="attachments[' + id.substring() + '][selected]" name="attachments[' + id + '][selected]" value="selected" /> '); 152 }); 142 153 143 154 //buttons for enhanced functions 144 $('.ml-submit:first').append('<input type="submit" class="button savebutton" name="insertall" id="insertall" value="<?php echo attribute_escape( __( 'Insert selected images', 'faster-image-insert') ); ?>" /> '); 145 $('.ml-submit:first').append('<input type="submit" class="button savebutton" name="invertall" id="invertall" value="<?php echo attribute_escape( __( 'Invert selection', 'faster-image-insert') ); ?>" /> ');155 $('.ml-submit:first').append('<input type="submit" class="button savebutton" name="insertall" id="insertall" value="<?php echo attribute_escape( __( 'Insert selected images', 'faster-image-insert') ); ?>" /> '); 156 $('.ml-submit:first').append('<input type="submit" class="button savebutton" name="invertall" id="invertall" value="<?php echo attribute_escape( __( 'Invert selection', 'faster-image-insert') ); ?>" /> '); 146 157 <?php if(!$compat) { ?> 147 158 if($('#media-search').length == 0) { … … 150 161 <?php } ?> 151 162 $('.ml-submit:first').append('<input type="submit" class="button savebutton" name="expandall" id="expandall" value="<?php echo attribute_escape( __( 'Toggle items', 'faster-image-insert') ); ?>" /> '); 152 $('.ml-submit #invertall').click(153 function(){154 $('#media-items .item_selection').each(function(e) {155 if($(this).is(':checked')) $(this).attr("checked","");156 else $(this).attr("checked","checked");157 });158 return false;159 }160 );163 $('.ml-submit #invertall').click( 164 function(){ 165 $('#media-items .item_selection').each(function(e) { 166 if($(this).is(':checked')) $(this).attr("checked",""); 167 else $(this).attr("checked","checked"); 168 }); 169 return false; 170 } 171 ); 161 172 //500 should be enough for everyone :-> 162 173 <?php if(!$compat) { ?> 163 $('.ml-submit #orderreverse').click(164 function(){174 $('.ml-submit #orderreverse').click( 175 function(){ 165 176 var i = 500; 166 $('#media-items .menu_order_input').each(function(e) {177 $('#media-items .menu_order_input').each(function(e) { 167 178 $(this).val(i); i--; 168 });169 return false;170 }171 );179 }); 180 return false; 181 } 182 ); 172 183 <?php } ?> 173 $('.ml-submit #expandall').click(174 function(){175 $('#media-items .media-item').each(function(e) {184 $('.ml-submit #expandall').click( 185 function(){ 186 $('#media-items .media-item').each(function(e) { 176 187 $(this).find(".describe-toggle-on").toggle(); 177 188 $(this).find(".describe-toggle-off").toggle(); 178 189 $(this).find(".slidetoggle").toggle(); 179 });180 return false;181 }182 );183 190 }); 191 return false; 192 } 193 ); 194 184 195 <?php 185 $mass_edit = 'faster_insert_mass_edit';186 $mass = get_option( $mass_edit );187 if($mass) {188 ?> 189 190 if($('#gallery-settings').length > 0) {191 $('#gallery-settings').before('<div id="mass-edit"><div class="title"><?php _e('Mass Image Edit','faster-image-insert'); ?></div></div>');192 $('#gallery-settings .describe').clone().appendTo('#mass-edit');193 $('#mass-edit').append('<p class="ml-submit"><input type="button" class="button" name="massedit" id="massedit" value="<?php _e('Apply changes','faster-image-insert'); ?>" /> <span><?php _e('Press "Save all changes" to save. Only Title/Captions can be permanently saved.','faster-image-insert'); ?></span></p>');194 195 $('#mass-edit tr:eq(0) .alignleft').html('<?php _e('Image Titles','faster-image-insert'); ?>');196 $('#mass-edit tr:eq(1) .alignleft').html('<?php _e('Image Captions / Alt-Texts','faster-image-insert'); ?>');197 $('#mass-edit tr:eq(2) .alignleft').html('<?php _e('Image Alignment','faster-image-insert'); ?>');198 $('#mass-edit tr:eq(3) .alignleft').html('<?php _e('Image Sizes','faster-image-insert'); ?>');199 200 $('#mass-edit tr:eq(0) .field').html('<input type="text" name="title_edit" id="title_edit" value="" />');201 $('#mass-edit tr:eq(1) .field').html('<input type="text" name="captn_edit" id="captn_edit" value="" />');202 $('#mass-edit tr:eq(2) .field').html('<input type="radio" name="align_edit" id="align_none" value="none" />\n<label for="align_none" class="radio"><?php _e('None') ?></label>\n<input type="radio" name="align_edit" id="align_left" value="left" />\n<label for="align_left" class="radio"><?php _e('Left') ?></label>\n<input type="radio" name="align_edit" id="align_center" value="center" />\n<label for="align_center" class="radio"><?php _e('Center') ?></label>\n<input type="radio" name="align_edit" id="align_right" value="right" />\n<label for="align_right" class="radio"><?php _e('Right') ?></label>');203 $('#mass-edit tr:eq(3) .field').html('<input type="radio" name="size_edit" id="size_thumb" value="thumbnail" />\n<label for="size_thumb" class="radio"><?php _e('Thumbnail') ?></label>\n<input type="radio" name="size_edit" id="size_medium" value="medium" />\n<label for="size_medium" class="radio"><?php _e('Medium') ?></label>\n<input type="radio" name="size_edit" id="size_large" value="large" />\n<label for="size_large" class="radio"><?php _e('Large') ?></label>\n<input type="radio" name="size_edit" id="size_full" value="full" />\n<label for="size_full" class="radio"><?php _e('Full size') ?></label>');204 205 $('#massedit').click(function() {206 var massedit = new Array();207 massedit[0] = $('#mass-edit .describe #title_edit').val();208 massedit[1] = $('#mass-edit .describe #captn_edit').val();209 massedit[2] = $('#mass-edit tr:eq(2) .field input:checked').val();210 massedit[3] = $('#mass-edit tr:eq(3) .field input:checked').val();211 //alert(massedit);212 $('.media-item').each(function(e) {213 if(typeof massedit[0] !== "undefined" && massedit[0].length > 0) $(this).find('.post_title .field input').val(massedit[0]);214 if(typeof massedit[1] !== "undefined" && massedit[1].length > 0) $(this).find('.post_excerpt .field input').val(massedit[1]);215 if(typeof massedit[2] !== "undefined" && massedit[2].length > 0) {216 //$(this).find('.align .field input:checked').removeAttr("checked");217 $(this).find('.align .field input[value='+massedit[2]+']').attr("checked","checked");218 }219 if(typeof massedit[3] !== "undefined" && massedit[3].length > 0) {220 //$(this).find('.image-size .field input:checked').removeAttr("checked");221 $(this).find('.image-size .field input[value='+massedit[3]+']').attr("checked","checked");222 }223 });224 });225 }196 $mass_edit = 'faster_insert_mass_edit'; 197 $mass = get_option( $mass_edit ); 198 if($mass) { 199 ?> 200 201 if($('#gallery-settings').length > 0) { 202 $('#gallery-settings').before('<div id="mass-edit"><div class="title"><?php _e('Mass Image Edit','faster-image-insert'); ?></div></div>'); 203 $('#gallery-settings .describe').clone().appendTo('#mass-edit'); 204 $('#mass-edit').append('<p class="ml-submit"><input type="button" class="button" name="massedit" id="massedit" value="<?php _e('Apply changes','faster-image-insert'); ?>" /> <span><?php _e('Press "Save all changes" to save. Only Title/Captions can be permanently saved.','faster-image-insert'); ?></span></p>'); 205 206 $('#mass-edit tr:eq(0) .alignleft').html('<?php _e('Image Titles','faster-image-insert'); ?>'); 207 $('#mass-edit tr:eq(1) .alignleft').html('<?php _e('Image Captions / Alt-Texts','faster-image-insert'); ?>'); 208 $('#mass-edit tr:eq(2) .alignleft').html('<?php _e('Image Alignment','faster-image-insert'); ?>'); 209 $('#mass-edit tr:eq(3) .alignleft').html('<?php _e('Image Sizes','faster-image-insert'); ?>'); 210 211 $('#mass-edit tr:eq(0) .field').html('<input type="text" name="title_edit" id="title_edit" value="" />'); 212 $('#mass-edit tr:eq(1) .field').html('<input type="text" name="captn_edit" id="captn_edit" value="" />'); 213 $('#mass-edit tr:eq(2) .field').html('<input type="radio" name="align_edit" id="align_none" value="none" />\n<label for="align_none" class="radio"><?php _e('None') ?></label>\n<input type="radio" name="align_edit" id="align_left" value="left" />\n<label for="align_left" class="radio"><?php _e('Left') ?></label>\n<input type="radio" name="align_edit" id="align_center" value="center" />\n<label for="align_center" class="radio"><?php _e('Center') ?></label>\n<input type="radio" name="align_edit" id="align_right" value="right" />\n<label for="align_right" class="radio"><?php _e('Right') ?></label>'); 214 $('#mass-edit tr:eq(3) .field').html('<input type="radio" name="size_edit" id="size_thumb" value="thumbnail" />\n<label for="size_thumb" class="radio"><?php _e('Thumbnail') ?></label>\n<input type="radio" name="size_edit" id="size_medium" value="medium" />\n<label for="size_medium" class="radio"><?php _e('Medium') ?></label>\n<input type="radio" name="size_edit" id="size_large" value="large" />\n<label for="size_large" class="radio"><?php _e('Large') ?></label>\n<input type="radio" name="size_edit" id="size_full" value="full" />\n<label for="size_full" class="radio"><?php _e('Full size') ?></label>'); 215 216 $('#massedit').click(function() { 217 var massedit = new Array(); 218 massedit[0] = $('#mass-edit .describe #title_edit').val(); 219 massedit[1] = $('#mass-edit .describe #captn_edit').val(); 220 massedit[2] = $('#mass-edit tr:eq(2) .field input:checked').val(); 221 massedit[3] = $('#mass-edit tr:eq(3) .field input:checked').val(); 222 //alert(massedit); 223 $('.media-item').each(function(e) { 224 if(typeof massedit[0] !== "undefined" && massedit[0].length > 0) $(this).find('.post_title .field input').val(massedit[0]); 225 if(typeof massedit[1] !== "undefined" && massedit[1].length > 0) $(this).find('.post_excerpt .field input').val(massedit[1]); 226 if(typeof massedit[2] !== "undefined" && massedit[2].length > 0) { 227 //$(this).find('.align .field input:checked').removeAttr("checked"); 228 $(this).find('.align .field input[value='+massedit[2]+']').attr("checked","checked"); 229 } 230 if(typeof massedit[3] !== "undefined" && massedit[3].length > 0) { 231 //$(this).find('.image-size .field input:checked').removeAttr("checked"); 232 $(this).find('.image-size .field input[value='+massedit[3]+']').attr("checked","checked"); 233 } 234 }); 235 }); 236 } 226 237 <?php } ?> 227 });238 }); 228 239 229 240 /* ]]> */ … … 257 268 /* ]]> */ 258 269 </script> 259 <?php260 exit;270 <?php 271 exit; 261 272 } 262 273 263 274 //catches the insert all images post request. 264 275 function faster_insert_form_handler() { 265 global $post_ID, $temp_ID;266 $post_id = (int) (0 == $post_ID ? $temp_ID : $post_ID);267 check_admin_referer('media-form');268 269 $image_line = 'faster_insert_image_line';270 $oneline = get_option( $image_line );271 272 $line_number = 'faster_insert_line_number';273 $number = get_option( $line_number );274 if(!is_numeric($number)) $number = 4;275 276 if ( isset($_POST['insertall']) &&!empty($_POST['attachments']) ) {277 $result = '';278 foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {279 $attachment = stripslashes_deep( $attachment );280 if (!empty($attachment['selected'])) {281 $html = $attachment['post_title'];282 if ( !empty($attachment['url']) ) {283 if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($post_id)) )284 $rel = " rel='attachment wp-att-".attribute_escape($attachment_id)."'";285 $html = "<a href='{$attachment['url']}'$rel>$html</a>";286 }287 $html = apply_filters('media_send_to_editor', $html, $attachment_id, $attachment);288 289 if(!$oneline) $result .= $html.str_repeat("\\n",$number);290 else $result .= $html.str_repeat("",$number);291 }292 }293 return fast_insert_to_editor($result);294 }295 296 return $errors;276 global $post_ID, $temp_ID; 277 $post_id = (int) (0 == $post_ID ? $temp_ID : $post_ID); 278 check_admin_referer('media-form'); 279 280 $image_line = 'faster_insert_image_line'; 281 $oneline = get_option( $image_line ); 282 283 $line_number = 'faster_insert_line_number'; 284 $number = get_option( $line_number ); 285 if(!is_numeric($number)) $number = 4; 286 287 if ( !empty($_POST['attachments']) ) { 288 $result = ''; 289 foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 290 $attachment = stripslashes_deep( $attachment ); 291 if (!empty($attachment['selected'])) { 292 $html = $attachment['post_title']; 293 if ( !empty($attachment['url']) ) { 294 if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($post_id)) ) 295 $rel = " rel='attachment wp-att-".attribute_escape($attachment_id)."'"; 296 $html = "<a href='{$attachment['url']}'$rel>$html</a>"; 297 } 298 $html = apply_filters('media_send_to_editor', $html, $attachment_id, $attachment); 299 //since 1.4.0: is the same as a blank space, but can be passed onto TinyMCE 300 if(!$oneline) $result .= $html.str_repeat("\\n<p> </p>\\n",$number); 301 else $result .= $html.str_repeat(" ",$number); 302 } 303 } 304 return fast_insert_to_editor($result); 305 } 306 307 return $errors; 297 308 } 298 309 299 310 //filter for media_upload_gallery, recognize insertall request. 300 311 function faster_insert_media_upload_gallery() { 301 if ( isset($_POST['insertall']) ) {302 $return = faster_insert_form_handler();303 304 if ( is_string($return) )305 return $return;306 if ( is_array($return) )307 $errors = $return;308 }312 if ( isset($_POST['insertall']) ) { 313 $return = faster_insert_form_handler(); 314 315 if ( is_string($return) ) 316 return $return; 317 if ( is_array($return) ) 318 $errors = $return; 319 } 309 320 } 310 321 311 322 function faster_insert_media_upload_library() { 312 if ( isset($_POST['insertall']) ) {313 $return = faster_insert_form_handler();314 315 if ( is_string($return) )316 return $return;317 if ( is_array($return) )318 $errors = $return;319 }323 if ( isset($_POST['insertall']) ) { 324 $return = faster_insert_form_handler(); 325 326 if ( is_string($return) ) 327 return $return; 328 if ( is_array($return) ) 329 $errors = $return; 330 } 320 331 } 321 332 322 333 //for disabling captions 323 334 function caption_off() { 324 $no_caption = 'faster_insert_no_caption';325 $nocaption = get_option( $no_caption );326 if($nocaption)327 return true;335 $no_caption = 'faster_insert_no_caption'; 336 $nocaption = get_option( $no_caption ); 337 if($nocaption) 338 return true; 328 339 } 329 340 … … 334 345 335 346 //display the actual content of option page. 336 function faster_insert_option_detail() { 337 338 $faster_insert_update = 'faster_insert_update'; 339 $faster_insert_delete = 'faster_insert_delete'; 340 $faster_insert_valid = 'faster_insert_valid'; 341 342 //all the options 343 $load_iframe = 'faster_insert_load_iframe'; 344 $upload_form = 'faster_insert_upload_form'; 345 $image_line = 'faster_insert_image_line'; 346 $line_number = 'faster_insert_line_number'; 347 $mass_edit = 'faster_insert_mass_edit'; 348 $no_caption = 'faster_insert_no_caption'; 349 $backcompat = 'faster_insert_backward_compat'; 347 function faster_insert_option_detail() { 348 349 $faster_insert_update = 'faster_insert_update'; 350 $faster_insert_delete = 'faster_insert_delete'; 351 $faster_insert_valid = 'faster_insert_valid'; 352 353 //all the options 354 $load_iframe = 'faster_insert_load_iframe'; 355 $upload_form = 'faster_insert_upload_form'; 356 $image_line = 'faster_insert_image_line'; 357 $line_number = 'faster_insert_line_number'; 358 $mass_edit = 'faster_insert_mass_edit'; 359 $no_caption = 'faster_insert_no_caption'; 350 360 $plugindebug = 'faster_insert_plugin_debug'; 351 352 361 353 362 $iframe = get_option( $load_iframe ); 354 $flash = get_option( $upload_form ); 355 $image = get_option( $image_line ); 356 $number = get_option( $line_number ); 357 $mass = get_option( $mass_edit ); 358 $caption = get_option( $no_caption ); 359 $compat = get_option( $backcompat ); 363 $flash = get_option( $upload_form ); 364 $image = get_option( $image_line ); 365 $number = get_option( $line_number ); 366 $mass = get_option( $mass_edit ); 367 $caption = get_option( $no_caption ); 360 368 $debug = get_option( $plugindebug ); 361 362 //update options369 370 //update options 363 371 if( isset($_POST[ $faster_insert_update ]) && $_POST[ $faster_insert_valid ] == 'V' ) { 364 365 $_POST[ $load_iframe ] == 'selected' ? $iframe = true : $iframe = false; 366 $_POST[ $upload_form ] == 'selected' ? $flash = true : $flash = false; 367 $_POST[ $image_line ] == 'selected' ? $image = true : $image = false; 368 if(is_numeric($_POST[ $line_number ])) $number = $_POST[ $line_number ]; else $number = 4; 369 $_POST[ $mass_edit ] == 'selected' ? $mass = true : $mass = false; 370 $_POST[ $no_caption ] == 'selected' ? $caption = true : $caption = false; 371 $_POST[ $backcompat ] == 'selected' ? $compat = true : $compat = false; 372 373 $_POST[ $load_iframe ] == 'selected' ? $iframe = true : $iframe = false; 374 $_POST[ $upload_form ] == 'selected' ? $flash = true : $flash = false; 375 $_POST[ $image_line ] == 'selected' ? $image = true : $image = false; 376 if(is_numeric($_POST[ $line_number ])) $number = $_POST[ $line_number ]; else $number = 4; 377 $_POST[ $mass_edit ] == 'selected' ? $mass = true : $mass = false; 378 $_POST[ $no_caption ] == 'selected' ? $caption = true : $caption = false; 372 379 $_POST[ $plugindebug ] == 'selected' ? $debug = true : $debug = false; 373 374 update_option( $load_iframe, $iframe ); 375 update_option( $upload_form, $flash ); 376 update_option( $image_line, $image ); 377 update_option( $line_number, $number ); 378 update_option( $mass_edit, $mass ); 379 update_option( $no_caption, $caption ); 380 update_option( $backcompat, $compat ); 380 381 update_option( $load_iframe, $iframe ); 382 update_option( $upload_form, $flash ); 383 update_option( $image_line, $image ); 384 update_option( $line_number, $number ); 385 update_option( $mass_edit, $mass ); 386 update_option( $no_caption, $caption ); 381 387 update_option( $plugindebug, $debug ); 382 388 383 echo '<div class="updated"><p><strong>'.__('Settings saved.', 'faster-image-insert').'</strong></p></div>'; 384 }385 386 //delete options389 echo '<div class="updated"><p><strong>'.__('Settings saved.', 'faster-image-insert').'</strong></p></div>'; 390 } 391 392 //delete options 387 393 if( isset($_POST[ $faster_insert_delete ]) && $_POST[ $faster_insert_valid ] == 'V' ) { 388 389 delete_option( $load_iframe );390 delete_option( $upload_form );391 delete_option( $image_line );392 delete_option( $line_number );393 delete_option( $mass_edit );394 delete_option( $no_caption );394 395 delete_option( $load_iframe ); 396 delete_option( $upload_form ); 397 delete_option( $image_line ); 398 delete_option( $line_number ); 399 delete_option( $mass_edit ); 400 delete_option( $no_caption ); 395 401 delete_option( $backcompat ); 396 402 delete_option( $plugindebug ); 397 403 398 404 $iframe = get_option( $load_iframe ); 399 $flash = get_option( $upload_form ); 400 $image = get_option( $image_line ); 401 $number = get_option( $line_number ); 402 $mass = get_option( $mass_edit ); 403 $caption = get_option( $no_caption ); 404 $compat = get_option( $backcompat ); 405 $flash = get_option( $upload_form ); 406 $image = get_option( $image_line ); 407 $number = get_option( $line_number ); 408 $mass = get_option( $mass_edit ); 409 $caption = get_option( $no_caption ); 405 410 $debug = get_option( $plugindebug ); 406 411 407 echo '<div class="updated"><p><strong>'.__('Settings deleted.', 'faster-image-insert').'</strong></p></div>'; 408 }409 410 echo '<div class="wrap">'."\n".411 '<div id="icon-options-general" class="icon32"><br /></div>'."\n".412 '<h2>'.__('Faster Image Insert - User Options','faster-image-insert').'</h2>'."\n".413 '<h3>'.__('Updates your settings here', 'faster-image-insert').'</h3>';412 echo '<div class="updated"><p><strong>'.__('Settings deleted.', 'faster-image-insert').'</strong></p></div>'; 413 } 414 415 echo '<div class="wrap">'."\n". 416 '<div id="icon-options-general" class="icon32"><br /></div>'."\n". 417 '<h2>'.__('Faster Image Insert - User Options','faster-image-insert').'</h2>'."\n". 418 '<h3>'.__('Updates your settings here', 'faster-image-insert').'</h3>'; 414 419 ?> 415 420 … … 446 451 <th scope="row"><?php _e("Enable mass-editing ?", 'faster-image-insert' ); ?></th> 447 452 <td><label for="<?php echo $mass_edit; ?>"><input type="checkbox" name="<?php echo $mass_edit; ?>" id="<?php echo $mass_edit; ?>" value="selected" <?php if($mass) echo 'checked="checked"' ?> /> <?php _e("Enable this if you want to use the mass-edit function, works well with WordPress 2.7+", 'faster-image-insert' ); ?></label></td> 448 </tr>449 450 <tr valign="top">451 <th scope="row"><?php _e("Disable backward-compatible mode ?", 'faster-image-insert' ); ?></th>452 <td><label for="<?php echo $backcompat; ?>"><input type="checkbox" name="<?php echo $backcompat; ?>" id="<?php echo $backcompat; ?>" value="selected" <?php if($compat) echo 'checked="checked"' ?> /> <?php _e("WordPress 2.8 has added feature to sort gallery, and fix a bug we reported, if you're using 2.8+, you may enable this to save a few bytes.", 'faster-image-insert' ); ?></label></td>453 453 </tr> 454 454 … … 467 467 </form> 468 468 469 <?php 470 echo '</div>'."\n";469 <?php 470 echo '</div>'."\n"; 471 471 } 472 472 473 473 //load languages file for i18n 474 474 function faster_insert_textdomain() { 475 if (function_exists('load_plugin_textdomain')) {476 if ( !defined('WP_PLUGIN_DIR') ) {477 load_plugin_textdomain('faster-image-insert', str_replace( ABSPATH, '', dirname(__FILE__) ) . '/languages');478 } else {479 load_plugin_textdomain('faster-image-insert', false, dirname( plugin_basename(__FILE__) ) . '/languages');480 }481 }475 if (function_exists('load_plugin_textdomain')) { 476 if ( !defined('WP_PLUGIN_DIR') ) { 477 load_plugin_textdomain('faster-image-insert', str_replace( ABSPATH, '', dirname(__FILE__) ) . '/languages'); 478 } else { 479 load_plugin_textdomain('faster-image-insert', false, dirname( plugin_basename(__FILE__) ) . '/languages'); 480 } 481 } 482 482 } 483 483 -
faster-image-insert/trunk/readme.txt
r140009 r160717 4 4 Tags: fast, quick, images, photos, insert, media, admin, edit 5 5 Requires at least: 2.6 6 Tested up to: 2.8. 26 Tested up to: 2.8.5 7 7 Stable tag: 1.3.7 8 8 … … 43 43 see http://blog.ticktag.org/2009/02/19/2765/ for screenshots 44 44 45 see **Other Notes** for changelog46 47 45 == Frequently Asked Questions == 48 46 … … 50 48 51 49 Yes, except less annoying (I hope). 52 53 = Would you mind slowing down releases ? =54 55 Fine, this version should be good for a while, until new bugs show-up ;-)56 50 57 51 = Why my items' ordering are not saved ? = … … 61 55 = Why reversed ordering starts with the number 500 ? = 62 56 63 It's just a number, I figure 500 should be enough for everyone; but you're free to change it. Note that ordering number can be negative, you may use drag-and-drop to set them back to positive numbers. 57 It's just a number, I figure 500 should be enough for everyone; but you're free to change it. Note that ordering number can be negative, perform drag-and-drop will set them back to natural numbers. 58 59 = Why are blank spaces/lines not saved ? = 60 61 WordPress' default editor TinyMCE strips consecutive blank spaces/lines; the action is performed when saving or switching edit mode. 64 62 65 63 = Why doesn't media manager load ? = … … 71 69 One way to workaround this problem is to enable the multiple image insert option in CFT's settings page. If you don't feel like hacking wordpress core, media-manager popup **within** CPT meta-box will cease to load, but other function should work as usual. 72 70 71 **This should be fixed in v1.5.0** 72 73 73 = Conflicts with Admin Drop Down Menu plugin ? = 74 74 75 Schedule and Farbtastic libraries in wordpress can NOT live next to each other. Unfortunely, they met in the add new post section via these two plugins, which rendered the page as blank. One workaround is to uncomment the line on wp_deregister_script('farbtastic') in faster-image-insert.php, it resolves the problem between two plugins, but also disable any color pickers. 75 Schedule and Farbtastic libraries in wordpress can NOT live next to each other. Unfortunely, they met in the add new post section via these two plugins, which rendered the page as blank. One workaround is to uncomment the line: 76 77 wp_deregister_script('farbtastic') 78 79 in faster-image-insert.php, it resolves the problem between two plugins, but also disable any color pickers. 80 81 **This should be fixed in v1.5.0** 76 82 77 83 == Changelog == 78 84 79 85 = trunk = 80 * unstable release 86 * [unstable release](http://downloads.wordpress.org/plugin/faster-image-insert.zip) 87 88 = 1.5.0 = 89 * Updates for the wordpress 2.8+ user; 90 * Removes dependence on internal scripts to resolve plugin conflicts; 91 * Attempts to work around the TinyMCE whitespace stripping problem; 92 * Compatible mode is now auto-enabled (load quicktags.js if not 2.8); 93 * Updates FAQ. 81 94 82 95 = 1.3.7 = … … 118 131 = 1.0.0 = 119 132 * initial release, basic function implemented. 133 134 == Notes == 135 136 Translations: 137 138 Chinese - by [DF](http://blog.ticktag.org/) 139 French - by [Li-An](http://www.li-an.fr/) 140 Danish - by [Georg](http://wordpress.blogos.dk/) 141 Russian - by [FatCow](http://www.fatcow.com/) 142 Japanese - by [Chibi](http://ilovechibi.net/) 143 144 Plugin License: 145 146 [Creative Commons Attribution 3.0 Unported](http://creativecommons.org/licenses/by/3.0/deed.en_US)
Note: See TracChangeset
for help on using the changeset viewer.