Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.wp-plugins.org/file-un-attach/tags/0.5.0@401959 b8457f37-d9ea-0310-8a92-e5e31aec5664
- Loading branch information
Hax
authored and
Hax
committed
Jun 28, 2011
0 parents
commit 057ce03
Showing
10 changed files
with
931 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FAQ | ||
|
||
1. Where can I change the settings? | ||
There are no settings; the plugin adds functionality to the media screens. | ||
|
||
2. When I stall the plugin I get the following error "unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or �}�" | ||
This is because your using PHP4 and this plugin only works with PHP5 | ||
|
||
3. How can I make donation to continue the plugin development? | ||
here is the link https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8SJEQXK5NK4ES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
// Object Copied from media-dev.js and renamed | ||
var funFindPosts; | ||
(function($){ | ||
funFindPosts = { | ||
open : function(af_name, af_val) { | ||
var st = document.documentElement.scrollTop || $(document).scrollTop(); | ||
|
||
if ( af_name && af_val ) { | ||
$('#fun-affected').attr('name', af_name).val(af_val); | ||
} | ||
$('#fun-find-posts').show().draggable({ | ||
handle: '#fun-find-posts-head' | ||
}).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-250px'}); | ||
|
||
$('#fun-find-posts-input').val(''); | ||
$('#fun-find-posts-input').focus().keyup(function(e){ | ||
if (e.which == 27) { funFindPosts.close(); } // close on Escape | ||
}); | ||
|
||
return false; | ||
}, | ||
|
||
close : function() { | ||
$('#fun-find-posts-response').html(''); | ||
$('#fun-find-posts').draggable('destroy').hide(); | ||
}, | ||
|
||
send : function() { | ||
var post = { | ||
action: 'find_posts', | ||
ps: $('#fun-find-posts-input').val(), | ||
_wpnonce : funlocal.nonceajax | ||
}; | ||
|
||
var selectedItem; | ||
$("input[type='radio']:checked").each(function() { selectedItem = $(this).val() }); | ||
post['post_type'] = selectedItem; | ||
|
||
var excludeIds = ''; | ||
$("#fun-find-posts-response input[type='checkbox']") | ||
.each(function(){ excludeIds += $(this).val()+',';}); | ||
post['exclude'] = excludeIds; excludeIds= ''; | ||
|
||
$.ajax({ | ||
type : 'GET', | ||
data : post, | ||
url : funlocal.adminurl+"ajax.php", | ||
success : function(x) { funFindPosts.show(x); }, | ||
error : function(r) { funFindPosts.error(r); } | ||
}); | ||
}, | ||
|
||
attchd: function(imgid) { | ||
var post = { | ||
img: imgid, | ||
action: 'find_attached', | ||
ps: $('#fun-find-posts-input').val(), | ||
_wpnonce : funlocal.nonceajax | ||
}; | ||
|
||
$.ajax({ | ||
data : post, | ||
type : 'GET', | ||
url : funlocal.adminurl+"ajax.php", | ||
success : function(x) { funFindPosts.show(x); }, | ||
error : function(r) { funFindPosts.error(r); } | ||
}); | ||
}, | ||
|
||
show : function(x) { | ||
$('.fun-search-results').remove(); | ||
if ( typeof(x) == 'string' ) { | ||
this.error({'responseText': x}); | ||
return; | ||
} | ||
|
||
var r = wpAjax.parseAjaxResponse(x); | ||
|
||
if ( r.errors ) { | ||
this.error({'responseText': wpAjax.broken}); | ||
} | ||
r = r.responses[0]; | ||
$('#fun-find-posts-response').append(r.data); | ||
}, | ||
|
||
error : function(r) { | ||
$('.fun-search-results').remove(); | ||
var er = r.statusText; | ||
if ( r.responseText ) { | ||
er = r.responseText; | ||
} | ||
if ( er ) { | ||
$('#fun-find-posts-response').append(er); | ||
} | ||
} | ||
}; | ||
|
||
$(document).ready(function() { | ||
$('#fun-find-posts-submit').click(function(e) { | ||
if ( '' == $('#fun-find-posts-response').html() ) | ||
e.preventDefault(); | ||
}); | ||
$( '#fun-find-posts .find-box-search :input' ).keypress( function( event ) { | ||
if ( 13 == event.which ) { | ||
funFindPosts.send(); | ||
return false; | ||
} | ||
} ); | ||
$('#fun-find-posts-search').click( funFindPosts.send ); | ||
$('#fun-find-posts-close' ).click( funFindPosts.close ); | ||
$('#doaction, #doaction2').click(function(e){ | ||
$('select[name^="action"]').each(function(){ | ||
if ( $(this).val() == 'attach' ) { | ||
e.preventDefault(); | ||
funFindPosts.open(); | ||
} | ||
}); | ||
}); | ||
}); | ||
})(jQuery); | ||
|
||
// File Un-attach functions | ||
jQuery(document).ready(function($){ | ||
|
||
$('.funattach').live('click',function(){ | ||
id = $(this).attr('name').replace('unattach-',''); | ||
$('.fun-mess-'+id).show(); | ||
return false; | ||
}); | ||
|
||
$('.fun-no').live('click',function(){ | ||
$(this).parents('.fun-message').hide(); | ||
return false; | ||
}); | ||
|
||
$('.fun-yes').live('click',function(){ | ||
id = $(this).attr('id').replace('file-unattch-',''); | ||
count = parseInt($('#attachments-count').html()); | ||
if(count > 0) $('#attachments-count').html(count-1) | ||
$.get(funlocal.adminurl+"ajax.php",{ | ||
imageid :id, | ||
action :'unattach', | ||
postid :$('#post_id').val(), | ||
_wpnonce :funlocal.nonceajax | ||
}) | ||
$(this).parents('.media-item').fadeOut('slow'); | ||
return false; | ||
}); | ||
|
||
$('.fun-unattach-row').live('click',function(){ | ||
id = $(this).attr('id').replace('file-unattch-',''); | ||
$.get(funlocal.adminurl+"ajax.php",{ | ||
imageid :id, | ||
action :'unattach', | ||
postid :$('#post_id').val(), | ||
_wpnonce :funlocal.nonceajax | ||
}) | ||
td = $(this).parents('td'); | ||
td.find('span').remove(); | ||
td.find('strong').replaceWith('('+funlocal.unattach+')'); | ||
$(this).remove(); | ||
return false; | ||
}); | ||
|
||
|
||
$('.fileattach').click(function(){ | ||
id = $(this).attr('name').replace('attach-',''); | ||
|
||
$(this).hide(); | ||
$('.fun-mess-'+id).show(); | ||
$('#attachments-count').html(parseInt($('#attachments-count').html())+1) | ||
$.get(funlocal.adminurl+"ajax.php",{ | ||
imageid :id, | ||
action :'attach', | ||
postid :$('#post_id').val(), | ||
_wpnonce :funlocal.nonceajax | ||
}) | ||
return false; | ||
}); | ||
|
||
$('.fun-find-posts').click(function(){ | ||
id = $(this).attr('id').replace('fun-find-posts-',''); | ||
funFindPosts.open('media[]',id); | ||
return false; | ||
}); | ||
|
||
$('.attached-list').click(function(){ | ||
id = $(this).attr('id').replace('attached-list-',''); | ||
funFindPosts.open('media[]',id); | ||
funFindPosts.attchd(id); | ||
return false; | ||
}); | ||
}); |
Oops, something went wrong.