thebrutalagenda/readme.html0000644001761300176130000001672611214074647016611 0ustar mustardamustarda WordPress › ReadMe

WordPress
Version 2.8

Semantic Personal Publishing Platform

First Things First

Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I'm proud to be a part of. Thousands of hours have gone into WordPress, and we're dedicated to making it better every day. Thank you for making it part of your world.

— Matt Mullenweg

Installation: Famous 5-minute install

  1. Unzip the package in an empty directory.
  2. Open up wp-config-sample.php with a text editor like WordPad or similar and fill in your database connection details.
  3. Save the file as wp-config.php
  4. Upload everything.
  5. Open /wp-admin/install.php in your browser. This should setup the tables needed for your blog. If there is an error, double check your wp-config.php file, and try again. If it fails again, please go to the support forums with as much data as you can gather.
  6. Note the password given to you.
  7. The install script should then send you to the login page. Sign in with the username admin and the password generated during the installation. You can then click on 'Profile' to change the password.

Upgrading

Before you upgrade anything, make sure you have backup copies of any files you may have modified such as index.php.

Upgrading from any previous WordPress to 2.8:

  1. Delete your old WP files, saving ones you've modified.
  2. Upload the new files.
  3. Point your browser to /wp-admin/upgrade.php.
  4. You wanted more, perhaps? That's it!

Template Changes

If you have customized your templates you will probably have to make some changes to them. If you're converting your 1.2 or earlier templates, we've created a special guide for you.

Online Resources

If you have any questions that aren't addressed in this document, please take advantage of WordPress' numerous online resources:

The WordPress Codex
The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.
The Development Blog
This is where you'll find the latest updates and news related to WordPress. Bookmark and check often.
WordPress Planet
The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.
WordPress Support Forums
If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.
WordPress IRC Channel
Finally, there is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (irc.freenode.net #wordpress)

System Recommendations

WordPress is the official continuation of b2/cafélog, which came from Michel V. The work has been continued by the WordPress developers. If you would like to support WordPress, please consider donating.

Upgrading from another system

WordPress can import from a number of systems. First you need to get WordPress installed and working as described above.

XML-RPC and Atom Interface

You can now post to your WordPress blog with tools like Windows Live Writer, Ecto, Bloggar, Radio Userland (which means you can use Radio's email-to-blog feature), NewzCrawler, and other tools that support the Blogging APIs! :) You can read more about XML-RPC support on the Codex.

Post via Email

You can post from an email client! To set this up go to your "Writing" options screen and fill in the connection details for your secret POP3 account. Then you need to set up wp-mail.php to execute periodically to check the mailbox for new posts. You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your wp-mail.php URL.

Posting is easy: Any email sent to the address you specify will be posted, with the subject as the title. It is best to keep the address discrete. The script will delete emails that are successfully posted.

User Roles

We've eliminated user levels in order to make way for the much more flexible roles system introduced in 2.0. You can read more about Roles and Capabilities on the Codex.

Final notes

Share the Love

WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better—you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.

Copyright

WordPress is released under the GPL (see license.txt).

thebrutalagenda/wp-admin/js/dashboard.js0000644001761300176130000000230711214074650021063 0ustar mustardamustardajQuery(document).ready(function(c){var a,b,d;a=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];b=function(){c.each(a,function(){var f=jQuery("#"+this+":visible div.inside").find(".widget-loading");if(f.size()){f.parent().load("index-extra.php?jax="+this)}})};b();postboxes.add_postbox_toggles("dashboard",{onShow:b});d=function(){var e=c("#quickpost-action"),f;f=c("#quick-press").submit(function(){c("#dashboard_quick_press h3").append('');c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==e.val()){e.val("post-quickpress-publish")}c("#dashboard_quick_press div.inside").load(f.attr("action"),f.serializeArray(),function(){c("#dashboard_quick_press h3 img").remove();c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");c("#dashboard_quick_press ul").find("li").each(function(){c("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");d()});return false});c("#publish").click(function(){e.val("post-quickpress-publish")})};d()});thebrutalagenda/wp-admin/js/edit-comments.dev.js0000644001761300176130000002670411214074647022476 0ustar mustardamustardavar theList, theExtraList, toggleWithKeyboard = false; (function($) { setCommentsList = function() { var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter; totalInput = $('#comments-form .tablenav :input[name="_total"]'); perPageInput = $('#comments-form .tablenav :input[name="_per_page"]'); pageInput = $('#comments-form .tablenav :input[name="_page"]'); dimAfter = function( r, settings ) { var c = $('#' + settings.element); if ( c.is('.unapproved') ) c.find('div.comment_status').html('0') else c.find('div.comment_status').html('1') $('span.pending-count').each( function() { var a = $(this), n; n = a.html().replace(/[ ,.]+/g, ''); n = parseInt(n,10); if ( isNaN(n) ) return; n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); if ( n < 0 ) { n = 0; } $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); n = n.toString(); if ( n.length > 3 ) n = n.substr(0, n.length-3)+' '+n.substr(-3); a.html(n); }); }; // Send current total, page, per_page and url delBefore = function( settings ) { settings.data._total = totalInput.val(); settings.data._per_page = perPageInput.val(); settings.data._page = pageInput.val(); settings.data._url = document.location.href; if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && !settings.data.spam ) return showNotice.warn() ? settings : false; return settings; }; /* Updates the current total (as displayed visibly) */ updateTotalCount = function( total, time, setConfidentTime ) { if ( time < lastConfidentTime ) { return; } totalInput.val( total.toString() ); if ( setConfidentTime ) { lastConfidentTime = time; } $('span.total-type-count').each( function() { var a = $(this), n; n = totalInput.val().toString(); if ( n.length > 3 ) n = n.substr(0, n.length-3)+' '+n.substr(-3); a.html(n); }); }; // In admin-ajax.php, we send back the unix time stamp instead of 1 on success delAfter = function( r, settings ) { $('span.pending-count').each( function() { var a = $(this), n; n = a.html().replace(/[ ,.]+/g, ''); n = parseInt(n,10); if ( isNaN(n) ) return; if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment n = n - 1; } else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" n = n + 1; } if ( n < 0 ) { n = 0; } $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0'); n = n.toString(); if ( n.length > 3 ) n = n.substr(0, n.length-3)+' '+n.substr(-3); a.html(n); }); $('span.spam-count').each( function() { var a = $(this), n; n = a.html().replace(/[ ,.]+/g, ''); n = parseInt(n,10); if ( isNaN(n) ) return; if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam n = n + 1; } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam n = n - 1; } if ( n < 0 ) { n = 0; } n = n.toString(); if ( n.length > 3 ) n = n.substr(0, n.length-3)+' '+n.substr(-3); a.html(n); }); // XML response if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) { // Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links) updateTotalCount( settings.parsed.responses[0].supplemental.total, settings.parsed.responses[0].supplemental.time, true ); if ( $.trim( settings.parsed.responses[0].supplemental.pageLinks ) ) { $('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( settings.parsed.responses[0].supplemental.pageLinks ) ); } else if ( 'undefined' != typeof settings.parsed.responses[0].supplemental.pageLinks ) { $('.tablenav-pages').find( '.page-numbers' ).remove(); } } else { // Decrement the total var total = parseInt( totalInput.val(), 10 ); if ( total-- < 0 ) total = 0; updateTotalCount( total, r, false ); } if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) { return; } theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() ); $('#get-extra-comments').submit(); }; theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } ); }; commentReply = { init : function() { var row = $('#replyrow'); $('a.cancel', row).click(function() { return commentReply.revert(); }); $('a.save', row).click(function() { return commentReply.send(); }); $('input#author, input#author-email, input#author-url', row).keypress(function(e){ if ( e.which == 13 ) { commentReply.send(); e.preventDefault(); return false; } }); // add events $('#the-comment-list .column-comment > p').dblclick(function(){ commentReply.toggle($(this).parent()); }); $('#doaction, #doaction2, #post-query-submit').click(function(e){ if ( $('#the-comment-list #replyrow').length > 0 ) commentReply.close(); }); this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || ''; }, addEvents : function(r) { r.each(function() { $(this).find('.column-comment > p').dblclick(function(){ commentReply.toggle($(this).parent()); }); }); }, toggle : function(el) { if ( $(el).css('display') != 'none' ) $(el).find('a.vim-q').click(); }, revert : function() { if ( $('#the-comment-list #replyrow').length < 1 ) return false; $('#replyrow').fadeOut('fast', function(){ commentReply.close(); }); return false; }, close : function() { $(this.o).fadeIn('fast').css('backgroundColor', ''); $('#com-reply').append( $('#replyrow') ); $('#replycontent').val(''); $('#edithead input').val(''); $('#replysubmit .error').html('').hide(); $('#replysubmit .waiting').hide(); if ( $.browser.msie ) $('#replycontainer, #replycontent').css('height', '120px'); else $('#replycontainer').resizable('destroy').css('height', '120px'); }, open : function(id, p, a) { var t = this, editRow, act, h; t.close(); t.o = '#comment-'+id; $('#replyrow td').attr('colspan', $('.widefat thead th:visible').length); editRow = $('#replyrow'), rowData = $('#inline-'+id); act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; $('#action', editRow).val(act); $('#comment_post_ID', editRow).val(p); $('#comment_ID', editRow).val(id); if ( a == 'edit' ) { $('#author', editRow).val( $('div.author', rowData).text() ); $('#author-email', editRow).val( $('div.author-email', rowData).text() ); $('#author-url', editRow).val( $('div.author-url', rowData).text() ); $('#status', editRow).val( $('div.comment_status', rowData).text() ); $('#replycontent', editRow).val( $('textarea.comment', rowData).val() ); $('#edithead, #savebtn', editRow).show(); $('#replyhead, #replybtn', editRow).hide(); h = $(t.o).height(); if ( h > 220 ) if ( $.browser.msie ) $('#replycontainer, #replycontent', editRow).height(h-105); else $('#replycontainer', editRow).height(h-105); $(t.o).after(editRow.hide()).fadeOut('fast', function(){ $('#replyrow').fadeIn('fast'); }); } else { $('#edithead, #savebtn', editRow).hide(); $('#replyhead, #replybtn', editRow).show(); $(t.o).after(editRow); $('#replyrow').hide().fadeIn('fast'); } if ( ! $.browser.msie ) $('#replycontainer').resizable({ handles : 's', axis : 'y', minHeight : 80, stop : function() { $('#replycontainer').width('auto'); } }); setTimeout(function() { var rtop, rbottom, scrollTop, vp, scrollBottom; rtop = $('#replyrow').offset().top; rbottom = rtop + $('#replyrow').height(); scrollTop = window.pageYOffset || document.documentElement.scrollTop; vp = document.documentElement.clientHeight || self.innerHeight || 0; scrollBottom = scrollTop + vp; if ( scrollBottom - 20 < rbottom ) window.scroll(0, rbottom - vp + 35); else if ( rtop - 20 < scrollTop ) window.scroll(0, rtop - 35); $('#replycontent').focus().keyup(function(e){ if (e.which == 27) commentReply.revert(); // close on Escape }); }, 600); return false; }, send : function() { var post = {}; $('#replysubmit .waiting').show(); $('#replyrow input').each(function() { post[ $(this).attr('name') ] = $(this).val(); }); post.content = $('#replycontent').val(); post.id = post.comment_post_ID; post.comments_listing = this.comments_listing; $.ajax({ type : 'POST', url : wpListL10n.url, data : post, success : function(x) { commentReply.show(x); }, error : function(r) { commentReply.error(r); } }); return false; }, show : function(xml) { var r, c, id, bg; if ( typeof(xml) == 'string' ) { this.error({'responseText': xml}); return false; } r = wpAjax.parseAjaxResponse(xml); if ( r.errors ) { this.error({'responseText': wpAjax.broken}); return false; } if ( 'edit-comment' == this.act ) $(this.o).remove(); r = r.responses[0]; c = r.data; $(c).hide() $('#replyrow').after(c); this.o = id = '#comment-'+r.id; this.revert(); this.addEvents($(id)); bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff'; $(id) .animate( { 'backgroundColor':'#CCEEBB' }, 600 ) .animate( { 'backgroundColor': bg }, 600 ); $.fn.wpList.process($(id)) }, error : function(r) { var er = r.statusText; $('#replysubmit .waiting').hide(); if ( r.responseText ) er = r.responseText.replace( /<.[^<>]*?>/g, '' ); if ( er ) $('#replysubmit .error').html(er).show(); } }; $(document).ready(function(){ var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk; setCommentsList(); commentReply.init(); $('span.delete a.delete').click(function(){return false;}); if ( typeof QTags != 'undefined' ) ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more'); if ( typeof $.table_hotkeys != 'undefined' ) { make_hotkeys_redirect = function(which) { return function() { var first_last, l; first_last = 'next' == which? 'first' : 'last'; l = $('.'+which+'.page-numbers'); if (l.length) window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1'; } }; edit_comment = function(event, current_row) { window.location = $('span.edit a', current_row).attr('href'); }; toggle_all = function() { toggleWithKeyboard = true; $('#comments-form thead #cb input:checkbox').click().attr('checked', ''); toggleWithKeyboard = false; } make_bulk = function(value) { return function(event, _) { $('option[value='+value+']').attr('selected', 'selected'); $('form#comments-form')[0].submit(); } }; $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment], ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')], ['shift+d', make_bulk('delete')], ['shift+x', toggle_all], ['shift+u', make_bulk('unapprove')]], {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')} ); } }); })(jQuery); thebrutalagenda/wp-admin/js/postbox.js0000644001761300176130000000505311214074650020633 0ustar mustardamustardavar postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox");e.toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery));thebrutalagenda/wp-admin/js/dashboard.dev.js0000644001761300176130000000321211214074647021642 0ustar mustardamustarda jQuery(document).ready( function($) { var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; // These widgets are sometimes populated via ajax ajaxWidgets = [ 'dashboard_incoming_links', 'dashboard_primary', 'dashboard_secondary', 'dashboard_plugins' ]; ajaxPopulateWidgets = function() { $.each( ajaxWidgets, function() { var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading'); if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); } } ); }; ajaxPopulateWidgets(); postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } ); /* QuickPress */ quickPressLoad = function() { var act = $('#quickpost-action'), t; t = $('#quick-press').submit( function() { $('#dashboard_quick_press h3').append( '' ); $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','disabled'); if ( 'post' == act.val() ) { act.val( 'post-quickpress-publish' ); } $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() { $('#dashboard_quick_press h3 img').remove(); $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled',''); $('#dashboard_quick_press ul').find('li').each( function() { $('#dashboard_recent_drafts ul').prepend( this ); } ).end().remove(); tb_init('a.thickbox'); quickPressLoad(); } ); return false; } ); $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); }; quickPressLoad(); } ); thebrutalagenda/wp-admin/js/postbox.dev.js0000644001761300176130000000745711214074647021430 0ustar mustardamustardavar postboxes; (function($) { postboxes = { add_postbox_toggles : function(page,args) { this.init(page,args); $('.postbox h3, .postbox .handlediv').click( function() { var p = $(this).parent('.postbox'); /* if ( p.hasClass('noclick') ) { p.removeClass('noclick'); return false; } */ p.toggleClass('closed'); postboxes.save_state(page); } ); $('.postbox h3 a').click( function(e) { e.stopPropagation(); } ); $('.hide-postbox-tog').click( function() { var box = $(this).val(); if ( $(this).attr('checked') ) { $('#' + box).show(); if ( $.isFunction( postboxes.pbshow ) ) postboxes.pbshow( box ); } else { $('#' + box).hide(); if ( $.isFunction( postboxes.pbhide ) ) postboxes.pbhide( box ); } postboxes.save_state(page); } ); $('.columns-prefs input[type="radio"]').click(function(){ var num = $(this).val(), i, el, p = $('#poststuff'); if ( p.length ) { // write pages if ( num == 2 ) { p.addClass('has-right-sidebar'); $('#side-sortables').addClass('temp-border'); } else if ( num == 1 ) { p.removeClass('has-right-sidebar'); $('#normal-sortables').append($('#side-sortables').children('.postbox')); } } else { // dashboard for ( i = 4; ( i > num && i > 1 ); i-- ) { el = $('#' + colname(i) + '-sortables'); $('#' + colname(i-1) + '-sortables').append(el.children('.postbox')); el.parent().hide(); } for ( i = 1; i <= num; i++ ) { el = $('#' + colname(i) + '-sortables'); if ( el.parent().is(':hidden') ) el.addClass('temp-border').parent().show(); } $('.postbox-container:visible').css('width', 98/num + '%'); } postboxes.save_order(page); }); function colname(n) { switch (n) { case 1: return 'normal'; break case 2: return 'side'; break case 3: return 'column3'; break case 4: return 'column4'; break default: return ''; } } }, init : function(page, args) { $.extend( this, args || {} ); $('#wpbody-content').css('overflow','hidden'); $('.meta-box-sortables').sortable({ placeholder: 'sortable-placeholder', connectWith: '.meta-box-sortables', items: '.postbox', handle: '.hndle', cursor: 'move', distance: 2, tolerance: 'pointer', forcePlaceholderSize: true, helper: 'clone', opacity: 0.65, start: function(e,ui) { $('body').css({ WebkitUserSelect: 'none', KhtmlUserSelect: 'none' }); /* if ( $.browser.msie ) return; ui.item.addClass('noclick'); */ }, stop: function(e,ui) { postboxes.save_order(page); ui.item.parent().removeClass('temp-border'); $('body').css({ WebkitUserSelect: '', KhtmlUserSelect: '' }); } }); }, save_state : function(page) { var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','), hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(','); $.post(postboxL10n.requestFile, { action: 'closed-postboxes', closed: closed, hidden: hidden, closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), page: page }); }, save_order : function(page) { var postVars, page_columns = $('.columns-prefs input:checked').val() || 0; postVars = { action: 'meta-box-order', _ajax_nonce: $('#meta-box-order-nonce').val(), page_columns: page_columns, page: page } $('.meta-box-sortables').each( function() { postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(','); } ); $.post( postboxL10n.requestFile, postVars ); }, /* Callbacks */ pbshow : false, pbhide : false }; }(jQuery)); thebrutalagenda/wp-admin/js/post.dev.js0000644001761300176130000003477211214074647020717 0ustar mustardamustarda// return an array with any duplicate, whitespace or values removed function array_unique_noempty(a) { var out = []; jQuery.each( a, function(key, val) { val = jQuery.trim(val); if ( val && jQuery.inArray(val, out) == -1 ) out.push(val); } ); return out; } function new_tag_remove_tag() { var id = jQuery( this ).attr( 'id' ), num = id.split('-check-num-')[1], taxbox = jQuery(this).parents('.tagsdiv'), current_tags = taxbox.find( '.the-tags' ).val().split(','), new_tags = []; delete current_tags[num]; jQuery.each( current_tags, function(key, val) { val = jQuery.trim(val); if ( val ) { new_tags.push(val); } }); taxbox.find('.the-tags').val( new_tags.join(',').replace(/\s*,+\s*/, ',').replace(/,+/, ',').replace(/,+\s+,+/, ',').replace(/,+\s*$/, '').replace(/^\s*,+/, '') ); tag_update_quickclicks(taxbox); return false; } function tag_update_quickclicks(taxbox) { if ( jQuery(taxbox).find('.the-tags').length == 0 ) return; var current_tags = jQuery(taxbox).find('.the-tags').val().split(','); jQuery(taxbox).find('.tagchecklist').empty(); shown = false; jQuery.each( current_tags, function( key, val ) { var txt, button_id; val = jQuery.trim(val); if ( !val.match(/^\s+$/) && '' != val ) { button_id = jQuery(taxbox).attr('id') + '-check-num-' + key; txt = 'X ' + val + ' '; jQuery(taxbox).find('.tagchecklist').append(txt); jQuery( '#' + button_id ).click( new_tag_remove_tag ); } }); if ( shown ) jQuery(taxbox).find('.tagchecklist').prepend(''+postL10n.tagsUsed+'
'); } function tag_flush_to_text(id, a) { a = a || false; var taxbox, text, tags, newtags; taxbox = jQuery('#'+id); text = a ? jQuery(a).text() : taxbox.find('input.newtag').val(); // is the input box empty (i.e. showing the 'Add new tag' tip)? if ( taxbox.find('input.newtag').hasClass('form-input-tip') && ! a ) return false; tags = taxbox.find('.the-tags').val(); newtags = tags ? tags + ',' + text : text; // massage newtags = newtags.replace(/\s+,+\s*/g, ',').replace(/,+/g, ',').replace(/,+\s+,+/g, ',').replace(/,+\s*$/g, '').replace(/^\s*,+/g, ''); newtags = array_unique_noempty(newtags.split(',')).join(','); taxbox.find('.the-tags').val(newtags); tag_update_quickclicks(taxbox); if ( ! a ) taxbox.find('input.newtag').val('').focus(); return false; } function tag_save_on_publish() { jQuery('.tagsdiv').each( function(i) { if ( !jQuery(this).find('input.newtag').hasClass('form-input-tip') ) tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id')); } ); } function tag_press_key( e ) { if ( 13 == e.which ) { tag_flush_to_text(jQuery(e.target).parents('.tagsdiv').attr('id')); return false; } }; function tag_init() { jQuery('.ajaxtag').show(); jQuery('.tagsdiv').each( function(i) { tag_update_quickclicks(this); } ); // add the quickadd form jQuery('.ajaxtag input.tagadd').click(function(){tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id'));}); jQuery('.ajaxtag input.newtag').focus(function() { if ( !this.cleared ) { this.cleared = true; jQuery(this).val( '' ).removeClass( 'form-input-tip' ); } }); jQuery('.ajaxtag input.newtag').blur(function() { if ( this.value == '' ) { this.cleared = false; jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); } }); // auto-save tags on post save/publish jQuery('#publish').click( tag_save_on_publish ); jQuery('#save-post').click( tag_save_on_publish ); // catch the enter key jQuery('.ajaxtag input.newtag').keypress( tag_press_key ); } var commentsBox, tagCloud; (function($){ commentsBox = { st : 0, get : function(total, num) { var st = this.st, data; if ( ! num ) num = 20; this.st += num; this.total = total; $('#commentsdiv img.waiting').show(); data = { 'action' : 'get-comments', 'mode' : 'single', '_ajax_nonce' : $('#add_comment_nonce').val(), 'post_ID' : $('#post_ID').val(), 'start' : st, 'num' : num }; $.post(ajaxurl, data, function(r) { r = wpAjax.parseAjaxResponse(r); $('#commentsdiv .widefat').show(); $('#commentsdiv img.waiting').hide(); if ( 'object' == typeof r && r.responses[0] ) { $('#the-comment-list').append( r.responses[0].data ); theList = theExtraList = null; $("a[className*=':']").unbind(); setCommentsList(); if ( commentsBox.st > commentsBox.total ) $('#show-comments').hide(); else $('#show-comments').html(postL10n.showcomm); return; } else if ( 1 == r ) { $('#show-comments').parent().html(postL10n.endcomm); return; } $('#the-comment-list').append(''+wpAjax.broken+''); } ); return false; } }; tagCloud = { init : function() { $('.tagcloud-link').click(function(){ tagCloud.get($(this).attr('id')); $(this).unbind().click(function(){ $(this).siblings('.the-tagcloud').toggle(); return false; }); return false; }); }, get : function(id) { var tax = id.substr(id.indexOf('-')+1); $.post(ajaxurl, {'action':'get-tagcloud','tax':tax}, function(r, stat) { if ( 0 == r || 'success' != stat ) r = wpAjax.broken; r = $('

'+r+'

'); $('a', r).click(function(){ var id = $(this).parents('p').attr('id'); tag_flush_to_text(id.substr(id.indexOf('-')+1), this); return false; }); $('#'+id).after(r); }); } }; $(document).ready(function(){tagCloud.init();}); })(jQuery); jQuery(document).ready( function($) { var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = ''; // for Press This if ( typeof autosave != 'function' ) autosave = function(){}; // postboxes postboxes.add_postbox_toggles('post'); // Editable slugs make_slugedit_clickable(); // prepare the tag UI tag_init(); $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } ); // auto-suggest stuff $('.newtag').each(function(){ var tax = $(this).parents('div.tagsdiv').attr('id'); $(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); }); // category tabs $('#category-tabs a').click(function(){ var t = $(this).attr('href'); $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); $('.tabs-panel').hide(); $(t).show(); if ( '#categories-all' == t ) deleteUserSetting('cats'); else setUserSetting('cats','pop'); return false; }); if ( getUserSetting('cats') ) $('#category-tabs a[href="#categories-pop"]').click(); // Ajax Cat $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); $('#category-add-sumbit').click(function(){$('#newcat').focus();}); syncChecks = function() { if ( noSyncChecks ) return; noSyncChecks = true; var th = jQuery(this), c = th.is(':checked'), id = th.val().toString(); $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); noSyncChecks = false; }; popularCats = $('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(','); catAddBefore = function( s ) { if ( !$('#newcat').val() ) return false; s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize(); return s; }; catAddAfter = function( r, s ) { var newCatParent = jQuery('#newcat_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' ); $(s.what + ' response_data', r).each( function() { var t = $($(this).text()); t.find( 'label' ).each( function() { var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o; $('#' + id).change( syncChecks ).change(); if ( newCatParent.find( 'option[value="' + val + '"]' ).size() ) return; name = $.trim( th.text() ); o = $( '' ).text( name ); newCatParent.prepend( o ); } ); newCatParentOption.attr( 'selected', 'selected' ); } ); }; $('#categorychecklist').wpList( { alt: '', response: 'category-ajax-response', addBefore: catAddBefore, addAfter: catAddAfter } ); $('#category-add-toggle').click( function() { $('#category-adder').toggleClass( 'wp-hidden-children' ); $('#category-tabs a[href="#categories-all"]').click(); return false; } ); $('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = ''; function updateVisibility() { if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { $('#sticky').attr('checked', false); $('#sticky-span').hide(); } else { $('#sticky-span').show(); } if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) { $('#password-span').hide(); } else { $('#password-span').show(); } } function updateText() { var attemptedDate, originalDate, currentDate, publishOn; attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val()); originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val()); currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val()); if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { publishOn = postL10n.publishOnFuture; $('#publish').val( postL10n.schedule ); } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { publishOn = postL10n.publishOn; $('#publish').val( postL10n.publish ); } else { publishOn = postL10n.publishOnPast; $('#publish').val( postL10n.update ); } if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack $('#timestamp').html(stamp); } else { $('#timestamp').html( publishOn + ' ' + $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' + $('#jj').val() + ', ' + $('#aa').val() + ' @ ' + $('#hh').val() + ':' + $('#mn').val() + ' ' ); } if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) { $('#publish').val( postL10n.update ); if ( $('#post_status option[value=publish]').length == 0 ) { $('#post_status').append(''); } $('#post_status option[value=publish]').html( postL10n.privatelyPublished ); $('#post_status option[value=publish]').attr('selected', true); $('.edit-post-status').hide(); } else { if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) { if ( $('#post_status option[value=publish]').length != 0 ) { $('#post_status option[value=publish]').remove(); $('#post_status').val($('#hidden_post_status').val()); } } else { $('#post_status option[value=publish]').html( postL10n.published ); } $('.edit-post-status').show(); } $('#post-status-display').html($('#post_status :selected').text()); if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) { $('#save-post').hide(); } else { $('#save-post').show(); if ( $('#post_status :selected').val() == 'pending' ) { $('#save-post').show().val( postL10n.savePending ); } else { $('#save-post').show().val( postL10n.saveDraft ); } } } $('.edit-visibility').click(function () { if ($('#post-visibility-select').is(":hidden")) { updateVisibility(); $('#post-visibility-select').slideDown("normal"); $('.edit-visibility').hide(); } return false; }); $('.cancel-post-visibility').click(function () { $('#post-visibility-select').slideUp("normal"); $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true); $('#post_password').val($('#hidden_post_password').val()); $('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked')); $('#post-visibility-display').html(visibility); $('.edit-visibility').show(); updateText(); return false; }); $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels $('#post-visibility-select').slideUp("normal"); $('.edit-visibility').show(); updateText(); if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { $('#sticky').attr('checked', false); } if ( true == $('#sticky').attr('checked') ) { sticky = 'Sticky'; } else { sticky = ''; } $('#post-visibility-display').html( postL10n[$('#post-visibility-select input:radio:checked').val() + sticky] ); return false; }); $('#post-visibility-select input:radio').change(function() { updateVisibility(); }); $('.edit-timestamp').click(function () { if ($('#timestampdiv').is(":hidden")) { $('#timestampdiv').slideDown("normal"); $('.edit-timestamp').hide(); } return false; }); $('.cancel-timestamp').click(function() { $('#timestampdiv').slideUp("normal"); $('#mm').val($('#hidden_mm').val()); $('#jj').val($('#hidden_jj').val()); $('#aa').val($('#hidden_aa').val()); $('#hh').val($('#hidden_hh').val()); $('#mn').val($('#hidden_mn').val()); $('.edit-timestamp').show(); updateText(); return false; }); $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels $('#timestampdiv').slideUp("normal"); $('.edit-timestamp').show(); updateText(); return false; }); $('.edit-post-status').click(function() { if ($('#post-status-select').is(":hidden")) { $('#post-status-select').slideDown("normal"); $(this).hide(); } return false; }); $('.save-post-status').click(function() { $('#post-status-select').slideUp("normal"); $('.edit-post-status').show(); updateText(); return false; }); $('.cancel-post-status').click(function() { $('#post-status-select').slideUp("normal"); $('#post_status').val($('#hidden_post_status').val()); $('.edit-post-status').show(); updateText(); return false; }); // Custom Fields $('#the-list').wpList( { addAfter: function( xml, s ) { $('table#list-table').show(); if ( $.isFunction( autosave_update_post_ID ) ) { autosave_update_post_ID(s.parsed.responses[0].supplemental.postid); } }, addBefore: function( s ) { s.data += '&post_id=' + $('#post_ID').val(); return s; } }); }); thebrutalagenda/wp-admin/js/post.js0000644001761300176130000002557111214074650020131 0ustar mustardamustardafunction array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}function new_tag_remove_tag(){var e=jQuery(this).attr("id"),a=e.split("-check-num-")[1],c=jQuery(this).parents(".tagsdiv"),b=c.find(".the-tags").val().split(","),d=[];delete b[a];jQuery.each(b,function(f,g){g=jQuery.trim(g);if(g){d.push(g)}});c.find(".the-tags").val(d.join(",").replace(/\s*,+\s*/,",").replace(/,+/,",").replace(/,+\s+,+/,",").replace(/,+\s*$/,"").replace(/^\s*,+/,""));tag_update_quickclicks(c);return false}function tag_update_quickclicks(b){if(jQuery(b).find(".the-tags").length==0){return}var a=jQuery(b).find(".the-tags").val().split(",");jQuery(b).find(".tagchecklist").empty();shown=false;jQuery.each(a,function(e,f){var c,d;f=jQuery.trim(f);if(!f.match(/^\s+$/)&&""!=f){d=jQuery(b).attr("id")+"-check-num-"+e;c='X '+f+" ";jQuery(b).find(".tagchecklist").append(c);jQuery("#"+d).click(new_tag_remove_tag)}});if(shown){jQuery(b).find(".tagchecklist").prepend(""+postL10n.tagsUsed+"
")}}function tag_flush_to_text(g,b){b=b||false;var e,f,c,d;e=jQuery("#"+g);f=b?jQuery(b).text():e.find("input.newtag").val();if(e.find("input.newtag").hasClass("form-input-tip")&&!b){return false}c=e.find(".the-tags").val();d=c?c+","+f:f;d=d.replace(/\s+,+\s*/g,",").replace(/,+/g,",").replace(/,+\s+,+/g,",").replace(/,+\s*$/g,"").replace(/^\s*,+/g,"");d=array_unique_noempty(d.split(",")).join(",");e.find(".the-tags").val(d);tag_update_quickclicks(e);if(!b){e.find("input.newtag").val("").focus()}return false}function tag_save_on_publish(){jQuery(".tagsdiv").each(function(a){if(!jQuery(this).find("input.newtag").hasClass("form-input-tip")){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))}})}function tag_press_key(a){if(13==a.which){tag_flush_to_text(jQuery(a.target).parents(".tagsdiv").attr("id"));return false}}function tag_init(){jQuery(".ajaxtag").show();jQuery(".tagsdiv").each(function(a){tag_update_quickclicks(this)});jQuery(".ajaxtag input.tagadd").click(function(){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))});jQuery(".ajaxtag input.newtag").focus(function(){if(!this.cleared){this.cleared=true;jQuery(this).val("").removeClass("form-input-tip")}});jQuery(".ajaxtag input.newtag").blur(function(){if(this.value==""){this.cleared=false;jQuery(this).val(postL10n.addTag).addClass("form-input-tip")}});jQuery("#publish").click(tag_save_on_publish);jQuery("#save-post").click(tag_save_on_publish);jQuery(".ajaxtag input.newtag").keypress(tag_press_key)}var commentsBox,tagCloud;(function(a){commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append(''+wpAjax.broken+"")});return false}};tagCloud={init:function(){a(".tagcloud-link").click(function(){tagCloud.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('

'+e+"

");a("a",e).click(function(){var f=a(this).parents("p").attr("id");tag_flush_to_text(f.substr(f.indexOf("-")+1),this);return false});a("#"+c).after(e)})}};a(document).ready(function(){tagCloud.init()})})(jQuery);jQuery(document).ready(function(g){var d=false,i,e,a=g("#timestamp").html(),b=g("#post-visibility-display").html(),h="";if(typeof autosave!="function"){autosave=function(){}}postboxes.add_postbox_toggles("post");make_slugedit_clickable();tag_init();g("#title").blur(function(){if((g("#post_ID").val()>0)||(g("#title").val().length==0)){return}autosave()});g(".newtag").each(function(){var j=g(this).parents("div.tagsdiv").attr("id");g(this).suggest("admin-ajax.php?action=ajax-tag-search&tax="+j,{delay:500,minchars:2,multiple:true,multipleSep:", "})});g("#category-tabs a").click(function(){var j=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g(".tabs-panel").hide();g(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){g('#category-tabs a[href="#categories-pop"]').click()}g("#newcat").one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#category-add-sumbit").click(function(){g("#newcat").focus()});i=function(){if(d){return}d=true;var j=jQuery(this),l=j.is(":checked"),k=j.val().toString();g("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l);d=false};popularCats=g("#categorychecklist-pop :checkbox").map(function(){return parseInt(jQuery(this).val(),10)}).get().join(",");catAddBefore=function(j){if(!g("#newcat").val()){return false}j.data+="&popular_ids="+popularCats+"&"+jQuery("#categorychecklist :checked").serialize();return j};e=function(m,k){var j=jQuery("#newcat_parent"),l=j.find('option[value="-1"]');g(k.what+" response_data",m).each(function(){var n=g(g(this).text());n.find("label").each(function(){var q=g(this),s=q.find("input").val(),t=q.find("input")[0].id,p,r;g("#"+t).change(i).change();if(j.find('option[value="'+s+'"]').size()){return}p=g.trim(q.text());r=g('').text(p);j.prepend(r)});l.attr("selected","selected")})};g("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:e});g("#category-add-toggle").click(function(){g("#category-adder").toggleClass("wp-hidden-children");g('#category-tabs a[href="#categories-all"]').click();return false});g(".categorychecklist .popular-category :checkbox").change(i).filter(":checked").change(),h="";function f(){if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("#post-visibility-select input:radio:checked").val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function c(){var j,l,k,m;j=new Date(g("#aa").val(),g("#mm").val()-1,g("#jj").val(),g("#hh").val(),g("#mn").val());l=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());k=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(j>k&&g("#original_post_status").val()!="future"){m=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(j<=k&&g("#original_post_status").val()!="publish"){m=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{m=postL10n.publishOnPast;g("#publish").val(postL10n.update)}}if(l.toUTCString()==j.toUTCString()){g("#timestamp").html(a)}else{g("#timestamp").html(m+" "+g("#mm option[value="+g("#mm").val()+"]").text()+" "+g("#jj").val()+", "+g("#aa").val()+" @ "+g("#hh").val()+":"+g("#mn").val()+" ")}if(g("#post-visibility-select input:radio:checked").val()=="private"){g("#publish").val(postL10n.update);if(g("#post_status option[value=publish]").length==0){g("#post_status").append('")}g("#post_status option[value=publish]").html(postL10n.privatelyPublished);g("#post_status option[value=publish]").attr("selected",true);g(".edit-post-status").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(g("#post_status option[value=publish]").length!=0){g("#post_status option[value=publish]").remove();g("#post_status").val(g("#hidden_post_status").val())}}else{g("#post_status option[value=publish]").html(postL10n.published)}g(".edit-post-status").show()}g("#post-status-display").html(g("#post_status :selected").text());if(g("#post_status :selected").val()=="private"||g("#post_status :selected").val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("#post_status :selected").val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}}g(".edit-visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){f();g("#post-visibility-select").slideDown("normal");g(".edit-visibility").hide()}return false});g(".cancel-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(b);g(".edit-visibility").show();c();return false});g(".save-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g(".edit-visibility").show();c();if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("#post-visibility-select input:radio:checked").val()+h]);return false});g("#post-visibility-select input:radio").change(function(){f()});g(".edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(".edit-timestamp").hide()}return false});g(".cancel-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g(".edit-timestamp").show();c();return false});g(".save-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g(".edit-timestamp").show();c();return false});g(".edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status").click(function(){g("#post-status-select").slideUp("normal");g(".edit-post-status").show();c();return false});g(".cancel-post-status").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g(".edit-post-status").show();c();return false});g("#the-list").wpList({addAfter:function(j,k){g("table#list-table").show();if(g.isFunction(autosave_update_post_ID)){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+g("#post_ID").val();return j}})});thebrutalagenda/wp-admin/js/edit-comments.js0000644001761300176130000001761211214074650021711 0ustar mustardamustardavar theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&!j.data.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);thebrutalagenda/wp-admin/edit-link-category-form.php0000644001761300176130000000566211214074650023336 0ustar mustardamustarda' . __('Edit Link Category') . ''; $submit_text = __('Update Category'); $form = '
'; $action = 'editedcat'; $nonce_action = 'update-link-category_' . $cat_ID; do_action('edit_link_category_form_pre', $category); } else { $heading = '

' . __('Add Link Category') . '

'; $submit_text = __('Add Category'); $form = ''; $action = 'addcat'; $nonce_action = 'add-link-category'; do_action('add_link_category_form_pre', $category); } /** * @ignore * @since 2.7 * @internal Used to prevent errors in page when no category is being edited. * * @param object $category */ function _fill_empty_link_category(&$category) { if ( ! isset( $category->name ) ) $category->name = ''; if ( ! isset( $category->slug ) ) $category->slug = ''; if ( ! isset( $category->description ) ) $category->description = ''; } _fill_empty_link_category($category); ?>

thebrutalagenda/wp-admin/plugin-editor.php0000644001761300176130000002032311214074650021453 0ustar mustardamustarda'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); $newcontent = stripslashes($_POST['newcontent']); if ( is_writeable($real_file) ) { $f = fopen($real_file, 'w+'); fwrite($f, $newcontent); fclose($f); // Deactivate so we can test it. if ( is_plugin_active($file) || isset($_POST['phperror']) ) { if ( is_plugin_active($file) ) deactivate_plugins($file, true); wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1")); exit; } wp_redirect("plugin-editor.php?file=$file&a=te"); } else { wp_redirect("plugin-editor.php?file=$file"); } exit; break; default: if ( !current_user_can('edit_plugins') ) wp_die('

'.__('You do not have sufficient permissions to edit plugins for this blog.').'

'); if ( isset($_GET['liveupdate']) ) { check_admin_referer('edit-plugin-test_' . $file); $error = validate_plugin($file); if ( is_wp_error($error) ) wp_die( $error ); if ( ! is_plugin_active($file) ) activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error wp_redirect("plugin-editor.php?file=$file&a=te"); exit; } if ( use_codepress() ) wp_enqueue_script( 'codepress' ); // List of allowable extensions $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); if ( ! is_file($real_file) ) { wp_die(sprintf('

%s

', __('No such file exists! Double check the name and try again.'))); } else { // Get the extension of the file if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { $ext = strtolower($matches[1]); // If extension is not in the acceptable list, skip it if ( !in_array( $ext, $editable_extensions) ) wp_die(sprintf('

%s

', __('Files of this type are not editable.'))); } } require_once('admin-header.php'); update_recently_edited(WP_PLUGIN_DIR . '/' . $file); $content = file_get_contents( $real_file ); if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { $functions = wp_doc_link_parse( $content ); $docs_select = ''; } $content = htmlspecialchars( $content ); $codepress_lang = codepress_get_lang($real_file); ?>

fatal error.') ?>

%s (active)'), $file); else echo sprintf(__('Browsing %s (active)'), $file); } else { if ( is_writeable($real_file) ) echo sprintf(__('Editing %s (inactive)'), $file); else echo sprintf(__('Browsing %s (inactive)'), $file); } ?>


    >

Warning: Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?>

"; else echo ""; ?>

the Codex for more information.'); ?>

 
thebrutalagenda/wp-admin/edit-category-form.php0000644001761300176130000000662411214074650022402 0ustar mustardamustardaname ) ) $category->name = ''; if ( ! isset( $category->slug ) ) $category->slug = ''; if ( ! isset( $category->parent ) ) $category->parent = ''; if ( ! isset( $category->description ) ) $category->description = ''; } do_action('edit_category_form_pre', $category); _fill_empty_category($category); ?>



0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>

thebrutalagenda/wp-admin/admin.php0000644001761300176130000001010611214074650017757 0ustar mustardamustardaflush_rules(); update_option( 'db_upgraded', false ); /** * Runs on the next page load after successful upgrade * * @since 2.8 */ do_action('after_db_upgrade'); } elseif ( get_option('db_version') != $wp_db_version ) { wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); exit; } require_once(ABSPATH . 'wp-admin/includes/admin.php'); auth_redirect(); nocache_headers(); update_category_cache(); set_screen_options(); $posts_per_page = get_option('posts_per_page'); $date_format = get_option('date_format'); $time_format = get_option('time_format'); wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback')); wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7')); wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF')); wp_enqueue_script( 'common' ); wp_enqueue_script( 'jquery-color' ); $editing = false; if (isset($_GET['page'])) { $plugin_page = stripslashes($_GET['page']); $plugin_page = plugin_basename($plugin_page); } require(ABSPATH . 'wp-admin/menu.php'); do_action('admin_init'); // Handle plugin admin pages. if (isset($plugin_page)) { if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) { $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); // backwards compatibility for plugins using add_management_page if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { // There could be plugin specific params on the URL, so we need the whole query string if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) $query_string = $_SERVER[ 'QUERY_STRING' ]; else $query_string = 'page=' . $plugin_page; wp_redirect( 'tools.php?' . $query_string ); exit; } } if ( $page_hook ) { do_action('load-' . $page_hook); if (! isset($_GET['noheader'])) require_once(ABSPATH . 'wp-admin/admin-header.php'); do_action($page_hook); } else { if ( validate_file($plugin_page) ) { wp_die(__('Invalid plugin page')); } if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) ) wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); do_action('load-' . $plugin_page); if (! isset($_GET['noheader'])) require_once(ABSPATH . 'wp-admin/admin-header.php'); include(WP_PLUGIN_DIR . "/$plugin_page"); } include(ABSPATH . 'wp-admin/admin-footer.php'); exit(); } else if (isset($_GET['import'])) { $importer = $_GET['import']; if ( ! current_user_can('import') ) wp_die(__('You are not allowed to import.')); if ( validate_file($importer) ) { wp_die(__('Invalid importer.')); } // Allow plugins to define importers as well if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) { wp_die(__('Cannot load importer.')); } include(ABSPATH . "wp-admin/import/$importer.php"); } $parent_file = 'tools.php'; $submenu_file = 'import.php'; $title = __('Import'); if (! isset($_GET['noheader'])) require_once(ABSPATH . 'wp-admin/admin-header.php'); require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); define('WP_IMPORTING', true); call_user_func($wp_importers[$importer][2]); include(ABSPATH . 'wp-admin/admin-footer.php'); // Make sure rules are flushed global $wp_rewrite; $wp_rewrite->flush_rules(); exit(); } else { do_action("load-$pagenow"); } if ( !empty($_REQUEST['action']) ) do_action('admin_action_' . $_REQUEST['action']); ?> thebrutalagenda/wp-admin/rtl.css0000644001761300176130000002563711214074650017510 0ustar mustardamustarda/* 0 - 200 =================================== */ td.available-theme { text-align: right; } #current-theme img { float: right; margin-right: 0; margin-left: 1em; } .quicktags, .search { font-family: Tahoma, "Times New Roman"; } /* 200 - 500 =================================== */ #save-post { float: right; } .preview { float: left; } #sticky-span { margin-left: 0; margin-right: 18px; } #post-body .misc-pub-section { border-right-width: 0; border-left-width: 1; border-right-style: none; border-left-style: solid; float: right; } #post-body .misc-pub-section-last { border-left: 0; } #delete-action { text-align: right; float: right; } #publishing-action { text-align: left; float: left; } .side-info ul { padding-left: 0; padding-right: 18px; } .submit input, .button, .button-primary, .button-secondary, .button-highlighted, #postcustomstuff .submit input { font-family: Tahoma, "Times New Roman"; } #wpcontent select { font-family: Tahoma, "Times New Roman"; } #quicktags { background-position: right top; } /* 500 - 700 =================================== */ #template div { margin-right: 0; margin-left: 190px; } * html #template div { margin-left: 0; } #your-profile legend { font-family: "Times New Roman", Tahoma; } #ajax-response.alignleft { margin-left: 0; margin-right: 2em; } .page-numbers { margin-right: 0; margin-left: 1px; } .column-author img, .column-username img { float: right; margin-right: 0; margin-left: 10px; } .tablenav a.button-secondary { margin: 8px 0 0 8px; } .tablenav .tablenav-pages { float: left; } .tablenav .displaying-num { margin-right: 0; margin-left: 10px; font-family: Tahoma, "Times New Roman"; } #postcustomstuff table input, #postcustomstuff table select, #postcustomstuff table textarea { margin: 8px 8px 8px 0; } /* 700 - 1000 =================================== */ #pass-strength-result { float: right; margin: 12px 1px 5px 5px; } /* Admin Header */ #user_info { float: left; } #header-logo { float: right; margin: 7px 15px 0 0; } #wphead h1 { font-family: "Times New Roman", Tahoma; float: right; } #wphead h1.long-title { font-family: "Times New Roman", Tahoma; } #adminmenu .wp-submenu a { padding-left: 0; padding-right: 12px; border-width: 0 0 0 1px; border-style: none none none solid; font-family: Tahoma, "Times New Roman"; } #adminmenu a.menu-top, #adminmenu .wp-submenu-head { font-family: Tahoma, "Times New Roman"; } #adminmenu img.wp-menu-image { float: right; } .folded #adminmenu img.wp-menu-image { padding: 7px 6px 0 0; } #adminmenu .wp-submenu .wp-submenu-head { padding: 6px 10px 6px 4px; } .folded #adminmenu .wp-submenu { margin: -1px 28px 0 0; } .folded #adminmenu .wp-submenu a { padding-left: 0; padding-right: 10px; } .folded #adminmenu a.wp-has-submenu { margin-left: 0; margin-right: 40px; } #adminmenu .wp-menu-toggle { float: left; padding: 1px 0 0 2px; clear: left; } #adminmenu div.wp-menu-image { float: right; } #wphead-info { margin: 0 15px 0 0; padding-right:0; padding-left: 15px; } /* end side admin menu */ /* 1000 - 1300 =================================== */ #adminmenu #awaiting-mod, #adminmenu span.update-plugins, #sidemenu li a span.update-plugins { font-family: tahoma; margin-left: 0; margin-right: 2px; } #adminmenu li #awaiting-mod span, #adminmenu li span.update-plugins span, #sidemenu li a span.update-plugins span { float: right; } .post-com-count-wrapper { font-family: tahoma; } .column-response .post-com-count { float: right; margin-right: 0; margin-left: 5px; } /* Tables used on comment.php and option/setting pages */ .form-table th, #wpbody-content .describe th { text-align: right; } .form-table input.tog { margin-right: 0; margin-left: 2px; float: right; } .form-table table.color-palette { float: right; } #profile-page .form-table #rich_editing { margin-right: 0; margin-left: 5px; } /* Post Screen */ /* 1300 - 1500 =================================== */ #normal-sortables .postbox .submit { float: left; } #post-body .tagsdiv #newtag { margin-right: 0; margin-left: 5px; } #post-status-info { padding: 0 7px 0 15px; } #comment-status-radio input { margin: 2px 0 5px 3px; } .tagchecklist { margin-left: 0; margin-right: 10px; } .tagchecklist strong { margin-left: 0; margin-right: -8px; } .tagchecklist span { float: right; } .tagchecklist span a { margin: 6px -9px 0 0; float: right; } .ac_results li { text-align: right; } #poststuff h2 { clear: right; } .description, .form-wrap p { font-family: Tahoma, Arial; } /* 1500 - 1800 =================================== */ .meta-box-sortables .postbox .handlediv { float: left; } .howto { font-family: Tahoma, Arial; } .postarea h3 label { float: right; } .postarea #add-media-button { float: left; right: auto; left: 10px; } .wp_themeSkin tr.mceFirst td.mceToolbar { background-position: right top; } #poststuff #edButtonPreview, #poststuff #edButtonHTML { margin: 5px 0 0 5px; float: left; } #poststuff #edButtonHTML { margin-right: 0; margin-left: 15px; } #media-buttons a { padding: 0 10px 5px 0; } .submitbox .submit { text-align: right; } .inside-submitbox #post_status { margin: 2px -2px 2px 0; } .submitbox .submit input { margin-right: 0; margin-left: 4px; } /* Categories */ #category-adder { margin-left: 0; margin-right: 120px; } #post-body ul#category-tabs li.tabs { -moz-border-radius: 0 3px 3px 0; -webkit-border-top-left-radius: 0; -webkit-border-top-right-radius: 3px; -webkit-border-bottom-left-radius: 0; -webkit-border-bottom-right-radius: 3px; border-top-left-radius: 0; border-top-right-radius: 3px; border-bottom-left-radius: 0; border-bottom-right-radius: 3px; } #post-body ul#category-tabs { float: right; text-align: left; margin: 0 0 0 -120px; } #post-body #categorydiv div.tabs-panel, #post-body #linkcategorydiv div.tabs-panel { margin: 0 120px 0 5px; } /* 1800 - 2000 =================================== */ #side-sortables #category-tabs li { padding-right: 0; padding-left: 8px; } #categorydiv ul.categorychecklist ul, #linkcategorydiv ul.categorychecklist ul { margin-left: 0; margin-right: 18px; } /* positioning etc. */ p.search-box { float: left; } #posts-filter fieldset { float: right; margin: 0 0 1em 1.5ex; } #posts-filter fieldset legend { padding: 0 1px .2em 0; } .view-switch { float: left; } .filter { float: right; margin: -5px 10px 0 0; } #the-comment-list td.comment p.comment-author { margin-right: 0; } #the-comment-list p.comment-author img { float: right; margin-right: 0; margin-left: 8px; } .tablenav .delete { margin-right: 0; margin-left: 20px; } td.action-links, th.action-links { text-align: left; } /* 2000 - 2300 =================================== */ .filter .subsubsub { margin-left: 0; margin-right: -10px; } #wp-word-count { margin-right: 10px; } .tool-box .title { font-family: "Times New Roman", Tahoma; } .settings-toggle { text-align: left; margin: 5px 0 15px 7px; } .curtime #timestamp { background-position: right top; padding-left: 0; padding-right: 18px; } /* media popup 0819 */ #sidemenu { margin: -30px 315px 0 15px; float: left; padding-left: 0; padding-right: 10px; } #sidemenu a { float: right; } #replysubmit .button { margin-right: 0; margin-left: 5px; } /* 2300 - 2500 =================================== */ #edithead .inside { float: right; margin: 3px 5px 2px 0; } #replyrow #ed_reply_toolbar input { margin: 1px 1px 1px 2px; } /* show/hide settings */ #screen-meta-links { margin: 0 0 0 9px; } #screen-options-link-wrap, #contextual-help-link-wrap { float: left; font-family: Tahoma, "Times New Roman"; margin: 0 0 0 6px; } .metabox-prefs label { padding-right: 0; padding-left: 15px; } .metabox-prefs label input { margin: 0 2px 0 5px; } .inline-editor .save, .inline-editor .cancel { margin-right: 0; margin-left: 5px; } /* 2500 - 2700 =================================== */ #bulk-titles div a { float: right; margin: 3px -2px 0 3px; } #wpbody-content .filename { margin-left: 0; margin-right: 10px; } #wpbody-content .inline-edit-row fieldset { float: right; } #wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col { border-left: 0 none; border-right: 1px solid; } #wpbody-content .bulk-edit-row .inline-edit-col-bottom { float: left; } .inline-edit-row fieldset label span.title { float: right; } .inline-edit-row fieldset label span.input-text-wrap { margin-left: 0; margin-right: 5em; } .quick-edit-row-post fieldset.inline-edit-col-right label span.title { padding-right: 0; padding-left: 0.5em; } #wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child { margin-right: 0; margin-left: 0.5em; } /* 2700 - 3000 =================================== */ .inline-edit-row fieldset span.title, .inline-edit-row fieldset span.checkbox-title { font-family: Tahoma, "Times New Roman"; } .inline-edit-row fieldset .inline-edit-date { float: right; } .inline-edit-row fieldset ul.cat-checklist label, .inline-edit-row .catshow, .inline-edit-row .cathide, .inline-edit-row #bulk-titles div { font-family: Tahoma, "Times New Roman"; } .quick-edit-row-post fieldset label.inline-edit-status { float: right; } .describe-toggle-on, .describe-toggle-off { float: left; margin-right: 0; margin-left: 20px; } #wpbody-content #media-items .filename { float: right; margin-left: 0; margin-right: 10px; } .media-item .pinkynail { float: right; } #find-posts-response .found-radio { padding: 8px 8px 0 0; } .find-box-buttons { left: auto; right: 12px; } .find-box-search label { padding-right: 0; padding-left: 6px; } /* favorite-actions */ #favorite-actions { float: left; } #favorite-first { padding: 3px 12px 4px 30px; } #favorite-inside { } #favorite-inside a { padding: 3px 10px 3px 5px; } #favorite-toggle { right: auto; left: 0; background:transparent url(images/fav-arrow-rtl.gif) no-repeat 10px -4px; } #utc-time, #local-time { padding-left: 0; padding-right: 25px; font-family: Tahoma, Arial; } .icon32 { float: right; margin: 14px 0 0 6px; } .subtitle { padding-left: 0; padding-right: 25px; } ol { list-style-type:decimal; margin-left:0; margin-right:2em; } /* TinyMCE =================================== */ .clearlooks2 .mceTop .mceLeft { width:100% !important; } /* ltr =================================== */ #author-email, #author-url, #rss-url-1, #edit-slug-box, #post_name, #trackback_url, #metakeyinput, #post_password, #slug, #category_nicename, #link_url, #link_image, #rss_uri, #menu_order, #email, #newcomment_author_url, #pages-exclude, #template textarea, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #siteurl, #home, #admin_email, #gmt_offset, #default_post_edit_rows, #mailserver_url, #mailserver_login, #mailserver_pass, #mailserver_port, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #close_comments_days_old, #comments_per_page, #comment_max_links, #moderation_keys, #blacklist_keys, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #large_size_w, #large_size_h, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #rules { direction: ltr; } thebrutalagenda/wp-admin/theme-editor.php0000644001761300176130000002016011214074650021256 0ustar mustardamustarda'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); $newcontent = stripslashes($_POST['newcontent']); $theme = urlencode($theme); if (is_writeable($real_file)) { //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable $f = fopen($real_file, 'w+'); if ($f !== FALSE) { fwrite($f, $newcontent); fclose($f); $location = "theme-editor.php?file=$file&theme=$theme&a=te"; } else { $location = "theme-editor.php?file=$file&theme=$theme"; } } else { $location = "theme-editor.php?file=$file&theme=$theme"; } $location = wp_kses_no_null($location); $strip = array('%0d', '%0a'); $location = str_replace($strip, '', $location); header("Location: $location"); exit(); break; default: if ( !current_user_can('edit_themes') ) wp_die('

'.__('You do not have sufficient permissions to edit themes for this blog.').'

'); if ( use_codepress() ) wp_enqueue_script( 'codepress' ); require_once('admin-header.php'); update_recently_edited($file); if ( !is_file($real_file) ) $error = 1; if ( !$error && filesize($real_file) > 0 ) { $f = fopen($real_file, 'r'); $content = fread($f, filesize($real_file)); if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { $functions = wp_doc_link_parse( $content ); $docs_select = ''; } $content = htmlspecialchars( $content ); $codepress_lang = codepress_get_lang($real_file); } ?>

$description (%s)" : "%s"; ?>



    ($template_show)" : "$description"; $filedesc = ( $template_file == $file ) ? "$description ($template_show)" : $filedesc; // If we have two files of the same name prefer the one in the Template Directory // This means that we display the correct files for child themes which overload Templates as well as Styles if( array_key_exists($description, $template_mapping ) ) { if ( false !== strpos( $template_file, $template_dir ) ) { $template_mapping[ $description ] = array( $template_file, $filedesc ); } } else { $template_mapping[ $description ] = array( $template_file, $filedesc ); } } ksort( $template_mapping ); while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) : ?>
  • &theme=">

    ($style_show)" : "$description"; $filedesc = ( $style_file == $file ) ? "$description ($style_show)" : $filedesc; $template_mapping[ $description ] = array( $style_file, $filedesc ); } ksort( $template_mapping ); while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) : ?>
  • &theme=">

"; ?>

the Codex for more information.'); ?>

' . __('Oops, no such file exists! Double check the name and try again, merci.') . '

'; } ?>
 
thebrutalagenda/wp-admin/upgrade.php0000644001761300176130000000530411214074650020322 0ustar mustardamustarda > <?php _e( 'WordPress › Upgrade' ); ?>

WordPress

thebrutalagenda/wp-admin/wp-admin.css0000644001761300176130000014733011214074650020416 0ustar mustardamustardatextarea, input, select { border-width: 1px; border-style: solid; -moz-border-radius: 4px; -khtml-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } input[type="checkbox"], input[type="radio"], input[type="image"] { border: 0 none; } p, ul, ol, blockquote, input, select { font-size: 12px; } select option { padding: 2px; } .plugins .name, #pass-strength-result.strong, #pass-strength-result.short, .button-highlighted, #quicktags #ed_strong, #ed_reply_toolbar #ed_reply_strong { font-weight: bold; } .plugins p { margin: 0 4px; padding: 0; } .plugins .desc p { margin: 0 0 8px; } .plugins td.desc { line-height: 1.5em; } .plugins .desc ul, .plugins .desc ol { margin: 0 0 0 2em; } .plugins .desc ul { list-style-type: disc; } .plugins .action-links { white-space: nowrap; } .plugins .row-actions-visible { padding: 0; } .widefat tbody.plugins th.check-column { padding: 7px 0; } .widefat .plugins td, .widefat .plugins th { border-bottom: 0 none; } #install-plugins .plugins td, #install-plugins .plugins th { border-bottom-style: solid; border-bottom-width: 1px; } .plugins .inactive td, .plugins .inactive th, .plugins .active td, .plugins .active th { border-top-style: solid; border-top-width: 1px; padding: 5px 7px 0; } #wpbody-content .plugins .plugin-title { padding-right: 12px; } .plugins .second td, .plugins .second th { border-top: 0 none; padding: 0 7px 5px; } .plugins-php .widefat tfoot th, .plugins-php .widefat tfoot td { border-top-style: solid; border-top-width: 1px; } .import-system { font-size: 16px; } .anchors { margin: 10px 20px 10px 20px; } table#availablethemes { border-spacing: 0; border-width: 1px 0; border-style: solid none; margin: 10px auto; width: 100%; } td.available-theme { vertical-align: top; width: 240px; margin: 0; padding: 20px; text-align: left; } table#availablethemes td { border-width: 0 1px 1px; border-style: none solid solid; } table#availablethemes td.right, table#availablethemes td.left { border-right: 0 none; border-left: 0 none; } table#availablethemes td.bottom { border-bottom: 0 none; } .available-theme a.screenshot { width: 240px; height: 180px; display: block; border-width: 1px; border-style: solid; margin-bottom: 10px; overflow: hidden; } .available-theme img { width: 240px; } .available-theme h3 { margin: 15px 0 5px; } #current-theme { margin: 1em 0 1.5em; } #current-theme a { border-bottom: none; } #current-theme h3 { font-size: 17px; font-weight: normal; margin: 0; } #current-theme .theme-description { margin-top: 5px; } #current-theme img { float: left; border-width: 1px; border-style: solid; margin-right: 1em; margin-bottom: 1.5em; width: 150px; } #TB_window #TB_title a.tb-theme-preview-link, #TB_window #TB_title a.tb-theme-preview-link:visited { font-weight: bold; text-decoration: none; } #TB_window #TB_title { background-color: #222; color: #cfcfcf; } .checkbox { border: none; margin: 0; padding: 0; } .code, code { font-family: Consolas, Monaco, Courier, monospace; } kbd, code { padding: 1px 3px; margin: 0 1px; font-size: 11px; } .commentlist li { padding: 1em 1em .2em; margin: 0; border-bottom-width: 1px; border-bottom-style: solid; } .commentlist li li { border-bottom: 0; padding: 0; } .commentlist p { padding: 0; margin: 0 0 .8em; } .post-categories { display: inline; margin: 0; padding: 0; } .post-categories li { display: inline; } .quicktags, .search { font: 12px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; } .submit { padding: 1.5em 0; margin: 5px 0; -moz-border-radius: 0 0 3px 3px; -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-left-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; } form p.submit a.cancel:hover { text-decoration: none; } #submitdiv h3, #pagesubmitdiv h3 { margin-bottom: 0 !important; } #misc-publishing-actions { padding: 6px 0 16px 0; } .misc-pub-section { padding: 6px; border-bottom-width: 1px; border-bottom-style: solid; } .misc-pub-section-last { border-bottom: 0 none; } #minor-publishing-actions { padding: 6px; text-align: right; } #minor-publishing { border-bottom-width: 1px; border-bottom-style: solid; } #save-post { float: left; } .preview { float: right; } #major-publishing-actions { padding: 6px; clear: both; border-top: none; } #minor-publishing-actions input, #major-publishing-actions input, #minor-publishing-actions .preview { min-width: 80px; text-align: center; } #delete-action { line-height: 25px; vertical-align: middle; text-align: left; float: left; } #publishing-action { text-align: right; float: right; } #post-body #minor-publishing { padding-bottom: 10px; } #post-body #misc-publishing-actions { padding: 0; } #post-body .misc-pub-section { border-right-width: 1px; border-right-style: solid; border-bottom: 0 none; min-height: 30px; float: left; max-width: 32%; } #post-body .misc-pub-section-last { border-right: 0; } #sticky-span { margin-left: 18px; } #post-status-display, #post-visibility-display { font-weight: bold; } .side-info { margin: 0; padding: 4px; font-size: 11px; } .side-info h5 { padding-bottom: 7px; font-size: 14px; margin: 12px 2px 5px; border-bottom-width: 1px; border-bottom-style: solid; } .side-info ul { margin: 0; padding-left: 18px; list-style: square; } .submit input, .button, .button-primary, .button-secondary, .button-highlighted, #postcustomstuff .submit input { text-decoration: none; font-size: 11px !important; line-height: 16px; padding: 2px 8px; cursor: pointer; border-width: 1px; border-style: solid; -moz-border-radius: 11px; -khtml-border-radius: 11px; -webkit-border-radius: 11px; border-radius: 11px; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; -khtml-box-sizing: content-box; box-sizing: content-box; } a.button, a.button-primary, a.button-secondary { line-height: 1.2em; -webkit-border-radius: 10px; padding: 4px 10px; white-space: nowrap; } #doaction, #doaction2 { margin-right: 8px; } .tablenav select[name="action"], .tablenav select[name="action2"] { width: 120px; } .tablenav select[name="m"] { width: 120px; } .tablenav select#cat { width: 150px; } #wpcontent select { padding: 2px; height: 2em; font-size: 11px; } #wpcontent option { padding: 2px; } .approve { display: none; } .unapproved .approve, .spam .approve { display: inline; } .unapproved .unapprove { display: none; } .narrow { width: 70%; margin-bottom: 40px; } .narrow p { line-height: 150%; } textarea.all-options, input.all-options { width: 250px; } #namediv table { width: 100%; } #namediv td.first { width: 10px; white-space: nowrap; } #namediv input { width: 98%; } #namediv p { margin: 10px 0; } #wpbody-content .metabox-holder { padding-top: 10px; } #content { margin: 0; width: 100%; } #editorcontainer #content { padding: 6px; line-height: 150%; border: 0 none; outline: none; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -khtml-box-sizing: border-box; box-sizing: border-box; } #editorcontainer, #quicktags { border-style: solid; border-width: 1px; border-collapse: separate; -moz-border-radius: 6px 6px 0 0; -webkit-border-top-right-radius: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-right-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-right-radius: 6px; border-top-left-radius: 6px; } #quicktags { padding: 0; margin-bottom: -3px; border-bottom-width: 3px; background-image: url("images/ed-bg.gif"); background-position: left top; background-repeat: repeat-x; } #quicktags #ed_toolbar { padding: 2px 4px 0; } #ed_toolbar input, #ed_reply_toolbar input { margin: 3px 1px 4px; line-height: 18px; display: inline-block; min-width: 26px; padding: 2px 4px; font-size: 12px; } #ed_reply_toolbar input { margin: 1px 2px 1px 1px; } #quicktags #ed_link, #ed_reply_toolbar #ed_reply_link { text-decoration: underline; } #quicktags #ed_del, #ed_reply_toolbar #ed_reply_del { text-decoration: line-through; } #quicktags #ed_em, #ed_reply_toolbar #ed_reply_em { font-style: italic; } #excerpt, .attachmentlinks { margin: 0; height: 4em; width: 98%; } /* post meta postbox */ #postcustomstuff table, #postcustomstuff input, #postcustomstuff textarea { border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } #postcustomstuff .updatemeta, #postcustomstuff .deletemeta { margin: auto; } #postcustomstuff thead th { padding: 5px 8px 8px; } #postcustom #postcustomstuff .submit, #pagecustomdiv #postcustomstuff .submit { border: 0 none; float: none; padding: 5px 8px; } #side-sortables #postcustom #postcustomstuff .submit, #side-sortables #pagecustomdiv #postcustomstuff .submit { padding: 0 5px; } #side-sortables #postcustom #postcustomstuff td.left input, #side-sortables #pagecustomdiv #postcustomstuff td.left input { margin: 3px 3px 0; } #side-sortables #postcustom #postcustomstuff #the-list textarea, #side-sortables #pagecustomdiv #postcustomstuff #the-list textarea { height: 85px; margin: 3px; } #postcustomstuff table { margin: 0; width: 100%; border-width: 1px; border-style: solid; border-spacing: 0; } #postcustomstuff table input, #postcustomstuff table select, #postcustomstuff table textarea { width: 95%; margin: 8px 0 8px 8px; } #postcustomstuff th.left, #postcustomstuff td.left { width: 38%; } #postcustomstuff .submit input { width: auto; } #postcustomstuff #newmeta .submit { padding: 0 8px; } #postcustomstuff table #addmetasub { width: auto; } #postcustomstuff #newmetaleft { vertical-align: top; } #postcustomstuff #newmetaleft a { padding: 0 10px; text-decoration: none; } #save { width: 15em; } #template div { margin-right: 190px; } * html #template div { margin-right: 0; } /* A handy div class for hiding controls. Some browsers will disable them when you set display: none; */ .zerosize { height: 0; width: 0; margin: 0; border: 0; padding: 0; overflow: hidden; position: absolute; } * html #themeselect { padding: 0 3px; height: 22px; } #your-profile legend { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-size: 22px; } #your-profile #rich_editing { border: none; } #howto { font-size: 11px; margin: 0 5px; display: block; } #ajax-response.alignleft { margin-left: 2em; } div.nav { height: 2em; padding: 7px 10px; vertical-align: text-top; margin: 5px 0; } .nav .button-secondary { padding: 2px 4px; } a.page-numbers { border-bottom-style: solid; border-bottom-width: 2px; font-weight: bold; margin-right: 1px; padding: 0 2px; } p.pagenav { margin: 0; display: inline; } .pagenav span { font-weight: bold; margin: 0 6px; } .row-title { font-size: 12px !important; font-weight: bold; } .column-comment p { margin: 0.6em 0; } .column-author img, .column-username img { float: left; margin-right: 10px; margin-top: 3px; } .tablenav a.button-secondary { display: block; margin: 3px 8px 0 0; } .tablenav { clear: both; height: 30px; margin: 6px 0 4px; vertical-align: middle; } .tablenav .tablenav-pages { float: right; display: block; cursor: default; height: 30px; line-height: 30px; font-size: 11px; } .tablenav .tablenav-pages a, .tablenav-pages span.current { text-decoration: none; border: none; padding: 3px 6px; border-width: 1px; border-style: solid; -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } .tablenav .displaying-num { margin-right: 10px; font-size: 12px; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style: italic; } .tablenav .actions { padding: 2px 8px 0 0; } td.media-icon { vertical-align: middle; text-align: center; width: 80px; } td.media-icon img { max-width: 80px; max-height: 60px; } #update-nag { line-height: 29px; font-size: 12px; text-align: center; } #update-nag { border-width: 1px 0; border-style: solid none; } .plugins .plugin-update { padding: 0; } .plugin-update .update-message { margin: 0 10px 8px 31px; font-weight: bold; } #pass-strength-result { border-style: solid; border-width: 1px; float: left; margin: 12px 5px 5px 1px; padding: 3px 5px; text-align: center; width: 200px; } .row-actions { visibility: hidden; padding: 2px 0 0; } tr:hover .row-actions, div.comment-item:hover .row-actions { visibility: visible; } .row-actions-visible { padding: 2px 0 0; cursor: pointer; } /* Admin Header */ #wphead-info { margin: 0 0 0 15px; padding-right: 15px; } #user_info { float: right; font-size: 12px; line-height: 46px; height: 46px; } #user_info p { margin: 0; padding: 0; line-height: 46px; } #wphead { height: 46px; } #wphead a, #adminmenu a, #sidemenu a, #taglist a, #catlist a, #show-settings a { text-decoration: none; } #header-logo { float: left; margin: 7px 0 0 15px; } #wphead h1 { font: normal 22px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; padding: 10px 8px 5px; margin: 0; float: left; } #wphead h1.long-title { font: normal 18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; padding: 12px 10px 5px; } #wphead #site-visit-button { background-repeat:repeat-x; background-position:0 0; -moz-border-radius:3px; -webkit-border-radius:3px; -khtml-border-radius:3px; border-radius:3px; cursor:pointer; /* to keep IE happy */ display:-moz-inline-stack; /* to keep FF2 happy */ display:inline-block; font-size: 50%; font-style:normal; line-height:17px; margin-left:5px; padding:0 6px; vertical-align:middle; } #wphead h1 a:hover { text-decoration:none; } #wphead h1 a:hover #site-title { text-decoration:underline; } /* side admin menu */ #adminmenu * { -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; } #adminmenu .wp-submenu { display: none; list-style: none; padding: 0; margin: 0; position: relative; z-index: 2; border-width: 1px 0 0; border-style: solid none none; } #adminmenu .wp-submenu a { font: normal 11px/18px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; } #adminmenu .wp-submenu li.current, #adminmenu .wp-submenu li.current a, #adminmenu .wp-submenu li.current a:hover { font-weight: bold; } #adminmenu a.menu-top, #adminmenu .wp-submenu-head { font: normal 13px/18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; } #adminmenu div.wp-submenu-head { display: none; } .folded #adminmenu div.wp-submenu-head, .folded #adminmenu li.wp-has-submenu div.sub-open { display: block; } .folded #adminmenu a.menu-top, .folded #adminmenu .wp-submenu, .folded #adminmenu li.wp-menu-open .wp-submenu, .folded #adminmenu div.wp-menu-toggle { display: none; } #adminmenu li.wp-menu-open .wp-submenu, .no-js #adminmenu .open-if-no-js .wp-submenu { display: block; } #adminmenu div.wp-menu-image { float: left; width: 28px; height: 28px; } #adminmenu li { margin: 0; padding: 0; cursor: pointer; } #adminmenu a { display: block; line-height: 18px; padding: 1px 5px 3px; } #adminmenu li.menu-top { min-height: 26px; } #adminmenu a.menu-top { line-height: 18px; min-width: 10em; padding: 5px 5px; border-width: 1px 1px 0; border-style: solid solid none; } #adminmenu .wp-submenu a { margin: 0; padding-left: 12px; border-width: 0 1px 0 0; border-style: none solid none none; } #adminmenu .menu-top-last ul.wp-submenu { border-width: 0 0 1px; border-style: none none solid; } #adminmenu .wp-submenu li { padding: 0; margin: 0; } .folded #adminmenu li.menu-top { width: 28px; height: 30px; overflow: hidden; border-width: 1px 1px 0; border-style: solid solid none; } #adminmenu .menu-top-first a.menu-top, .folded #adminmenu li.menu-top-first, #adminmenu .wp-submenu .wp-submenu-head { border-width: 1px 1px 0; border-style: solid solid none; -moz-border-radius-topleft :6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-right-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-right-radius: 6px; border-top-left-radius: 6px; } #adminmenu .menu-top-last a.menu-top, .folded #adminmenu li.menu-top-last { border-width: 1px; border-style: solid; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-bottom-left-radius: 6px; -khtml-border-bottom-right-radius: 6px; -khtml-border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; } #adminmenu li.wp-menu-open a.menu-top-last { border-bottom: 0 none; -moz-border-radius-bottomright: 0; -moz-border-radius-bottomleft: 0; -webkit-border-bottom-right-radius: 0; -webkit-border-bottom-left-radius: 0; -khtml-border-bottom-right-radius: 0; -khtml-border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } #adminmenu img.wp-menu-image { float: left; padding: 8px 6px 0; opacity: 0.6; filter: alpha(opacity=60); } #adminmenu li.menu-top:hover img.wp-menu-image, #adminmenu li.wp-has-current-submenu img.wp-menu-image { opacity: 1; filter: alpha(opacity=100); } .folded #adminmenu img.wp-menu-image { padding: 7px 0 0 6px; } #adminmenu li.wp-menu-separator { height: 21px; padding: 0; margin: 0; } #adminmenu a.separator { cursor: w-resize; height: 20px; padding: 0; } .folded #adminmenu a.separator { cursor: e-resize; } #adminmenu .wp-menu-separator-last { height: 10px; width: 1px; } #adminmenu .wp-submenu .wp-submenu-head { border-width: 1px; border-style: solid; padding: 6px 4px 6px 10px; cursor: default; } .folded #adminmenu .wp-submenu { position: absolute; margin: -1px 0 0 28px; padding: 0 8px 8px; z-index: 999; border: 0 none; } .folded #adminmenu .wp-submenu ul { width: 140px; border-width: 0 0 1px; border-style: none none solid; } .folded #adminmenu .wp-submenu li.wp-first-item { border-top: 0 none; } .folded #adminmenu .wp-submenu a { padding-left: 10px; } .folded #adminmenu a.wp-has-submenu { margin-left: 40px; } #adminmenu li.menu-top-last .wp-submenu ul { border-width: 0 0 1px; border-style: none none solid; } #adminmenu .wp-menu-toggle { width: 22px; clear: right; float: right; margin: 1px 0 0; height: 27px; padding: 1px 2px 0 0; cursor: default; } #adminmenu li.wp-has-current-submenu ul { border-bottom-width: 1px; border-bottom-style: solid; } #adminmenu .wp-menu-image a { height: 24px; } #adminmenu .wp-menu-image img { padding: 6px 0 0 1px; } /* end side admin menu */ /* comments/plugins bubble in menu */ #adminmenu #awaiting-mod, #adminmenu span.update-plugins, #sidemenu li a span.update-plugins { position: absolute; font-family: Helvetica, Arial, sans-serif; font-size: 7pt; font-weight: bold; margin-top: 2px; margin-left: 2px; -moz-border-radius: 7px; -khtml-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px; } #adminmenu li #awaiting-mod span, #adminmenu li span.update-plugins span, #sidemenu li a span.update-plugins span { float: left; display: block; height: 1.6em; line-height: 1.6em; padding: 0 6px; } #adminmenu li span.count-0, #sidemenu li a .count-0 { display: none; } /* end menu stuff */ /* comments bubble */ .post-com-count-wrapper { min-width: 22px; font-family: Helvetica, Arial, sans-serif; } .post-com-count { height: 1.3em; line-height: 1.1em; display: block; text-decoration: none; padding: 0 0 6px; cursor: pointer; background-position: center -80px; background-repeat: no-repeat; } .post-com-count span { font-size: 9px; font-weight: bold; height: 1.7em; line-height: 1.70em; min-width: 0.7em; padding: 0 6px; display: inline-block; cursor: pointer; -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } strong .post-com-count { background-position: center -55px; } .post-com-count:hover { background-position: center -3px; } .column-response .post-com-count { float: left; margin-right: 5px; text-align: center; } .response-links { float: left; } #the-comment-list .attachment-80x60 { padding: 4px 8px; } /* Admin Footer */ #footer { margin-top: -45px; } #footer, #footer a { font-size: 12px; font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style: italic; } #footer p { margin: 0; padding: 15px; line-height: 15px; } #footer a { text-decoration: none; } #footer a:hover { text-decoration: underline; } /* Tables used on comment.php and option/setting pages */ .form-table { border-collapse: collapse; margin-top: 0.5em; width: 100%; margin-bottom: -8px; clear: both; } .form-table td, #wpbody-content .describe td { margin-bottom: 9px; padding: 4px 10px 12px; line-height: 20px; font-size: 11px; } .form-table th, .form-wrap label { font-weight: normal; text-shadow: rgba(255,255,255,1) 0 1px 0; } .form-table th, #wpbody-content .describe th { vertical-align: top; text-align: left; padding: 10px; width: 200px; } .form-table th.th-full { width: auto; } .form-table input, .form-table textarea, #wpbody-content .describe input, #wpbody-content .describe textarea { border-width: 1px; border-style: solid; } .form-table div.color-option { display: block; clear: both; margin-top: 12px; } .form-table input.tog { margin-top: 2px; margin-right: 2px; float: left; } .form-table table.color-palette { vertical-align: bottom; float: left; margin: -12px 3px 11px; } .form-table .color-palette td { border-width: 1px 1px 0; border-style: solid solid none; height: 10px; line-height: 20px; width: 10px; } textarea.large-text { width: 99%; } .form-table input.regular-text, #adduser .form-field input { width: 25em; } .form-table input.small-text { width: 50px; } #profile-page .form-table textarea { width: 500px; margin-bottom: 6px; } #profile-page .form-table #rich_editing { margin-right: 5px } .form-table .pre { padding: 8px; margin: 0; } .pre { /* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */ white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } table.form-table td .updated { font-size: 13px; } /* divs for cats and tags pages */ .form-wrap { margin: 10px 0; width: 97%; } .form-wrap p, .form-wrap label { font-size: 11px; } .form-wrap label { display: block; padding: 2px; font-size: 12px; } .form-field input, .form-field textarea { border-style: solid; border-width: 1px; width: 95%; } p.description, .form-wrap p { margin: 2px 0 5px; } p.help, p.description, span.description, .form-wrap p { font-size: 12px; font-style: italic; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; } .form-wrap .form-field { margin: 0 0 10px; padding: 8px; } .col-wrap h3 { margin: 12px 0; font-size: 1.1em; } .col-wrap p.submit { margin-top: -10px; } .tagcloud { width: 97%; margin: 0 0 40px; text-align: justify; } .tagcloud h3 { margin: 2px 0 12px; } /* Post Screen */ #post-body #normal-sortables { min-height: 50px; } #post-body #advanced-sortables { min-height: 20px; } .postbox { position: relative; min-width: 255px; width: 99.5%; } #trackback_url { width: 99%; } #normal-sortables .postbox .submit { background: transparent none; border: 0 none; float: right; padding: 0 12px; margin: 0; } #normal-sortables .postbox #replyrow .submit { float: none; margin: 0; padding: 3px 7px; } #side-sortables .submitbox .submit input, #side-sortables .submitbox .submit .preview, #side-sortables .submitbox .submit a.preview:hover { border: 0 none; } #side-sortables .inside-submitbox .insidebox, .stuffbox .insidebox { margin: 11px 0; } #side-sortables .comments-box, #normal-sortables .comments-box { border: 0 none; } #side-sortables .comments-box thead th, #normal-sortables .comments-box thead th { background: transparent; padding: 0 7px 4px; font-style: italic; } #commentsdiv img.waiting { padding-left: 5px; vertical-align: middle; } #post-body .tagsdiv #newtag { margin-right: 5px; width: 16em; } #side-sortables input#post_password { width: 94% } #side-sortables .tagsdiv #newtag { width: 68%; } #post-status-info { border-width: 0 1px 1px; border-style: none solid solid; width: 100%; -moz-border-radius: 0 0 6px 6px; -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -khtml-border-bottom-left-radius: 6px; -khtml-border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; } #post-status-info td { font-size: 11px; } .autosave-info { padding: 2px 15px 2px 2px; text-align: right; } #editorcontent #post-status-info { border: none; } #post-body .wp_themeSkin .mceStatusbar a.mceResize { display: block; background: transparent url(images/resize.gif) no-repeat scroll right bottom; width: 12px; cursor: se-resize; margin: 0 2px; position: relative; top: 22px; } #pagesubmitdiv div.inside, #linksubmitdiv div.inside, div.inside { padding: 0; margin: 0; } #comment-status-radio p { margin: 3px 0 5px; } #comment-status-radio input { margin: 2px 3px 5px 0; vertical-align: middle; } #comment-status-radio label { padding: 5px 0; } .tagchecklist { margin-left: 10px; font-size: 12px; overflow: auto; } .tagchecklist strong { margin-left: -8px; position: absolute; } .tagchecklist span { margin-right: 25px; display: block; float: left; font-size: 11px; line-height: 1.8em; white-space: nowrap; cursor: default; } .tagchecklist span a { margin: 6px 0pt 0pt -9px; cursor: pointer; width: 10px; height: 10px; display: block; float: left; text-indent: -9999px; overflow: hidden; position: absolute; } .howto { font-style: italic; display: block; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; } .ac_results { padding: 0; margin: 0; list-style: none; position: absolute; z-index: 10000; display: none; border-width: 1px; border-style: solid; } .ac_results li { padding: 2px 5px; white-space: nowrap; text-align: left; } .ac_over { cursor: pointer; } .ac_match { text-decoration: underline; } #poststuff h2 { margin-top: 20px; font-size: 1.5em; margin-bottom: 15px; padding: 0 0 3px; clear: left; } .widget .widget-top, .postbox h3 { cursor: move; -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; } .postbox .hndle span { padding: 6px 0; } .postbox .hndle { cursor: move; } .hndle a { font-size: 11px; font-weight: normal; } #dashboard-widgets .meta-box-sortables { margin: 0 5px; } .postbox .handlediv { float: right; width: 23px; height: 26px; } .sortable-placeholder { border-width: 1px; border-style: dashed; margin-bottom: 20px; } #poststuff h3, .metabox-holder h3 { font-size: 12px; font-weight: bold; padding: 7px 9px; margin: 0; line-height: 1; } .widget, .postbox, .stuffbox { margin-bottom: 20px; border-width: 1px; border-style: solid; line-height: 1; -moz-border-radius: 6px; -khtml-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } .widget .widget-top, .postbox h3, .postbox h3, .stuffbox h3 { -moz-border-radius: 6px 6px 0 0; -webkit-border-top-right-radius: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-right-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-right-radius: 6px; border-top-left-radius: 6px; } .postbox.closed h3 { -moz-border-radius-bottomleft:4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright:4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } .postbox table.form-table { margin-bottom: 0; } .postbox input[type="text"], .postbox textarea, .stuffbox input[type="text"], .stuffbox textarea { border-width: 1px; border-style: solid; } #poststuff .inside, #poststuff .inside p { font-size: 11px; margin: 6px; } #poststuff .inside .submitbox p { margin: 1em 0; } #post-visibility-select { line-height: 1.5em; margin-top: 3px; } #poststuff #submitdiv .inside { margin: 0; } #titlediv, #poststuff .postarea { margin-bottom: 20px; } #titlediv { margin-bottom: 20px; } #titlediv label { cursor: text; } #titlediv div.inside { margin: 0; } #poststuff #titlewrap { border: 0; padding: 0; } #titlediv #title { padding: 3px 4px; border-width: 1px; border-style: solid; -moz-border-radius: 6px; -khtml-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; font-size: 1.7em; width: 100%; outline: none; } #poststuff .inside-submitbox, #side-sortables .inside-submitbox { margin: 0 3px; font-size: 11px; } input#link_description, input#link_url { width: 98%; } #pending { background: 0 none; border: 0 none; padding: 0; font-size: 11px; margin-top: -1px; } #edit-slug-box { height: 1em; margin-top: 8px; padding: 0 7px; } #editable-post-name-full { display: none; } #editable-post-name input { width: 16em; } .postarea h3 label { float: left; } .postarea #add-media-button { float: right; margin: 7px 0pt 0pt; position: relative; right: 10px; } #poststuff #editor-toolbar { height: 30px; } .wp_themeSkin tr.mceFirst td.mceToolbar { border-width: 0 0 1px; border-style: none none solid; } #edButtonPreview, #edButtonHTML { height: 18px; margin: 5px 5px 0 0; padding: 4px 5px 2px; float: right; cursor: pointer; border-width: 1px; border-style: solid; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-right-radius: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; } .js .theEditor { color: white; } #poststuff #edButtonHTML { margin-right: 15px; } #media-buttons { cursor: default; padding: 8px 8px 0; } #media-buttons a { cursor: pointer; padding: 0 0 5px 10px; } #media-buttons img { vertical-align: middle; } .submitbox .submit { text-align: left; padding: 12px 10px 10px; font-size: 11px; } .submitbox .submitdelete { border-bottom-width: 1px; border-bottom-style: solid; text-decoration: none; padding: 1px 2px; } .inside-submitbox #post_status { margin: 2px 0 2px -2px; } .submitbox .submit a:hover { border-bottom-width: 1px; border-bottom-style: solid; } .submitbox .submit input { margin-bottom: 8px; margin-right: 4px; padding: 6px; } #post-status-select { line-height: 2.5em; margin-top: 3px; } /* Categories */ #category-adder { margin-left: 120px; padding: 4px 0; } #category-adder h4 { margin: 0 0 8px; } #side-sortables #category-adder { margin: 0; } #post-body #category-add input, #category-add select { width: 30%; } #side-sortables #category-add input { width: 94%; } #side-sortables #category-add select { width: 100%; } #category-add input#category-add-sumbit { width: auto; } #post-body ul#category-tabs { float: left; width: 120px; text-align: right; /* Negative margin for the sake of those without JS: all tabs display */ margin: 0 -120px 0 5px; padding: 0; } #post-body ul#category-tabs li { padding: 8px; } #post-body ul#category-tabs li.tabs { -moz-border-radius: 3px 0 0 3px; -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; } #post-body ul#category-tabs li.tabs a { font-weight: bold; text-decoration: none; } #categorydiv div.tabs-panel, #linkcategorydiv div.tabs-panel { height: 150px; overflow: auto; padding: 0.5em 0.9em; border-style: solid; border-width: 1px; } #post-body #categorydiv div.tabs-panel, #post-body #linkcategorydiv div.tabs-panel { margin: 0 5px 0 125px; } #side-sortables #category-tabs li { display: inline; padding-right: 8px; } #side-sortables #category-tabs a { text-decoration: none; } #side-sortables #category-tabs { margin-bottom: 3px; } #categorydiv ul, #linkcategorydiv ul { list-style: none; padding: 0; margin: 0; } #categorydiv ul.categorychecklist ul, #linkcategorydiv ul.categorychecklist ul { margin-left: 18px; } ul.categorychecklist li { margin: 0; padding: 0; line-height: 19px; } #category-adder h4 { margin-top: 4px; margin-bottom: 0px; } #categorydiv .tabs-panel { border-width: 3px; border-style: solid; } ul#category-tabs { margin-top: 12px; } ul#category-tabs li.tabs { border-style: solid solid none; border-width: 1px 1px 0; } #post-body #category-tabs li.tabs { border-style: solid none solid solid; border-width: 1px 0 1px 1px; margin-right: -1px; } ul#category-tabs li { padding: 5px 8px; -moz-border-radius: 3px 3px 0 0; -webkit-border-top-left-radius: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-left-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; } /* positioning etc. */ form#tags-filter { position: relative; } p.search-box { float: right; margin: -5px 0 0; } .screen-per-page { width: 3em; } #posts-filter fieldset { float: left; margin: 0 1.5ex 1em 0; padding: 0; } #posts-filter fieldset legend { padding: 0 0 .2em 1px; } .bordertitle { padding-bottom: 5px; border-bottom-width: 1px; border-bottom-style: solid; } /* Edit posts */ td.post-title strong, td.plugin-title strong { display: block; margin-bottom: .2em; } td.post-title p, td.plugin-title p { margin: 6px 0; } td.plugin-title { white-space: nowrap; } /* Global classes */ .wp-hidden-children .wp-hidden-child, .ui-tabs-hide, #codepress-off { display: none; } .commentlist .avatar { vertical-align: text-top; } .defaultavatarpicker .avatar { margin: 2px 0; vertical-align: middle; } body.wp-admin { min-width: 785px; } .view-switch { float: right; margin: 6px 8px 0; } .view-switch a { text-decoration: none; } .filter { float: left; margin: -5px 0 0 10px; } .filter .subsubsub { margin-left: -10px; margin-top: 13px; } #the-comment-list td.comment p.comment-author { margin-top: 0; margin-left: 0; } #the-comment-list p.comment-author img { float: left; margin-right: 8px; } #the-comment-list p.comment-author strong a { border: none; } #the-comment-list td { vertical-align: top; } #the-comment-list td.comment { word-wrap: break-word; } #the-comment-list .check-column { padding-top: 8px; } #templateside ul li a { text-decoration: none; } .indicator-hint { padding-top: 8px; } #display_name { width: 15em; } .tablenav .delete { margin-right: 20px; } td.action-links, th.action-links { text-align: right; } /* Diff */ table.diff { width: 100%; } table.diff col.content { width: 50%; } table.diff tr { background-color: transparent; } table.diff td, table.diff th { padding: .5em; font-family: Consolas, Monaco, Courier, monospace; border: none; } table.diff .diff-deletedline del, table.diff .diff-addedline ins { text-decoration: none; } #wp-word-count { display: block; padding: 2px 7px; } fieldset { border: 0; padding: 0; margin: 0; } .tool-box { margin: 15px 0 35px; } .tool-box .buttons { margin: 15px 0; } .tool-box .title { margin: 8px 0; font: 18px/24px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; } .pressthis a { font-size: 1.2em; } #wp_editbtns, #wp_gallerybtns { padding: 2px; position: absolute; display: none; z-index: 999998; } #wp_editimgbtn, #wp_delimgbtn, #wp_editgallery, #wp_delgallery { margin: 2px; padding: 2px; border-width: 1px; border-style: solid; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .settings-toggle { text-align: right; margin: 5px 7px 15px 0; font-size: 12px; } .settings-toggle h3 { margin: 0; } #timestampdiv select { height: 20px; line-height: 20px; padding: 0; } #jj, #hh, #mn { width: 2em; padding: 1px; font-size: 12px; } #aa { width: 3.4em; padding: 1px; font-size: 12px; } .curtime #timestamp { background-repeat: no-repeat; background-position: left top; padding-left: 18px; } #timestampdiv { padding-top: 5px; line-height: 23px; } #timestampdiv p { margin: 8px 0 6px; } #timestampdiv input { border-width: 1px; border-style: solid; } /* media popup 0819 */ #sidemenu { margin: -30px 15px 0 315px; list-style: none; position: relative; float: right; padding-left: 10px; font-size: 12px; } #sidemenu a { padding: 0 7px; display: block; float: left; line-height: 28px; border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; } #sidemenu li { display: inline; line-height: 200%; list-style: none; text-align: center; white-space: nowrap; margin: 0; padding: 0; } #sidemenu a.current { font-weight: normal; padding-left: 6px; padding-right: 6px; -moz-border-radius: 4px 4px 0 0; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-left-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-width: 1px; border-style: solid; } #sidemenu { margin: -30px 15px 0 315px; list-style: none; position: relative; float: right; padding-left: 10px; font-size: 12px; } #sidemenu a { padding: 0 7px; display: block; float: left; line-height: 28px; border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; } #sidemenu li a .count-0 { display: none; } /* reply to comments */ #replyrow { font-size: 11px; } #replyrow input { border-width: 1px; border-style: solid; } #replyrow td { padding: 2px; } #replyrow #editorcontainer { border: 0 none; } #replysubmit { margin: 0; padding: 3px 7px; } #replysubmit img.waiting, .inline-edit-save img.waiting, #commentstatusdiv img.waiting { padding: 0 10px; vertical-align: top; } #replysubmit .button { margin-right: 5px; } #replyrow #editor-toolbar { display: none; } #replyhead { font-size: 12px; font-weight: bold; padding: 2px 10px 4px; } #edithead .inside { float: left; padding: 3px 0 2px 5px; margin: 0; text-align: center; font-size: 11px; } #edithead .inside input { width: 180px; font-size: 11px; } #edithead label { padding: 2px 0; } #replycontainer { padding: 5px; border: 0 none; height: 120px; overflow: hidden; position: relative; } #replycontent { resize: none; margin: 0; width: 100%; height: 100%; padding: 0; line-height: 150%; border: 0 none; outline: none; font-size: 12px; } #replyrow #ed_reply_toolbar { margin: 0; padding: 2px 3px; } /* show/hide settings */ #screen-meta { position: relative; clear: both; } #screen-meta-links { margin: 0 9px 0 0; } #screen-meta .screen-reader-text { visibility: hidden; } #screen-options-link-wrap, #contextual-help-link-wrap { float: right; background: transparent url( images/screen-options-left.gif ) no-repeat 0 0; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; height: 22px; padding: 0; margin: 0 6px 0 0; } #screen-meta a.show-settings { text-decoration: none; z-index: 1; padding: 0 16px 0 6px; height: 22px; line-height: 22px; font-size: 10px; display: block; background-repeat: no-repeat; background-position: right bottom; } #screen-meta a.show-settings { background-image: url( images/screen-options-right.gif ); } #screen-meta a.show-settings:hover { text-decoration: none; } #screen-options-wrap h5, #contextual-help-wrap h5 { margin: 8px 0; font-size: 13px; } #screen-options-wrap, #contextual-help-wrap { border-style: none solid solid; border-top: 0 none; border-width: 0 1px 1px; margin: 0 15px; padding: 8px 12px 12px; -moz-border-radius: 0 0 0 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } .metabox-prefs label { padding-right: 15px; white-space: nowrap; line-height: 30px; } .metabox-prefs label input { margin: 0 5px 0 2px; } .metabox-prefs label a { display: none; } /* Inline Editor .quick-edit* is for Quick Edit .bulk-edit* is for Bulk Edit .inline-edit* is for everything */ /* Layout */ tr.inline-edit-row td { padding: 0 0.5em; } #wpbody-content .inline-edit-row fieldset { font-size: 12px; float: left; margin: 0; padding: 0; width: 100%; } #wpbody-content .inline-edit-row fieldset .inline-edit-col { padding: 0 0.5em; } #wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col { border-width: 0 0 0 1px; border-style: none none none solid; } #wpbody-content .quick-edit-row-post .inline-edit-col-left { width: 40%; } #wpbody-content .quick-edit-row-post .inline-edit-col-right { width: 39%; } #wpbody-content .inline-edit-row-post .inline-edit-col-center { width: 20%; } #wpbody-content .quick-edit-row-page .inline-edit-col-left { width: 50%; } #wpbody-content .quick-edit-row-page .inline-edit-col-right, #wpbody-content .bulk-edit-row-post .inline-edit-col-right { width: 49%; } #wpbody-content .bulk-edit-row .inline-edit-col-left { width: 30%; } #wpbody-content .bulk-edit-row-page .inline-edit-col-right { width: 69%; } #wpbody-content .bulk-edit-row .inline-edit-col-bottom { float: right; width: 69%; } #wpbody-content .inline-edit-row-page .inline-edit-col-right, #owpbody-content .bulk-edit-row-post .inline-edit-col-right { margin-top: 27px; } .inline-edit-row fieldset .inline-edit-group { clear: both; } .inline-edit-row fieldset .inline-edit-group:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .inline-edit-row p.submit { clear: both; padding: 0.5em; margin: 0.5em 0 0; } .inline-edit-row span.error { line-height: 22px; margin: 0 15px; padding: 3px 5px; } /* Positioning */ .inline-edit-row h4 { margin: .2em 0; padding: 0; line-height: 23px; } .inline-edit-row fieldset span.title, .inline-edit-row fieldset span.checkbox-title { margin: 0; padding: 0; line-height: 27px; } .inline-edit-row fieldset label, .inline-edit-row fieldset span.inline-edit-categories-label { display: block; margin: .2em 0; } .inline-edit-row fieldset label.inline-edit-tags { margin-top: 0; } .inline-edit-row fieldset label.inline-edit-tags span.title { margin: .2em 0; } .inline-edit-row fieldset label span.title { display: block; float: left; width: 5em; } .inline-edit-row fieldset label span.input-text-wrap { display: block; margin-left: 5em; } .quick-edit-row-post fieldset.inline-edit-col-right label span.title { width: auto; padding-right: 0.5em; } .inline-edit-row .input-text-wrap input[type=text] { width: 100%; } .inline-edit-row fieldset label input[type=checkbox] { vertical-align: text-bottom; } .inline-edit-row fieldset label textarea { width: 100%; height: 4em; } #wpbody-content .bulk-edit-row fieldset .inline-edit-group label { max-width: 50%; } #wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child { margin-right: 0.5em } /* Styling */ .inline-edit-row h4 { text-transform: uppercase; } .inline-edit-row fieldset span.title, .inline-edit-row fieldset span.checkbox-title { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style: italic; line-height: 1.8em; } /* Specific Elements */ .inline-edit-row fieldset input[type="text"], .inline-edit-row fieldset textarea { border-style: solid; border-width: 1px; } .inline-edit-row fieldset .inline-edit-date { float: left; } .inline-edit-row fieldset input[name=jj], .inline-edit-row fieldset input[name=hh], .inline-edit-row fieldset input[name=mn] { font-size: 12px; width: 2.1em; } .inline-edit-row fieldset input[name=aa] { font-size: 12px; width: 3.5em; } .inline-edit-row fieldset label input.inline-edit-password-input { width: 8em; } .inline-edit-row .catshow, .inline-edit-row .cathide { cursor: pointer; } ul.cat-checklist { height: 12em; border-style: solid; border-width: 1px; overflow-y: scroll; padding: 0 5px; margin: 0; } #bulk-titles { display: block; height: 12em; border-style: solid; border-width: 1px; overflow-y: scroll; padding: 0 5px; margin: 0 0 5px; } .inline-edit-row fieldset ul.cat-checklist li, .inline-edit-row fieldset ul.cat-checklist input { margin: 0; } .inline-edit-row fieldset ul.cat-checklist label, .inline-edit-row .catshow, .inline-edit-row .cathide, .inline-edit-row #bulk-titles div { font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-style: normal; font-size: 11px; } table .inline-edit-row fieldset ul.cat-hover { height: auto; max-height: 30em; overflow-y: auto; position: absolute; } .inline-edit-row fieldset label input.inline-edit-menu-order-input { width: 3em; } .inline-edit-row fieldset label input.inline-edit-slug-input { width: 75%; } .quick-edit-row-post fieldset label.inline-edit-status { float: left; } #bulk-titles { line-height: 140%; } #bulk-titles div { margin: 0.2em 0.3em; } #bulk-titles div a { cursor: pointer; display: block; float: left; height: 10px; margin: 3px 3px 0 -2px; overflow: hidden; position: relative; text-indent: -9999px; width: 10px; } /* Media library */ #wpbody-content #media-items .describe { border-collapse: collapse; width: 100%; border-top-style: solid; border-top-width: 1px; clear: both; cursor: default; padding: 5px; width: 100%; } #wpbody-content .describe .media-item-info tr { background-color: transparent; } #wpbody-content .filename { padding: 0 10px; } #wpbody-content .media-item .thumbnail { max-height: 128px; max-width: 128px; } #wpbody-content .media-upload-form label { display: block; font-size: 13px; margin: 0.5em; } abbr.required { border: medium none; text-decoration: none; } #wpbody-content .describe input[type="text"], #wpbody-content .describe textarea { width: 460px; } #wpbody-content .describe p.help { margin: 0; padding: 0 0 0 5px; } .describe-toggle-on, .describe-toggle-off { display: block; line-height: 36px; float: right; margin-right: 20px; } .describe-toggle-off { display: none; } #wpbody-content .media-item { border-bottom-style: solid; border-bottom-width: 1px; min-height: 36px; position: relative; width: 100%; } #wpbody-content #media-items { border-style: solid solid none; border-width: 1px; width: 670px; } #wpbody-content #media-items .filename { line-height: 36px; overflow: hidden; } .media-item .pinkynail { float: left; height: 32px; margin: 2px; max-width: 40px; max-height: 40px; } .media-item .startopen, .media-item .startclosed { display: none; } .media-item .original { position: relative; height: 34px; text-align: center; } .media-item .percent { font-weight: bold; } .crunching { display: block; line-height: 32px; text-align: right; margin-right: 5px; } button.dismiss { position: absolute; top: 7px; right: 5px; z-index: 4; width: 8em; } .file-error { float: left; font-weight: bold; padding: 10px; } .progress { position: relative; margin-bottom: -36px; height: 36px; } .bar { width: 0; height: 100%; border-right-width: 3px; border-right-style: solid; } #media-items a.delete, #media-items a.del-link { padding: 1px 4px 2px; } /* find posts */ .find-box { width: 500px; height: 300px; overflow: hidden; padding: 33px 5px 40px; position: absolute; z-index: 1000; } .find-box-head { cursor: move; font-weight: bold; height: 2em; line-height: 2em; padding: 1px 12px; position: absolute; top: 5px; width: 100%; } .find-box-inside { overflow: auto; width: 100%; height: 100%; } .find-box-search { padding: 12px; border-width: 1px; border-style: none none solid; } #find-posts-response { margin: 8px 0; padding: 0 1px; } #find-posts-response table { width: 100%; } #find-posts-response .found-radio { padding: 5px 0 0 8px; width: 15px; } .find-box-buttons { width: 480px; margin: 8px; } .find-box-search label { padding-right: 6px; } .find-box #resize-se { position: absolute; right: 1px; bottom: 1px; } /* favorite-actions */ #favorite-actions { float: right; margin: 11px 12px 0; min-width: 130px; position: relative; } #favorite-first { -moz-border-radius: 12px; -khtml-border-radius: 12px; -webkit-border-radius: 12px; border-radius: 12px; line-height: 15px; padding: 3px 30px 4px 12px; border-width: 1px; border-style: solid; } #favorite-inside { margin: 0 0 0 0px; padding: 0 1px 6px 1px; border-width: 1px; border-style: solid; position: absolute; z-index: 11; display: none; -moz-border-radius: 0 0 12px 12px; -webkit-border-bottom-right-radius: 12px; -webkit-border-bottom-left-radius: 12px; -khtml-border-bottom-right-radius: 12px; -khtml-border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; border-bottom-left-radius: 12px; } #favorite-actions a { display: block; text-decoration: none; font-size: 11px; } #favorite-inside a { padding: 3px 5px 3px 10px; } #favorite-toggle { height: 22px; position: absolute; right: 0; top: 1px; width: 28px; } #favorite-actions .slide-down { -moz-border-radius: 12px 12px 0 0; -webkit-border-bottom-right-radius: 0; -webkit-border-bottom-left-radius: 0; -khtml-border-bottom-right-radius: 0; -khtml-border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-bottom-width: 1px; border-bottom-style: solid; } #utc-time, #local-time { padding-left: 25px; font-style: italic; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; } ul#dismissed-updates { display: none; } form.upgrade { margin-top: 8px; } form.upgrade .hint { font-style: italic; font-size: 85%; margin: -0.5em 0 2em 0; } #poststuff .inside .the-tagcloud { margin: 5px 0 10px; padding: 8px; border-width: 1px; border-style: solid; line-height: 1.8em; word-spacing: 3px; -moz-border-radius: 6px; -khtml-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } br.clear { height: 2px; line-height: 2px; } .swfupload { margin: 5px 10px; vertical-align: middle; } /* table.fixed column width */ table.fixed { table-layout: fixed; } .fixed .column-rating, .fixed .column-visible { width: 8%; } .fixed .column-date, .fixed .column-parent, .fixed .column-links { width: 10%; } .fixed .column-response, .fixed .column-author, .fixed .column-categories, .fixed .column-tags, .fixed .column-rel, .fixed .column-role { width: 15%; } .fixed .column-comments { width: 4em; padding-top: 8px; } .fixed .column-slug { width: 25%; } .fixed .column-posts { width: 10%; } .fixed .column-icon { width: 80px; } #commentstatusdiv .fixed .column-author, #comments-form .fixed .column-author, #commentstatusdiv .fixed .column-date { width: 20%; } .widefat th, .widefat td { overflow: hidden; } table .vers, table .column-visible, table .column-rating { text-align: center; } .icon32 { float: left; height: 36px; margin: 14px 6px 0 0; width: 36px; } .key-labels label { line-height: 24px; } .subtitle { font-size: 0.75em; line-height: 1; padding-left: 25px; } ol { list-style-type: decimal; margin-left: 2em; } .postbox-container { float: left; padding-right: 0.5%; } .postbox-container .meta-box-sortables { min-height: 300px; } .temp-border { border: 1px dotted #ccc; } .columns-prefs label { padding: 0 5px; } .theme-install-php h4, .plugin-install-php h4 { margin: 2.5em 0 8px; } p.install-help { margin: 8px 0; font-style: italic; } p.popular-tags { -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; border-width: 1px; border-style: solid; line-height: 2em; padding: 8px 12px 12px; text-align: justify; } p.popular-tags a { padding: 0 3px; } .stuffbox .editcomment { clear: none; } .ajax-feedback { visibility: hidden; vertical-align: bottom; } .tagsdiv .newtag { width: 180px; } .tagsdiv .the-tags { display: block; height: 60px; margin: 0 auto; overflow: auto; width: 260px; } #post-body-content .tagsdiv .the-tags { margin: 0 5px; } label, #your-profile label + a { vertical-align: middle; } .plugin-update-tr .update-message { margin: 5px; padding: 3px 5px; border-width: 1px; border-style: solid; -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } thebrutalagenda/wp-admin/edit-tag-form.php0000644001761300176130000000451311214074650021333 0ustar mustardamustarda


thebrutalagenda/wp-admin/includes/plugin-install.php0000644001761300176130000005351111214074650023446 0ustar mustardamustardaper_page) ) $args->per_page = 24; $args = apply_filters('plugins_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter. $res = apply_filters('plugins_api', false, $action, $args); //NOTE: Allows a plugin to completely override the builtin WordPress.org API. if ( ! $res ) { $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) ); if ( is_wp_error($request) ) { $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.

Try again'), $request->get_error_message() ); } else { $res = unserialize($request['body']); if ( ! $res ) $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']); } } return apply_filters('plugins_api_result', $res, $action, $args); } /** * Retrieve popular WordPress plugin tags. * * @since 2.7.0 * * @param array $args * @return array */ function install_popular_tags( $args = array() ) { if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) ) add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload. if ( $cache && $cache->timeout + 3 * 60 * 60 > time() ) return $cache->cached; $tags = plugins_api('hot_tags', $args); if ( is_wp_error($tags) ) return $tags; $cache = (object) array('timeout' => time(), 'cached' => $tags); update_option('wporg_popular_tags', $cache); wp_cache_set('popular_tags', $cache, 'api'); return $tags; } add_action('install_plugins_search', 'install_search', 10, 1); /** * Display search results and display as tag cloud. * * @since 2.7.0 * * @param string $page */ function install_search($page) { $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; $args = array(); switch( $type ){ case 'tag': $args['tag'] = sanitize_title_with_dashes($term); break; case 'term': $args['search'] = $term; break; case 'author': $args['author'] = $term; break; } $args['page'] = $page; $api = plugins_api('query_plugins', $args); if ( is_wp_error($api) ) wp_die($api); add_action('install_plugins_table_header', 'install_search_form'); display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); return; } add_action('install_plugins_dashboard', 'install_dashboard'); function install_dashboard() { ?>

WordPress Plugin Directory or upload a plugin in .zip format via this page.') ?>

esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ), 'name' => $tag['name'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count'] ); echo '
'; } /** * Display search form for searching plugins. * * @since 2.7.0 */ function install_search_form(){ $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; ?>
'featured', 'page' => $page); $api = plugins_api('query_plugins', $args); if ( is_wp_error($api) ) wp_die($api); display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); } add_action('install_plugins_popular', 'install_popular', 10, 1); /** * Display popular plugins. * * @since 2.7.0 * * @param string $page */ function install_popular($page = 1) { $args = array('browse' => 'popular', 'page' => $page); $api = plugins_api('query_plugins', $args); display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); } add_action('install_plugins_upload', 'install_plugins_upload', 10, 1); /** * Upload from zip * @since 2.8.0 * * @param string $page */ function install_plugins_upload( $page = 1 ) { ?>

'new', 'page' => $page); $api = plugins_api('query_plugins', $args); if ( is_wp_error($api) ) wp_die($api); display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); } add_action('install_plugins_updated', 'install_updated', 10, 1); /** * Display recently updated plugins. * * @since 2.7.0 * * @param string $page */ function install_updated($page = 1) { $args = array('browse' => 'updated', 'page' => $page); $api = plugins_api('query_plugins', $args); display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); } /** * Display plugin content based on plugin list. * * @since 2.7.0 * * @param array $plugins List of plugins. * @param string $page * @param int $totalpages Number of pages. */ function display_plugins_table($plugins, $page = 1, $totalpages = 1){ $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()), 'abbr' => array('title' => array()),'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()); ?>
add_query_arg('paged', '%#%', $url), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $totalpages, 'current' => $page )); if ( $page_links ) echo "\t\t
$page_links
"; ?>
'; foreach( (array) $plugins as $plugin ){ if ( is_object($plugin) ) $plugin = (array) $plugin; $title = wp_kses($plugin['name'], $plugins_allowedtags); //Limit description to 400char, and remove any HTML. $description = strip_tags($plugin['description']); if ( strlen($description) > 400 ) $description = mb_substr($description, 0, 400) . '…'; //remove any trailing entities $description = preg_replace('/&[^;\s]{0,6}$/', '', $description); //strip leading/trailing & multiple consecutive lines $description = trim($description); $description = preg_replace("|(\r?\n)+|", "\n", $description); //\n =>
$description = nl2br($description); $version = wp_kses($plugin['version'], $plugins_allowedtags); $name = strip_tags($title . ' ' . $version); $author = $plugin['author']; if( ! empty($plugin['author']) ) $author = ' ' . sprintf( __('By %s'), $author ) . '.'; $author = wp_kses($author, $plugins_allowedtags); if( isset($plugin['homepage']) ) $title = '' . $title . ''; $action_links = array(); $action_links[] = '' . __('Install') . ''; $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); ?>
', __('No plugins match your request.'), '
<?php _e('5 stars') ?>
<?php _e('4 stars') ?>
<?php _e('3 stars') ?>
<?php _e('2 stars') ?>
<?php _e('1 star') ?>
$page_links
"; ?>
stripslashes( $_REQUEST['plugin'] ) )); if ( is_wp_error($api) ) wp_die($api); $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); //Sanitize HTML foreach ( (array)$api->sections as $section_name => $content ) $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key ) $api->$key = wp_kses($api->$key, $plugins_allowedtags); $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English. if( empty($section) || ! isset($api->sections[ $section ]) ) $section = array_shift( $section_titles = array_keys((array)$api->sections) ); iframe_header( __('Plugin Install') ); echo "
\n"; echo "
    \n"; foreach ( (array)$api->sections as $section_name => $content ) { $title = $section_name; $title = ucwords(str_replace('_', ' ', $title)); $class = ( $section_name == $section ) ? ' class="current"' : ''; $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) ); $href = esc_url($href); $san_title = esc_attr(sanitize_title_with_dashes($title)); echo "\t
  • $title
  • \n"; } echo "
\n"; echo "
\n"; ?>
download_link) ) : ?>

response as $file => $plugin ) { if ( $plugin->slug === $api->slug ) { $type = 'update_available'; $update_file = $file; break; } } } if ( 'install' == $type && is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) { $installed_plugin = get_plugins('/' . $api->slug); if ( ! empty($installed_plugin) ) { $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){ $type = 'latest_installed'; } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) { $type = 'newer_installed'; $newer_version = $installed_plugin[ $key ]['Version']; } else { //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh delete_option('update_plugins'); $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names $type = 'update_available'; } } } switch ( $type ) : default: case 'install': if ( current_user_can('install_plugins') ) : ?>

    version) ) : ?>
  • version ?>
  • author) ) : ?>
  • author, '_blank') ?>
  • last_updated) ) : ?>
  • last_updated)) ) ?>
  • requires) ) : ?>
  • requires) ?>
  • tested) ) : ?>
  • tested ?>
  • downloaded) ) : ?>
  • downloaded), number_format_i18n($api->downloaded)) ?>
  • slug) ) : ?>
  • homepage) ) : ?>

<?php _e('5 stars') ?>
<?php _e('4 stars') ?>
<?php _e('3 stars') ?>
<?php _e('2 stars') ?>
<?php _e('1 star') ?>
num_ratings), number_format_i18n($api->num_ratings)); ?>
tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') ) echo '

' . __('Warning: This plugin has not been tested with your current version of WordPress.') . '

'; else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') ) echo '

' . __('Warning: This plugin has not been marked as compatible with your version of WordPress.') . '

'; foreach ( (array)$api->sections as $section_name => $content ) { $title = $section_name; $title[0] = strtoupper($title[0]); $title = str_replace('_', ' ', $title); $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/'); $content = links_add_target($content, '_blank'); $san_title = esc_attr(sanitize_title_with_dashes($title)); $display = ( $section_name == $section ) ? 'block' : 'none'; echo "\t
\n"; echo "\t\t

$title

"; echo $content; echo "\t
\n"; } echo "
\n"; iframe_footer(); exit; } thebrutalagenda/wp-admin/includes/plugin.php0000644001761300176130000010644411214074650022006 0ustar mustardamustarda * /* * Plugin Name: Name of Plugin * Plugin URI: Link to plugin information * Description: Plugin Description * Author: Plugin author's name * Author URI: Link to the author's web site * Version: Must be set in the plugin for WordPress 2.3+ * Text Domain: Optional. Unique identifier, should be same as the one used in * plugin_text_domain() * Domain Path: Optional. Only useful if the translations are located in a * folder above the plugin's base path. For example, if .mo files are * located in the locale folder then Domain Path will be "/locale/" and * must have the first slash. Defaults to the base folder the plugin is * located in. * * / # Remove the space to close comment * * * Plugin data returned array contains the following: * 'Name' - Name of the plugin, must be unique. * 'Title' - Title of the plugin and the link to the plugin's web site. * 'Description' - Description of what the plugin does and/or notes * from the author. * 'Author' - The author's name * 'AuthorURI' - The authors web site address. * 'Version' - The plugin version number. * 'PluginURI' - Plugin web site address. * 'TextDomain' - Plugin's text domain for localization. * 'DomainPath' - Plugin's relative directory path to .mo files. * * Some users have issues with opening large files and manipulating the contents * for want is usually the first 1kiB or 2kiB. This function stops pulling in * the plugin contents when it has all of the required plugin data. * * The first 8kiB of the file will be pulled in and if the plugin data is not * within that first 8kiB, then the plugin author should correct their plugin * and move the plugin data headers to the top. * * The plugin file is assumed to have permissions to allow for scripts to read * the file. This is not checked however and the file is only opened for * reading. * * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations. * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations. * @since 1.5.0 * * @param string $plugin_file Path to the plugin file * @param bool $markup If the returned data should have HTML markup applied * @param bool $translate If the returned data should be translated * @return array See above for description. */ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { // We don't need to write to the file, so just open for reading. $fp = fopen($plugin_file, 'r'); // Pull only the first 8kiB of the file in. $plugin_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose($fp); preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name ); preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri ); preg_match( '|Version:(.*)|i', $plugin_data, $version ); preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ); preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ); foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { if ( !empty( ${$field} ) ) ${$field} = _cleanup_header_comment(${$field}[1]); else ${$field} = ''; } $plugin_data = array( 'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description, 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 'TextDomain' => $text_domain, 'DomainPath' => $domain_path ); if ( $markup || $translate ) $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate); return $plugin_data; } function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) { //Translate fields if( $translate && ! empty($plugin_data['TextDomain']) ) { if( ! empty( $plugin_data['DomainPath'] ) ) load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file). $plugin_data['DomainPath']); else load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file)); foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field ) $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']); } //Apply Markup if ( $markup ) { if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) ) $plugin_data['Title'] = '' . $plugin_data['Name'] . ''; else $plugin_data['Title'] = $plugin_data['Name']; if ( ! empty($plugin_data['AuthorURI']) && ! empty($plugin_data['Author']) ) $plugin_data['Author'] = '' . $plugin_data['Author'] . ''; $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); if( ! empty($plugin_data['Author']) ) $plugin_data['Description'] .= ' ' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.'; } $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); // Sanitize all displayed data $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags); $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags); return $plugin_data; } /** * Get a list of a plugin's files. * * @since 2.8.0 * * @param string $plugin Plugin ID * @return array List of files relative to the plugin root. */ function get_plugin_files($plugin) { $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; $dir = dirname($plugin_file); $plugin_files = array($plugin); if ( is_dir($dir) && $dir != WP_PLUGIN_DIR ) { $plugins_dir = @ opendir( $dir ); if ( $plugins_dir ) { while (($file = readdir( $plugins_dir ) ) !== false ) { if ( substr($file, 0, 1) == '.' ) continue; if ( is_dir( $dir . '/' . $file ) ) { $plugins_subdir = @ opendir( $dir . '/' . $file ); if ( $plugins_subdir ) { while (($subfile = readdir( $plugins_subdir ) ) !== false ) { if ( substr($subfile, 0, 1) == '.' ) continue; $plugin_files[] = plugin_basename("$dir/$file/$subfile"); } @closedir( $plugins_subdir ); } } else { if ( plugin_basename("$dir/$file") != $plugin ) $plugin_files[] = plugin_basename("$dir/$file"); } } @closedir( $plugins_dir ); } } return $plugin_files; } /** * Check the plugins directory and retrieve all plugin files with plugin data. * * WordPress only supports plugin files in the base plugins directory * (wp-content/plugins) and in one directory above the plugins directory * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and * must be found in those two locations. It is recommended that do keep your * plugin files in directories. * * The file with the plugin data is the file that will be included and therefore * needs to have the main execution for the plugin. This does not mean * everything must be contained in the file and it is recommended that the file * be split for maintainability. Keep everything in one file for extreme * optimization purposes. * * @since unknown * * @param string $plugin_folder Optional. Relative path to single plugin folder. * @return array Key is the plugin file path and the value is an array of the plugin data. */ function get_plugins($plugin_folder = '') { if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') ) $cache_plugins = array(); if ( isset($cache_plugins[ $plugin_folder ]) ) return $cache_plugins[ $plugin_folder ]; $wp_plugins = array (); $plugin_root = WP_PLUGIN_DIR; if( !empty($plugin_folder) ) $plugin_root .= $plugin_folder; // Files in wp-content/plugins directory $plugins_dir = @ opendir( $plugin_root); $plugin_files = array(); if ( $plugins_dir ) { while (($file = readdir( $plugins_dir ) ) !== false ) { if ( substr($file, 0, 1) == '.' ) continue; if ( is_dir( $plugin_root.'/'.$file ) ) { $plugins_subdir = @ opendir( $plugin_root.'/'.$file ); if ( $plugins_subdir ) { while (($subfile = readdir( $plugins_subdir ) ) !== false ) { if ( substr($subfile, 0, 1) == '.' ) continue; if ( substr($subfile, -4) == '.php' ) $plugin_files[] = "$file/$subfile"; } } } else { if ( substr($file, -4) == '.php' ) $plugin_files[] = $file; } } } @closedir( $plugins_dir ); @closedir( $plugins_subdir ); if ( !$plugins_dir || empty($plugin_files) ) return $wp_plugins; foreach ( $plugin_files as $plugin_file ) { if ( !is_readable( "$plugin_root/$plugin_file" ) ) continue; $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. if ( empty ( $plugin_data['Name'] ) ) continue; $wp_plugins[plugin_basename( $plugin_file )] = $plugin_data; } uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' )); $cache_plugins[ $plugin_folder ] = $wp_plugins; wp_cache_set('plugins', $cache_plugins, 'plugins'); return $wp_plugins; } /** * Check whether the plugin is active by checking the active_plugins list. * * @since 2.5.0 * * @param string $plugin Base plugin path from plugins directory. * @return bool True, if in the active plugins list. False, not in the list. */ function is_plugin_active($plugin) { return in_array($plugin, get_option('active_plugins')); } /** * Attempts activation of plugin in a "sandbox" and redirects on success. * * A plugin that is already activated will not attempt to be activated again. * * The way it works is by setting the redirection to the error before trying to * include the plugin file. If the plugin fails, then the redirection will not * be overwritten with the success message. Also, the options will not be * updated and the activation hook will not be called on plugin error. * * It should be noted that in no way the below code will actually prevent errors * within the file. The code should not be used elsewhere to replicate the * "sandbox", which uses redirection to work. * {@source 13 1} * * If any errors are found or text is outputted, then it will be captured to * ensure that the success redirection will update the error redirection. * * @since unknown * * @param string $plugin Plugin path to main plugin file with plugin data. * @param string $redirect Optional. URL to redirect to. * @return WP_Error|null WP_Error on invalid file or null on success. */ function activate_plugin($plugin, $redirect = '') { $current = get_option('active_plugins'); $plugin = plugin_basename(trim($plugin)); $valid = validate_plugin($plugin); if ( is_wp_error($valid) ) return $valid; if ( !in_array($plugin, $current) ) { if ( !empty($redirect) ) wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error ob_start(); @include(WP_PLUGIN_DIR . '/' . $plugin); $current[] = $plugin; sort($current); update_option('active_plugins', $current); do_action('activate_' . $plugin); ob_end_clean(); } return null; } /** * Deactivate a single plugin or multiple plugins. * * The deactivation hook is disabled by the plugin upgrader by using the $silent * parameter. * * @since unknown * * @param string|array $plugins Single plugin or list of plugins to deactivate. * @param bool $silent Optional, default is false. Prevent calling deactivate hook. */ function deactivate_plugins($plugins, $silent= false) { $current = get_option('active_plugins'); if ( !is_array($plugins) ) $plugins = array($plugins); foreach ( $plugins as $plugin ) { $plugin = plugin_basename($plugin); if( ! is_plugin_active($plugin) ) continue; array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu! if ( ! $silent ) //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output. do_action('deactivate_' . trim( $plugin )); } update_option('active_plugins', $current); } /** * Activate multiple plugins. * * When WP_Error is returned, it does not mean that one of the plugins had * errors. It means that one or more of the plugins file path was invalid. * * The execution will be halted as soon as one of the plugins has an error. * * @since unknown * * @param string|array $plugins * @param string $redirect Redirect to page after successful activation. * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation. */ function activate_plugins($plugins, $redirect = '') { if ( !is_array($plugins) ) $plugins = array($plugins); $errors = array(); foreach ( (array) $plugins as $plugin ) { if ( !empty($redirect) ) $redirect = add_query_arg('plugin', $plugin, $redirect); $result = activate_plugin($plugin, $redirect); if ( is_wp_error($result) ) $errors[$plugin] = $result; } if ( !empty($errors) ) return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors); return true; } /** * Remove directory and files of a plugin for a single or list of plugin(s). * * If the plugins parameter list is empty, false will be returned. True when * completed. * * @since unknown * * @param array $plugins List of plugin * @param string $redirect Redirect to page when complete. * @return mixed */ function delete_plugins($plugins, $redirect = '' ) { global $wp_filesystem; if( empty($plugins) ) return false; $checked = array(); foreach( $plugins as $plugin ) $checked[] = 'checked[]=' . $plugin; ob_start(); $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins'); if ( false === ($credentials = request_filesystem_credentials($url)) ) { $data = ob_get_contents(); ob_end_clean(); if( ! empty($data) ){ include_once( ABSPATH . 'wp-admin/admin-header.php'); echo $data; include( ABSPATH . 'wp-admin/admin-footer.php'); exit; } return; } if ( ! WP_Filesystem($credentials) ) { request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again $data = ob_get_contents(); ob_end_clean(); if( ! empty($data) ){ include_once( ABSPATH . 'wp-admin/admin-header.php'); echo $data; include( ABSPATH . 'wp-admin/admin-footer.php'); exit; } return; } if ( ! is_object($wp_filesystem) ) return new WP_Error('fs_unavailable', __('Could not access filesystem.')); if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors); //Get the base plugin folder $plugins_dir = $wp_filesystem->wp_plugins_dir(); if ( empty($plugins_dir) ) return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.')); $plugins_dir = trailingslashit( $plugins_dir ); $errors = array(); foreach( $plugins as $plugin_file ) { // Run Uninstall hook if ( is_uninstallable_plugin( $plugin_file ) ) uninstall_plugin($plugin_file); $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) ); // If plugin is in its own directory, recursively delete the directory. if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder $deleted = $wp_filesystem->delete($this_plugin_dir, true); else $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file); if ( ! $deleted ) $errors[] = $plugin_file; } if ( ! empty($errors) ) return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) ); // Force refresh of plugin update information if ( $current = get_transient('update_plugins') ) { unset( $current->response[ $plugin_file ] ); set_transient('update_plugins', $current); } return true; } function validate_active_plugins() { $check_plugins = get_option('active_plugins'); // Sanity check. If the active plugin list is not an array, make it an // empty array. if ( !is_array($check_plugins) ) { update_option('active_plugins', array()); return; } //Invalid is any plugin that is deactivated due to error. $invalid = array(); // If a plugin file does not exist, remove it from the list of active // plugins. foreach ( $check_plugins as $check_plugin ) { $result = validate_plugin($check_plugin); if ( is_wp_error( $result ) ) { $invalid[$check_plugin] = $result; deactivate_plugins( $check_plugin, true); } } return $invalid; } /** * Validate the plugin path. * * Checks that the file exists and {@link validate_file() is valid file}. * * @since unknown * * @param string $plugin Plugin Path * @return WP_Error|int 0 on success, WP_Error on failure. */ function validate_plugin($plugin) { if ( validate_file($plugin) ) return new WP_Error('plugin_invalid', __('Invalid plugin path.')); if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) ) return new WP_Error('plugin_not_found', __('Plugin file does not exist.')); $installed_plugins = get_plugins(); if ( ! isset($installed_plugins[$plugin]) ) return new WP_Error('no_plugin_header', __('The plugin does not have a valid header.')); return 0; } /** * Whether the plugin can be uninstalled. * * @since 2.7.0 * * @param string $plugin Plugin path to check. * @return bool Whether plugin can be uninstalled. */ function is_uninstallable_plugin($plugin) { $file = plugin_basename($plugin); $uninstallable_plugins = (array) get_option('uninstall_plugins'); if ( isset( $uninstallable_plugins[$file] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) return true; return false; } /** * Uninstall a single plugin. * * Calls the uninstall hook, if it is available. * * @since 2.7.0 * * @param string $plugin Relative plugin path from Plugin Directory. */ function uninstall_plugin($plugin) { $file = plugin_basename($plugin); $uninstallable_plugins = (array) get_option('uninstall_plugins'); if ( file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) { if ( isset( $uninstallable_plugins[$file] ) ) { unset($uninstallable_plugins[$file]); update_option('uninstall_plugins', $uninstallable_plugins); } unset($uninstallable_plugins); define('WP_UNINSTALL_PLUGIN', $file); include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php'; return true; } if ( isset( $uninstallable_plugins[$file] ) ) { $callable = $uninstallable_plugins[$file]; unset($uninstallable_plugins[$file]); update_option('uninstall_plugins', $uninstallable_plugins); unset($uninstallable_plugins); include WP_PLUGIN_DIR . '/' . $file; add_action( 'uninstall_' . $file, $callable ); do_action( 'uninstall_' . $file ); } } // // Menu // function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) { global $menu, $admin_page_hooks; $file = plugin_basename( $file ); $admin_page_hooks[$file] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $file, '' ); if (!empty ( $function ) && !empty ( $hookname )) add_action( $hookname, $function ); if ( empty($icon_url) ) $icon_url = 'images/generic.png'; elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) $icon_url = 'https://' . substr($icon_url, 7); $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); return $hookname; } function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') { global $menu, $admin_page_hooks, $_wp_last_object_menu; $file = plugin_basename( $file ); $admin_page_hooks[$file] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $file, '' ); if (!empty ( $function ) && !empty ( $hookname )) add_action( $hookname, $function ); if ( empty($icon_url) ) $icon_url = 'images/generic.png'; $_wp_last_object_menu++; $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); return $hookname; } function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') { global $menu, $admin_page_hooks, $_wp_last_utility_menu; $file = plugin_basename( $file ); $admin_page_hooks[$file] = sanitize_title( $menu_title ); $hookname = get_plugin_page_hookname( $file, '' ); if (!empty ( $function ) && !empty ( $hookname )) add_action( $hookname, $function ); if ( empty($icon_url) ) $icon_url = 'images/generic.png'; elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) $icon_url = 'https://' . substr($icon_url, 7); $_wp_last_utility_menu++; $menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); return $hookname; } function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) { global $submenu; global $menu; global $_wp_real_parent_file; global $_wp_submenu_nopriv; $file = plugin_basename( $file ); $parent = plugin_basename( $parent); if ( isset( $_wp_real_parent_file[$parent] ) ) $parent = $_wp_real_parent_file[$parent]; if ( !current_user_can( $access_level ) ) { $_wp_submenu_nopriv[$parent][$file] = true; return false; } // If the parent doesn't already have a submenu, add a link to the parent // as the first item in the submenu. If the submenu file is the same as the // parent file someone is trying to link back to the parent manually. In // this case, don't automatically add a link back to avoid duplication. if (!isset( $submenu[$parent] ) && $file != $parent ) { foreach ( (array)$menu as $parent_menu ) { if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) ) $submenu[$parent][] = $parent_menu; } } $submenu[$parent][] = array ( $menu_title, $access_level, $file, $page_title ); $hookname = get_plugin_page_hookname( $file, $parent); if (!empty ( $function ) && !empty ( $hookname )) add_action( $hookname, $function ); return $hookname; } /** * Add sub menu page to the tools main menu. * * @param string $page_title * @param unknown_type $menu_title * @param unknown_type $access_level * @param unknown_type $file * @param unknown_type $function * @return unknown */ function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'tools.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'options-general.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_theme_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { if ( current_user_can('edit_users') ) $parent = 'users.php'; else $parent = 'profile.php'; return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function ); } function add_dashboard_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'index.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_posts_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_media_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'upload.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_links_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_pages_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'edit-pages.php', $page_title, $menu_title, $access_level, $file, $function ); } function add_comments_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $access_level, $file, $function ); } // // Pluggable Menu Support -- Private // function get_admin_page_parent( $parent = '' ) { global $parent_file; global $menu; global $submenu; global $pagenow; global $plugin_page; global $_wp_real_parent_file; global $_wp_menu_nopriv; global $_wp_submenu_nopriv; if ( !empty ( $parent ) && 'admin.php' != $parent ) { if ( isset( $_wp_real_parent_file[$parent] ) ) $parent = $_wp_real_parent_file[$parent]; return $parent; } /* if ( !empty ( $parent_file ) ) { if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; return $parent_file; } */ if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) { foreach ( (array)$menu as $parent_menu ) { if ( $parent_menu[2] == $plugin_page ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; return $parent_file; } } if ( isset( $_wp_menu_nopriv[$plugin_page] ) ) { $parent_file = $plugin_page; if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; return $parent_file; } } if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) { $parent_file = $pagenow; if ( isset( $_wp_real_parent_file[$parent_file] ) ) $parent_file = $_wp_real_parent_file[$parent_file]; return $parent_file; } foreach (array_keys( (array)$submenu ) as $parent) { foreach ( $submenu[$parent] as $submenu_array ) { if ( isset( $_wp_real_parent_file[$parent] ) ) $parent = $_wp_real_parent_file[$parent]; if ( $submenu_array[2] == $pagenow ) { $parent_file = $parent; return $parent; } else if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) { $parent_file = $parent; return $parent; } } } if ( empty($parent_file) ) $parent_file = ''; return ''; } function get_admin_page_title() { global $title; global $menu; global $submenu; global $pagenow; global $plugin_page; if ( isset( $title ) && !empty ( $title ) ) { return $title; } $hook = get_plugin_page_hook( $plugin_page, $pagenow ); $parent = $parent1 = get_admin_page_parent(); if ( empty ( $parent) ) { foreach ( (array)$menu as $menu_array ) { if ( isset( $menu_array[3] ) ) { if ( $menu_array[2] == $pagenow ) { $title = $menu_array[3]; return $menu_array[3]; } else if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) { $title = $menu_array[3]; return $menu_array[3]; } } else { $title = $menu_array[0]; return $title; } } } else { foreach (array_keys( $submenu ) as $parent) { foreach ( $submenu[$parent] as $submenu_array ) { if ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) && (($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page continue; if ( isset( $submenu_array[3] ) ) { $title = $submenu_array[3]; return $submenu_array[3]; } else { $title = $submenu_array[0]; return $title; } } } if ( !isset($title) || empty ( $title ) ) { foreach ( $menu as $menu_array ) { if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($pagenow == 'admin.php' ) && ($parent1 == $menu_array[2] ) ) { $title = $menu_array[3]; return $menu_array[3]; } } } } return $title; } function get_plugin_page_hook( $plugin_page, $parent_page ) { $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); if ( has_action($hook) ) return $hook; else return null; } function get_plugin_page_hookname( $plugin_page, $parent_page ) { global $admin_page_hooks; $parent = get_admin_page_parent( $parent_page ); $page_type = 'admin'; if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) { if ( isset( $admin_page_hooks[$plugin_page] ) ) $page_type = 'toplevel'; else if ( isset( $admin_page_hooks[$parent] )) $page_type = $admin_page_hooks[$parent]; } else if ( isset( $admin_page_hooks[$parent] ) ) { $page_type = $admin_page_hooks[$parent]; } $plugin_name = preg_replace( '!\.php!', '', $plugin_page ); return $page_type.'_page_'.$plugin_name; } function user_can_access_admin_page() { global $pagenow; global $menu; global $submenu; global $_wp_menu_nopriv; global $_wp_submenu_nopriv; global $plugin_page; $parent = get_admin_page_parent(); if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) return false; if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) ) return false; if ( empty( $parent) ) { if ( isset( $_wp_menu_nopriv[$pagenow] ) ) return false; if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) ) return false; if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) return false; foreach (array_keys( $_wp_submenu_nopriv ) as $key ) { if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) return false; if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) return false; } return true; } if ( isset( $submenu[$parent] ) ) { foreach ( $submenu[$parent] as $submenu_array ) { if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) { if ( current_user_can( $submenu_array[1] )) return true; else return false; } else if ( $submenu_array[2] == $pagenow ) { if ( current_user_can( $submenu_array[1] )) return true; else return false; } } } foreach ( $menu as $menu_array ) { if ( $menu_array[2] == $parent) { if ( current_user_can( $menu_array[1] )) return true; else return false; } } return true; } /* Whitelist functions */ /** * Register a setting and its sanitization callback * * @since 2.7.0 * * @param string $option_group A settings group name. Can be anything. * @param string $option_name The name of an option to sanitize and save. * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value. * @return unknown */ function register_setting($option_group, $option_name, $sanitize_callback = '') { return add_option_update_handler($option_group, $option_name, $sanitize_callback); } /** * Unregister a setting * * @since 2.7.0 * * @param unknown_type $option_group * @param unknown_type $option_name * @param unknown_type $sanitize_callback * @return unknown */ function unregister_setting($option_group, $option_name, $sanitize_callback = '') { return remove_option_update_handler($option_group, $option_name, $sanitize_callback); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $option_group * @param unknown_type $option_name * @param unknown_type $sanitize_callback */ function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') { global $new_whitelist_options; $new_whitelist_options[ $option_group ][] = $option_name; if ( $sanitize_callback != '' ) add_filter( "sanitize_option_{$option_name}", $sanitize_callback ); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $option_group * @param unknown_type $option_name * @param unknown_type $sanitize_callback */ function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') { global $new_whitelist_options; $pos = array_search( $option_name, (array) $new_whitelist_options ); if ( $pos !== false ) unset( $new_whitelist_options[ $option_group ][ $pos ] ); if ( $sanitize_callback != '' ) remove_filter( "sanitize_option_{$option_name}", $sanitize_callback ); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $options * @return unknown */ function option_update_filter( $options ) { global $new_whitelist_options; if ( is_array( $new_whitelist_options ) ) $options = add_option_whitelist( $new_whitelist_options, $options ); return $options; } add_filter( 'whitelist_options', 'option_update_filter' ); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $new_options * @param unknown_type $options * @return unknown */ function add_option_whitelist( $new_options, $options = '' ) { if( $options == '' ) { global $whitelist_options; } else { $whitelist_options = $options; } foreach( $new_options as $page => $keys ) { foreach( $keys as $key ) { if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) { $whitelist_options[ $page ] = array(); $whitelist_options[ $page ][] = $key; } else { $pos = array_search( $key, $whitelist_options[ $page ] ); if ( $pos === false ) $whitelist_options[ $page ][] = $key; } } } return $whitelist_options; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $del_options * @param unknown_type $options * @return unknown */ function remove_option_whitelist( $del_options, $options = '' ) { if( $options == '' ) { global $whitelist_options; } else { $whitelist_options = $options; } foreach( $del_options as $page => $keys ) { foreach( $keys as $key ) { if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) { $pos = array_search( $key, $whitelist_options[ $page ] ); if( $pos !== false ) unset( $whitelist_options[ $page ][ $pos ] ); } } } return $whitelist_options; } /** * Output nonce, action, and option_page fields for a settings page. * * @since 2.7.0 * * @param string $option_group A settings group name. This should match the group name used in register_setting(). */ function settings_fields($option_group) { echo ""; echo ''; wp_nonce_field("$option_group-options"); } ?> thebrutalagenda/wp-admin/includes/class-wp-filesystem-direct.php0000644001761300176130000001570311214074650025670 0ustar mustardamustardamethod = 'direct'; $this->errors = new WP_Error(); $this->permission = umask(); } function connect() { return true; } function setDefaultPermissions($perm) { $this->permission = $perm; } function get_contents($file) { return @file_get_contents($file); } function get_contents_array($file) { return @file($file); } function put_contents($file, $contents, $mode = false, $type = '') { if ( ! ($fp = @fopen($file, 'w' . $type)) ) return false; @fwrite($fp, $contents); @fclose($fp); $this->chmod($file,$mode); return true; } function cwd() { return @getcwd(); } function chdir($dir) { return @chdir($dir); } function chgrp($file, $group, $recursive = false) { if ( ! $this->exists($file) ) return false; if ( ! $recursive ) return @chgrp($file, $group); if ( ! $this->is_dir($file) ) return @chgrp($file, $group); //Is a directory, and we want recursive $file = trailingslashit($file); $filelist = $this->dirlist($file); foreach ($filelist as $filename) $this->chgrp($file . $filename, $group, $recursive); return true; } function chmod($file, $mode = false, $recursive = false) { if ( ! $mode ) $mode = $this->permission; if ( ! $this->exists($file) ) return false; if ( ! $recursive ) return @chmod($file,$mode); if ( ! $this->is_dir($file) ) return @chmod($file, $mode); //Is a directory, and we want recursive $file = trailingslashit($file); $filelist = $this->dirlist($file); foreach ($filelist as $filename) $this->chmod($file . $filename, $mode, $recursive); return true; } function chown($file, $owner, $recursive = false) { if ( ! $this->exists($file) ) return false; if ( ! $recursive ) return @chown($file, $owner); if ( ! $this->is_dir($file) ) return @chown($file, $owner); //Is a directory, and we want recursive $filelist = $this->dirlist($file); foreach ($filelist as $filename){ $this->chown($file . '/' . $filename, $owner, $recursive); } return true; } function owner($file) { $owneruid = @fileowner($file); if ( ! $owneruid ) return false; if ( ! function_exists('posix_getpwuid') ) return $owneruid; $ownerarray = posix_getpwuid($owneruid); return $ownerarray['name']; } function getchmod($file) { return substr(decoct(@fileperms($file)),3); } function group($file) { $gid = @filegroup($file); if ( ! $gid ) return false; if ( ! function_exists('posix_getgrgid') ) return $gid; $grouparray = posix_getgrgid($gid); return $grouparray['name']; } function copy($source, $destination, $overwrite = false) { if ( ! $overwrite && $this->exists($destination) ) return false; return copy($source, $destination); } function move($source, $destination, $overwrite = false) { //Possible to use rename()? if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){ $this->delete($source); return true; } else { return false; } } function delete($file, $recursive = false) { if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem. return false; $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise if ( $this->is_file($file) ) return @unlink($file); if ( ! $recursive && $this->is_dir($file) ) return @rmdir($file); //At this point its a folder, and we're in recursive mode $file = trailingslashit($file); $filelist = $this->dirlist($file, true); $retval = true; if ( is_array($filelist) ) //false if no files, So check first. foreach ($filelist as $filename => $fileinfo) if ( ! $this->delete($file . $filename, $recursive) ) $retval = false; if ( file_exists($file) && ! @rmdir($file) ) $retval = false; return $retval; } function exists($file) { return @file_exists($file); } function is_file($file) { return @is_file($file); } function is_dir($path) { return @is_dir($path); } function is_readable($file) { return @is_readable($file); } function is_writable($file) { return @is_writable($file); } function atime($file) { return @fileatime($file); } function mtime($file) { return @filemtime($file); } function size($file) { return @filesize($file); } function touch($file, $time = 0, $atime = 0){ if ($time == 0) $time = time(); if ($atime == 0) $atime = time(); return @touch($file, $time, $atime); } function mkdir($path, $chmod = false, $chown = false, $chgrp = false){ if ( ! $chmod) $chmod = $this->permission; if ( ! @mkdir($path, $chmod) ) return false; if ( $chown ) $this->chown($path, $chown); if ( $chgrp ) $this->chgrp($path, $chgrp); return true; } function rmdir($path, $recursive = false) { //Currently unused and untested, Use delete() instead. if ( ! $recursive ) return @rmdir($path); //recursive: $filelist = $this->dirlist($path); foreach ($filelist as $filename => $det) { if ( '/' == substr($filename, -1, 1) ) $this->rmdir($path . '/' . $filename, $recursive); @rmdir($filename); } return @rmdir($path); } function dirlist($path, $incdot = false, $recursive = false) { if ( $this->is_file($path) ) { $limitFile = basename($path); $path = dirname($path); } else { $limitFile = false; } if ( ! $this->is_dir($path) ) return false; $ret = array(); $dir = @dir($path); if ( ! $dir ) return false; while (false !== ($entry = $dir->read()) ) { $struc = array(); $struc['name'] = $entry; if ( '.' == $struc['name'] || '..' == $struc['name'] ) continue; //Do not care about these folders. if ( '.' == $struc['name'][0] && !$incdot) continue; if ( $limitFile && $struc['name'] != $limitFile) continue; $struc['perms'] = $this->gethchmod($path.'/'.$entry); $struc['permsn'] = $this->getnumchmodfromh($struc['perms']); $struc['number'] = false; $struc['owner'] = $this->owner($path.'/'.$entry); $struc['group'] = $this->group($path.'/'.$entry); $struc['size'] = $this->size($path.'/'.$entry); $struc['lastmodunix']= $this->mtime($path.'/'.$entry); $struc['lastmod'] = date('M j',$struc['lastmodunix']); $struc['time'] = date('h:i:s',$struc['lastmodunix']); $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; if ( 'd' == $struc['type'] ) { if ( $recursive ) $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); else $struc['files'] = array(); } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset($dir); return $ret; } } ?> thebrutalagenda/wp-admin/includes/manifest.php0000644001761300176130000002544711214074647022327 0ustar mustardamustardaid || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) { // If the new role isn't editable by the logged-in user die with error $editable_roles = get_editable_roles(); if (!$editable_roles[$_POST['role']]) wp_die(__('You can’t give users that role.')); $user = new WP_User( $user_id ); $user->set_role( $_POST['role'] ); } } } else { add_action( 'user_register', 'add_user' ); // See above return edit_user(); } } /** * Edit user settings based on contents of $_POST * * Used on user-edit.php and profile.php to manage and process user options, passwords etc. * * @since 2.0 * * @param int $user_id Optional. User ID. * @return int user id of the updated user */ function edit_user( $user_id = 0 ) { global $current_user, $wp_roles, $wpdb; if ( $user_id != 0 ) { $update = true; $user->ID = (int) $user_id; $userdata = get_userdata( $user_id ); $user->user_login = $wpdb->escape( $userdata->user_login ); } else { $update = false; $user = ''; } if ( isset( $_POST['user_login'] )) $user->user_login = esc_html( trim( $_POST['user_login'] )); $pass1 = $pass2 = ''; if ( isset( $_POST['pass1'] )) $pass1 = $_POST['pass1']; if ( isset( $_POST['pass2'] )) $pass2 = $_POST['pass2']; if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' )) $user->role = $_POST['role']; // If the new role isn't editable by the logged-in user die with error $editable_roles = get_editable_roles(); if (!$editable_roles[$_POST['role']]) wp_die(__('You can’t give users that role.')); } if ( isset( $_POST['email'] )) $user->user_email = esc_html( trim( $_POST['email'] )); if ( isset( $_POST['url'] ) ) { if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) { $user->user_url = ''; } else { $user->user_url = esc_url( trim( $_POST['url'] )); $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; } } if ( isset( $_POST['first_name'] )) $user->first_name = esc_html( trim( $_POST['first_name'] )); if ( isset( $_POST['last_name'] )) $user->last_name = esc_html( trim( $_POST['last_name'] )); if ( isset( $_POST['nickname'] )) $user->nickname = esc_html( trim( $_POST['nickname'] )); if ( isset( $_POST['display_name'] )) $user->display_name = esc_html( trim( $_POST['display_name'] )); if ( isset( $_POST['description'] )) $user->description = trim( $_POST['description'] ); if ( isset( $_POST['jabber'] )) $user->jabber = esc_html( trim( $_POST['jabber'] )); if ( isset( $_POST['aim'] )) $user->aim = esc_html( trim( $_POST['aim'] )); if ( isset( $_POST['yim'] )) $user->yim = esc_html( trim( $_POST['yim'] )); if ( !$update ) $user->rich_editing = 'true'; // Default to true for new users. else if ( isset( $_POST['rich_editing'] ) ) $user->rich_editing = $_POST['rich_editing']; else $user->rich_editing = 'true'; $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] )? $_POST['comment_shortcuts'] : ''; $user->use_ssl = 0; if ( !empty($_POST['use_ssl']) ) $user->use_ssl = 1; if ( !$update ) $user->admin_color = 'fresh'; // Default to fresh for new users. else if ( isset( $_POST['admin_color'] ) ) $user->admin_color = $_POST['admin_color']; else $user->admin_color = 'fresh'; $errors = new WP_Error(); /* checking that username has been typed */ if ( $user->user_login == '' ) $errors->add( 'user_login', __( 'ERROR: Please enter a username.' )); /* checking the password has been typed twice */ do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 )); if ( $update ) { if ( empty($pass1) && !empty($pass2) ) $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) ); elseif ( !empty($pass1) && empty($pass2) ) $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) ); } else { if ( empty($pass1) ) $errors->add( 'pass', __( 'ERROR: Please enter your password.' ), array( 'form-field' => 'pass1' ) ); elseif ( empty($pass2) ) $errors->add( 'pass', __( 'ERROR: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) ); } /* Check for "\" in password */ if ( false !== strpos( stripslashes($pass1), "\\" ) ) $errors->add( 'pass', __( 'ERROR: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); /* checking the password has been typed twice the same */ if ( $pass1 != $pass2 ) $errors->add( 'pass', __( 'ERROR: Please enter the same password in the two password fields.' ), array( 'form-field' => 'pass1' ) ); if (!empty ( $pass1 )) $user->user_pass = $pass1; if ( !$update && !validate_username( $user->user_login ) ) $errors->add( 'user_login', __( 'ERROR: This username is invalid. Please enter a valid username.' )); if (!$update && username_exists( $user->user_login )) $errors->add( 'user_login', __( 'ERROR: This username is already registered. Please choose another one.' )); /* checking e-mail address */ if ( empty ( $user->user_email ) ) { $errors->add( 'empty_email', __( 'ERROR: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) ); } elseif (!is_email( $user->user_email ) ) { $errors->add( 'invalid_email', __( 'ERROR: The e-mail address isn’t correct.' ), array( 'form-field' => 'email' ) ); } elseif ( ( $owner_id = email_exists($user->user_email) ) && $owner_id != $user->ID ) { $errors->add( 'email_exists', __('ERROR: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); } // Allow plugins to return there own errors. do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) ); if ( $errors->get_error_codes() ) return $errors; if ( $update ) { $user_id = wp_update_user( get_object_vars( $user )); } else { $user_id = wp_insert_user( get_object_vars( $user )); wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' ); } return $user_id; } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * * @return array List of user IDs. */ function get_author_user_ids() { global $wpdb; $level_key = $wpdb->prefix . 'user_level'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * * @param int $user_id User ID. * @return array|bool List of editable authors. False if no editable users. */ function get_editable_authors( $user_id ) { global $wpdb; $editable = get_editable_user_ids( $user_id ); if( !$editable ) { return false; } else { $editable = join(',', $editable); $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); } return apply_filters('get_editable_authors', $authors); } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * * @param int $user_id User ID. * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros. * @return unknown */ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { global $wpdb; $user = new WP_User( $user_id ); if ( ! $user->has_cap("edit_others_{$post_type}s") ) { if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false ) return array($user->id); else return false; } $level_key = $wpdb->prefix . 'user_level'; $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); if ( $exclude_zeros ) $query .= " AND meta_value != '0'"; return $wpdb->get_col( $query ); } /** * Fetch a filtered list of user roles that the current user is * allowed to edit. * * Simple function who's main purpose is to allow filtering of the * list of roles in the $wp_roles object so that plugins can remove * innappropriate ones depending on the situation or user making edits. * Specifically because without filtering anyone with the edit_users * capability can edit others to be administrators, even if they are * only editors or authors. This filter allows admins to delegate * user management. * * @since 2.8 * * @return unknown */ function get_editable_roles() { global $wp_roles; $all_roles = $wp_roles->roles; $editable_roles = apply_filters('editable_roles', $all_roles); return $editable_roles; } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * * @return unknown */ function get_nonauthor_user_ids() { global $wpdb; $level_key = $wpdb->prefix . 'user_level'; return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); } /** * Retrieve editable posts from other users. * * @since unknown * * @param int $user_id User ID to not retrieve posts from. * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'. * @return array List of posts from others. */ function get_others_unpublished_posts($user_id, $type='any') { global $wpdb; $editable = get_editable_user_ids( $user_id ); if ( in_array($type, array('draft', 'pending')) ) $type_sql = " post_status = '$type' "; else $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; if( !$editable ) { $other_unpubs = ''; } else { $editable = join(',', $editable); $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); } return apply_filters('get_others_drafts', $other_unpubs); } /** * Retrieve drafts from other users. * * @since unknown * * @param int $user_id User ID. * @return array List of drafts from other users. */ function get_others_drafts($user_id) { return get_others_unpublished_posts($user_id, 'draft'); } /** * Retrieve pending review posts from other users. * * @since unknown * * @param int $user_id User ID. * @return array List of posts with pending review post type from other users. */ function get_others_pending($user_id) { return get_others_unpublished_posts($user_id, 'pending'); } /** * Retrieve user data and filter it. * * @since unknown * * @param int $user_id User ID. * @return object WP_User object with user data. */ function get_user_to_edit( $user_id ) { $user = new WP_User( $user_id ); $user->user_login = esc_attr($user->user_login); $user->user_email = esc_attr($user->user_email); $user->user_url = esc_url($user->user_url); $user->first_name = esc_attr($user->first_name); $user->last_name = esc_attr($user->last_name); $user->display_name = esc_attr($user->display_name); $user->nickname = esc_attr($user->nickname); $user->aim = isset( $user->aim ) && !empty( $user->aim ) ? esc_attr($user->aim) : ''; $user->yim = isset( $user->yim ) && !empty( $user->yim ) ? esc_attr($user->yim) : ''; $user->jabber = isset( $user->jabber ) && !empty( $user->jabber ) ? esc_attr($user->jabber) : ''; $user->description = isset( $user->description ) && !empty( $user->description ) ? esc_html($user->description) : ''; return $user; } /** * Retrieve the user's drafts. * * @since unknown * * @param int $user_id User ID. * @return array */ function get_users_drafts( $user_id ) { global $wpdb; $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id); $query = apply_filters('get_users_drafts', $query); return $wpdb->get_results( $query ); } /** * Remove user and optionally reassign posts and links to another user. * * If the $reassign parameter is not assigned to an User ID, then all posts will * be deleted of that user. The action 'delete_user' that is passed the User ID * being deleted will be run after the posts are either reassigned or deleted. * The user meta will also be deleted that are for that User ID. * * @since unknown * * @param int $id User ID. * @param int $reassign Optional. Reassign posts and links to new User ID. * @return bool True when finished. */ function wp_delete_user($id, $reassign = 'novalue') { global $wpdb; $id = (int) $id; $user = new WP_User($id); // allow for transaction statement do_action('delete_user', $id); if ($reassign == 'novalue') { $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) ); if ($post_ids) { foreach ($post_ids as $post_id) wp_delete_post($post_id); } // Clean links $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); if ( $link_ids ) { foreach ( $link_ids as $link_id ) wp_delete_link($link_id); } } else { $reassign = (int) $reassign; $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) ); $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $id) ); } // FINALLY, delete user $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) ); wp_cache_delete($id, 'users'); wp_cache_delete($user->user_login, 'userlogins'); wp_cache_delete($user->user_email, 'useremail'); wp_cache_delete($user->user_nicename, 'userslugs'); // allow for commit transaction do_action('deleted_user', $id); return true; } /** * Remove all capabilities from user. * * @since unknown * * @param int $id User ID. */ function wp_revoke_user($id) { $id = (int) $id; $user = new WP_User($id); $user->remove_all_caps(); } if ( !class_exists('WP_User_Search') ) : /** * WordPress User Search class. * * @since unknown * @author Mark Jaquith */ class WP_User_Search { /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $results; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $search_term; /** * Page number. * * @since unknown * @access private * @var int */ var $page; /** * Role name that users have. * * @since unknown * @access private * @var string */ var $role; /** * Raw page number. * * @since unknown * @access private * @var int|bool */ var $raw_page; /** * Amount of users to display per page. * * @since unknown * @access public * @var int */ var $users_per_page = 50; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $first_user; /** * {@internal Missing Description}} * * @since unknown * @access private * @var int */ var $last_user; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $query_limit; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $query_sort; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $query_from_where; /** * {@internal Missing Description}} * * @since unknown * @access private * @var int */ var $total_users_for_query = 0; /** * {@internal Missing Description}} * * @since unknown * @access private * @var bool */ var $too_many_total_users = false; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $search_errors; /** * {@internal Missing Description}} * * @since unknown * @access private * @var unknown_type */ var $paging_text; /** * PHP4 Constructor - Sets up the object properties. * * @since unknown * * @param string $search_term Search terms string. * @param int $page Optional. Page ID. * @param string $role Role name. * @return WP_User_Search */ function WP_User_Search ($search_term = '', $page = '', $role = '') { $this->search_term = $search_term; $this->raw_page = ( '' == $page ) ? false : (int) $page; $this->page = (int) ( '' == $page ) ? 1 : $page; $this->role = $role; $this->prepare_query(); $this->query(); $this->prepare_vars_for_template_usage(); $this->do_paging(); } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * @access public */ function prepare_query() { global $wpdb; $this->first_user = ($this->page - 1) * $this->users_per_page; $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page); $this->query_sort = ' ORDER BY user_login'; $search_sql = ''; if ( $this->search_term ) { $searches = array(); $search_sql = 'AND ('; foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) $searches[] = $col . " LIKE '%$this->search_term%'"; $search_sql .= implode(' OR ', $searches); $search_sql .= ')'; } $this->query_from_where = "FROM $wpdb->users"; if ( $this->role ) $this->query_from_where .= $wpdb->prepare(" INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); else $this->query_from_where .= " WHERE 1=1"; $this->query_from_where .= " $search_sql"; } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * @access public */ function query() { global $wpdb; $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit); if ( $this->results ) $this->total_users_for_query = $wpdb->get_var('SELECT COUNT(ID) ' . $this->query_from_where); // no limit else $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!')); } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * @access public */ function prepare_vars_for_template_usage() { $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * @access public */ function do_paging() { if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results $args = array(); if( ! empty($this->search_term) ) $args['usersearch'] = urlencode($this->search_term); if( ! empty($this->role) ) $args['role'] = urlencode($this->role); $this->paging_text = paginate_links( array( 'total' => ceil($this->total_users_for_query / $this->users_per_page), 'current' => $this->page, 'base' => 'users.php?%_%', 'format' => 'userspage=%#%', 'add_args' => $args ) ); if ( $this->paging_text ) { $this->paging_text = sprintf( '' . __( 'Displaying %s–%s of %s' ) . '%s', number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), number_format_i18n( $this->total_users_for_query ), $this->paging_text ); } } } /** * {@internal Missing Short Description}} * * {@internal Missing Long Description}} * * @since unknown * @access public * * @return unknown */ function get_results() { return (array) $this->results; } /** * Displaying paging text. * * @see do_paging() Builds paging text. * * @since unknown * @access public */ function page_links() { echo $this->paging_text; } /** * Whether paging is enabled. * * @see do_paging() Builds paging text. * * @since unknown * @access public * * @return bool */ function results_are_paged() { if ( $this->paging_text ) return true; return false; } /** * Whether there are search terms. * * @since unknown * @access public * * @return bool */ function is_search() { if ( $this->search_term ) return true; return false; } } endif; add_action('admin_init', 'default_password_nag_handler'); function default_password_nag_handler($errors = false) { global $user_ID; if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it. return; //get_user_setting = JS saved UI setting. else no-js-falback code. if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) { delete_user_setting('default_password_nag'); update_usermeta($user_ID, 'default_password_nag', false); } } add_action('profile_update', 'default_password_nag_edit_user', 10, 2); function default_password_nag_edit_user($user_ID, $old_data) { global $user_ID; if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it. return; $new_data = get_userdata($user_ID); if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed. delete_user_setting('default_password_nag'); update_usermeta($user_ID, 'default_password_nag', false); } } add_action('admin_notices', 'default_password_nag'); function default_password_nag() { global $user_ID; if ( ! get_usermeta($user_ID, 'default_password_nag') ) return; echo '

'; printf(__("Notice: you're using the auto-generated password for your account. Would you like to change it to something you'll remember easier?
Yes, Take me to my profile page | No Thanks, Do not remind me again."), admin_url('profile.php') . '#password', '?default_password_nag=0'); echo '

'; } ?> thebrutalagenda/wp-admin/includes/widgets.php0000644001761300176130000001677411214074650022164 0ustar mustardamustarda $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' ); if ( isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']) ) { $id_base = $wp_registered_widget_controls[$widget['id']]['id_base']; $args['_temp_id'] = "$id_base-__i__"; $args['_multi_num'] = next_widget_id_number($id_base); $args['_add'] = 'multi'; } else { $args['_add'] = 'single'; if ( $sidebar ) $args['_hide'] = '1'; } $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) ); call_user_func_array( 'wp_widget_control', $args ); } } /** * {@internal Missing Short Description}} * * @since unknown * * @param string $sidebar */ function wp_list_widget_controls( $sidebar ) { add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' ); echo "\t
\n"; dynamic_sidebar( $sidebar ); echo "\t
\n"; } /** * {@internal Missing Short Description}} * * @since unknown * * @param array $params * @return array */ function wp_list_widget_controls_dynamic_sidebar( $params ) { global $wp_registered_widgets; static $i = 0; $i++; $widget_id = $params[0]['widget_id']; $id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id; $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : ''; $params[0]['before_widget'] = "
"; $params[0]['after_widget'] = "
"; $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) { $wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback']; $wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control'; } return $params; } function next_widget_id_number($id_base) { global $wp_registered_widgets; $number = 2; while ( isset($wp_registered_widgets["$id_base-$number"]) ) $number++; return $number; } /** * Meta widget used to display the control form for a widget. * * Called from dynamic_sidebar(). * * @since unknown * * @param array $sidebar_args * @return array */ function wp_widget_control( $sidebar_args ) { global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets; $widget_id = $sidebar_args['widget_id']; $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false; $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : '-1'; // position of widget in sidebar $control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : array(); $widget = $wp_registered_widgets[$widget_id]; $id_format = $widget['id']; $widget_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; $id_base = isset($control['id_base']) ? $control['id_base'] : $widget_id; $multi_number = isset($sidebar_args['_multi_num']) ? $sidebar_args['_multi_num'] : ''; $add_new = isset($sidebar_args['_add']) ? $sidebar_args['_add'] : ''; $query_arg = array( 'editwidget' => $widget['id'] ); if ( $add_new ) { $query_arg['addnew'] = 1; if ( $multi_number ) { $query_arg['num'] = $multi_number; $query_arg['base'] = $id_base; } } else { $query_arg['sidebar'] = $sidebar_id; $query_arg['key'] = $key; } // We aren't showing a widget control, we're outputing a template for a mult-widget control if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) { // number == -1 implies a template where id numbers are replaced by a generic '__i__' $control['params'][0]['number'] = -1; // with id_base widget id's are constructed like {$id_base}-{$id_number} if ( isset($control['id_base']) ) $id_format = $control['id_base'] . '-__i__'; } $wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback']; unset($wp_registered_widgets[$widget_id]['_callback']); $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) ); $has_form = 'noform'; echo $sidebar_args['before_widget']; ?>

" . __('There are no options for this widget.') . "

\n"; ?>
|

method = 'ssh2'; $this->errors = new WP_Error(); //Check if possible to use ssh2 functions. if ( ! extension_loaded('ssh2') ) { $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available')); return false; } if ( ! version_compare(phpversion(), '5', '>=') ) { $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however requires PHP 5+')); return false; } // Set defaults: if ( empty($opt['port']) ) $this->options['port'] = 22; else $this->options['port'] = $opt['port']; if ( empty($opt['hostname']) ) $this->errors->add('empty_hostname', __('SSH2 hostname is required')); else $this->options['hostname'] = $opt['hostname']; if ( isset($opt['base']) && ! empty($opt['base']) ) $this->wp_base = $opt['base']; // Check if the options provided are OK. if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) { $this->options['public_key'] = $opt['public_key']; $this->options['private_key'] = $opt['private_key']; $this->options['hostkey'] = array('hostkey' => 'ssh-rsa'); $this->keys = true; } elseif ( empty ($opt['username']) ) { $this->errors->add('empty_username', __('SSH2 username is required')); } if ( !empty($opt['username']) ) $this->options['username'] = $opt['username']; if ( empty ($opt['password']) ) { if ( !$this->keys ) // password can be blank if we are using keys $this->errors->add('empty_password', __('SSH2 password is required')); } else { $this->options['password'] = $opt['password']; } } function connect() { if ( ! $this->keys ) { $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']); } else { $this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']); } if ( ! $this->link ) { $this->errors->add('connect', sprintf(__('Failed to connect to SSH2 Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); return false; } if ( !$this->keys ) { if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password']) ) { $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); return false; } } else { if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) { $this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username'])); return false; } } $this->sftp_link = ssh2_sftp($this->link); return true; } function run_command( $command, $returnbool = false) { if ( ! $this->link ) return false; if ( ! ($stream = ssh2_exec($this->link, $command)) ) { $this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command)); } else { stream_set_blocking( $stream, true ); stream_set_timeout( $stream, $this->timeout ); $data = stream_get_contents($stream); if ( $returnbool ) return '' != trim($data); else return $data; } return false; } function setDefaultPermissions($perm) { $this->debug("setDefaultPermissions();"); if ( $perm ) $this->permission = $perm; } function get_contents($file, $type = '', $resumepos = 0 ) { $file = ltrim($file, '/'); return file_get_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function get_contents_array($file) { $file = ltrim($file, '/'); return file('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function put_contents($file, $contents, $type = '' ) { $file = ltrim($file, '/'); return file_put_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file, $contents); } function cwd() { $cwd = $this->run_command('pwd'); if( $cwd ) $cwd = trailingslashit($cwd); return $cwd; } function chdir($dir) { return $this->run_command('cd ' . $dir, true); } function chgrp($file, $group, $recursive = false ) { if ( ! $this->exists($file) ) return false; if ( ! $recursive || ! $this->is_dir($file) ) return $this->run_command(sprintf('chgrp %o %s', $mode, escapeshellarg($file)), true); return $this->run_command(sprintf('chgrp -R %o %s', $mode, escapeshellarg($file)), true); } function chmod($file, $mode = false, $recursive = false) { if( ! $mode ) $mode = $this->permission; if( ! $mode ) return false; if ( ! $this->exists($file) ) return false; if ( ! $recursive || ! $this->is_dir($file) ) return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true); return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true); } function chown($file, $owner, $recursive = false ) { if ( ! $this->exists($file) ) return false; if ( ! $recursive || ! $this->is_dir($file) ) return $this->run_command(sprintf('chown %o %s', $mode, escapeshellarg($file)), true); return $this->run_command(sprintf('chown -R %o %s', $mode, escapeshellarg($file)), true); } function owner($file) { $owneruid = @fileowner('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); if ( ! $owneruid ) return false; if ( ! function_exists('posix_getpwuid') ) return $owneruid; $ownerarray = posix_getpwuid($owneruid); return $ownerarray['name']; } function getchmod($file) { return substr(decoct(@fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/') )),3); } function group($file) { $gid = @filegroup('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/')); if ( ! $gid ) return false; if ( ! function_exists('posix_getgrgid') ) return $gid; $grouparray = posix_getgrgid($gid); return $grouparray['name']; } function copy($source, $destination, $overwrite = false ) { if( ! $overwrite && $this->exists($destination) ) return false; $content = $this->get_contents($source); if( false === $content) return false; return $this->put_contents($destination, $content); } function move($source, $destination, $overwrite = false) { return @ssh2_sftp_rename($this->link, $source, $destination); } function delete($file, $recursive = false) { if ( $this->is_file($file) ) return ssh2_sftp_unlink($this->sftp_link, $file); if ( ! $recursive ) return ssh2_sftp_rmdir($this->sftp_link, $file); $filelist = $this->dirlist($file); if ( is_array($filelist) ) { foreach ( $filelist as $filename => $fileinfo) { $this->delete($file . '/' . $filename, $recursive); } } return ssh2_sftp_rmdir($this->sftp_link, $file); } function exists($file) { //return $this->run_command(sprintf('ls -lad %s', escapeshellarg($file)), true); $file = ltrim($file, '/'); return file_exists('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function is_file($file) { $file = ltrim($file, '/'); return is_file('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function is_dir($path) { $path = ltrim($path, '/'); return is_dir('ssh2.sftp://' . $this->sftp_link .'/' . $path); } function is_readable($file) { $file = ltrim($file, '/'); return is_readable('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function is_writable($file) { $file = ltrim($file, '/'); return is_writable('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function atime($file) { $file = ltrim($file, '/'); return fileatime('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function mtime($file) { $file = ltrim($file, '/'); return filemtime('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function size($file) { $file = ltrim($file, '/'); return filesize('ssh2.sftp://' . $this->sftp_link .'/' . $file); } function touch($file, $time = 0, $atime = 0) { //Not implmented. } function mkdir($path, $chmod = null, $chown = false, $chgrp = false) { $path = untrailingslashit($path); $chmod = !empty($chmod) ? $chmod : $this->permission; if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) ) return false; if ( $chown ) $this->chown($path, $chown); if ( $chgrp ) $this->chgrp($path, $chgrp); return true; } function rmdir($path, $recursive = false) { return $this->delete($path, $recursive); } function dirlist($path, $incdot = false, $recursive = false) { if ( $this->is_file($path) ) { $limitFile = basename($path); $path = dirname($path); } else { $limitFile = false; } if ( ! $this->is_dir($path) ) return false; $ret = array(); $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') ); if ( ! $dir ) return false; while (false !== ($entry = $dir->read()) ) { $struc = array(); $struc['name'] = $entry; if ( '.' == $struc['name'] || '..' == $struc['name'] ) continue; //Do not care about these folders. if ( '.' == $struc['name'][0] && !$incdot) continue; if ( $limitFile && $struc['name'] != $limitFile) continue; $struc['perms'] = $this->gethchmod($path.'/'.$entry); $struc['permsn'] = $this->getnumchmodfromh($struc['perms']); $struc['number'] = false; $struc['owner'] = $this->owner($path.'/'.$entry); $struc['group'] = $this->group($path.'/'.$entry); $struc['size'] = $this->size($path.'/'.$entry); $struc['lastmodunix']= $this->mtime($path.'/'.$entry); $struc['lastmod'] = date('M j',$struc['lastmodunix']); $struc['time'] = date('h:i:s',$struc['lastmodunix']); $struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f'; if ( 'd' == $struc['type'] ) { if ( $recursive ) $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); else $struc['files'] = array(); } $ret[ $struc['name'] ] = $struc; } $dir->close(); unset($dir); return $ret; } }thebrutalagenda/wp-admin/includes/media.php0000644001761300176130000020301611214074650021560 0ustar mustardamustarda __('From Computer'), // handler action suffix => tab text 'type_url' => __('From URL'), 'gallery' => __('Gallery'), 'library' => __('Media Library') ); return apply_filters('media_upload_tabs', $_default_tabs); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $tabs * @return unknown */ function update_gallery_tab($tabs) { global $wpdb; if ( !isset($_REQUEST['post_id']) ) { unset($tabs['gallery']); return $tabs; } if ( intval($_REQUEST['post_id']) ) $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id']))); if ( empty($attachments) ) { unset($tabs['gallery']); return $tabs; } $tabs['gallery'] = sprintf(__('Gallery (%s)'), "$attachments"); return $tabs; } add_filter('media_upload_tabs', 'update_gallery_tab'); /** * {@internal Missing Short Description}} * * @since unknown */ function the_media_upload_tabs() { global $redir_tab; $tabs = media_upload_tabs(); if ( !empty($tabs) ) { echo "
    \n"; if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) $current = $redir_tab; elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) $current = $_GET['tab']; else $current = apply_filters('media_upload_default_tab', 'type'); foreach ( $tabs as $callback => $text ) { $class = ''; if ( $current == $callback ) $class = " class='current'"; $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false)); $link = "$text"; echo "\t
  • $link
  • \n"; } echo "
\n"; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $id * @param unknown_type $alt * @param unknown_type $title * @param unknown_type $align * @param unknown_type $url * @param unknown_type $rel * @param unknown_type $size * @return unknown */ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') { $htmlalt = ( empty($alt) ) ? $title : $alt; $html = get_image_tag($id, $htmlalt, $title, $align, $size); $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : ''; if ( $url ) $html = '$html"; $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size ); return $html; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $html * @param unknown_type $id * @param unknown_type $alt * @param unknown_type $title * @param unknown_type $align * @param unknown_type $url * @param unknown_type $size * @return unknown */ function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html; $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; preg_match( '/width="([0-9]+)/', $html, $matches ); if ( ! isset($matches[1]) ) return $html; $width = $matches[1]; $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html ); if ( empty($align) ) $align = 'none'; $alt = ! empty($alt) ? addslashes($alt) : ''; $shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]'; return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); } add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 ); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $html */ function media_send_to_editor($html) { ?> false); $time = current_time('mysql'); if ( $post = get_post($post_id) ) { if ( substr( $post->post_date, 0, 4 ) > 0 ) $time = $post->post_date; } $name = $_FILES[$file_id]['name']; $file = wp_handle_upload($_FILES[$file_id], $overrides, $time); if ( isset($file['error']) ) return new WP_Error( 'upload_error', $file['error'] ); $name_parts = pathinfo($name); $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = $name; $content = ''; // use image exif/iptc data for title and caption defaults if possible if ( $image_meta = @wp_read_image_metadata($file) ) { if ( trim($image_meta['title']) ) $title = $image_meta['title']; if ( trim($image_meta['caption']) ) $content = $image_meta['caption']; } // Construct the attachment array $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, ), $post_data ); // Save the data $id = wp_insert_attachment($attachment, $file, $post_id); if ( !is_wp_error($id) ) { wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); } return $id; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file_array * @param unknown_type $post_id * @param unknown_type $desc * @param unknown_type $post_data * @return unknown */ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) { $overrides = array('test_form'=>false); $file = wp_handle_sideload($file_array, $overrides); if ( isset($file['error']) ) return new WP_Error( 'upload_error', $file['error'] ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $title = preg_replace('/\.[^.]+$/', '', basename($file)); $content = ''; // use image exif/iptc data for title and caption defaults if possible if ( $image_meta = @wp_read_image_metadata($file) ) { if ( trim($image_meta['title']) ) $title = $image_meta['title']; if ( trim($image_meta['caption']) ) $content = $image_meta['caption']; } $title = @$desc; // Construct the attachment array $attachment = array_merge( array( 'post_mime_type' => $type, 'guid' => $url, 'post_parent' => $post_id, 'post_title' => $title, 'post_content' => $content, ), $post_data ); // Save the data $id = wp_insert_attachment($attachment, $file, $post_id); if ( !is_wp_error($id) ) { wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); return $url; } return $id; } /** * {@internal Missing Short Description}} * * Wrap iframe content (produced by $content_func) in a doctype, html head/body * etc any additional function args will be passed to content_func. * * @since unknown * * @param unknown_type $content_func */ function wp_iframe($content_func /* ... */) { ?> > <?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?> > $image_title $video_title $audio_title $media_title EOF; printf($context, $out); } add_action( 'media_buttons', 'media_buttons' ); add_action('media_upload_media', 'media_upload_handler'); /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_form_handler() { check_admin_referer('media-form'); $errors = array(); if ( isset($_POST['send']) ) { $keys = array_keys($_POST['send']); $send_id = (int) array_shift($keys); } if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { $post = $_post = get_post($attachment_id, ARRAY_A); if ( isset($attachment['post_content']) ) $post['post_content'] = $attachment['post_content']; if ( isset($attachment['post_title']) ) $post['post_title'] = $attachment['post_title']; if ( isset($attachment['post_excerpt']) ) $post['post_excerpt'] = $attachment['post_excerpt']; if ( isset($attachment['menu_order']) ) $post['menu_order'] = $attachment['menu_order']; if ( isset($send_id) && $attachment_id == $send_id ) { if ( isset($attachment['post_parent']) ) $post['post_parent'] = $attachment['post_parent']; } $post = apply_filters('attachment_fields_to_save', $post, $attachment); if ( isset($post['errors']) ) { $errors[$attachment_id] = $post['errors']; unset($post['errors']); } if ( $post != $_post ) wp_update_post($post); foreach ( get_attachment_taxonomies($post) as $t ) if ( isset($attachment[$t]) ) wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false); } if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?> $html"; } $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); return media_send_to_editor($html); } return $errors; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_image() { $errors = array(); $id = 0; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if ( is_wp_error($id) ) { $errors['upload_error'] = $id; $id = false; } } if ( !empty($_POST['insertonlybutton']) ) { $src = $_POST['insertonly']['src']; if ( !empty($src) && !strpos($src, '://') ) $src = "http://$src"; $alt = esc_attr($_POST['insertonly']['alt']); if ( isset($_POST['insertonly']['align']) ) { $align = esc_attr($_POST['insertonly']['align']); $class = " class='align$align'"; } if ( !empty($src) ) $html = "$alt"; $html = apply_filters('image_send_to_editor_url', $html, $src, $alt, $align); return media_send_to_editor($html); } if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); return media_upload_gallery(); } if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id ); return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file * @param unknown_type $post_id * @param unknown_type $desc * @return unknown */ function media_sideload_image($file, $post_id, $desc = null) { if (!empty($file) ) { $file_array['name'] = basename($file); $tmp = download_url($file); $file_array['tmp_name'] = $tmp; $desc = @$desc; if ( is_wp_error($tmp) ) { @unlink($file_array['tmp_name']); $file_array['tmp_name'] = ''; } $id = media_handle_sideload($file_array, $post_id, $desc); $src = $id; if ( is_wp_error($id) ) { @unlink($file_array['tmp_name']); return $id; } } if ( !empty($src) ) { $alt = @$desc; $html = "$alt"; return $html; } } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_audio() { $errors = array(); $id = 0; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if ( is_wp_error($id) ) { $errors['upload_error'] = $id; $id = false; } } if ( !empty($_POST['insertonlybutton']) ) { $href = $_POST['insertonly']['href']; if ( !empty($href) && !strpos($href, '://') ) $href = "http://$href"; $title = esc_attr($_POST['insertonly']['title']); if ( empty($title) ) $title = basename($href); if ( !empty($title) && !empty($href) ) $html = "$title"; $html = apply_filters('audio_send_to_editor_url', $html, $href, $title); return media_send_to_editor($html); } if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); return media_upload_gallery(); } if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id ); return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id ); } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_video() { $errors = array(); $id = 0; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if ( is_wp_error($id) ) { $errors['upload_error'] = $id; $id = false; } } if ( !empty($_POST['insertonlybutton']) ) { $href = $_POST['insertonly']['href']; if ( !empty($href) && !strpos($href, '://') ) $href = "http://$href"; $title = esc_attr($_POST['insertonly']['title']); if ( empty($title) ) $title = basename($href); if ( !empty($title) && !empty($href) ) $html = "$title"; $html = apply_filters('video_send_to_editor_url', $html, $href, $title); return media_send_to_editor($html); } if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); return media_upload_gallery(); } if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id ); return wp_iframe( 'media_upload_type_form', 'video', $errors, $id ); } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_file() { $errors = array(); $id = 0; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if ( is_wp_error($id) ) { $errors['upload_error'] = $id; $id = false; } } if ( !empty($_POST['insertonlybutton']) ) { $href = $_POST['insertonly']['href']; if ( !empty($href) && !strpos($href, '://') ) $href = "http://$href"; $title = esc_attr($_POST['insertonly']['title']); if ( empty($title) ) $title = basename($href); if ( !empty($title) && !empty($href) ) $html = "$title"; $html = apply_filters('file_send_to_editor_url', $html, $href, $title); return media_send_to_editor($html); } if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); return media_upload_gallery(); } if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id ); return wp_iframe( 'media_upload_type_form', 'file', $errors, $id ); } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_gallery() { $errors = array(); if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } wp_enqueue_script('admin-gallery'); return wp_iframe( 'media_upload_gallery_form', $errors ); } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function media_upload_library() { $errors = array(); if ( !empty($_POST) ) { $return = media_upload_form_handler(); if ( is_string($return) ) return $return; if ( is_array($return) ) $errors = $return; } return wp_iframe( 'media_upload_library_form', $errors ); } /** * Retrieve HTML for the image alignment radio buttons with the specified one checked. * * @since unknown * * @param unknown_type $post * @param unknown_type $checked * @return unknown */ function image_align_input_fields( $post, $checked = '' ) { $alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right')); if ( !array_key_exists( (string) $checked, $alignments ) ) $checked = 'none'; $out = array(); foreach ($alignments as $name => $label) { $name = esc_attr($name); $out[] = ""; } return join("\n", $out); } /** * Retrieve HTML for the size radio buttons with the specified one checked. * * @since unknown * * @param unknown_type $post * @param unknown_type $checked * @return unknown */ function image_size_input_fields( $post, $checked = '' ) { // get a list of the actual pixel dimensions of each possible intermediate version of this image $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size')); foreach ( $size_names as $size => $name ) { $downsize = image_downsize($post->ID, $size); // is this size selectable? $enabled = ( $downsize[3] || 'full' == $size ); $css_id = "image-size-{$size}-{$post->ID}"; // if this size is the default but that's not available, don't select it if ( $checked && !$enabled ) $checked = ''; // if $checked was not specified, default to the first available size that's bigger than a thumbnail if ( !$checked && $enabled && 'thumbnail' != $size ) $checked = $size; $html = "
"; $html .= ""; // only show the dimensions if that choice is available if ( $enabled ) $html .= " "; $html .= '
'; $out[] = $html; } return array( 'label' => __('Size'), 'input' => 'html', 'html' => join("\n", $out), ); } /** * Retrieve HTML for the Link URL buttons with the default link type as specified. * * @since unknown * * @param unknown_type $post * @param unknown_type $url_type * @return unknown */ function image_link_input_fields($post, $url_type='') { $file = wp_get_attachment_url($post->ID); $link = get_attachment_link($post->ID); $url = ''; if ( $url_type == 'file' ) $url = $file; elseif ( $url_type == 'post' ) $url = $link; return "
"; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $form_fields * @param unknown_type $post * @return unknown */ function image_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['post_title']['required'] = true; $file = wp_get_attachment_url($post->ID); $form_fields['image_url']['value'] = $file; $form_fields['post_excerpt']['label'] = __('Caption'); $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); $form_fields['post_content']['label'] = __('Description'); $form_fields['align'] = array( 'label' => __('Alignment'), 'input' => 'html', 'html' => image_align_input_fields($post, get_option('image_default_align')), ); $form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size')); } return $form_fields; } add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $form_fields * @param unknown_type $post * @return unknown */ function media_single_attachment_fields_to_edit( $form_fields, $post ) { unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']); return $form_fields; } function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { unset($form_fields['image_url']); return $form_fields; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $post * @param unknown_type $attachment * @return unknown */ function image_attachment_fields_to_save($post, $attachment) { if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { if ( strlen(trim($post['post_title'])) == 0 ) { $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid'])); $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.'); } } return $post; } add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $html * @param unknown_type $attachment_id * @param unknown_type $attachment * @return unknown */ function image_media_send_to_editor($html, $attachment_id, $attachment) { $post =& get_post($attachment_id); if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $url = $attachment['url']; if ( isset($attachment['align']) ) $align = $attachment['align']; else $align = 'none'; if ( !empty($attachment['image-size']) ) $size = $attachment['image-size']; else $size = 'medium'; $rel = ( $url == get_attachment_link($attachment_id) ); return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size); } return $html; } add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $post * @param unknown_type $errors * @return unknown */ function get_attachment_fields_to_edit($post, $errors = null) { if ( is_int($post) ) $post =& get_post($post); if ( is_array($post) ) $post = (object) $post; $image_url = wp_get_attachment_url($post->ID); $edit_post = sanitize_post($post, 'edit'); $form_fields = array( 'post_title' => array( 'label' => __('Title'), 'value' => $edit_post->post_title, ), 'post_excerpt' => array( 'label' => __('Caption'), 'value' => $edit_post->post_excerpt, ), 'post_content' => array( 'label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea', ), 'url' => array( 'label' => __('Link URL'), 'input' => 'html', 'html' => image_link_input_fields($post, get_option('image_default_link_type')), 'helps' => __('Enter a link URL or click above for presets.'), ), 'menu_order' => array( 'label' => __('Order'), 'value' => $edit_post->menu_order ), 'image_url' => array( 'label' => __('File URL'), 'input' => 'html', 'html' => "
", 'value' => isset($edit_post->post_url) ? $edit_post->post_url : '', 'helps' => __('Location of the uploaded file.'), ) ); foreach ( get_attachment_taxonomies($post) as $taxonomy ) { $t = (array) get_taxonomy($taxonomy); if ( empty($t['label']) ) $t['label'] = $taxonomy; if ( empty($t['args']) ) $t['args'] = array(); $terms = get_object_term_cache($post->ID, $taxonomy); if ( empty($terms) ) $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); $values = array(); foreach ( $terms as $term ) $values[] = $term->name; $t['value'] = join(', ', $values); $form_fields[$taxonomy] = $t; } // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) $form_fields = array_merge_recursive($form_fields, (array) $errors); $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); return $form_fields; } /** * Retrieve HTML for media items of post gallery. * * The HTML markup retrieved will be created for the progress of SWF Upload * component. Will also create link for showing and hiding the form to modify * the image attachment. * * @since unknown * * @param int $post_id Optional. Post ID. * @param array $errors Errors for attachment, if any. * @return string */ function get_media_items( $post_id, $errors ) { if ( $post_id ) { $post = get_post($post_id); if ( $post && $post->post_type == 'attachment' ) $attachments = array($post->ID => $post); else $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') ); } else { if ( is_array($GLOBALS['wp_the_query']->posts) ) foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) $attachments[$attachment->ID] = $attachment; } $output = ''; foreach ( (array) $attachments as $id => $attachment ) if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) $output .= "\n
$item\n
"; return $output; } /** * Retrieve HTML form for modifying the image attachment. * * @since unknown * * @param int $attachment_id Attachment ID for modification. * @param string|array $args Optional. Override defaults. * @return string HTML form for attachment. */ function get_media_item( $attachment_id, $args = null ) { global $redir_tab; $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true ); $args = wp_parse_args( $args, $default_args ); extract( $args, EXTR_SKIP ); global $post_mime_types; if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) $thumb_url = $thumb_url[0]; else return false; $toggle_on = __('Show'); $toggle_off = __('Hide'); $post = get_post($attachment_id); $filename = basename($post->guid); $title = esc_attr($post->post_title); if ( $_tags = get_the_tags($attachment_id) ) { foreach ( $_tags as $tag ) $tags[] = $tag->name; $tags = esc_attr(join(', ', $tags)); } $type = ''; if ( isset($post_mime_types) ) { $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); $type = array_shift($keys); $type = ""; } $form_fields = get_attachment_fields_to_edit($post, $errors); if ( $toggle ) { $class = empty($errors) ? 'startclosed' : 'startopen'; $toggle_links = " $toggle_on $toggle_off"; } else { $class = 'form-table'; $toggle_links = ''; } $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case $display_title = $show_title ? "
" . wp_html_excerpt($display_title, 60) . "
" : ''; $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false; $order = ''; foreach ( $form_fields as $key => $val ) { if ( 'menu_order' == $key ) { if ( $gallery ) $order = ''; else $order = ''; unset($form_fields['menu_order']); break; } } $item = " $type $toggle_links $order $display_title \n"; $defaults = array( 'input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array(), ); $delete_href = wp_nonce_url("post.php?action=delete-post&post=$attachment_id", 'delete-post_' . $attachment_id); if ( $send ) $send = ""; if ( $delete ) $delete = "" . __('Delete') . ""; if ( ( $send || $delete ) && !isset($form_fields['buttons']) ) $form_fields['buttons'] = array('tr' => "\t\t\n"); $hidden_fields = array(); foreach ( $form_fields as $id => $field ) { if ( $id{0} == '_' ) continue; if ( !empty($field['tr']) ) { $item .= $field['tr']; continue; } $field = array_merge($defaults, $field); $name = "attachments[$attachment_id][$id]"; if ( $field['input'] == 'hidden' ) { $hidden_fields[$name] = $field['value']; continue; } $required = $field['required'] ? '*' : ''; $aria_required = $field['required'] ? " aria-required='true' " : ''; $class = $id; $class .= $field['required'] ? ' form-required' : ''; $item .= "\t\t\n\t\t\t\n\t\t\t\n\t\t\n"; $extra_rows = array(); if ( !empty($field['errors']) ) foreach ( array_unique((array) $field['errors']) as $error ) $extra_rows['error'][] = $error; if ( !empty($field['extra_rows']) ) foreach ( $field['extra_rows'] as $class => $rows ) foreach ( (array) $rows as $html ) $extra_rows[$class][] = $html; foreach ( $extra_rows as $class => $rows ) foreach ( $rows as $html ) $item .= "\t\t\n"; } if ( !empty($form_fields['_final']) ) $item .= "\t\t\n"; $item .= "\t\n"; $item .= "\t
$filename
$post->post_mime_type
" . mysql2date($post->post_date, get_option('time_format')) . "
" . apply_filters('media_meta', '', $post) . "
$send $delete
" . sprintf(__("You are about to delete %s."), $filename) . " " . __('Continue') . " " . __('Cancel') . "
"; if ( !empty($field[$field['input']]) ) $item .= $field[$field['input']]; elseif ( $field['input'] == 'textarea' ) { $item .= ""; } else { $item .= ""; } if ( !empty($field['helps']) ) $item .= "

" . join( "

\n

", array_unique((array) $field['helps']) ) . '

'; $item .= "
$html
{$form_fields['_final']}
\n"; foreach ( $hidden_fields as $name => $value ) $item .= "\t\n"; if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) { $parent = (int) $_REQUEST['post_id']; $parent_name = "attachments[$attachment_id][post_parent]"; $item .= "\t\n"; } return $item; } /** * {@internal Missing Short Description}} * * @since unknown */ function media_upload_header() { ?>
get_error_message(); ?>

'.esc_html($id->get_error_message()).'
'; exit; } } ?>

| |
add_query_arg( 'paged', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($wp_query->found_posts / 10), 'current' => $_GET['paged'] )); if ( $page_links ) echo "
$page_links
"; ?>
posts WHERE post_type = 'attachment' ORDER BY post_date DESC"; $arc_result = $wpdb->get_results( $arc_query ); $month_count = count($arc_result); if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>

required *

' . $alt_help . '


' . __('Enter a link URL or click above for presets.') . '

'; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function type_url_form_audio() { return '
*
*
' . __('Link text, e.g. “Still Alive by Jonathan Coulton”') . '
'; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function type_url_form_video() { return '
*
*
' . __('Link text, e.g. “Lucy on YouTube“') . '
'; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function type_url_form_file() { return '
*
*
' . __('Link text, e.g. “Ransom Demands (PDF)”') . '
'; } /** * {@internal Missing Short Description}} * * Support a GET parameter for disabling the flash uploader. * * @since unknown * * @param unknown_type $flash * @return unknown */ function media_upload_use_flash($flash) { if ( array_key_exists('flash', $_REQUEST) ) $flash = !empty($_REQUEST['flash']); return $flash; } add_filter('flash_uploader', 'media_upload_use_flash'); /** * {@internal Missing Short Description}} * * @since unknown */ function media_upload_flash_bypass() { echo '

'; printf( __('You are using the Flash uploader. Problems? Try the Browser uploader instead.'), esc_url(add_query_arg('flash', 0)) ); echo '

'; } /** * {@internal Missing Short Description}} * * @since unknown */ function media_upload_html_bypass($flash = true) { echo '

'; _e('You are using the Browser uploader.'); if ( $flash ) { // the user manually selected the browser uploader, so let them switch back to Flash echo ' '; printf( __('Try the Flash uploader instead.'), esc_url(add_query_arg('flash', 1)) ); } echo "

\n"; } add_action('post-flash-upload-ui', 'media_upload_flash_bypass'); add_action('post-html-upload-ui', 'media_upload_html_bypass'); /** * {@internal Missing Short Description}} * * Make sure the GET parameter sticks when we submit a form. * * @since unknown * * @param unknown_type $url * @return unknown */ function media_upload_bypass_url($url) { if ( array_key_exists('flash', $_REQUEST) ) $url = add_query_arg('flash', intval($_REQUEST['flash'])); return $url; } add_filter('media_upload_form_url', 'media_upload_bypass_url'); add_filter('async_upload_image', 'get_media_item', 10, 2); add_filter('async_upload_audio', 'get_media_item', 10, 2); add_filter('async_upload_video', 'get_media_item', 10, 2); add_filter('async_upload_file', 'get_media_item', 10, 2); add_action('media_upload_image', 'media_upload_image'); add_action('media_upload_audio', 'media_upload_audio'); add_action('media_upload_video', 'media_upload_video'); add_action('media_upload_file', 'media_upload_file'); add_filter('media_upload_gallery', 'media_upload_gallery'); add_filter('media_upload_library', 'media_upload_library'); ?> thebrutalagenda/wp-admin/includes/dashboard.php0000644001761300176130000010734411214074650022437 0ustar mustardamustarda get_option('home'), 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=20&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10, 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false ); } wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); // WP Plugins Widget if ( current_user_can( 'activate_plugins' ) ) wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); // QuickPress Widget if ( current_user_can('edit_posts') ) wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); // Recent Drafts if ( current_user_can('edit_posts') ) wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); // Primary feed (Dev Blog) Widget if ( !isset( $widget_options['dashboard_primary'] ) ) { $update = true; $widget_options['dashboard_primary'] = array( 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/development/' ) ), 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/development/feed/' ) ), 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Development Blog' ) ), 'items' => 2, 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1 ); } wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' ); // Secondary Feed (Planet) Widget if ( !isset( $widget_options['dashboard_secondary'] ) ) { $update = true; $widget_options['dashboard_secondary'] = array( 'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ), 'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ), 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), 'items' => 5 ); } wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' ); // Hook to register new widgets do_action( 'wp_dashboard_setup' ); // Filter widget order $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); foreach ( $dashboard_widgets as $widget_id ) { $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " " . __('View all') . ''; wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] ); } if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) { ob_start(); // hack - but the same hack wp-admin/widgets.php uses wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); ob_end_clean(); wp_redirect( remove_query_arg( 'edit' ) ); exit; } if ( $update ) update_option( 'dashboard_widget_options', $widget_options ); do_action('do_meta_boxes', 'dashboard', 'normal', ''); do_action('do_meta_boxes', 'dashboard', 'side', ''); } function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) { global $wp_dashboard_control_callbacks; if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { $wp_dashboard_control_callbacks[$widget_id] = $control_callback; if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); $widget_name .= ' ' . __( 'Cancel' ) . ''; add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' ); return; } list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); $widget_name .= ' ' . __( 'Configure' ) . ''; } $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary'); $location = 'normal'; if ( in_array($widget_id, $side_widgets) ) $location = 'side'; add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', $location, 'core' ); } function _wp_dashboard_control_callback( $dashboard, $meta_box ) { echo '
'; wp_dashboard_trigger_widget_control( $meta_box['id'] ); echo "

"; echo '
'; } /** * Displays the dashboard. * * @since unknown */ function wp_dashboard() { global $screen_layout_columns; $hide2 = $hide3 = $hide4 = ''; switch ( $screen_layout_columns ) { case 4: $width = 'width:24.5%;'; break; case 3: $width = 'width:32.67%;'; $hide4 = 'display:none;'; break; case 2: $width = 'width:49%;'; $hide3 = $hide4 = 'display:none;'; break; default: $width = 'width:98%;'; $hide2 = $hide3 = $hide4 = 'display:none;'; } ?>
\n"; do_meta_boxes( 'dashboard', 'normal', '' ); echo "\t
\n"; do_meta_boxes( 'dashboard', 'side', '' ); echo "\t
\n"; do_meta_boxes( 'dashboard', 'column3', '' ); echo "\t
\n"; do_meta_boxes( 'dashboard', 'column4', '' ); ?>

' . __('At a Glance') . '

'; echo "\n\t".'
'."\n\t".''; echo "\n\t".''; // Posts $num = number_format_i18n( $num_posts->publish ); $text = _n( 'Post', 'Posts', intval($num_posts->publish) ); if ( current_user_can( 'edit_posts' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; /* TODO: Show status breakdown on hover if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can $post_type_texts[] = ''.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).''; } if ( $can_edit_posts && !empty($num_posts->draft) ) { $post_type_texts[] = ''.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).''; } if ( $can_edit_posts && !empty($num_posts->future) ) { $post_type_texts[] = ''.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).''; } if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) { $pending_text = sprintf( _n( 'There is %2$s post pending your review.', 'There are %2$s posts pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) ); } else { $pending_text = ''; } */ // Total Comments $num = number_format_i18n($num_comm->total_comments); $text = _n( 'Comment', 'Comments', $num_comm->total_comments ); if ( current_user_can( 'moderate_comments' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; echo ''; // Pages $num = number_format_i18n( $num_pages->publish ); $text = _n( 'Page', 'Pages', $num_pages->publish ); if ( current_user_can( 'edit_pages' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; // Approved Comments $num = number_format_i18n($num_comm->approved); $text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved ); if ( current_user_can( 'moderate_comments' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; echo "\n\t"; // Categories $num = number_format_i18n( $num_cats ); $text = _n( 'Category', 'Categories', $num_cats ); if ( current_user_can( 'manage_categories' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; // Pending Comments $num = number_format_i18n($num_comm->moderated); $text = _n( 'Pending', 'Pending', $num_comm->moderated ); if ( current_user_can( 'moderate_comments' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; echo "\n\t"; // Tags $num = number_format_i18n( $num_tags ); $text = _n( 'Tag', 'Tags', $num_tags ); if ( current_user_can( 'manage_categories' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; // Spam Comments $num = number_format_i18n($num_comm->spam); $text = _n( 'Spam', 'Spam', $num_comm->spam ); if ( current_user_can( 'moderate_comments' ) ) { $num = "$num"; $text = "$text"; } echo ''; echo ''; echo ""; do_action('right_now_table_end'); echo "\n\t
' . $num . '' . $text . '' . $num . '' . $text . '
' . $num . '' . $text . '' . $num . '' . $text . '
' . $num . '' . $text . '' . $num . '' . $text . '
' . $num . '' . $text . '' . $num . '' . $text . '
\n\t
"; echo "\n\t".'
'; $ct = current_theme_info(); echo "\n\t

"; if ( !empty($wp_registered_sidebars) ) { $sidebars_widgets = wp_get_sidebars_widgets(); $num_widgets = 0; foreach ( (array) $sidebars_widgets as $k => $v ) { if ( 'wp_inactive_widgets' == $k ) continue; if ( is_array($v) ) $num_widgets = $num_widgets + count($v); } $num = number_format_i18n( $num_widgets ); if ( current_user_can( 'switch_themes' ) ) { echo '' . __('Change Theme') . ''; printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); } else { printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), $ct->title, $num); } } else { if ( current_user_can( 'switch_themes' ) ) { echo '' . __('Change Theme') . ''; printf('Theme %1$s', $ct->title); } else { printf('Theme %1$s', $ct->title); } } echo '

'; update_right_now_message(); echo "\n\t".'
'; do_action( 'rightnow_end' ); do_action( 'activity_box_end' ); } function wp_dashboard_quick_press() { $drafts = false; if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) { $view = get_permalink( $_POST['post_ID'] ); $edit = esc_url( get_edit_post_link( $_POST['post_ID'] ) ); if ( 'post-quickpress-publish' == $_POST['action'] ) { if ( current_user_can('publish_posts') ) printf( '

' . __( 'Post Published. View post | Edit post' ) . '

', esc_url( $view ), $edit ); else printf( '

' . __( 'Post submitted. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); } else { printf( '

' . __( 'Draft Saved. Preview post | Edit post' ) . '

', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); $drafts_query = new WP_Query( array( 'post_type' => 'post', 'post_status' => 'draft', 'author' => $GLOBALS['current_user']->ID, 'posts_per_page' => 1, 'orderby' => 'modified', 'order' => 'DESC' ) ); if ( $drafts_query->posts ) $drafts =& $drafts_query->posts; } printf('

' . __('You can also try %s, easy blogging from anywhere on the Web.') . '

', '' . __('Press This') . '' ); $_REQUEST = array(); // hack for get_default_post_to_edit() } $post = get_default_post_to_edit(); ?>


'post', 'post_status' => 'draft', 'author' => $GLOBALS['current_user']->ID, 'posts_per_page' => 5, 'orderby' => 'modified', 'order' => 'DESC' ) ); $drafts =& $drafts_query->posts; } if ( $drafts && is_array( $drafts ) ) { $list = array(); foreach ( $drafts as $draft ) { $url = get_edit_post_link( $draft->ID ); $title = _draft_or_post_title( $draft->ID ); $item = "

$title " . get_the_time( get_option( 'date_format' ), $draft ) . '

'; if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) ) $item .= '

' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '…' : '' ) . '

'; $list[] = $item; } ?>
  • \n
  • ", $list ); ?>

get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) { foreach ( $possible as $comment ) { if ( count( $comments ) >= 5 ) break; if ( in_array( $comment->comment_approved, $allowed_states ) ) $comments[] = $comment; } $start = $start + 50; } if ( $comments ) : ?>

comment_post_ID ); $comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID )); $comment_post_link = "$comment_post_title"; $comment_link = '#'; $delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) ); $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); $actions = array(); $actions_string = ''; if ( current_user_can('edit_post', $comment->comment_post_ID) ) { $actions['approve'] = "" . __( 'Approve' ) . ''; $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; $actions['edit'] = "". __('Edit') . ''; //$actions['quickedit'] = '' . __('Quick Edit') . ''; $actions['reply'] = '' . __('Reply') . ''; $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; $actions['delete'] = "" . __('Delete') . ''; $actions = apply_filters( 'comment_row_actions', $actions, $comment ); $i = 0; foreach ( $actions as $action => $link ) { ++$i; ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; // Reply and quickedit need a hide-if-no-js span if ( 'reply' == $action || 'quickedit' == $action ) $action .= ' hide-if-no-js'; $actions_string .= "$sep$link"; } } ?>
comment_ID) ) ); ?>> comment_type || 'comment' == $comment->comment_type ) : ?>

' . get_comment_author_link() . '', $comment_post_link." ".$comment_link, ' ' . __( '[Pending]' ) . '' ); ?>

comment_type ) : case 'pingback' : $type = __( 'Pingback' ); break; case 'trackback' : $type = __( 'Trackback' ); break; default : $type = ucwords( $comment->comment_type ); endswitch; $type = esc_html( $type ); ?>

$type", $comment_post_link ); ?>

'; printf(__('RSS Error: %s'), $rss->get_error_message()); echo '

'; } return; } if ( !$rss->get_item_quantity() ) { echo '

' . __('This dashboard widget queries Google Blog Search so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "

\n"; return; } echo "
    \n"; $count = 0; foreach ( $rss->get_items() as $item ) { $publisher = ''; $site_link = ''; $link = ''; $content = ''; $date = ''; $link = esc_url( strip_tags( $item->get_link() ) ); $author = $item->get_author(); $site_link = esc_url( strip_tags( $author->get_link() ) ); if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) ) $publisher = __( 'Somebody' ); if ( $site_link ) $publisher = "$publisher"; else $publisher = "$publisher"; $content = $item->get_content(); $content = wp_html_excerpt($content, 50) . ' ...'; if ( $link ) /* translators: incoming links feed, %1$s is other person, %3$s is content */ $text = __( '%1$s linked here saying, "%3$s"' ); else /* translators: incoming links feed, %1$s is other person, %3$s is content */ $text = __( '%1$s linked here saying, "%3$s"' ); if ( $show_date ) { if ( $show_author || $show_summary ) /* translators: incoming links feed, %4$s is the date */ $text .= ' ' . __( 'on %4$s' ); $date = esc_html( strip_tags( $item->get_date() ) ); $date = strtotime( $date ); $date = gmdate( get_option( 'date_format' ), $date ); } echo "\t
  • " . sprintf( $text, $publisher, $link, $content, $date ) . "
  • \n"; } echo "
\n"; } function wp_dashboard_incoming_links_control() { wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) ); } function wp_dashboard_primary() { wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' ); } function wp_dashboard_primary_control() { wp_dashboard_rss_control( 'dashboard_primary' ); } /** * {@internal Missing Short Description}} * * @since unknown * * @param int $widget_id */ function wp_dashboard_rss_output( $widget_id ) { $widgets = get_option( 'dashboard_widget_options' ); echo "
"; wp_widget_rss_output( $widgets[$widget_id] ); echo "
"; } function wp_dashboard_secondary() { wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' ); } function wp_dashboard_secondary_control() { wp_dashboard_rss_control( 'dashboard_secondary' ); } /** * Display secondary dashboard RSS widget feed. * * @since unknown * * @return unknown */ function wp_dashboard_secondary_output() { $widgets = get_option( 'dashboard_widget_options' ); @extract( @$widgets['dashboard_secondary'], EXTR_SKIP ); $rss = @fetch_feed( $url ); if ( is_wp_error($rss) ) { if ( is_admin() || current_user_can('manage_options') ) { echo '

'; printf(__('RSS Error: %s'), $rss->get_error_message()); echo '

'; } } elseif ( !$rss->get_item_quantity() ) { return false; } else { echo '
'; wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] ); echo '
'; } } function wp_dashboard_plugins() { wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array( 'http://wordpress.org/extend/plugins/rss/browse/popular/', 'http://wordpress.org/extend/plugins/rss/browse/new/', 'http://wordpress.org/extend/plugins/rss/browse/updated/' ) ); } /** * Display plugins most popular, newest plugins, and recently updated widget text. * * @since unknown */ function wp_dashboard_plugins_output() { $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' ); $new = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' ); $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' ); if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { $plugin_slugs = array_keys( get_plugins() ); set_transient( 'plugin_slugs', $plugin_slugs, 86400 ); } foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) continue; $items = $$feed->get_items(0, 5); // Pick a random, non-installed plugin while ( true ) { // Abort this foreach loop iteration if there's no plugins left of this type if ( 0 == count($items) ) continue 2; $item_key = array_rand($items); $item = $items[$item_key]; list($link, $frag) = explode( '#', $item->get_link() ); $link = esc_url($link); if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) $slug = $matches[1]; else { unset( $items[$item_key] ); continue; } // Is this random plugin's slug already installed? If so, try again. reset( $plugin_slugs ); foreach ( $plugin_slugs as $plugin_slug ) { if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { unset( $items[$item_key] ); continue 2; } } // If we get to this point, then the random plugin isn't installed and we can stop the while(). break; } // Eliminate some common badly formed plugin descriptions while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) unset($items[$item_key]); if ( !isset($items[$item_key]) ) continue; // current bbPress feed item titles are: user on "topic title" if ( preg_match( '/"(.*)"/s', $item->get_title(), $matches ) ) $title = $matches[1]; else // but let's make it forward compatible if things change $title = $item->get_title(); $title = esc_html( $title ); $description = esc_html( strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) ); $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; echo "

$label

\n"; echo "
$title
 (" . __( 'Install' ) . ")\n"; echo "

$description

\n"; } } /** * Checks to see if all of the feed url in $check_urls are cached. * * If $check_urls is empty, look for the rss feed url found in the dashboard * widget optios of $widget_id. If cached, call $callback, a function that * echoes out output for this widget. If not cache, echo a "Loading..." stub * which is later replaced by AJAX call (see top of /wp-admin/index.php) * * @since unknown * * @param int $widget_id * @param callback $callback * @param array $check_urls RSS feeds * @return bool False on failure. True on success. */ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { $loading = '

' . __( 'Loading…' ) . '

'; if ( empty($check_urls) ) { $widgets = get_option( 'dashboard_widget_options' ); if ( empty($widgets[$widget_id]['url']) ) { echo $loading; return false; } $check_urls = array( $widgets[$widget_id]['url'] ); } include_once ABSPATH . WPINC . '/class-feed.php'; foreach ( $check_urls as $check_url ) { $cache = new WP_Feed_Cache_Transient('', md5($check_url), ''); if ( ! $cache->load() ) { echo $loading; return false; } } if ( $callback && is_callable( $callback ) ) { $args = array_slice( func_get_args(), 2 ); array_unshift( $args, $widget_id ); call_user_func_array( $callback, $args ); } return true; } /* Dashboard Widgets Controls */ // Calls widget_control callback /** * Calls widget control callback. * * @since unknown * * @param int $widget_control_id Registered Widget ID. */ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { global $wp_dashboard_control_callbacks; if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) { call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) ); } } /** * The RSS dashboard widget control. * * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data * from RSS-type widgets. * * @since unknown * * @param string widget_id * @param array form_inputs */ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) $widget_options = array(); if ( !isset($widget_options[$widget_id]) ) $widget_options[$widget_id] = array(); $number = 1; // Hack to use wp_widget_rss_form() $widget_options[$widget_id]['number'] = $number; if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) { $_POST['widget-rss'][$number] = stripslashes_deep( $_POST['widget-rss'][$number] ); $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); // title is optional. If black, fill it if possible if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { $rss = fetch_feed($widget_options[$widget_id]['url']); if ( ! is_wp_error($rss) ) $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); else $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); } update_option( 'dashboard_widget_options', $widget_options ); } wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); } /** * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS). */ function wp_dashboard_empty() {} ?> thebrutalagenda/wp-admin/includes/update-core.php0000644001761300176130000002173211214074650022714 0ustar mustardamustardaexists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) { $wp_filesystem->delete($from, true); return new WP_Error('insane_distro', __('The update could not be unpacked') ); } apply_filters('update_feedback', __('Installing the latest version')); // Create maintenance file to signal that we are upgrading $maintenance_string = ''; $maintenance_file = $to . '.maintenance'; $wp_filesystem->delete($maintenance_file); $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); // Copy new versions of WP files into place. $result = copy_dir($from . '/wordpress', $to); if ( is_wp_error($result) ) { $wp_filesystem->delete($maintenance_file); $wp_filesystem->delete($working_dir, true); return $result; } // Remove old files foreach ( $_old_files as $old_file ) { $old_file = $to . $old_file; if ( !$wp_filesystem->exists($old_file) ) continue; $wp_filesystem->delete($old_file, true); } // Upgrade DB with separate request apply_filters('update_feedback', __('Upgrading database')); $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); wp_remote_post($db_upgrade_url, array('timeout' => 60)); // Remove working directory $wp_filesystem->delete($from, true); // Force refresh of update information if ( function_exists('delete_transient') ) delete_transient('update_core'); else delete_option('update_core'); // Remove maintenance file, we're done. $wp_filesystem->delete($maintenance_file); } ?> thebrutalagenda/wp-admin/includes/template.php0000644001761300176130000037012011214074650022315 0ustar mustardamustarda 0); if ( !empty($_GET['s']) ) $args['search'] = $_GET['s']; $categories = get_categories( $args ); if ( empty($categories) ) return false; } $children = _get_term_hierarchy('category'); _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count ); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $categories * @param unknown_type $count * @param unknown_type $parent * @param unknown_type $level * @param unknown_type $page * @param unknown_type $per_page * @return unknown */ function _cat_rows( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count ) { $start = ($page - 1) * $per_page; $end = $start + $per_page; ob_start(); foreach ( $categories as $key => $category ) { if ( $count >= $end ) break; if ( $category->parent != $parent && empty($_GET['s']) ) continue; // If the page starts in a subtree, print the parents. if ( $count == $start && $category->parent > 0 ) { $my_parents = array(); $p = $category->parent; while ( $p ) { $my_parent = get_category( $p ); $my_parents[] = $my_parent; if ( $my_parent->parent == 0 ) break; $p = $my_parent->parent; } $num_parents = count($my_parents); while( $my_parent = array_pop($my_parents) ) { echo "\t" . _cat_row( $my_parent, $level - $num_parents ); $num_parents--; } } if ( $count >= $start ) echo "\t" . _cat_row( $category, $level ); unset( $categories[ $key ] ); $count++; if ( isset($children[$category->term_id]) ) _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count ); } $output = ob_get_contents(); ob_end_clean(); echo $output; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $category * @param unknown_type $level * @param unknown_type $name_override * @return unknown */ function _cat_row( $category, $level, $name_override = false ) { static $row_class = ''; $category = get_category( $category, OBJECT, 'display' ); $default_cat_id = (int) get_option( 'default_category' ); $pad = str_repeat( '— ', max(0, $level) ); $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); $edit_link = "categories.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { $edit = "name)) . "'>" . esc_attr( $name ) . '
'; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; if ( $default_cat_id != $category->term_id ) $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; $actions = apply_filters('cat_row_actions', $actions, $category); $action_count = count($actions); $i = 0; $edit .= '
'; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $edit .= "$link$sep"; } $edit .= '
'; } else { $edit = $name; } $row_class = 'alternate' == $row_class ? '' : 'alternate'; $qe_data = get_category_to_edit($category->term_id); $category->count = number_format_i18n( $category->count ); $posts_count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = ""; $columns = get_column_headers('categories'); $hidden = get_hidden_columns('categories'); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': $output .= ""; if ( $default_cat_id != $category->term_id ) { $output .= ""; } else { $output .= " "; } $output .= ''; break; case 'name': $output .= "$edit"; $output .= ''; break; case 'description': $output .= "$category->description"; break; case 'slug': $output .= "$category->slug"; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; $output .= "$posts_count\n"; break; default: $output .= ""; $output .= apply_filters('manage_categories_custom_column', '', $column_name, $category->term_id); $output .= ""; } } $output .= ''; return $output; } /** * {@internal Missing Short Description}} * * @since 2.7 * * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit. * * @param string $type "tag", "category" or "link-category" * @return */ function inline_edit_term_row($type) { if ( ! current_user_can( 'manage_categories' ) ) return; $is_tag = $type == 'edit-tags'; $columns = get_column_headers($type); $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) ); $col_count = count($columns) - count($hidden); ?>
name ); $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { $edit = "name)) . "'>$name
"; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; if ( $default_cat_id != $category->term_id ) $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; $actions = apply_filters('link_cat_row_actions', $actions, $category); $action_count = count($actions); $i = 0; $edit .= '
'; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $edit .= "$link$sep"; } $edit .= '
'; } else { $edit = $name; } $row_class = 'alternate' == $row_class ? '' : 'alternate'; $qe_data = get_term_to_edit($category->term_id, 'link_category'); $category->count = number_format_i18n( $category->count ); $count = ( $category->count > 0 ) ? "$category->count" : $category->count; $output = ""; $columns = get_column_headers('edit-link-categories'); $hidden = get_hidden_columns('edit-link-categories'); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': $output .= ""; if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { $output .= ""; } else { $output .= " "; } $output .= ""; break; case 'name': $output .= "$edit"; $output .= ''; break; case 'description': $output .= "$category->description"; break; case 'slug': $output .= "$category->slug"; break; case 'links': $attributes = 'class="links column-links num"' . $style; $output .= "$count"; break; default: $output .= ""; $output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id); $output .= ""; } } $output .= ''; return $output; } /** * Outputs the html checked attribute. * * Compares the first two arguments and if identical marks as checked * * @since 2.8 * * @param any $checked One of the values to compare * @param any $current (true) The other value to compare if not just true * @param bool $echo Whether or not to echo or just return the string */ function checked( $checked, $current = true, $echo = true) { return __checked_selected_helper( $checked, $current, $echo, 'checked' ); } /** * Outputs the html selected attribute. * * Compares the first two arguments and if identical marks as selected * * @since 2.8 * * @param any selected One of the values to compare * @param any $current (true) The other value to compare if not just true * @param bool $echo Whether or not to echo or just return the string */ function selected( $selected, $current = true, $echo = true) { return __checked_selected_helper( $selected, $current, $echo, 'selected' ); } /** * Private helper function for checked and selected. * * Compares the first two arguments and if identical marks as $type * * @since 2.8 * @access private * * @param any $helper One of the values to compare * @param any $current (true) The other value to compare if not just true * @param bool $echo Whether or not to echo or just return the string * @param string $type The type of checked|selected we are doing. */ function __checked_selected_helper( $helper, $current, $echo, $type) { if ( $helper == $current) $result = " $type='$type'"; else $result = ''; if ($echo) echo $result; return $result; } // // Category Checklists // /** * {@internal Missing Short Description}} * * @since unknown * @deprecated Use {@link wp_link_category_checklist()} * @see wp_link_category_checklist() * * @param unknown_type $default * @param unknown_type $parent * @param unknown_type $popular_ids */ function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) { global $post_ID; wp_category_checklist($post_ID); } /** * {@internal Missing Short Description}} * * @since unknown */ class Walker_Category_Checklist extends Walker { var $tree_type = 'category'; var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this function start_lvl(&$output, $depth, $args) { $indent = str_repeat("\t", $depth); $output .= "$indent
    \n"; } function end_lvl(&$output, $depth, $args) { $indent = str_repeat("\t", $depth); $output .= "$indent
\n"; } function start_el(&$output, $category, $depth, $args) { extract($args); $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : ''; $output .= "\n
  • " . ''; } function end_el(&$output, $category, $depth, $args) { $output .= "
  • \n"; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $post_id * @param unknown_type $descendants_and_self * @param unknown_type $selected_cats * @param unknown_type $popular_cats */ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) { if ( empty($walker) || !is_a($walker, 'Walker') ) $walker = new Walker_Category_Checklist; $descendants_and_self = (int) $descendants_and_self; $args = array(); if ( is_array( $selected_cats ) ) $args['selected_cats'] = $selected_cats; elseif ( $post_id ) $args['selected_cats'] = wp_get_post_categories($post_id); else $args['selected_cats'] = array(); if ( is_array( $popular_cats ) ) $args['popular_cats'] = $popular_cats; else $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); if ( $descendants_and_self ) { $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" ); $self = get_category( $descendants_and_self ); array_unshift( $categories, $self ); } else { $categories = get_categories('get=all'); } // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) $checked_categories = array(); $keys = array_keys( $categories ); foreach( $keys as $k ) { if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { $checked_categories[] = $categories[$k]; unset( $categories[$k] ); } } // Put checked cats on top echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args)); // Then the rest of them echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args)); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $taxonomy * @param unknown_type $default * @param unknown_type $number * @param unknown_type $echo * @return unknown */ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { global $post_ID; if ( $post_ID ) $checked_categories = wp_get_post_categories($post_ID); else $checked_categories = array(); $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); $popular_ids = array(); foreach ( (array) $categories as $category ) { $popular_ids[] = $category->term_id; if ( !$echo ) // hack for AJAX use continue; $id = "popular-category-$category->term_id"; ?> term_id; $name = esc_html( apply_filters('the_category', $category->name)); $checked = in_array( $cat_id, $checked_categories ); echo '"; } } // Tag stuff // Returns a single tag row (see tag_rows below) // Note: this is also used in admin-ajax.php! /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $tag * @param unknown_type $class * @return unknown */ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) { $count = number_format_i18n( $tag->count ); $tagsel = ($taxonomy == 'post_tag' ? 'tag' : $taxonomy); $count = ( $count > 0 ) ? "$count" : $count; $name = apply_filters( 'term_name', $tag->name ); $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit'); $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&tag_ID=$tag->term_id"; $out = ''; $out .= ''; $columns = get_column_headers('edit-tags'); $hidden = get_hidden_columns('edit-tags'); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': $out .= ' '; break; case 'name': $out .= '' . $name . '
    '; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; $actions = apply_filters('tag_row_actions', $actions, $tag); $action_count = count($actions); $i = 0; $out .= '
    '; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $out .= "$link$sep"; } $out .= '
    '; $out .= ''; break; case 'description': $out .= "$tag->description"; break; case 'slug': $out .= "$tag->slug"; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; $out .= "$count"; break; default: $out .= ""; $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id); $out .= ""; } } $out .= ''; return $out; } // Outputs appropriate rows for the Nth page of the Tag Management screen, // assuming M tags displayed at a time on the page // Returns the number of tags displayed /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page * @param unknown_type $pagesize * @param unknown_type $searchterms * @return unknown */ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) { // Get a page worth of tags $start = ($page - 1) * $pagesize; $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); if ( !empty( $searchterms ) ) { $args['search'] = $searchterms; } $tags = get_terms( $taxonomy, $args ); // convert it to table rows $out = ''; $count = 0; foreach( $tags as $tag ) $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"', $taxonomy ); // filter and send to screen echo $out; return $count; } // define the columns to display, the syntax is 'internal name' => 'display name' /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function wp_manage_posts_columns() { $posts_columns = array(); $posts_columns['cb'] = ''; /* translators: manage posts column name */ $posts_columns['title'] = _x('Post', 'column name'); $posts_columns['author'] = __('Author'); $posts_columns['categories'] = __('Categories'); $posts_columns['tags'] = __('Tags'); if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) $posts_columns['comments'] = '
    Comments
    '; $posts_columns['date'] = __('Date'); $posts_columns = apply_filters('manage_posts_columns', $posts_columns); return $posts_columns; } // define the columns to display, the syntax is 'internal name' => 'display name' /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function wp_manage_media_columns() { $posts_columns = array(); $posts_columns['cb'] = ''; $posts_columns['icon'] = ''; /* translators: column name */ $posts_columns['media'] = _x('File', 'column name'); $posts_columns['author'] = __('Author'); //$posts_columns['tags'] = _x('Tags', 'column name'); /* translators: column name */ $posts_columns['parent'] = _x('Attached to', 'column name'); $posts_columns['comments'] = '
    Comments
    '; //$posts_columns['comments'] = __('Comments'); /* translators: column name */ $posts_columns['date'] = _x('Date', 'column name'); $posts_columns = apply_filters('manage_media_columns', $posts_columns); return $posts_columns; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function wp_manage_pages_columns() { $posts_columns = array(); $posts_columns['cb'] = ''; $posts_columns['title'] = __('Title'); $posts_columns['author'] = __('Author'); $post_status = 'all'; if ( !empty($_GET['post_status']) ) $post_status = $_GET['post_status']; if ( !in_array($post_status, array('pending', 'draft', 'future')) ) $posts_columns['comments'] = '
    '; $posts_columns['date'] = __('Date'); $posts_columns = apply_filters('manage_pages_columns', $posts_columns); return $posts_columns; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page * @return unknown */ function get_column_headers($page) { global $_wp_column_headers; if ( !isset($_wp_column_headers) ) $_wp_column_headers = array(); // Store in static to avoid running filters on each call if ( isset($_wp_column_headers[$page]) ) return $_wp_column_headers[$page]; switch ($page) { case 'edit': $_wp_column_headers[$page] = wp_manage_posts_columns(); break; case 'edit-pages': $_wp_column_headers[$page] = wp_manage_pages_columns(); break; case 'edit-comments': $_wp_column_headers[$page] = array( 'cb' => '', 'author' => __('Author'), /* translators: column name */ 'comment' => _x('Comment', 'column name'), //'date' => __('Submitted'), 'response' => __('In Response To') ); break; case 'link-manager': $_wp_column_headers[$page] = array( 'cb' => '', 'name' => __('Name'), 'url' => __('URL'), 'categories' => __('Categories'), 'rel' => __('Relationship'), 'visible' => __('Visible'), 'rating' => __('Rating') ); break; case 'upload': $_wp_column_headers[$page] = wp_manage_media_columns(); break; case 'categories': $_wp_column_headers[$page] = array( 'cb' => '', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'posts' => __('Posts') ); break; case 'edit-link-categories': $_wp_column_headers[$page] = array( 'cb' => '', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'links' => __('Links') ); break; case 'edit-tags': $_wp_column_headers[$page] = array( 'cb' => '', 'name' => __('Name'), 'description' => __('Description'), 'slug' => __('Slug'), 'posts' => __('Posts') ); break; case 'users': $_wp_column_headers[$page] = array( 'cb' => '', 'username' => __('Username'), 'name' => __('Name'), 'email' => __('E-mail'), 'role' => __('Role'), 'posts' => __('Posts') ); break; default : $_wp_column_headers[$page] = array(); } $_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]); return $_wp_column_headers[$page]; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $type * @param unknown_type $id */ function print_column_headers( $type, $id = true ) { $type = str_replace('.php', '', $type); $columns = get_column_headers( $type ); $hidden = get_hidden_columns($type); $styles = array(); // $styles['tag']['posts'] = 'width: 90px;'; // $styles['link-category']['links'] = 'width: 90px;'; // $styles['category']['posts'] = 'width: 90px;'; // $styles['link']['visible'] = 'text-align: center;'; foreach ( $columns as $column_key => $column_display_name ) { $class = ' class="manage-column'; $class .= " column-$column_key"; if ( 'cb' == $column_key ) $class .= ' check-column'; elseif ( in_array($column_key, array('posts', 'comments', 'links')) ) $class .= ' num'; $class .= '"'; $style = ''; if ( in_array($column_key, $hidden) ) $style = 'display:none;'; if ( isset($styles[$type]) && isset($styles[$type][$column_key]) ) $style .= ' ' . $styles[$type][$column_key]; $style = ' style="' . $style . '"'; ?> > true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); ?>
    " style="display: none">


    id, true, $type ); // TODO: ROLE SYSTEM if ( $authors && count( $authors ) > 1 ) : $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1); if ( $bulk ) $users_opt['show_option_none'] = __('- No Change -'); ?>
    $column_display_name ) { if ( isset( $core_columns[$column_name] ) ) continue; do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $type); } ?>


    post_type, $post->ID) ) return; $title = esc_attr($post->post_title); echo ' '; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $posts */ function post_rows( $posts = array() ) { global $wp_query, $post, $mode; add_filter('the_title','esc_html'); // Create array of post IDs. $post_ids = array(); if ( empty($posts) ) $posts = &$wp_query->posts; foreach ( $posts as $a_post ) $post_ids[] = $a_post->ID; $comment_pending_count = get_pending_comments_num($post_ids); if ( empty($comment_pending_count) ) $comment_pending_count = array(); foreach ( $posts as $post ) { if ( empty($comment_pending_count[$post->ID]) ) $comment_pending_count[$post->ID] = 0; _post_row($post, $comment_pending_count[$post->ID], $mode); } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $a_post * @param unknown_type $pending_comments * @param unknown_type $mode */ function _post_row($a_post, $pending_comments, $mode) { global $post; static $rowclass; $global_post = $post; $post = $a_post; setup_postdata($post); $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; global $current_user; $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); $edit_link = get_edit_post_link( $post->ID ); $title = _draft_or_post_title(); ?> post_status ); ?> iedit' valign="top"> $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': ?> ID ) ) { ?> post_date && 'date' == $column_name ) { $t_time = $h_time = __('Unpublished'); $time_diff = 0; } else { $t_time = get_the_time(__('Y/m/d g:i:s A')); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < 24*60*60 ) $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); else $h_time = mysql2date(__('Y/m/d'), $m_time); } echo ''; if ( 'excerpt' == $mode ) echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode); else echo '' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . ''; echo '
    '; if ( 'publish' == $post->post_status ) { _e('Published'); } elseif ( 'future' == $post->post_status ) { if ( $time_diff > 0 ) echo '' . __('Missed schedule') . ''; else _e('Scheduled'); } else { _e('Last Modified'); } echo ''; break; case 'title': $attributes = 'class="post-title column-title"' . $style; ?> >ID ) ) { ?> ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can('edit_post', $post->ID) ) $actions['view'] = '' . __('Preview') . ''; } else { $actions['view'] = '' . __('View') . ''; } $actions = apply_filters('post_row_actions', $actions, $post); $action_count = count($actions); $i = 0; echo '
    '; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; echo "$link$sep"; } echo '
    '; get_inline_data($post); ?> >slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . ""; echo join( ', ', $out ); } else { _e('Uncategorized'); } ?> >ID); if ( !empty( $tags ) ) { $out = array(); foreach ( $tags as $c ) $out[] = " " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . ""; echo join( ', ', $out ); } else { _e('No Tags'); } ?> >
    '; comments_number("" . /* translators: comment count link */ _x('0', 'comment count') . '', "" . /* translators: comment count link */ _x('1', 'comment count') . '', "" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . ''); if ( $pending_comments ) echo ''; ?>
    > ID) ) { echo "" . __('Edit') . ""; } ?> ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . ""; } ?> >ID); ?> post_parent > 0 ) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int)$page->post_parent; while ( $find_main_page > 0 ) { $parent = get_page($find_main_page); if ( is_null($parent) ) break; $level++; $find_main_page = (int)$parent->post_parent; if ( !isset($parent_name) ) $parent_name = $parent->post_title; } } $page->post_title = esc_html( $page->post_title ); $pad = str_repeat( '— ', $level ); $id = (int) $page->ID; $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; $posts_columns = get_column_headers('edit-pages'); $hidden = get_hidden_columns('edit-pages'); $title = _draft_or_post_title(); ?> $column_display_name) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': ?> post_date && 'date' == $column_name ) { $t_time = $h_time = __('Unpublished'); $time_diff = 0; } else { $t_time = get_the_time(__('Y/m/d g:i:s A')); $m_time = $page->post_date; $time = get_post_time('G', true); $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < 24*60*60 ) $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); else $h_time = mysql2date(__('Y/m/d'), $m_time); } echo ''; echo '' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . ''; echo '
    '; if ( 'publish' == $page->post_status ) { _e('Published'); } elseif ( 'future' == $page->post_status ) { if ( $time_diff > 0 ) echo '' . __('Missed schedule') . ''; else _e('Scheduled'); } else { _e('Last Modified'); } echo ''; break; case 'title': $attributes = 'class="post-title page-title column-title"' . $style; $edit_link = get_edit_post_link( $page->ID ); ?> >ID ) ) { ?> ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline'] = '' . __('Quick Edit') . ''; $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can('edit_page', $page->ID) ) $actions['view'] = '' . __('Preview') . ''; } else { $actions['view'] = '' . __('View') . ''; } $actions = apply_filters('page_row_actions', $actions, $page); $action_count = count($actions); $i = 0; echo '
    '; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; echo "$link$sep"; } echo '
    '; get_inline_data($post); echo ''; break; case 'comments': ?> >
    ID ); $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); if ( $left ) echo ''; comments_number("" . /* translators: comment count link */ _x('0', 'comment count') . '', "" . /* translators: comment count link */ _x('1', 'comment count') . '', "" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . ''); if ( $left ) echo ''; ?>
    > > 'menu_order') ); if ( ! $pages ) return false; } /* * arrange pages into two parts: top level pages and children_pages * children_pages is two dimensional array, eg. * children_pages[10][] contains all sub-pages whose parent is 10. * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations * If searching, ignore hierarchy and treat everything as top level */ if ( empty($_GET['s']) ) { $top_level_pages = array(); $children_pages = array(); foreach ( $pages as $page ) { // catch and repair bad pages if ( $page->post_parent == $page->ID ) { $page->post_parent = 0; $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) ); clean_page_cache( $page->ID ); } if ( 0 == $page->post_parent ) $top_level_pages[] = $page; else $children_pages[ $page->post_parent ][] = $page; } $pages = &$top_level_pages; } $count = 0; $start = ($pagenum - 1) * $per_page; $end = $start + $per_page; foreach ( $pages as $page ) { if ( $count >= $end ) break; if ( $count >= $start ) echo "\t" . display_page_row( $page, $level ); $count++; if ( isset($children_pages) ) _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); } // if it is the last pagenum and there are orphaned pages, display them with paging as well if ( isset($children_pages) && $count < $end ){ foreach( $children_pages as $orphans ){ foreach ( $orphans as $op ) { if ( $count >= $end ) break; if ( $count >= $start ) echo "\t" . display_page_row( $op, 0 ); $count++; } } } } /* * Given a top level page ID, display the nested hierarchy of sub-pages * together with paging support */ /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $children_pages * @param unknown_type $count * @param unknown_type $parent * @param unknown_type $level * @param unknown_type $pagenum * @param unknown_type $per_page */ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) { if ( ! isset( $children_pages[$parent] ) ) return; $start = ($pagenum - 1) * $per_page; $end = $start + $per_page; foreach ( $children_pages[$parent] as $page ) { if ( $count >= $end ) break; // If the page starts in a subtree, print the parents. if ( $count == $start && $page->post_parent > 0 ) { $my_parents = array(); $my_parent = $page->post_parent; while ( $my_parent) { $my_parent = get_post($my_parent); $my_parents[] = $my_parent; if ( !$my_parent->post_parent ) break; $my_parent = $my_parent->post_parent; } $num_parents = count($my_parents); while( $my_parent = array_pop($my_parents) ) { echo "\t" . display_page_row( $my_parent, $level - $num_parents ); $num_parents--; } } if ( $count >= $start ) echo "\t" . display_page_row( $page, $level ); $count++; _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); } unset( $children_pages[$parent] ); //required in order to keep track of orphans } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $user_object * @param unknown_type $style * @param unknown_type $role * @return unknown */ function user_row( $user_object, $style = '', $role = '' ) { global $wp_roles; $current_user = wp_get_current_user(); if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) ) $user_object = new WP_User( (int) $user_object ); $email = $user_object->user_email; $url = $user_object->user_url; $short_url = str_replace( 'http://', '', $url ); $short_url = str_replace( 'www.', '', $short_url ); if ('/' == substr( $short_url, -1 )) $short_url = substr( $short_url, 0, -1 ); if ( strlen( $short_url ) > 35 ) $short_url = substr( $short_url, 0, 32 ).'...'; $numposts = get_usernumposts( $user_object->ID ); $checkbox = ''; // Check if the user for this row is editable if ( current_user_can( 'edit_user', $user_object->ID ) ) { // Set up the user editing link // TODO: make profile/user-edit determination a seperate function if ($current_user->ID == $user_object->ID) { $edit_link = 'profile.php'; } else { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) ); } $edit = "$user_object->user_login
    "; // Set up the hover actions for this user $actions = array(); $actions['edit'] = '' . __('Edit') . ''; if ( $current_user->ID != $user_object->ID ) $actions['delete'] = "" . __('Delete') . ""; $actions = apply_filters('user_row_actions', $actions, $user_object); $action_count = count($actions); $i = 0; $edit .= '
    '; foreach ( $actions as $action => $link ) { ++$i; ( $i == $action_count ) ? $sep = '' : $sep = ' | '; $edit .= "$link$sep"; } $edit .= '
    '; // Set up the checkbox (because the user is editable, otherwise its empty) $checkbox = ""; } else { $edit = '' . $user_object->user_login . ''; } $role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : __('None'); $r = ""; $columns = get_column_headers('users'); $hidden = get_hidden_columns('users'); $avatar = get_avatar( $user_object->ID, 32 ); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': $r .= "$checkbox"; break; case 'username': $r .= "$avatar $edit"; break; case 'name': $r .= "$user_object->first_name $user_object->last_name"; break; case 'email': $r .= "$email"; break; case 'role': $r .= "$role_name"; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; $r .= ""; if ( $numposts > 0 ) { $r .= ""; $r .= $numposts; $r .= ''; } else { $r .= 0; } $r .= ""; break; default: $r .= ""; $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID); $r .= ""; } } $r .= ''; return $r; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $status * @param unknown_type $s * @param unknown_type $start * @param unknown_type $num * @param unknown_type $post * @param unknown_type $type * @return unknown */ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) { global $wpdb; $start = abs( (int) $start ); $num = (int) $num; $post = (int) $post; $count = wp_count_comments(); $index = ''; if ( 'moderated' == $status ) { $approved = "comment_approved = '0'"; $total = $count->moderated; } elseif ( 'approved' == $status ) { $approved = "comment_approved = '1'"; $total = $count->approved; } elseif ( 'spam' == $status ) { $approved = "comment_approved = 'spam'"; $total = $count->spam; } else { $approved = "( comment_approved = '0' OR comment_approved = '1' )"; $total = $count->moderated + $count->approved; $index = 'USE INDEX (comment_date_gmt)'; } if ( $post ) { $total = ''; $post = " AND comment_post_ID = '$post'"; $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num"; } else { $post = ''; $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num"; } if ( 'comment' == $type ) $typesql = "AND comment_type = ''"; elseif ( 'pingback' == $type ) $typesql = "AND comment_type = 'pingback'"; elseif ( 'trackback' == $type ) $typesql = "AND comment_type = 'trackback'"; elseif ( 'pings' == $type ) $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )"; else $typesql = ''; if ( !empty($type) ) $total = ''; if ( $s ) { $total = ''; $s = $wpdb->escape($s); $query = "FROM $wpdb->comments WHERE (comment_author LIKE '%$s%' OR comment_author_email LIKE '%$s%' OR comment_author_url LIKE ('%$s%') OR comment_author_IP LIKE ('%$s%') OR comment_content LIKE ('%$s%') ) AND $approved $typesql"; } else { $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql"; } $comments = $wpdb->get_results("SELECT * $query $orderby"); if ( '' === $total ) $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query"); update_comment_cache($comments); return array($comments, $total); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $comment_id * @param unknown_type $mode * @param unknown_type $comment_status * @param unknown_type $checkbox */ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) { global $comment, $post, $_comment_pending_count; $comment = get_comment( $comment_id ); $post = get_post($comment->comment_post_ID); $the_comment_status = wp_get_comment_status($comment->comment_ID); $user_can = current_user_can('edit_post', $post->ID); $author_url = get_comment_author_url(); if ( 'http://' == $author_url ) $author_url = ''; $author_url_display = $author_url; $author_url_display = str_replace('http://www.', '', $author_url_display); $author_url_display = str_replace('http://', '', $author_url_display); if ( strlen($author_url_display) > 50 ) $author_url_display = substr($author_url_display, 0, 49) . '...'; $ptime = date('G', strtotime( $comment->comment_date ) ); if ( ( abs(time() - $ptime) ) < 86400 ) $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); else $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date ); $delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) ); $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); echo ""; $columns = get_column_headers('edit-comments'); $hidden = get_hidden_columns('edit-comments'); foreach ( $columns as $column_name => $column_display_name ) { $class = "class=\"$column_name column-$column_name\""; $style = ''; if ( in_array($column_name, $hidden) ) $style = ' style="display:none;"'; $attributes = "$class$style"; switch ($column_name) { case 'cb': if ( !$checkbox ) break; echo ''; if ( $user_can ) echo ""; echo ''; break; case 'comment': echo ""; echo '
    '; printf(__('Submitted on %2$s at %3$s'), get_comment_link($comment->comment_ID), get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia'))); echo '
    '; comment_text(); ?> comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . ''; $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments if ( 'approved' == $the_comment_status ) { $actions['unapprove'] = "" . __( 'Unapprove' ) . ''; unset($actions['approve']); } else { $actions['approve'] = "" . __( 'Approve' ) . ''; unset($actions['unapprove']); } } if ( 'spam' != $the_comment_status ) $actions['spam'] = "" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . ''; $actions['delete'] = "" . __('Delete') . ''; $actions['edit'] = "". __('Edit') . ''; $actions['quickedit'] = '' . __('Quick Edit') . ''; if ( 'spam' != $the_comment_status ) $actions['reply'] = '' . __('Reply') . ''; $actions = apply_filters( 'comment_row_actions', $actions, $comment ); $i = 0; echo '
    '; foreach ( $actions as $action => $link ) { ++$i; ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; // Reply and quickedit need a hide-if-no-js span when not added with ajax if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) $action .= ' hide-if-no-js'; echo "$sep$link"; } echo '
    '; } echo ''; break; case 'author': echo ""; comment_author(); echo '
    '; if ( !empty($author_url) ) echo "$author_url_display
    "; if ( $user_can ) { if ( !empty($comment->comment_author_email) ) { comment_author_email_link(); echo '
    '; } echo ''; comment_author_IP(); echo ''; } //current_user_can echo ''; break; case 'date': echo "" . get_comment_date(__('Y/m/d \a\t g:ia')) . ''; break; case 'response': if ( 'single' !== $mode ) { if ( isset( $_comment_pending_count[$post->ID] ) ) { $pending_comments = absint( $_comment_pending_count[$post->ID] ); } else { $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) ); $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID]; } if ( $user_can ) { $post_link = ""; $post_link .= get_the_title($post->ID) . ''; } else { $post_link = get_the_title($post->ID); } echo "\n"; echo ''; if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) ) echo $thumb; echo ''; } break; default: echo "\n"; do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); echo "\n"; break; } } echo "\n"; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $position * @param unknown_type $checkbox * @param unknown_type $mode */ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) { global $current_user; // allow plugin to replace the popup content $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) ); if ( ! empty($content) ) { echo $content; return; } $columns = get_column_headers('edit-comments'); $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) ); $col_count = count($columns) - count($hidden); ?>
    0) ); if ( $categories ) { foreach ( $categories as $category ) { if ( $currentcat != $category->term_id && $parent == $category->parent) { $pad = str_repeat( '– ', $level ); $category->name = esc_html( $category->name ); echo "\n\t"; wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories ); } } } else { return false; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $meta */ function list_meta( $meta ) { // Exit if no meta if ( ! $meta ) { echo ' '; //TBODY needed for list-manipulation JS return; } $count = 0; ?>
    $entry['meta_id'] = (int) $entry['meta_id']; $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); $r .= "\n\t"; $r .= "\n\t\t"; $r .= "\n\t\t
    "; $r .= "\n\t\t
    "; $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); $r .= ""; $r .= "\n\t\t\n\t"; return $r; } /** * {@internal Missing Short Description}} * * @since unknown */ function meta_form() { global $wpdb; $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); $keys = $wpdb->get_col( " SELECT meta_key FROM $wpdb->postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY LOWER(meta_key) LIMIT $limit" ); if ( $keys ) natcasesort($keys); ?>

    post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ) ? false : true; $tab_index_attribute = ''; if ( (int) $tab_index > 0 ) $tab_index_attribute = " tabindex=\"$tab_index\""; // echo '
    '; $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 ); $post_date = ($for_post) ? $post->post_date : $comment->comment_date; $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj ); $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj ); $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj ); $cur_jj = gmdate( 'd', $time_adj ); $cur_mm = gmdate( 'm', $time_adj ); $cur_aa = gmdate( 'Y', $time_adj ); $cur_hh = gmdate( 'H', $time_adj ); $cur_mn = gmdate( 'i', $time_adj ); $month = "'; $day = ''; $year = ''; $hour = ''; $minute = ''; /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); echo ''; if ( $multi ) return; echo "\n\n"; foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) { echo '' . "\n"; $cur_timeunit = 'cur_' . $timeunit; echo '' . "\n"; } ?>

    $template"; endforeach; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $default * @param unknown_type $parent * @param unknown_type $level * @return unknown */ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { global $wpdb, $post_ID; $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) ); if ( $items ) { foreach ( $items as $item ) { // A page cannot be its own parent. if (!empty ( $post_ID ) ) { if ( $item->ID == $post_ID ) { continue; } } $pad = str_repeat( ' ', $level * 3 ); if ( $item->ID == $default) $current = ' selected="selected"'; else $current = ''; echo "\n\t"; parent_dropdown( $default, $item->ID, $level +1 ); } } else { return false; } } /** * {@internal Missing Short Description}} * * @since unknown */ function browse_happy() { $getit = __( 'WordPress recommends a better browser' ); echo '
    Browse Happy
    '; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $id * @return unknown */ function the_attachment_links( $id = false ) { $id = (int) $id; $post = & get_post( $id ); if ( $post->post_type != 'attachment' ) return false; $icon = get_attachment_icon( $post->ID ); $attachment_data = wp_get_attachment_metadata( $id ); $thumb = isset( $attachment_data['thumb'] ); ?> html elements for role selectors based on $wp_roles * * @package WordPress * @subpackage Administration * @since 2.1 * * @uses $wp_roles * @param string $default slug for the role that should be already selected */ function wp_dropdown_roles( $selected = false ) { global $wp_roles; $p = ''; $r = ''; $editable_roles = get_editable_roles(); foreach( $editable_roles as $role => $details ) { $name = translate_user_role($details['name'] ); if ( $selected == $role ) // Make default first in list $p = "\n\t"; else $r .= "\n\t"; } echo $p . $r; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $size * @return unknown */ function wp_convert_hr_to_bytes( $size ) { $size = strtolower($size); $bytes = (int) $size; if ( strpos($size, 'k') !== false ) $bytes = intval($size) * 1024; elseif ( strpos($size, 'm') !== false ) $bytes = intval($size) * 1024 * 1024; elseif ( strpos($size, 'g') !== false ) $bytes = intval($size) * 1024 * 1024 * 1024; return $bytes; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $bytes * @return unknown */ function wp_convert_bytes_to_hr( $bytes ) { $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' ); $log = log( $bytes, 1024 ); $power = (int) $log; $size = pow(1024, $log - $power); return $size . $units[$power]; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function wp_max_upload_size() { $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); return $bytes; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $action */ function wp_import_upload_form( $action ) { $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = wp_convert_bytes_to_hr( $bytes ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?>

    ()

    post_name); // just in case if ( strlen($name) ) echo ''; } /** * Add a meta box to an edit form. * * @since 2.5.0 * * @param string $id String for use in the 'id' attribute of tags. * @param string $title Title of the meta box. * @param string $callback Function that fills the box with the desired content. The function should echo its output. * @param string $page The type of edit page on which to show the box (post, page, link). * @param string $context The context within the page where the boxes should show ('normal', 'advanced'). * @param string $priority The priority within the context where the boxes should show ('high', 'low'). */ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null) { global $wp_meta_boxes; if ( !isset($wp_meta_boxes) ) $wp_meta_boxes = array(); if ( !isset($wp_meta_boxes[$page]) ) $wp_meta_boxes[$page] = array(); if ( !isset($wp_meta_boxes[$page][$context]) ) $wp_meta_boxes[$page][$context] = array(); foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) { foreach ( array('high', 'core', 'default', 'low') as $a_priority ) { if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) ) continue; // If a core box was previously added or removed by a plugin, don't add. if ( 'core' == $priority ) { // If core box previously deleted, don't add if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] ) return; // If box was added with default priority, give it core priority to maintain sort order if ( 'default' == $a_priority ) { $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id]; unset($wp_meta_boxes[$page][$a_context]['default'][$id]); } return; } // If no priority given and id already present, use existing priority if ( empty($priority) ) { $priority = $a_priority; // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority. } elseif ( 'sorted' == $priority ) { $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title']; $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback']; $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args']; } // An id can be in only one priority and one context if ( $priority != $a_priority || $context != $a_context ) unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]); } } if ( empty($priority) ) $priority = 'low'; if ( !isset($wp_meta_boxes[$page][$context][$priority]) ) $wp_meta_boxes[$page][$context][$priority] = array(); $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page * @param unknown_type $context * @param unknown_type $object * @return int number of meta_boxes */ function do_meta_boxes($page, $context, $object) { global $wp_meta_boxes; static $already_sorted = false; //do_action('do_meta_boxes', $page, $context, $object); $hidden = get_hidden_meta_boxes($page); echo "
    \n"; $i = 0; do { // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) { foreach ( $sorted as $box_context => $ids ) foreach ( explode(',', $ids) as $id ) if ( $id ) add_meta_box( $id, null, null, $page, $box_context, 'sorted' ); } $already_sorted = true; if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) ) break; foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) { if ( isset($wp_meta_boxes[$page][$context][$priority]) ) { foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { if ( false == $box || ! $box['title'] ) continue; $i++; $style = ''; if ( in_array($box['id'], $hidden) ) $style = 'style="display:none;"'; echo '
    ' . "\n"; echo '

    '; echo "

    {$box['title']}

    \n"; echo '
    ' . "\n"; call_user_func($box['callback'], $object, $box); echo "
    \n"; echo "
    \n"; } } } } while(0); echo "
    "; return $i; } /** * Remove a meta box from an edit form. * * @since 2.6.0 * * @param string $id String for use in the 'id' attribute of tags. * @param string $page The type of edit page on which to show the box (post, page, link). * @param string $context The context within the page where the boxes should show ('normal', 'advanced'). */ function remove_meta_box($id, $page, $context) { global $wp_meta_boxes; if ( !isset($wp_meta_boxes) ) $wp_meta_boxes = array(); if ( !isset($wp_meta_boxes[$page]) ) $wp_meta_boxes[$page] = array(); if ( !isset($wp_meta_boxes[$page][$context]) ) $wp_meta_boxes[$page][$context] = array(); foreach ( array('high', 'core', 'default', 'low') as $priority ) $wp_meta_boxes[$page][$context][$priority][$id] = false; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page */ function meta_box_prefs($page) { global $wp_meta_boxes; if ( empty($wp_meta_boxes[$page]) ) return; $hidden = get_hidden_meta_boxes($page); foreach ( array_keys($wp_meta_boxes[$page]) as $context ) { foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) { foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { if ( false == $box || ! $box['title'] ) continue; // Submit box cannot be hidden if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) continue; $box_id = $box['id']; echo '\n"; } } } } function get_hidden_meta_boxes($page) { $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false ); // Hide slug boxes by default if ( empty($hidden[0]) ) { if ( 'page' == $page ) $hidden = array('pageslugdiv'); elseif ( 'post' == $page ) $hidden = array('slugdiv'); } return $hidden; } /** * Add a new section to a settings page. * * @since 2.7.0 * * @param string $id String for use in the 'id' attribute of tags. * @param string $title Title of the section. * @param string $callback Function that fills the section with the desired content. The function should echo its output. * @param string $page The type of settings page on which to show the section (general, reading, writing, ...). */ function add_settings_section($id, $title, $callback, $page) { global $wp_settings_sections; if ( !isset($wp_settings_sections) ) $wp_settings_sections = array(); if ( !isset($wp_settings_sections[$page]) ) $wp_settings_sections[$page] = array(); if ( !isset($wp_settings_sections[$page][$id]) ) $wp_settings_sections[$page][$id] = array(); $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); } /** * Add a new field to a settings page. * * @since 2.7.0 * * @param string $id String for use in the 'id' attribute of tags. * @param string $title Title of the field. * @param string $callback Function that fills the field with the desired content. The function should echo its output. * @param string $page The type of settings page on which to show the field (general, reading, writing, ...). * @param string $section The section of the settingss page in which to show the box (default, ...). * @param array $args Additional arguments */ function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) { global $wp_settings_fields; if ( !isset($wp_settings_fields) ) $wp_settings_fields = array(); if ( !isset($wp_settings_fields[$page]) ) $wp_settings_fields[$page] = array(); if ( !isset($wp_settings_fields[$page][$section]) ) $wp_settings_fields[$page][$section] = array(); $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page */ function do_settings_sections($page) { global $wp_settings_sections, $wp_settings_fields; if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) ) return; foreach ( (array) $wp_settings_sections[$page] as $section ) { echo "

    {$section['title']}

    \n"; call_user_func($section['callback'], $section); if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) ) continue; echo ''; do_settings_fields($page, $section['id']); echo '
    '; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page * @param unknown_type $section */ function do_settings_fields($page, $section) { global $wp_settings_fields; if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) ) return; foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { echo ''; if ( !empty($field['args']['label_for']) ) echo ''; else echo '' . $field['title'] . ''; echo ''; call_user_func($field['callback']); echo ''; echo ''; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $page */ function manage_columns_prefs($page) { $columns = get_column_headers($page); $hidden = get_hidden_columns($page); foreach ( $columns as $column => $title ) { // Can't hide these if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column ) continue; if ( empty($title) ) continue; if ( 'comments' == $column ) $title = __('Comments'); $id = "$column-hide"; echo '\n"; } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $found_action */ function find_posts_div($found_action = '') { ?> post_password ) ) echo esc_attr( $post->post_password ); } /** * {@internal Missing Short Description}} * * @since unknown */ function favorite_actions( $screen = null ) { switch ( $screen ) { case 'post-new.php': $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts')); break; case 'edit-pages.php': $default_action = array('page-new.php' => array(__('New Page'), 'edit_pages')); break; case 'page-new.php': $default_action = array('edit-pages.php' => array(__('Edit Pages'), 'edit_pages')); break; case 'upload.php': $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); break; case 'media-new.php': $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); break; case 'link-manager.php': $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); break; case 'link-add.php': $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); break; case 'users.php': $default_action = array('user-new.php' => array(__('New User'), 'create_users')); break; case 'user-new.php': $default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); break; case 'plugins.php': $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); break; case 'plugin-install.php': $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); break; case 'themes.php': $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); break; case 'theme-install.php': $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); break; default: $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); break; } $actions = array( 'post-new.php' => array(__('New Post'), 'edit_posts'), 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), 'page-new.php' => array(__('New Page'), 'edit_pages'), 'media-new.php' => array(__('Upload'), 'upload_files'), 'edit-comments.php' => array(__('Comments'), 'moderate_comments') ); $default_key = array_keys($default_action); $default_key = $default_key[0]; if ( isset($actions[$default_key]) ) unset($actions[$default_key]); $actions = array_merge($default_action, $actions); $actions = apply_filters('favorite_actions', $actions); $allowed_actions = array(); foreach ( $actions as $action => $data ) { if ( current_user_can($data[1]) ) $allowed_actions[$action] = $data[0]; } if ( empty($allowed_actions) ) return; $first = array_keys($allowed_actions); $first = $first[0]; echo '
    '; echo '

    '; echo '
    '; array_shift($allowed_actions); foreach ( $allowed_actions as $action => $label) { echo "\n"; } echo "
    \n"; } /** * Get the post title. * * The post title is fetched and if it is blank then a default string is * returned. * * @since 2.7.0 * @param int $id The post id. If not supplied the global $post is used. * */ function _draft_or_post_title($post_id = 0) { $title = get_the_title($post_id); if ( empty($title) ) $title = __('(no title)'); return $title; } /** * Display the search query. * * A simple wrapper to display the "s" parameter in a GET URI. This function * should only be used when {@link the_search_query()} cannot. * * @uses attr * @since 2.7.0 * */ function _admin_search_query() { echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : ''; } /** * Generic Iframe header for use with Thickbox * * @since 2.7.0 * @param string $title Title of the Iframe page. * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued). * */ function iframe_header( $title = '', $limit_styles = false ) { ?> > <?php bloginfo('name') ?> › <?php echo $title ?> — <?php _e('WordPress'); ?> > post_password) ) $post_states[] = __('Password protected'); if ( 'private' == $post->post_status && 'private' != $post_status ) $post_states[] = __('Private'); if ( 'draft' == $post->post_status && 'draft' != $post_status ) $post_states[] = __('Draft'); if ( 'pending' == $post->post_status && 'pending' != $post_status ) /* translators: post state */ $post_states[] = _x('Pending', 'post state'); if ( is_sticky($post->ID) ) $post_states[] = __('Sticky'); $post_states = apply_filters( 'display_post_states', $post_states ); if ( ! empty($post_states) ) { $state_count = count($post_states); $i = 0; echo ' - '; foreach ( $post_states as $state ) { ++$i; ( $i == $state_count ) ? $sep = '' : $sep = ', '; echo "$state$sep"; } } } function screen_meta($screen) { global $wp_meta_boxes, $_wp_contextual_help; $screen = str_replace('.php', '', $screen); $screen = str_replace('-new', '', $screen); $screen = str_replace('-add', '', $screen); $screen = apply_filters('screen_meta_screen', $screen); $column_screens = get_column_headers($screen); $meta_screens = array('index' => 'dashboard'); if ( isset($meta_screens[$screen]) ) $screen = $meta_screens[$screen]; $show_screen = false; $show_on_screen = false; if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) ) { $show_screen = true; $show_on_screen = true; } $screen_options = screen_options($screen); if ( $screen_options ) $show_screen = true; if ( !isset($_wp_contextual_help) ) $_wp_contextual_help = array(); $settings = ''; switch ( $screen ) { case 'post': if ( !isset($_wp_contextual_help['post']) ) { $help = drag_drop_help(); $help .= '

    ' . __('Writing Posts') . '

    '; $_wp_contextual_help['post'] = $help; } break; case 'page': if ( !isset($_wp_contextual_help['page']) ) { $help = drag_drop_help(); $_wp_contextual_help['page'] = $help; } break; case 'dashboard': if ( !isset($_wp_contextual_help['dashboard']) ) { $help = '

    ' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "

    \n"; $help .= drag_drop_help(); $_wp_contextual_help['dashboard'] = $help; } break; case 'link': if ( !isset($_wp_contextual_help['link']) ) { $help = drag_drop_help(); $_wp_contextual_help['link'] = $help; } break; case 'options-general': if ( !isset($_wp_contextual_help['options-general']) ) $_wp_contextual_help['options-general'] = __('General Settings'); break; case 'theme-install': case 'plugin-install': if ( ( !isset($_GET['tab']) || 'dashboard' == $_GET['tab'] ) && !isset($_wp_contextual_help[$screen]) ) { $help = plugins_search_help(); $_wp_contextual_help[$screen] = $help; } break; case 'theme-editor': case 'plugin-editor': $settings = '

    ' . __('Enable syntax highlighting') . '' . __('Disable syntax highlighting') . "

    \n"; $show_screen = true; break; case 'widgets': if ( !isset($_wp_contextual_help['widgets']) ) { $help = widgets_help(); $_wp_contextual_help['widgets'] = $help; } $settings = '

    ' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . "

    \n"; $show_screen = true; break; } ?>
    ' . __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you’ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '

    ' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '

    '; } function plugins_search_help() { return '

    ' . __('Search help') . '

    ' . '

    ' . __('You may search based on 3 criteria:') . '
    ' . __('Term: Searches theme names and descriptions for the specified term.') . '
    ' . __('Tag: Searches for themes tagged as such.') . '
    ' . __('Author: Searches for themes created by the Author, or which the Author contributed to.') . '

    '; } function widgets_help() { return '

    ' . __('Widgets are added and arranged by simple drag ’n’ drop. If you hover your mouse over the titlebar of a widget, you’ll see a 4-arrow cursor which indicates that the widget is movable. Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you’ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '

    ' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '

    ' . __('To remove a widget from a sidebar and keep its configuration, drag it to Inactive Widgets.') . '

    ' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '

    '; } function screen_layout($screen) { global $screen_layout_columns; $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2); $columns = apply_filters('screen_layout_columns', $columns, $screen); if ( !isset($columns[$screen]) ) { $screen_layout_columns = 0; return ''; } $screen_layout_columns = get_user_option("screen_layout_$screen"); $num = $columns[$screen]; if ( ! $screen_layout_columns ) $screen_layout_columns = 2; $i = 1; $return = '
    ' . __('Screen Layout') . "
    \n
    " . __('Number of Columns:') . "\n"; while ( $i <= $num ) { $return .= "\n"; ++$i; } $return .= "
    \n"; return $return; } function screen_options($screen) { switch ( $screen ) { case 'edit': $per_page_label = __('Posts per page:'); break; case 'edit-pages': $per_page_label = __('Pages per page:'); break; case 'edit-comments': $per_page_label = __('Comments per page:'); break; case 'upload': $per_page_label = __('Media items per page:'); break; case 'categories': $per_page_label = __('Categories per page:'); break; case 'edit-tags': $per_page_label = __('Tags per page:'); break; case 'plugins': $per_page_label = __('Plugins per page:'); break; default: return ''; } $option = str_replace('-', '_', "${screen}_per_page"); $per_page = get_user_option($option); if ( empty($per_page) ) { if ( 'plugins' == $screen ) $per_page = 999; else $per_page = 20; } $return = '
    ' . __('Options') . "
    \n"; $return .= "
    \n"; if ( !empty($per_page_label) ) $return .= " \n"; $return .= ""; $return .= ""; $return .= "
    \n"; return $return; } function screen_icon($name = '') { global $parent_file, $hook_suffix; if ( empty($name) ) { if ( isset($parent_file) && !empty($parent_file) ) $name = substr($parent_file, 0, -4); else $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix); } ?>

    thebrutalagenda/wp-admin/includes/misc.php0000644001761300176130000004201411214074650021433 0ustar mustardamustarda $markerline ) { if (strpos($markerline, '# BEGIN ' . $marker) !== false) $state = false; if ( $state ) { if ( $n + 1 < count( $markerdata ) ) fwrite( $f, "{$markerline}\n" ); else fwrite( $f, "{$markerline}" ); } if (strpos($markerline, '# END ' . $marker) !== false) { fwrite( $f, "# BEGIN {$marker}\n" ); if ( is_array( $insertion )) foreach ( $insertion as $insertline ) fwrite( $f, "{$insertline}\n" ); fwrite( $f, "# END {$marker}\n" ); $state = true; $foundit = true; } } } if (!$foundit) { fwrite( $f, "\n# BEGIN {$marker}\n" ); foreach ( $insertion as $insertline ) fwrite( $f, "{$insertline}\n" ); fwrite( $f, "# END {$marker}\n" ); } fclose( $f ); return true; } else { return false; } } /** * Updates the htaccess file with the current rules if it is writable. * * Always writes to the file if it exists and is writable to ensure that we * blank out old rules. * * @since unknown */ function save_mod_rewrite_rules() { global $wp_rewrite; $home_path = get_home_path(); $htaccess_file = $home_path.'.htaccess'; // If the file doesn't already exists check for write access to the directory and whether of not we have some rules. // else check for write access to the file. if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) { if ( got_mod_rewrite() ) { $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); return insert_with_markers( $htaccess_file, 'WordPress', $rules ); } } return false; } /** * Updates the IIS web.config file with the current rules if it is writable. * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file. * * @since 2.8.0 * * @return bool True if web.config was updated successfully */ function iis7_save_url_rewrite_rules(){ global $wp_rewrite; $home_path = get_home_path(); $web_config_file = $home_path . 'web.config'; // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) { if ( iis7_supports_permalinks() ) { $rule = $wp_rewrite->iis7_url_rewrite_rules(); if ( ! empty($rule) ) { return iis7_add_rewrite_rule($web_config_file, $rule); } else { return iis7_delete_rewrite_rule($web_config_file); } } } return false; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file */ function update_recently_edited( $file ) { $oldfiles = (array ) get_option( 'recently_edited' ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $oldfiles = array_reverse( $oldfiles ); $oldfiles = array_unique( $oldfiles ); if ( 5 < count( $oldfiles )) array_pop( $oldfiles ); } else { $oldfiles[] = $file; } update_option( 'recently_edited', $oldfiles ); } /** * If siteurl or home changed, flush rewrite rules. * * @since unknown * * @param unknown_type $old_value * @param unknown_type $value */ function update_home_siteurl( $old_value, $value ) { global $wp_rewrite; if ( defined( "WP_INSTALLING" ) ) return; // If home changed, write rewrite rules to new location. $wp_rewrite->flush_rules(); } add_action( 'update_option_home', 'update_home_siteurl', 10, 2 ); add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 ); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $url * @return unknown */ function url_shorten( $url ) { $short_url = str_replace( 'http://', '', stripslashes( $url )); $short_url = str_replace( 'www.', '', $short_url ); if ('/' == substr( $short_url, -1 )) $short_url = substr( $short_url, 0, -1 ); if ( strlen( $short_url ) > 35 ) $short_url = substr( $short_url, 0, 32 ).'...'; return $short_url; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $vars */ function wp_reset_vars( $vars ) { for ( $i=0; $iget_error_data() ) $message = $message->get_error_message() . ': ' . $message->get_error_data(); else $message = $message->get_error_message(); } echo "

    $message

    \n"; } function wp_doc_link_parse( $content ) { if ( !is_string( $content ) || empty( $content ) ) return array(); $tokens = token_get_all( $content ); $functions = array(); $ignore_functions = array(); for ( $t = 0, $count = count( $tokens ); $t < $count; $t++ ) { if ( !is_array( $tokens[$t] ) ) continue; if ( T_STRING == $tokens[$t][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) { // If it's a function or class defined locally, there's not going to be any docs available if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) { $ignore_functions[] = $tokens[$t][1]; } // Add this to our stack of unique references $functions[] = $tokens[$t][1]; } } $functions = array_unique( $functions ); sort( $functions ); $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); $ignore_functions = array_unique( $ignore_functions ); $out = array(); foreach ( $functions as $function ) { if ( in_array( $function, $ignore_functions ) ) continue; $out[] = $function; } return $out; } /** * Determines the language to use for CodePress syntax highlighting, * based only on a filename. * * @since 2.8 * * @param string $filename The name of the file to be highlighting **/ function codepress_get_lang( $filename ) { $codepress_supported_langs = apply_filters( 'codepress_supported_langs', array( '.css' => 'css', '.js' => 'javascript', '.php' => 'php', '.html' => 'html', '.htm' => 'html', '.txt' => 'text' ) ); $extension = substr( $filename, strrpos( $filename, '.' ) ); if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) ) return $codepress_supported_langs[$extension]; return 'generic'; } /** * Adds Javascript required to make CodePress work on the theme/plugin editors. * * This code is attached to the action admin_print_footer_scripts. * * @since 2.8 **/ function codepress_footer_js() { // Script-loader breaks CP's automatic path-detection, thus CodePress.path // CP edits in an iframe, so we need to grab content back into normal form ?> 999 ) return; break; default: $value = apply_filters('set-screen-option', false, $option, $value); if ( false === $value ) return; break; } update_usermeta($user->ID, $option, $value); wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); exit; } } function wp_menu_unfold() { if ( isset($_GET['unfoldmenu']) ) { delete_user_setting('mfold'); wp_redirect( remove_query_arg( 'unfoldmenu', stripslashes($_SERVER['REQUEST_URI']) ) ); exit; } } /** * Check if IIS 7 supports pretty permalinks * * @since 2.8.0 * * @return bool */ function iis7_supports_permalinks() { global $is_iis7; $supports_permalinks = false; if ( $is_iis7 ) { /* First we check if the DOMDocument class exists. If it does not exist, * which is the case for PHP 4.X, then we cannot easily update the xml configuration file, * hence we just bail out and tell user that pretty permalinks cannot be used. * This is not a big issue because PHP 4.X is going to be depricated and for IIS it * is recommended to use PHP 5.X NTS. * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'. * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs * via ISAPI then pretty permalinks will not work. */ $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' ); } return apply_filters('iis7_supports_permalinks', $supports_permalinks); } /** * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file * * @since 2.8.0 * * @return bool * @param string $filename The file path to the configuration file */ function iis7_rewrite_rule_exists($filename) { if ( ! file_exists($filename) ) return false; if ( ! class_exists('DOMDocument') ) return false; $doc = new DOMDocument(); if ( $doc->load($filename) === false ) return false; $xpath = new DOMXPath($doc); $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']'); if ( $rules->length == 0 ) return false; else return true; } /** * Delete WordPress rewrite rule from web.config file if it exists there * * @since 2.8.0 * * @param string $filename Name of the configuration file * @return bool */ function iis7_delete_rewrite_rule($filename) { // If configuration file does not exist then rules also do not exist so there is nothing to delete if ( ! file_exists($filename) ) return true; if ( ! class_exists('DOMDocument') ) return false; $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc -> load($filename) === false ) return false; $xpath = new DOMXPath($doc); $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']'); if ( $rules->length > 0 ) { $child = $rules->item(0); $parent = $child->parentNode; $parent->removeChild($child); $doc->formatOutput = true; saveDomDocument($doc, $filename); } return true; } /** * Add WordPress rewrite rule to the IIS 7 configuration file. * * @since 2.8.0 * * @param string $filename The file path to the configuration file * @param string $rewrite_rule The XML fragment with URL Rewrite rule * @return bool */ function iis7_add_rewrite_rule($filename, $rewrite_rule) { if ( ! class_exists('DOMDocument') ) return false; // If configuration file does not exist then we create one. if ( ! file_exists($filename) ) { $fp = fopen( $filename, 'w'); fwrite($fp, ''); fclose($fp); } $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; if ( $doc->load($filename) === false ) return false; $xpath = new DOMXPath($doc); // First check if the rule already exists as in that case there is no need to re-add it $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']'); if ( $wordpress_rules->length > 0 ) return true; // Check the XPath to the rewrite rule and create XML nodes if they do not exist $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules'); if ( $xmlnodes->length > 0 ) { $rules_node = $xmlnodes->item(0); } else { $rules_node = $doc->createElement('rules'); $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite'); if ( $xmlnodes->length > 0 ) { $rewrite_node = $xmlnodes->item(0); $rewrite_node->appendChild($rules_node); } else { $rewrite_node = $doc->createElement('rewrite'); $rewrite_node->appendChild($rules_node); $xmlnodes = $xpath->query('/configuration/system.webServer'); if ( $xmlnodes->length > 0 ) { $system_webServer_node = $xmlnodes->item(0); $system_webServer_node->appendChild($rewrite_node); } else { $system_webServer_node = $doc->createElement('system.webServer'); $system_webServer_node->appendChild($rewrite_node); $xmlnodes = $xpath->query('/configuration'); if ( $xmlnodes->length > 0 ) { $config_node = $xmlnodes->item(0); $config_node->appendChild($system_webServer_node); } else { $config_node = $doc->createElement('configuration'); $doc->appendChild($config_node); $config_node->appendChild($system_webServer_node); } } } } $rule_fragment = $doc->createDocumentFragment(); $rule_fragment->appendXML($rewrite_rule); $rules_node->appendChild($rule_fragment); $doc->formatOutput = true; saveDomDocument($doc, $filename); return true; } /** * Saves the XML document into a file * * @since 2.8.0 * * @param DOMDocument $doc * @param string $filename */ function saveDomDocument($doc, $filename) { $config = $doc->saveXML(); $config = preg_replace("/([^\r])\n/", "$1\r\n", $config); $fp = fopen($filename, 'w'); fwrite($fp, $config); fclose($fp); } /** * Workaround for Windows bug in is_writable() function * * @since 2.8.0 * * @param object $path * @return bool */ function win_is_writable($path) { /* will work in despite of Windows ACLs bug * NOTE: use a trailing slash for folders!!! * see http://bugs.php.net/bug.php?id=27609 * see http://bugs.php.net/bug.php?id=30931 */ if ( $path{strlen($path)-1} == '/' ) // recursively return a temporary file path return win_is_writable($path . uniqid(mt_rand()) . '.tmp'); else if ( is_dir($path) ) return win_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp'); // check tmp file for read/write capabilities $rm = file_exists($path); $f = @fopen($path, 'a'); if ($f===false) return false; fclose($f); if ( ! $rm ) unlink($path); return true; } ?> thebrutalagenda/wp-admin/includes/file.php0000644001761300176130000007037111214074650021426 0ustar mustardamustarda __( 'Main Index Template' ), 'style.css' => __( 'Stylesheet' ), 'rtl.css' => __( 'RTL Stylesheet' ), 'comments.php' => __( 'Comments' ), 'comments-popup.php' => __( 'Popup Comments' ), 'footer.php' => __( 'Footer' ), 'header.php' => __( 'Header' ), 'sidebar.php' => __( 'Sidebar' ), 'archive.php' => __( 'Archives' ), 'category.php' => __( 'Category Template' ), 'page.php' => __( 'Page Template' ), 'search.php' => __( 'Search Results' ), 'searchform.php' => __( 'Search Form' ), 'single.php' => __( 'Single Post' ), '404.php' => __( '404 Template' ), 'link.php' => __( 'Links Template' ), 'functions.php' => __( 'Theme Functions' ), 'attachment.php' => __( 'Attachment Template' ), 'image.php' => __('Image Attachment Template'), 'video.php' => __('Video Attachment Template'), 'audio.php' => __('Audio Attachment Template'), 'application.php' => __('Application Attachment Template'), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ), // Deprecated files 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' )); /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file * @return unknown */ function get_file_description( $file ) { global $wp_file_descriptions; if ( isset( $wp_file_descriptions[basename( $file )] ) ) { return $wp_file_descriptions[basename( $file )]; } elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) { $template_data = implode( '', file( WP_CONTENT_DIR . $file ) ); if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name )) return _cleanup_header_comment($name[1]) . ' Page Template'; } return basename( $file ); } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function get_home_path() { $home = get_option( 'home' ); $siteurl = get_option( 'siteurl' ); if ( $home != '' && $home != $siteurl ) { $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); $home_path = trailingslashit( $home_path ); } else { $home_path = ABSPATH; } return $home_path; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file * @return unknown */ function get_real_file_to_edit( $file ) { if ('index.php' == $file || '.htaccess' == $file ) { $real_file = get_home_path() . $file; } else { $real_file = WP_CONTENT_DIR . $file; } return $real_file; } /** * {@internal Missing Short Description}} * * @since unknown * * @param string $folder Optional. Full path to folder * @param int $levels Optional. Levels of folders to follow, Default: 100 (PHP Loop limit). * @return bool|array */ function list_files( $folder = '', $levels = 100 ) { if( empty($folder) ) return false; if( ! $levels ) return false; $files = array(); if ( $dir = @opendir( $folder ) ) { while (($file = readdir( $dir ) ) !== false ) { if ( in_array($file, array('.', '..') ) ) continue; if ( is_dir( $folder . '/' . $file ) ) { $files2 = list_files( $folder . '/' . $file, $levels - 1); if( $files2 ) $files = array_merge($files, $files2 ); else $files[] = $folder . '/' . $file . '/'; } else { $files[] = $folder . '/' . $file; } } } @closedir( $dir ); return $files; } /** * {@internal Missing Short Description}} * * @since unknown * * @return unknown */ function get_temp_dir() { if ( defined('WP_TEMP_DIR') ) return trailingslashit(WP_TEMP_DIR); $temp = WP_CONTENT_DIR . '/'; if ( is_dir($temp) && is_writable($temp) ) return $temp; if ( function_exists('sys_get_temp_dir') ) return trailingslashit(sys_get_temp_dir()); return '/tmp/'; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $filename * @param unknown_type $dir * @return unknown */ function wp_tempnam($filename = '', $dir = ''){ if ( empty($dir) ) $dir = get_temp_dir(); $filename = basename($filename); if ( empty($filename) ) $filename = time(); $filename = $dir . wp_unique_filename($dir, $filename); touch($filename); return $filename; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file * @param unknown_type $allowed_files * @return unknown */ function validate_file_to_edit( $file, $allowed_files = '' ) { $file = stripslashes( $file ); $code = validate_file( $file, $allowed_files ); if (!$code ) return $file; switch ( $code ) { case 1 : wp_die( __('Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' )); case 2 : wp_die( __('Sorry, can’t call files with their real path.' )); case 3 : wp_die( __('Sorry, that file cannot be edited.' )); } } /** * {@internal Missing Short Description}} * * @since unknown * * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file. * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ). * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ). */ function wp_handle_upload( &$file, $overrides = false, $time = null ) { // The default error handler. if (! function_exists( 'wp_handle_upload_error' ) ) { function wp_handle_upload_error( &$file, $message ) { return array( 'error'=>$message ); } } // You may define your own function and pass the name in $overrides['upload_error_handler'] $upload_error_handler = 'wp_handle_upload_error'; // You may define your own function and pass the name in $overrides['unique_filename_callback'] $unique_filename_callback = null; // $_POST['action'] must be set and its value must equal $overrides['action'] or this: $action = 'wp_handle_upload'; // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. $upload_error_strings = array( false, __( "The uploaded file exceeds the upload_max_filesize directive in php.ini." ), __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ), __( "The uploaded file was only partially uploaded." ), __( "No file was uploaded." ), '', __( "Missing a temporary folder." ), __( "Failed to write file to disk." ), __( "File upload stopped by extension." )); // All tests are on by default. Most can be turned off by $override[{test_name}] = false; $test_form = true; $test_size = true; // If you override this, you must provide $ext and $type!!!! $test_type = true; $mimes = false; // Install user overrides. Did we mention that this voids your warranty? if ( is_array( $overrides ) ) extract( $overrides, EXTR_OVERWRITE ); // A correct form post will pass this test. if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) return $upload_error_handler( $file, __( 'Invalid form submission.' )); // A successful upload will pass this test. It makes no sense to override this one. if ( $file['error'] > 0 ) return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); // A non-empty file will pass this test. if ( $test_size && !($file['size'] > 0 ) ) return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' )); // A properly uploaded file will pass this test. There should be no reason to override this one. if (! @ is_uploaded_file( $file['tmp_name'] ) ) return $upload_error_handler( $file, __( 'Specified file failed upload test.' )); // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. if ( $test_type ) { $wp_filetype = wp_check_filetype( $file['name'], $mimes ); extract( $wp_filetype ); if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); if ( !$ext ) $ext = ltrim(strrchr($file['name'], '.'), '.'); if ( !$type ) $type = $file['type']; } else { $type = ''; } // A writable uploads dir will pass this test. Again, there's no point overriding this one. if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) ) return $upload_error_handler( $file, $uploads['error'] ); $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); // Move the file to the uploads dir $new_file = $uploads['path'] . "/$filename"; if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) { return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); } // Set correct file permissions $stat = stat( dirname( $new_file )); $perms = $stat['mode'] & 0000666; @ chmod( $new_file, $perms ); // Compute the URL $url = $uploads['url'] . "/$filename"; return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); } /** * {@internal Missing Short Description}} * * Pass this function an array similar to that of a $_FILES POST array. * * @since unknown * * @param unknown_type $file * @param unknown_type $overrides * @return unknown */ function wp_handle_sideload( &$file, $overrides = false ) { // The default error handler. if (! function_exists( 'wp_handle_upload_error' ) ) { function wp_handle_upload_error( &$file, $message ) { return array( 'error'=>$message ); } } // You may define your own function and pass the name in $overrides['upload_error_handler'] $upload_error_handler = 'wp_handle_upload_error'; // You may define your own function and pass the name in $overrides['unique_filename_callback'] $unique_filename_callback = null; // $_POST['action'] must be set and its value must equal $overrides['action'] or this: $action = 'wp_handle_sideload'; // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. $upload_error_strings = array( false, __( "The uploaded file exceeds the upload_max_filesize directive in php.ini." ), __( "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form." ), __( "The uploaded file was only partially uploaded." ), __( "No file was uploaded." ), '', __( "Missing a temporary folder." ), __( "Failed to write file to disk." ), __( "File upload stopped by extension." )); // All tests are on by default. Most can be turned off by $override[{test_name}] = false; $test_form = true; $test_size = true; // If you override this, you must provide $ext and $type!!!! $test_type = true; $mimes = false; // Install user overrides. Did we mention that this voids your warranty? if ( is_array( $overrides ) ) extract( $overrides, EXTR_OVERWRITE ); // A correct form post will pass this test. if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) return $upload_error_handler( $file, __( 'Invalid form submission.' )); // A successful upload will pass this test. It makes no sense to override this one. if ( $file['error'] > 0 ) return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); // A non-empty file will pass this test. if ( $test_size && !(filesize($file['tmp_name']) > 0 ) ) return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' )); // A properly uploaded file will pass this test. There should be no reason to override this one. if (! @ is_file( $file['tmp_name'] ) ) return $upload_error_handler( $file, __( 'Specified file does not exist.' )); // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. if ( $test_type ) { $wp_filetype = wp_check_filetype( $file['name'], $mimes ); extract( $wp_filetype ); if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); if ( !$ext ) $ext = ltrim(strrchr($file['name'], '.'), '.'); if ( !$type ) $type = $file['type']; } // A writable uploads dir will pass this test. Again, there's no point overriding this one. if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) return $upload_error_handler( $file, $uploads['error'] ); $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); // Strip the query strings. $filename = str_replace('?','-', $filename); $filename = str_replace('&','-', $filename); // Move the file to the uploads dir $new_file = $uploads['path'] . "/$filename"; if ( false === @ rename( $file['tmp_name'], $new_file ) ) { return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); } // Set correct file permissions $stat = stat( dirname( $new_file )); $perms = $stat['mode'] & 0000666; @ chmod( $new_file, $perms ); // Compute the URL $url = $uploads['url'] . "/$filename"; $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); return $return; } /** * Downloads a url to a local file using the Snoopy HTTP Class. * * @since unknown * @todo Transition over to using the new HTTP Request API (jacob). * * @param string $url the URL of the file to download * @return mixed WP_Error on failure, string Filename on success. */ function download_url( $url ) { //WARNING: The file is not automatically deleted, The script must unlink() the file. if ( ! $url ) return new WP_Error('http_no_url', __('Invalid URL Provided')); $tmpfname = wp_tempnam($url); if ( ! $tmpfname ) return new WP_Error('http_no_file', __('Could not create Temporary file')); $handle = @fopen($tmpfname, 'wb'); if ( ! $handle ) return new WP_Error('http_no_file', __('Could not create Temporary file')); $response = wp_remote_get($url, array('timeout' => 30)); if ( is_wp_error($response) ) { fclose($handle); unlink($tmpfname); return $response; } if ( $response['response']['code'] != '200' ){ fclose($handle); unlink($tmpfname); return new WP_Error('http_404', trim($response['response']['message'])); } fwrite($handle, $response['body']); fclose($handle); return $tmpfname; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $file * @param unknown_type $to * @return unknown */ function unzip_file($file, $to) { global $wp_filesystem; if ( ! $wp_filesystem || !is_object($wp_filesystem) ) return new WP_Error('fs_unavailable', __('Could not access filesystem.')); // Unzip uses a lot of memory @ini_set('memory_limit', '256M'); $fs =& $wp_filesystem; require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php'); $archive = new PclZip($file); // Is the archive valid? if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) ) return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true)); if ( 0 == count($archive_files) ) return new WP_Error('empty_archive', __('Empty archive')); $path = explode('/', untrailingslashit($to)); for ( $i = count($path); $i > 0; $i-- ) { //>0 = first element is empty allways for paths starting with '/' $tmppath = implode('/', array_slice($path, 0, $i) ); if ( $fs->is_dir($tmppath) ) { //Found the highest folder that exists, Create from here(ie +1) for ( $i = $i + 1; $i <= count($path); $i++ ) { $tmppath = implode('/', array_slice($path, 0, $i) ); if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); } break; //Exit main for loop } } $to = trailingslashit($to); foreach ($archive_files as $file) { $path = $file['folder'] ? $file['filename'] : dirname($file['filename']); $path = explode('/', $path); for ( $i = count($path); $i >= 0; $i-- ) { //>=0 as the first element contains data if ( empty($path[$i]) ) continue; $tmppath = $to . implode('/', array_slice($path, 0, $i) ); if ( $fs->is_dir($tmppath) ) {//Found the highest folder that exists, Create from here for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please. $tmppath = $to . implode('/', array_slice($path, 0, $i) ); if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); } break; //Exit main for loop } } // We've made sure the folders are there, so let's extract the file now: if ( ! $file['folder'] ) { if ( !$fs->put_contents( $to . $file['filename'], $file['content']) ) return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']); $fs->chmod($to . $file['filename'], FS_CHMOD_FILE); } } return true; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $from * @param unknown_type $to * @return unknown */ function copy_dir($from, $to) { global $wp_filesystem; $dirlist = $wp_filesystem->dirlist($from); $from = trailingslashit($from); $to = trailingslashit($to); foreach ( (array) $dirlist as $filename => $fileinfo ) { if ( 'f' == $fileinfo['type'] ) { if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) { // If copy failed, chmod file to 0644 and try again. $wp_filesystem->chmod($to . $filename, 0644); if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename); } $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE); } elseif ( 'd' == $fileinfo['type'] ) { if ( !$wp_filesystem->is_dir($to . $filename) ) { if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename); } $result = copy_dir($from . $filename, $to . $filename); if ( is_wp_error($result) ) return $result; } } } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $args * @return unknown */ function WP_Filesystem( $args = false, $context = false ) { global $wp_filesystem; require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); $method = get_filesystem_method($args, $context); if ( ! $method ) return false; if ( ! class_exists("WP_Filesystem_$method") ) { $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); if( ! file_exists($abstraction_file) ) return; require_once($abstraction_file); } $method = "WP_Filesystem_$method"; $wp_filesystem = new $method($args); if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) return false; if ( !$wp_filesystem->connect() ) return false; //There was an erorr connecting to the server. // Set the permission constants if not already set. if ( ! defined('FS_CHMOD_DIR') ) define('FS_CHMOD_DIR', 0755 ); if ( ! defined('FS_CHMOD_FILE') ) define('FS_CHMOD_FILE', 0644 ); return true; } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $args * @param string $context Full path to the directory that is tested for being writable. * @return unknown */ function get_filesystem_method($args = array(), $context = false) { $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ if ( !$context ) $context = WP_CONTENT_DIR; $context = trailingslashit($context); $temp_file_name = $context . '.write-test-' . time(); $temp_handle = @fopen($temp_file_name, 'w'); if ( $temp_handle ) { if ( getmyuid() == fileowner($temp_file_name) ) $method = 'direct'; @fclose($temp_handle); unlink($temp_file_name); } } if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2'; if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread return apply_filters('filesystem_method', $method, $args); } /** * {@internal Missing Short Description}} * * @since unknown * * @param unknown_type $form_post * @param unknown_type $type * @param unknown_type $error * @return unknown */ function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) { $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context); if ( '' !== $req_cred ) return $req_cred; if ( empty($type) ) $type = get_filesystem_method(array(), $context); if ( 'direct' == $type ) return true; $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : ''); // Check to see if we are setting the public/private keys for ssh $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : ''); $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : ''); //sanitize the hostname, Some people might pass in odd-data: $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off if ( strpos($credentials['hostname'], ':') ) list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2); else unset($credentials['port']); if ( defined('FTP_SSH') || (defined('FS_METHOD') && 'ssh' == FS_METHOD) ) $credentials['connection_type'] = 'ssh'; else if ( defined('FTP_SSL') && 'ftpext' == $type ) //Only the FTP Extension understands SSL $credentials['connection_type'] = 'ftps'; else if ( !empty($_POST['connection_type']) ) $credentials['connection_type'] = $_POST['connection_type']; else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP $credentials['connection_type'] = 'ftp'; if ( ! $error && ( ( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) || ( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) ) ) ) { $stored_credentials = $credentials; if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code. $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']); update_option('ftp_credentials', $stored_credentials); return $credentials; } $hostname = ''; $username = ''; $password = ''; $connection_type = ''; if ( !empty($credentials) ) extract($credentials, EXTR_OVERWRITE); if ( $error ) { $error_string = __('Error: There was an error connecting to the server, Please verify the settings are correct.'); if ( is_wp_error($error) ) $error_string = $error->get_error_message(); echo '

    ' . $error_string . '

    '; } ?>

    " size="40" />
    size="40" />
    size="40" />


    size="40" />
    size="40" />


    thebrutalagenda/wp-admin/media-upload.php0000644001761300176130000000547511214074650021245 0ustar mustardamustarda

    thebrutalagenda/wp-admin/edit-comments.php0000644001761300176130000003367411214074650021456 0ustar mustardamustardaescape( $_REQUEST['pagegen_timestamp'] ); if ( current_user_can('moderate_comments')) { $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); } else { $deleted_spam = 0; } $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam; if ( $post_id ) $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); wp_redirect( $redirect_to ); } elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) { check_admin_referer('bulk-comments'); $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2']; $deleted = $approved = $unapproved = $spammed = 0; foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each $comment_id = (int) $comment_id; $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) ); if ( !current_user_can('edit_post', $_post_id) ) continue; switch( $doaction ) { case 'markspam' : wp_set_comment_status($comment_id, 'spam'); $spammed++; break; case 'delete' : wp_set_comment_status($comment_id, 'delete'); $deleted++; break; case 'approve' : wp_set_comment_status($comment_id, 'approve'); $approved++; break; case 'unapprove' : wp_set_comment_status($comment_id, 'hold'); $unapproved++; break; } endforeach; $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved; if ( $post_id ) $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); if ( isset($_REQUEST['apage']) ) $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to ); if ( !empty($_REQUEST['mode']) ) $redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to); if ( !empty($_REQUEST['comment_status']) ) $redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to); if ( !empty($_REQUEST['s']) ) $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to); wp_redirect( $redirect_to ); } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); exit; } if ( $post_id ) $title = sprintf(__('Edit Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); else $title = __('Edit Comments'); require_once('admin-header.php'); $mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']); $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam')) ) $comment_status = 'all'; $comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : ''; $search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : ''; $search = esc_attr( $search_dirty ); ?>

    ' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_GET['s'] ) ), 50 ) ) . '' ); ?>

    0 || $deleted > 0 || $spam > 0 ) { echo '

    '; if ( $approved > 0 ) { printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); echo '
    '; } if ( $deleted > 0 ) { printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted ); echo '
    '; } if ( $spam > 0 ) { printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam ); echo '
    '; } echo '

    '; } } ?>
      moderated) ), "" . number_format_i18n($num_comments->moderated) . ""), //, number_format_i18n($num_comments->spam) ), "" . number_format_i18n($num_comments->spam) . "") $stati = array( 'all' => _n_noop('All', 'All'), // singular not used 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'), 'approved' => _n_noop('Approved', 'Approved'), // singular not used 'spam' => _n_noop('Spam (%s)', 'Spam (%s)') ); $link = 'edit-comments.php'; if ( !empty($comment_type) && 'all' != $comment_type ) $link = add_query_arg( 'comment_type', $comment_type, $link ); foreach ( $stati as $status => $label ) { $class = ''; if ( $status == $comment_status ) $class = ' class="current"'; if ( !isset( $num_comments->$status ) ) $num_comments->$status = 10; $link = add_query_arg( 'comment_status', $status, $link ); if ( $post_id ) $link = add_query_arg( 'p', absint( $post_id ), $link ); /* // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark if ( !empty( $_GET['s'] ) ) $link = add_query_arg( 's', esc_attr( stripslashes( $_GET['s'] ) ), $link ); */ $status_links[] = "
    • " . sprintf( _n( $label[0], $label[1], $num_comments->$status ), number_format_i18n( $num_comments->$status ) ) . ''; } $status_links = apply_filters( 'comment_status_links', $status_links ); echo implode( " |
    • \n", $status_links) . ''; unset($status_links); ?>
    comment_post_ID; } $_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids); foreach ( (array) $_comment_post_ids as $_cpid ) $_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0; if ( empty($_comment_pending_count) ) $_comment_pending_count = array(); $comments = array_slice($_comments, 0, $comments_per_page); $extra_comments = array_slice($_comments, $comments_per_page); $page_links = paginate_links( array( 'base' => add_query_arg( 'apage', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($total / $comments_per_page), 'current' => $page )); ?>
    ' . __( 'Displaying %s–%s of %s' ) . '%s', number_format_i18n( $start + 1 ), number_format_i18n( min( $page * $comments_per_page, $total ) ), '' . number_format_i18n( $total ) . '', $page_links ); echo $page_links_text; ?>

    comment_ID, $mode, $comment_status ); ?> comment_ID, $mode, $comment_status ); ?>
    $page_links_text
    "; ?>

    thebrutalagenda/wp-admin/link-parse-opml.php0000644001761300176130000000473011144426310021703 0ustar mustardamustarda 'link_url', 'HTMLURL' => 'link_url', 'TEXT' => 'link_name', 'TITLE' => 'link_name', 'TARGET' => 'link_target', 'DESCRIPTION' => 'link_description', 'XMLURL' => 'link_rss' ); $map = $opml_map; /** * XML callback function for the start of a new XML tag. * * @since unknown * @access private * * @uses $updated_timestamp Not used inside function. * @uses $all_links Not used inside function. * @uses $map Stores names of attributes to use. * @global array $names * @global array $urls * @global array $targets * @global array $descriptions * @global array $feeds * * @param mixed $parser XML Parser resource. * @param string $tagName XML element name. * @param array $attrs XML element attributes. */ function startElement($parser, $tagName, $attrs) { global $updated_timestamp, $all_links, $map; global $names, $urls, $targets, $descriptions, $feeds; if ($tagName == 'OUTLINE') { foreach (array_keys($map) as $key) { if (isset($attrs[$key])) { $$map[$key] = $attrs[$key]; } } //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]
    \n"); // save the data away. $names[] = $link_name; $urls[] = $link_url; $targets[] = $link_target; $feeds[] = $link_rss; $descriptions[] = $link_description; } // end if outline } /** * XML callback function that is called at the end of a XML tag. * * @since unknown * @access private * @package WordPress * @subpackage Dummy * * @param mixed $parser XML Parser resource. * @param string $tagName XML tag name. */ function endElement($parser, $tagName) { // nothing to do. } // Create an XML parser $xml_parser = xml_parser_create(); // Set the functions to handle opening and closing tags xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!xml_parse($xml_parser, $opml, true)) { echo(sprintf(__('XML error: %1$s at line %2$s'), xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } // Free up memory used by the XML parser xml_parser_free($xml_parser); ?> thebrutalagenda/wp-admin/css/global.css0000644001761300176130000001473111214074650020730 0ustar mustardamustarda/* http://meyerweb.com/eric/tools/css/reset/ */ /* v1.0 | 20080212 */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; /* font-size: 100%; vertical-align: baseline; */ background: transparent; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } /* remember to define focus styles! */ /* :focus { outline: 0; } */ /* remember to highlight inserts somehow! */ ins { text-decoration: none; } del { text-decoration: line-through; } /* tables still need 'cellspacing="0"' in the markup */ /* table { border-collapse: collapse; border-spacing: 0; } */ /* end reset css */ /* 2 column liquid layout */ #wpwrap { height: auto; min-height: 100%; width: 100%; } #wpcontent { height: 100%; padding-bottom: 50px; } #wpbody { clear: both; margin-left: 175px; } .folded #wpbody { margin-left: 60px; } #wpbody-content { float: left; width: 100%; } #adminmenu { float: left; clear: left; width: 145px; margin-top: 15px; margin-right: 5px; margin-bottom: 15px; margin-left: -160px; position: relative; padding: 0; list-style: none; } .folded #adminmenu { margin-left: -45px; } .folded #adminmenu, .folded #adminmenu li.menu-top { width: 28px; } #footer { clear: both; position: relative; width: 100%; } /* inner 2 column liquid layout */ .inner-sidebar { float: right; clear: right; display: none; width: 281px; position: relative; } .inner-sidebar #side-sortables { width: 280px; min-height: 300px; } .has-right-sidebar .inner-sidebar { display: block; } .has-right-sidebar #post-body { float: left; clear: left; width: 100%; margin-right: -340px; } .has-right-sidebar #post-body-content { margin-right: 300px; } /* 2 columns main area */ #col-container { overflow: hidden; padding: 0; margin: 0; } #col-left { padding: 0; margin: 0; overflow: hidden; width: 39%; } #col-right { float: right; clear: right; overflow: hidden; padding: 0; margin: 0; width: 59%; } /* utility classes */ .alignleft { float: left; } .alignright { float: right; } .textleft { text-align: left; } .textright { text-align: right; } .clear { clear: both; } /* Hide visually but not from screen readers */ .screen-reader-text, .screen-reader-text span { position: absolute; left: -1000em; height: 1px; width: 1px; overflow: hidden; } .hidden, .js .closed .inside, .js .hide-if-js, .no-js .hide-if-no-js { display: none; } /* include margin and padding in the width calculation of input and textarea */ input[type="text"], input[type="password"], textarea { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; /* ie8 only */ box-sizing: border-box; } input[type="checkbox"], input[type="radio"] { vertical-align: middle; } /* styles for use by people extending the WordPress interface */ html, body { height: 100%; } body, td, textarea, input, select { font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-size: 13px; } body, textarea { line-height: 1.4em; } input, select { line-height: 1em; } p { margin: 1em 0; } blockquote { margin: 1em; } label { cursor: pointer; } li, dd { margin-bottom: 6px; } p, li, dl, dd, dt { line-height: 140%; } textarea, input, select { margin: 1px; padding: 3px; } h1 { display: block; font-size: 2em; font-weight: bold; margin: .67em 0; } h2 { display: block; font-size: 1.5em; font-weight: bold; margin: .83em 0; } h3 { display: block; font-size: 1.17em; font-weight: bold; margin: 1em 0; } h4 { display: block; font-size: 1em; font-weight: bold; margin: 1.33em 0; } h5 { display: block; font-size: 0.83em; font-weight: bold; margin: 1.67em 0; } h6 { display: block; font-size: 0.67em; font-weight: bold; margin: 2.33em 0; } ul.ul-disc { list-style: disc outside; } ul.ul-square { list-style: square outside; } ol.ol-decimal { list-style: decimal outside; } ul.ul-disc, ul.ul-square, ol.ol-decimal { margin-left: 1.8em; } ul.ul-disc > li, ul.ul-square > li, ol.ol-decimal > li { margin: 0 0 0.5em; } .subsubsub { list-style: none; margin: 8px 0 5px; padding: 0; white-space: nowrap; font-size: 11px; float: left; } .subsubsub a { line-height: 2; padding: .2em; text-decoration: none; } .subsubsub a .count, .subsubsub a.current .count { color: #999; font-weight: normal; } .subsubsub a.current { font-weight: bold; background: none; border: none; } .subsubsub li { display: inline; margin: 0; padding: 0; } .widefat { border-width: 1px; border-style: solid; border-collapse: separate; border-spacing: 0; width: 100%; clear: both; margin: 0; -moz-border-radius: 4px; -khtml-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .widefat * { word-wrap: break-word; } .widefat a { text-decoration: none; } .widefat td, .widefat th { border-bottom-width: 1px; border-bottom-style: solid; font-size: 11px; vertical-align: text-top; } .widefat td { padding: 3px 7px; vertical-align: top; } .widefat td p, .widefat td ol, .widefat td ul { font-size: 11px; } .widefat th { padding: 7px 7px 8px; text-align: left; line-height: 1.3em; } .widefat th input { margin: 0 0 0 8px; padding: 0; vertical-align: text-top; } .widefat .check-column { width: 2.2em; padding: 0; } .widefat tbody th.check-column { padding: 7px 0 22px; } .widefat .num, .column-comments, .column-links, .column-posts, .column-parent { text-align: center; } .widefat th#comments { vertical-align: middle; } .wrap { margin: 0 15px 0 5px; } .updated, .error { border-width: 1px; border-style: solid; padding: 0 0.6em; margin: 5px 15px 2px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } .updated p, .error p { margin: 0.5em 0; line-height: 1; padding: 2px; } .wrap .updated, .wrap .error { margin: 5px 0 15px; } .wrap h2 { font: italic normal normal 24px/29px Georgia, "Times New Roman", "Bitstream Charter", Times, serif; margin: 0; padding: 14px 15px 3px 0; line-height: 35px; text-shadow: rgba(255,255,255,1) 0px 1px 0px; } .wrap h2.long-header { padding-right: 0; } thebrutalagenda/wp-admin/css/colors-fresh.css0000644001761300176130000007555311214074650022107 0ustar mustardamustardahtml { background-color: #f9f9f9; } * html input, * html .widget { border-color: #dfdfdf; } textarea, input, select { border-color: #DFDFDF; } kbd, code { background: #eaeaea; } input[readonly] { background-color: #eee; } .find-box-search { border-color: #dfdfdf; background-color: #f1f1f1; } .find-box { background-color: #f1f1f1; } .find-box-inside { background-color: #fff; } a.page-numbers:hover { border-color: #999; } body, #wpbody, .form-table .pre { color: #333; } body > #upload-menu { border-bottom-color: #fff; } #postcustomstuff table, #your-profile fieldset, #rightnow, div.dashboard-widget, #dashboard-widgets p.dashboard-widget-links, #replyrow #ed_reply_toolbar input { border-color: #ccc; } #poststuff .inside label.spam { color: red; } #poststuff .inside label.waiting { color: orange; } #poststuff .inside label.approved { color: green; } #postcustomstuff table { border-color: #dfdfdf; background-color: #F9F9F9; } #postcustomstuff thead th { background-color: #F1F1F1; } #postcustomstuff table input, #postcustomstuff table textarea { border-color: #dfdfdf; background-color: #fff; } .widefat { border-color: #dfdfdf; background-color: #fff; } div.dashboard-widget-error { background-color: #c43; } div.dashboard-widget-notice { background-color: #cfe1ef; } div.dashboard-widget-submit { border-top-color: #ccc; } div.tabs-panel, ul#category-tabs li.tabs { border-color: #dfdfdf; } ul#category-tabs li.tabs { background-color: #f1f1f1; } input.disabled, textarea.disabled { background-color: #ccc; } /* #upload-menu li a.upload-tab-link, */ .login #backtoblog a:hover, #plugin-information .action-button a, #plugin-information .action-button a:hover, #plugin-information .action-button a:visited { color: #fff; } .widget .widget-top, .postbox h3, .stuffbox h3 { background: #dfdfdf url("../images/gray-grad.png") repeat-x left top; text-shadow: #fff 0 1px 0; } .form-table th, .form-wrap label { color: #222; text-shadow: #fff 0 1px 0; } .description, .form-wrap p { color: #666; } strong .post-com-count span { background-color: #21759b; } .sorthelper { background-color: #ccf3fa; } .ac_match, .subsubsub a.current { color: #000; } .wrap h2 { color: #464646; } .ac_over { background-color: #f0f0b8; } .ac_results { background-color: #fff; border-color: #808080; } .ac_results li { color: #101010; } .alternate, .alt { background-color: #f9f9f9; } .available-theme a.screenshot { background-color: #f1f1f1; border-color: #ddd; } .bar { background-color: #e8e8e8; border-right-color: #99d; } #media-upload { background: #fff; } #media-upload .slidetoggle { border-top-color: #dfdfdf; } .error, #login #login_error { background-color: #ffebe8; border-color: #c00; } .error a { color: #c00; } .form-invalid { background-color: #ffebe8 !important; } .form-invalid input { border-color: #c00 !important; } .submit { border-color: #DFDFDF; } .highlight { background-color: #e4f2fd; color: #d54e21; } .howto, .nonessential, #edit-slug-box, .form-input-tip, .rss-widget span.rss-date, .subsubsub { color: #666; } .media-item { border-bottom-color: #dfdfdf; } #wpbody-content #media-items .describe { border-top-color: #dfdfdf; } .describe input[type="text"], .describe textarea { border-color: #dfdfdf; } .media-upload-form label.form-help, td.help { color: #9a9a9a; } .post-com-count { background-image: url(../images/bubble_bg.gif); color: #fff; } .post-com-count span { background-color: #bbb; color: #fff; } .post-com-count:hover span { background-color: #d54e21; } .quicktags, .search { background-color: #ccc; color: #000; } .side-info h5, .bordertitle { border-bottom-color: #dadada; } .side-info ul { color: #666; } .button, .button-secondary, .submit input, input[type=button], input[type=submit] { border-color: #bbb; color: #464646; } .button:hover, .button-secondary:hover, .submit input:hover, input[type=button]:hover, input[type=submit]:hover { color: #000; border-color: #666; } .button, .submit input, .button-secondary { background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top; } .button:active, .submit input:active, .button-secondary:active { background: #eee url(../images/white-grad-active.png) repeat-x scroll left top; } .button-primary, .submit .button-primary, #login form .submit input { border-color: #298cba !important; font-weight: bold; color: #FFF !important; background: #21759B url(../images/button-grad.png) repeat-x scroll left top; } .button-primary:active, #login form .submit input:active { background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important; } .button[disabled], .button:disabled, .button-secondary[disabled], .button-secondary:disabled, a.button.disabled { color: #ccc !important; border-color: #ccc; } .button-primary[disabled], .button-primary:disabled { color: #2fa0d5 !important; } a:active, a:focus { color: #d54e21; } a:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #adminmenu ul.wp-submenu a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, #login form .submit input:hover, #media-upload a.del-link:hover, div.dashboard-widget-submit input:hover, .subsubsub a:hover, .subsubsub a.current:hover, .ui-tabs-nav a:hover, .plugins .inactive a:hover, #all-plugins-table .plugins .inactive a:hover, #search-plugins-table .plugins .inactive a:hover { color: #d54e21; } #the-comment-list .comment-item, #dashboard-widgets #dashboard_quick_press form p.submit { border-color: #dfdfdf; } .button-primary:hover, #login form .submit input:hover { border-color: #13455b !important; color: #EAF2FA !important; } #side-sortables #category-tabs .tabs a { color: #333; } #rightnow .rbutton { background-color: #ebebeb; color: #264761; } .submitbox .submit { background-color: #464646; color: #ccc; } .plugins a.delete:hover, #all-plugins-table .plugins a.delete:hover, #search-plugins-table .plugins a.delete:hover, .submitbox .submitdelete, a.delete { color: #f00; border-bottom-color: #f00; } .submitbox .submitdelete:hover, #media-items a.delete:hover { color: #fff; background-color: #f00; border-bottom-color: #f00; } #normal-sortables .submitbox .submitdelete:hover { color: #000; background-color: #f00; border-bottom-color: #f00; } .tablenav .dots { border-color: transparent; } .tablenav .next, .tablenav .prev { border-color: transparent; color: #21759b; } .tablenav .next:hover, .tablenav .prev:hover { border-color: transparent; color: #d54e21; } .updated, .login #login_error, .login .message { background-color: #ffffe0; border-color: #e6db55; } .update-message { color: #000000; } a.page-numbers { border-bottom-color: #B8D3E2; } .commentlist li { border-bottom-color: #ccc; } .widefat td, .widefat th, #install-plugins .plugins td, #install-plugins .plugins th { border-color: #dfdfdf; } .widefat th { text-shadow: rgba(255,255,255,0.8) 0 1px 0; } .widefat thead tr th, .widefat tfoot tr th, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, .find-box-head { color: #333; background: #dfdfdf url(../images/gray-grad.png) repeat-x scroll left top; } h3.dashboard-widget-title small a { color: #d7d7d7; } h3.dashboard-widget-title small a:hover { color: #fff; } a, #adminmenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-items a.delete, .plugins a.delete, .ui-tabs-nav a { color: #21759b; } /* Because we don't want visited on these links */ body.press-this .tabs a, body.press-this .tabs a:hover { background-color: #fff; border-color: #c6d9e9; border-bottom-color: #fff; color: #d54e21; } #adminmenu #awaiting-mod, #adminmenu .update-plugins, #sidemenu a .update-plugins, #rightnow .reallynow, #plugin-information .action-button { background-color: #d54e21; color: #fff; } #adminmenu li a:hover #awaiting-mod, #adminmenu li a:hover .update-plugins, #sidemenu li a:hover .update-plugins { background-color: #264761; color: #fff; } #adminmenu li.current a #awaiting-mod, #adminmenu li.current a .update-plugins, #adminmenu li.wp-has-current-submenu a .update-plugins, #adminmenu li.wp-has-current-submenu a .update-plugins { background-color: #ddd; color: #000; text-shadow: none; -moz-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; -khtml-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; -webkit-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; box-shadow: rgba(0,0,0,0.2) 0 -1px 0; } #adminmenu li.current a:hover #awaiting-mod, #adminmenu li.current a:hover .update-plugins, #adminmenu li.wp-has-current-submenu a:hover #awaiting-mod, #adminmenu li.wp-has-current-submenu a:hover .update-plugins { background-color: #264761; color: #fff; } div#media-upload-header, div#plugin-information-header { background-color: #f9f9f9; border-bottom-color: #dfdfdf; } #currenttheme img { border-color: #666; } #dashboard_secondary div.dashboard-widget-content ul li a { background-color: #f9f9f9; } input.readonly, textarea.readonly { background-color: #ddd; } #ed_toolbar input, #ed_reply_toolbar input { background: #fff url("../images/fade-butt.png") repeat-x 0 -2px; } #editable-post-name { background-color: #fffbcc; } #edit-slug-box strong, .tablenav .displaying-num, #submitted-on { color: #777; } .login #nav a { color: #21759b !important; } .login #nav a:hover { color: #d54e21 !important; } #footer, #footer-upgrade { background: #464646; color: #999; } #media-items { border-color: #dfdfdf; } .checkbox, .side-info, .plugins tr, #your-profile #rich_editing { background-color: #fff; } .plugins .inactive, .plugins .inactive th, .plugins .inactive td, tr.inactive + tr.plugin-update-tr .plugin-update { background-color: #eee; } .plugin-update-tr .update-message { background-color: #fffbe4; border-color: #dfdfdf; } .plugins .active, .plugins .active th, .plugins .active td { color: #000; } .plugins .inactive a { color: #557799; } #the-comment-list .unapproved, #the-comment-list .unapproved th, #the-comment-list .unapproved td { background-color: #ffffe0; } #the-comment-list .approve a { color: #006505; } #the-comment-list .unapprove a { color: #d98500; } #the-comment-list .delete a { color: #bc0b0b; } .widget, #widget-list .widget-top, .postbox, #titlediv, #poststuff .postarea, .stuffbox { border-color: #dfdfdf; } .widget, .postbox { background-color: #fff; } .ui-sortable .postbox h3 { color: #464646; } .widget .widget-top, .ui-sortable .postbox h3:hover { color: #000; } .curtime #timestamp { background-image: url(../images/date-button.gif); } #quicktags #ed_link { color: #00f; } #rightnow .youhave { background-color: #f0f6fb; } #rightnow a { color: #448abd; } .tagchecklist span a, #bulk-titles div a { background: url(../images/xit.gif) no-repeat; } .tagchecklist span a:hover, #bulk-titles div a:hover { background: url(../images/xit.gif) no-repeat -10px 0; } #update-nag { background-color: #fffeeb; border-color: #ccc; color: #555; } .login #backtoblog a { color: #ccc; } #wphead { background-color: #464646; } body.login { border-top-color: #464646; } #wphead h1 a { color: #fff; } #login form input { color: #555; } #user_info { color: #999; } #user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited { color: #ccc; text-decoration: none; } #user_info a:hover, #footer a:hover { color: #fff; text-decoration: underline !important; } #user_info a:active, #footer a:active { color: #ccc !important; } div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete a:hover { color: #f00; } #pass-strength-result { background-color: #eee; border-color: #ddd !important; } #pass-strength-result.bad { background-color: #ffb78c; border-color: #ff853c !important; } #pass-strength-result.good { background-color: #ffec8b; border-color: #fc0 !important; } #pass-strength-result.short { background-color: #ffa0a0; border-color: #f04040 !important; } #pass-strength-result.strong { background-color: #c3ff88; border-color: #8dff1c !important; } /* editors */ #quicktags { border-color: #dfdfdf; background-color: #dfdfdf; } #ed_toolbar input { border-color: #C3C3C3; } #ed_toolbar input:hover { border-color: #aaa; background: #ddd; } #poststuff .wp_themeSkin .mceStatusbar { border-color: #EDEDED; } #poststuff #edButtonPreview, #poststuff #edButtonHTML { background-color: #f1f1f1; border-color: #dfdfdf; color: #999; } #poststuff #editor-toolbar .active { border-bottom-color: #e9e9e9; background-color: #e9e9e9; color: #333; } /* TinyMCE */ #post-status-info { background-color: #EDEDED; } .wp_themeSkin *, .wp_themeSkin a:hover, .wp_themeSkin a:link, .wp_themeSkin a:visited, .wp_themeSkin a:active { color: #000; } /* Containers */ .wp_themeSkin iframe { background: #fff; } /* Layout */ .wp_themeSkin .mceStatusbar { color: #000; background-color: #f5f5f5; } /* Button */ .wp_themeSkin .mceButton { background-color: #e9e8e8; border-color: #B2B2B2; } .wp_themeSkin a.mceButtonEnabled:hover, .wp_themeSkin a.mceButtonActive, .wp_themeSkin a.mceButtonSelected { background-color: #d5d5d5; border-color: #777 !important; } .wp_themeSkin .mceButtonDisabled { border-color: #ccc !important; } /* ListBox */ .wp_themeSkin .mceListBox .mceText, .wp_themeSkin .mceListBox .mceOpen { border-color: #B2B2B2; background-color: #d5d5d5; } .wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, .wp_themeSkin .mceListBoxHover .mceOpen, .wp_themeSkin .mceListBoxSelected .mceOpen, .wp_themeSkin .mceListBoxSelected .mceText { border-color: #777 !important; background-color: #d5d5d5; } .wp_themeSkin table.mceListBoxEnabled:hover .mceText, .wp_themeSkin .mceListBoxHover .mceText { border-color: #777 !important; } .wp_themeSkin select.mceListBox { border-color: #B2B2B2; background-color: #fff; } /* SplitButton */ .wp_themeSkin .mceSplitButton a.mceAction, .wp_themeSkin .mceSplitButton a.mceOpen { border-color: #B2B2B2; } .wp_themeSkin .mceSplitButton a.mceOpen:hover, .wp_themeSkin .mceSplitButtonSelected a.mceOpen, .wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction, .wp_themeSkin .mceSplitButton a.mceAction:hover { background-color: #d5d5d5; border-color: #777 !important; } .wp_themeSkin .mceSplitButtonActive { background-color: #B2B2B2; } /* ColorSplitButton */ .wp_themeSkin div.mceColorSplitMenu table { background-color: #ebebeb; border-color: #B2B2B2; } .wp_themeSkin .mceColorSplitMenu a { border-color: #B2B2B2; } .wp_themeSkin .mceColorSplitMenu a.mceMoreColors { border-color: #fff; } .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover { border-color: #0A246A; background-color: #B6BDD2; } .wp_themeSkin a.mceMoreColors:hover { border-color: #0A246A; } /* Menu */ .wp_themeSkin .mceMenu { border-color: #ddd; } .wp_themeSkin .mceMenu table { background-color: #ebeaeb; } .wp_themeSkin .mceMenu .mceText { color: #000; } .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover, .wp_themeSkin .mceMenu .mceMenuItemActive { background-color: #f5f5f5; } .wp_themeSkin td.mceMenuItemSeparator { background-color: #aaa; } .wp_themeSkin .mceMenuItemTitle a { background-color: #ccc; border-bottom-color: #aaa; } .wp_themeSkin .mceMenuItemTitle span.mceText { color: #000; } .wp_themeSkin .mceMenuItemDisabled .mceText { color: #888; } .wp_themeSkin tr.mceFirst td.mceToolbar { background: #dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top; border-color: #dfdfdf; } .wp-admin #mceModalBlocker { background: #000; } .wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft { background: #444444; border-left: 1px solid #999; border-top: 1px solid #999; -moz-border-radius: 4px 0 0 0; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } .wp-admin .clearlooks2 .mceFocus .mceTop .mceRight { background: #444444; border-right: 1px solid #999; border-top: 1px solid #999; border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius: 0 4px 0 0; } .wp-admin .clearlooks2 .mceMiddle .mceLeft { background: #f1f1f1; border-left: 1px solid #999; } .wp-admin .clearlooks2 .mceMiddle .mceRight { background: #f1f1f1; border-right: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom { background: #f1f1f1; border-bottom: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceLeft { background: #f1f1f1; border-bottom: 1px solid #999; border-left: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceCenter { background: #f1f1f1; border-bottom: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceRight { background: #f1f1f1; border-bottom: 1px solid #999; border-right: 1px solid #999; } .wp-admin .clearlooks2 .mceFocus .mceTop span { color: #e5e5e5; } /* end TinyMCE */ #editorcontainer, #post-status-info, #titlediv #title, .editwidget .widget-inside { border-color: #dfdfdf; } #titlediv #title { background-color: #fff; } #tTips p#tTips_inside { background-color: #ddd; color: #333; } #timestampdiv input, #namediv input, #poststuff .inside .the-tagcloud { border-color: #ddd; } /* menu */ #adminmenu * { border-color: #e3e3e3; } #adminmenu li.wp-menu-separator { background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px; } .folded #adminmenu li.wp-menu-separator { background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px; } #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { background: transparent url(../images/menu-bits.gif) no-repeat scroll left -207px; } #adminmenu .wp-has-submenu:hover .wp-menu-toggle, #adminmenu .wp-menu-open .wp-menu-toggle { background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px; } #adminmenu a.menu-top { background: #f1f1f1 url(../images/menu-bits.gif) repeat-x scroll left -379px; } #adminmenu .wp-submenu a { background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px; } #adminmenu .wp-has-current-submenu ul li a { background: none; } #adminmenu .wp-has-current-submenu ul li a.current { background: url(../images/menu-dark.gif) top left no-repeat !important; } #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, #adminmenu .menu-top .current { background: #6d6d6d url(../images/menu-bits.gif) top left repeat-x; border-color: #6d6d6d; color: #fff; text-shadow: rgba(0,0,0,0.4) 0px -1px 0px; } #adminmenu li.wp-has-current-submenu .wp-submenu, #adminmenu li.wp-has-current-submenu ul li a { border-color: #aaa !important; } #adminmenu li.wp-has-current-submenu ul li a { background: url(../images/menu-dark.gif) bottom left no-repeat !important; } #adminmenu li.wp-has-current-submenu ul { border-bottom-color: #aaa; } #adminmenu li.menu-top .current:hover { border-color: #B5B5B5; } #adminmenu .wp-submenu .current a.current { background: transparent url(../images/menu-bits.gif) no-repeat scroll 0 -289px; } #adminmenu .wp-submenu a:hover { background-color: #EAF2FA !important; color: #333 !important; } #adminmenu .wp-submenu li.current, #adminmenu .wp-submenu li.current a, #adminmenu .wp-submenu li.current a:hover { color: #333; background-color: #f5f5f5; background-image: none; border-color: #e3e3e3; text-shadow: rgba(255,255,255,1) 0px 1px 0px; } #adminmenu .wp-submenu ul { background-color: #fff; } .folded #adminmenu li.menu-top, #adminmenu .wp-submenu .wp-submenu-head { background-color: #F1F1F1; } .folded #adminmenu li.wp-has-current-submenu, .folded #adminmenu li.menu-top.current { background-color: #e6e6e6; } #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { background-color: #EAEAEA; border-color: #aaa; } #adminmenu div.wp-submenu { background-color: transparent; } /* menu icons */ #adminmenu #menu-dashboard div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -61px -33px; } #adminmenu #menu-dashboard:hover div.wp-menu-image, #adminmenu #menu-dashboard.wp-has-current-submenu div.wp-menu-image, #adminmenu #menu-dashboard.current div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -61px -1px; } #adminmenu #menu-posts div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -272px -33px; } #adminmenu #menu-posts:hover div.wp-menu-image, #adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -272px -1px; } #adminmenu #menu-media div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -121px -33px; } #adminmenu #menu-media:hover div.wp-menu-image, #adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -121px -1px; } #adminmenu #menu-links div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -91px -33px; } #adminmenu #menu-links:hover div.wp-menu-image, #adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -91px -1px; } #adminmenu #menu-pages div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -151px -33px; } #adminmenu #menu-pages:hover div.wp-menu-image, #adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -151px -1px; } #adminmenu #menu-comments div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -31px -33px; } #adminmenu #menu-comments:hover div.wp-menu-image, #adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image, #adminmenu #menu-comments.current div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -31px -1px; } #adminmenu #menu-appearance div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -1px -33px; } #adminmenu #menu-appearance:hover div.wp-menu-image, #adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -1px -1px; } #adminmenu #menu-plugins div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -181px -33px; } #adminmenu #menu-plugins:hover div.wp-menu-image, #adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -181px -1px; } #adminmenu #menu-users div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -301px -33px; } #adminmenu #menu-users:hover div.wp-menu-image, #adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -301px -1px; } #adminmenu #menu-tools div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -211px -33px; } #adminmenu #menu-tools:hover div.wp-menu-image, #adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -211px -1px; } #adminmenu #menu-settings div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -241px -33px; } #adminmenu #menu-settings:hover div.wp-menu-image, #adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu.png") no-repeat scroll -241px -1px; } /* end menu */ /* Diff */ table.diff .diff-deletedline { background-color: #ffdddd; } table.diff .diff-deletedline del { background-color: #ff9999; } table.diff .diff-addedline { background-color: #ddffdd; } table.diff .diff-addedline ins { background-color: #99ff99; } #att-info { background-color: #E4F2FD; } /* edit image */ #sidemenu a { background-color: #f9f9f9; border-color: #f9f9f9; border-bottom-color: #dfdfdf; } #sidemenu a.current { background-color: #fff; border-color: #dfdfdf #dfdfdf #fff; color: #D54E21; } #screen-options-wrap, #contextual-help-wrap { background-color: #f1f1f1; border-color: #dfdfdf; } #screen-meta-links a.show-settings { color: #606060; } #screen-meta-links a.show-settings:hover { color: #000; } #replysubmit { background-color: #f1f1f1; border-top-color: #ddd; } #replyerror { border-color: #ddd; background-color: #f9f9f9; } #edithead, #replyhead { background-color: #f1f1f1; } #ed_reply_toolbar { background-color: #e9e9e9; } /* table vim shortcuts */ .vim-current, .vim-current th, .vim-current td { background-color: #E4F2FD !important; } /* Install Plugins */ .star-average, .star.star-rating { background-color: #fc0; } div.star.select:hover { background-color: #d00; } #plugin-information .fyi ul { background-color: #eaf3fa; } #plugin-information .fyi h2.mainheader { background-color: #cee1ef; } #plugin-information pre, #plugin-information code { background-color: #ededff; } #plugin-information pre { border: 1px solid #ccc; } /* inline editor */ .inline-edit-row fieldset input[type="text"], .inline-edit-row fieldset textarea, #bulk-titles, #replyrow input { border-color: #ddd; } .inline-editor div.title { background-color: #EAF3FA; } .inline-editor ul.cat-checklist { background-color: #FFFFFF; border-color: #ddd; } .inline-editor .categories .catshow, .inline-editor .categories .cathide { color: #21759b; } .inline-editor .quick-edit-save { background-color: #f1f1f1; } #replyrow #ed_reply_toolbar input:hover { border-color: #aaa; background: #ddd; } fieldset.inline-edit-col-right .inline-edit-col { border-color: #dfdfdf; } .attention { color: #D54E21; } .meta-box-sortables .postbox:hover .handlediv { background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px; } #major-publishing-actions { background: #eaf2fa; } .tablenav .tablenav-pages { color: #555; } .tablenav .tablenav-pages a { border-color: #e3e3e3; background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px; } .tablenav .tablenav-pages a:hover { color: #d54e21; border-color: #d54321; } .tablenav .tablenav-pages a:active { color: #fff !important; } .tablenav .tablenav-pages .current { background: #dfdfdf; border-color: #d3d3d3; } #availablethemes, #availablethemes td { border-color: #ddd; } #current-theme img { border-color: #999; } #TB_window #TB_title a.tb-theme-preview-link, #TB_window #TB_title a.tb-theme-preview-link:visited { color: #999; } #TB_window #TB_title a.tb-theme-preview-link:hover, #TB_window #TB_title a.tb-theme-preview-link:focus { color: #ccc; } .misc-pub-section { border-bottom-color: #eee; } #minor-publishing { border-bottom-color: #ddd; } #post-body .misc-pub-section { border-right-color: #eee; } .post-com-count span { background-color: #bbb; } .form-table .color-palette td { border-color: #fff; } .sortable-placeholder { border-color: #bbb; background-color: #f5f5f5; } #post-body ul#category-tabs li.tabs a { color: #333; } #wp_editimgbtn, #wp_delimgbtn, #wp_editgallery, #wp_delgallery { border-color: #999; background-color: #eee; } #wp_editimgbtn:hover, #wp_delimgbtn:hover, #wp_editgallery:hover, #wp_delgallery:hover { border-color: #555; background-color: #ccc; } #favorite-first { background: #797979 url(../images/fav.png) repeat-x left center; border-color: #777 !important; border-bottom-color: #666 !important; } #favorite-inside { border-color: #797979; background-color: #797979; } #favorite-toggle { background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px; } #favorite-actions a { color: #ddd; } #favorite-actions a:hover { color: #fff; } #favorite-inside a:hover { text-decoration: underline; } #favorite-actions .slide-down { border-bottom-color: #626262; } .submit input, .button, .button-primary, .button-secondary, .button-highlighted, #postcustomstuff .submit input { text-shadow: rgba(255,255,255,1) 0 1px 0; } .button-primary, .submit .button-primary { text-shadow: rgba(0,0,0,0.3) 0 -1px 0; } #screen-meta a.show-settings { background-color: transparent; text-shadow: rgba(255,255,255,0.7) 0 1px 0; } #icon-edit, #icon-post { background: transparent url(../images/icons32.png) no-repeat -552px -5px; } #icon-index { background: transparent url(../images/icons32.png) no-repeat -137px -5px; } #icon-upload { background: transparent url(../images/icons32.png) no-repeat -251px -5px; } #icon-link-manager, #icon-link, #icon-link-category { background: transparent url(../images/icons32.png) no-repeat -190px -5px; } #icon-edit-pages, #icon-page { background: transparent url(../images/icons32.png) no-repeat -312px -5px; } #icon-edit-comments { background: transparent url(../images/icons32.png) no-repeat -72px -5px; } #icon-themes { background: transparent url(../images/icons32.png) no-repeat -11px -5px; } #icon-plugins { background: transparent url(../images/icons32.png) no-repeat -370px -5px; } #icon-users, #icon-profile, #icon-user-edit { background: transparent url(../images/icons32.png) no-repeat -600px -5px; } #icon-tools, #icon-admin { background: transparent url(../images/icons32.png) no-repeat -432px -5px; } #icon-options-general { background: transparent url(../images/icons32.png) no-repeat -492px -5px; } .view-switch #view-switch-list { background: transparent url(../images/list.png) no-repeat 0 0; } .view-switch #view-switch-list.current { background: transparent url(../images/list.png) no-repeat -40px 0; } .view-switch #view-switch-excerpt { background: transparent url(../images/list.png) no-repeat -20px 0; } .view-switch #view-switch-excerpt.current { background: transparent url(../images/list.png) no-repeat -60px 0; } #header-logo { background: transparent url(../images/wp-logo.gif) no-repeat scroll center center; } #wphead #site-visit-button { background-color:#585858; background-image: url(../images/visit-site-button-grad.gif); color:#aaa; text-shadow: #3F3F3F 0 -1px 0; } #wphead a:hover #site-visit-button { color:#fff; } #wphead a:focus #site-visit-button, #wphead a:active #site-visit-button { background-position:0 -27px; } .popular-tags, .feature-filter { background-color: #FFFFFF; border-color: #DFDFDF; } #theme-information .action-button { border-top-color: #DFDFDF; } .theme-listing br.line { border-bottom-color: #ccc; } div.widgets-sortables, #widgets-left .inactive { background-color: #f1f1f1; border-color: #ddd; } #available-widgets .widget-holder { background-color: #fff; border-color: #ddd; } #widgets-left .sidebar-name { background-color: #aaa; background-image: url(../images/ed-bg.gif); text-shadow: #FFFFFF 0 1px 0; border-color: #dfdfdf; } #widgets-right .sidebar-name { background-image: url(../images/fav.png); text-shadow: #3f3f3f 0 -1px 0; background-color: #636363; border-color: #636363; color: #fff; } .sidebar-name:hover, #removing-widget { color: #d54e21; } #removing-widget span { color: black; } #widgets-left .sidebar-name-arrow { background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px; } #widgets-right .sidebar-name-arrow { background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px; } .in-widget-title { color: #606060; } .deleting .widget-title * { color: #aaa; } thebrutalagenda/wp-admin/css/theme-editor-rtl.css0000644001761300176130000000024011144426313022642 0ustar mustardamustarda#templateside { float: left; } #themeselector { padding-right: 0; padding-left: 5px; float: left; } div.tablenav { margin-right: 0; margin-left: 210px; } thebrutalagenda/wp-admin/css/colors-classic.css0000644001761300176130000007640611214074650022417 0ustar mustardamustardahtml { background-color: #f7f6f1; } * html input, * html .widget { border-color: #8cbdd5; } textarea, input, select { border-color: #dfdfdf; } kbd, code { background: #eaeaea; } input[readonly] { background-color: #eee; } .find-box-search { border-color: #dfdfdf; background-color: #f1f1f1; } .find-box { background-color: #f1f1f1; } .find-box-inside { background-color: #fff; } a.page-numbers:hover { border-color: #999; } body, #wpbody, .form-table .pre { color: #333; } body > #upload-menu { border-bottom-color: #fff; } #postcustomstuff table, #your-profile fieldset, #rightnow, div.dashboard-widget, #dashboard-widgets p.dashboard-widget-links, #replyrow #ed_reply_toolbar input { border-color: #ccc; } #poststuff .inside label.spam { color: red; } #poststuff .inside label.waiting { color: orange; } #poststuff .inside label.approved { color: green; } #postcustomstuff table { border-color: #dfdfdf; background-color: #f9f9f9; } #postcustomstuff thead th { background-color: #f1f1f1; } #postcustomstuff table input, #postcustomstuff table textarea { border-color: #dfdfdf; background-color: #fff; } .widefat { border-color: #dfdfdf; background-color: #fff; } div.dashboard-widget-error { background-color: #c43; } div.dashboard-widget-notice { background-color: #cfe1ef; } div.dashboard-widget-submit { border-top-color: #ccc; } div.tabs-panel, ul#category-tabs li.tabs { border-color: #dfdfdf; } ul#category-tabs li.tabs { background-color: #f1f1f1; } input.disabled, textarea.disabled { background-color: #ccc; } /* #upload-menu li a.upload-tab-link, */ .login #backtoblog a:hover, #plugin-information .action-button a, #plugin-information .action-button a:hover, #plugin-information .action-button a:visited { color: #fff; } .widget .widget-top, .postbox h3, .stuffbox h3 { background: #d5e6f2 url("../images/blue-grad.png") repeat-x left top; text-shadow: #fff 0 1px 0; } .form-table th, .form-wrap label { color: #222; text-shadow: #fff 0 1px 0; } .description, .form-wrap p { color: #666; } strong .post-com-count span { background-color: #21759b; } .sorthelper { background-color: #ccf3fa; } .ac_match, .subsubsub a.current { color: #000; } .wrap h2 { color: #093e56; } .ac_over { background-color: #f0f0b8; } .ac_results { background-color: #fff; border-color: #808080; } .ac_results li { color: #101010; } .alt .alternate { background-color: #edfbfc; } .available-theme a.screenshot { background-color: #f1f1f1; border-color: #ddd; } .bar { background-color: #e8e8e8; border-right-color: #99d; } #media-upload { background: #fff; } #media-upload .slidetoggle { border-top-color: #dfdfdf; } .error, #login #login_error { background-color: #ffebe8; border-color: #c00; } .error a { color: #c00; } .form-invalid { background-color: #ffebe8 !important; } .form-invalid input { border-color: #c00 !important; } .submit { border-color: #8cbdd5; } .highlight { background-color: #e4f2fd; color: #d54e21; } .howto, .nonessential, #edit-slug-box, .form-input-tip, .rss-widget span.rss-date, .subsubsub { color: #666; } .media-item { border-bottom-color: #dfdfdf; } #wpbody-content #media-items .describe { border-top-color: #dfdfdf; } .describe input[type="text"], .describe textarea { border-color: #dfdfdf; } .media-upload-form label.form-help, td.help { color: #9a9a9a; } .post-com-count { background-image: url(../images/bubble_bg.gif); color: #fff; } .post-com-count span { background-color: #bbb; color: #fff; } .post-com-count:hover span { background-color: #d54e21; } .quicktags, .search { background-color: #ccc; color: #000; } .side-info h5, .bordertitle { border-bottom-color: #dadada; } .side-info ul { color: #666; } .button, .button-secondary, .submit input, input[type=button], input[type=submit] { border-color: #dfdfdf; color: #464646; } .button:hover, .button-secondary:hover, .submit input:hover, input[type=button]:hover, input[type=submit]:hover { color: #000; border-color: #adaca7; } .button, .submit input, .button-secondary { background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top; } .button:active, .submit input:active, .button-secondary:active { background: #eee url(../images/white-grad-active.png) repeat-x scroll left top; } .button-primary, .submit .button-primary, #login form .submit input { border-color: #5b86ab !important; font-weight: bold; color: #fff !important; background: #5580a6 url(../images/button-grad-vs.png) repeat-x scroll left top; } .button-primary:active, #login form .submit input:active { background: #21759b url(../images/button-grad-active-vs.png) repeat-x scroll left top !important; } .button[disabled], .button:disabled, .button-secondary[disabled], .button-secondary:disabled, a.button.disabled { color: #ccc !important; border-color: #ccc; } .button-primary[disabled], .button-primary:disabled { color: #80a3d2 !important; } a:active, a:focus { color: #d54e21; } a:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #adminmenu ul.wp-submenu a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, #login form .submit input:hover, #media-upload a.del-link:hover, div.dashboard-widget-submit input:hover, .subsubsub a:hover, .subsubsub a.current:hover, .ui-tabs-nav a:hover, .plugins .inactive a:hover, #all-plugins-table .plugins .inactive a:hover, #search-plugins-table .plugins .inactive a:hover { color: #d54e21; } #the-comment-list .comment-item, #dashboard-widgets #dashboard_quick_press form p.submit { border-color: #dfdfdf; } #dashboard_right_now .table { background:#faf9f7 !important; } .button-primary:hover, #login form .submit input:hover { border-color: #2e5475 !important; color: #eaf2fa !important; } #side-sortables #category-tabs .tabs a { color: #333; } #rightnow .rbutton { background-color: #ebebeb; color: #264761; } .submitbox .submit { background-color: #464646; color: #ccc; } .plugins a.delete:hover, #all-plugins-table .plugins a.delete:hover, #search-plugins-table .plugins a.delete:hover, .submitbox .submitdelete, a.delete { color: #f00; border-bottom-color: #f00; } .submitbox .submitdelete:hover, #media-items a.delete:hover { color: #fff; background-color: #f00; border-bottom-color: #f00; } #normal-sortables .submitbox .submitdelete:hover { color: #000; background-color: #f00; border-bottom-color: #f00; } .tablenav .dots { border-color: transparent; } .tablenav .next, .tablenav .prev { border-color: transparent; color: #21759b; } .tablenav .next:hover, .tablenav .prev:hover { border-color: transparent; color: #d54e21; } .updated, .login #login_error, .login .message { background-color: #ffffe0; border-color: #e6db55; } .update-message { color: #000000; } a.page-numbers { border-bottom-color: #b8d3e2; } .commentlist li { border-bottom-color: #ccc; } .widefat td, .widefat th, #install-plugins .plugins td, #install-plugins .plugins th { border-color: #dfdfdf; } .widefat th { text-shadow: rgba(255,255,255,0.8) 0 1px 0; } .widefat thead tr th, .widefat tfoot tr th, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, .find-box-head { color: #333; background: #d5e6f2 url(../images/blue-grad.png) repeat-x scroll left top; } h3.dashboard-widget-title small a { color: #d7d7d7; } h3.dashboard-widget-title small a:hover { color: #fff; } a, #adminmenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-items a.delete, .plugins a.delete, .ui-tabs-nav a { color: #1c6280; } /* Because we don't want visited on these links */ body.press-this .tabs a, body.press-this .tabs a:hover { background-color: #fff; border-color: #c6d9e9; border-bottom-color: #fff; color: #d54e21; } #adminmenu #awaiting-mod, #adminmenu .update-plugins, #sidemenu a .update-plugins, #rightnow .reallynow, #plugin-information .action-button { background-color: #d54e21; color: #fff; } #adminmenu li a:hover #awaiting-mod, #adminmenu li a:hover .update-plugins, #sidemenu li a:hover .update-plugins { background-color: #264761; color: #fff; } #adminmenu li.current a #awaiting-mod, #adminmenu li.current a .update-plugins, #adminmenu li.wp-has-current-submenu a .update-plugins, #adminmenu li.wp-has-current-submenu a .update-plugins { background-color: #ddd; color: #000; text-shadow: none; -moz-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; -khtml-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; -webkit-box-shadow: rgba(0,0,0,0.2) 0 -1px 0; box-shadow: rgba(0,0,0,0.2) 0 -1px 0; } #adminmenu li.current a:hover #awaiting-mod, #adminmenu li.current a:hover .update-plugins, #adminmenu li.wp-has-current-submenu a:hover #awaiting-mod, #adminmenu li.wp-has-current-submenu a:hover .update-plugins { background-color: #264761; color: #fff; } div#media-upload-header, div#plugin-information-header { background-color: #f9f9f9; border-bottom-color: #dfdfdf; } #currenttheme img { border-color: #666; } #dashboard_secondary div.dashboard-widget-content ul li a { background-color: #f9f9f9; } input.readonly, textarea.readonly { background-color: #ddd; } #ed_toolbar input, #ed_reply_toolbar input { background: #fff url("../images/fade-butt.png") repeat-x 0 -2px; } #editable-post-name { background-color: #fffbcc; } #edit-slug-box strong, .tablenav .displaying-num, #submitted-on { color: #777; } .login #nav a { color: #21759b !important; } .login #nav a:hover { color: #d54e21 !important; } #footer, #footer-upgrade { background: #1d507d; color: #b6d1e4; } #media-items { border-color: #dfdfdf; } .checkbox, .side-info, .plugins tr, .postbox, #your-profile #rich_editing { background-color: #fff; } .plugins .inactive, .plugins .inactive th, .plugins .inactive td, tr.inactive + tr.plugin-update-tr .plugin-update { background-color: #ebeeef; } .plugin-update-tr .update-message { background-color: #fffbe4; border-color: #dfdfdf; } .plugins .active, .plugins .active th, .plugins .active td { color: #000; } .plugins .inactive a { color: #557799; } #the-comment-list .unapproved, #the-comment-list .unapproved th, #the-comment-list .unapproved td { background-color: #ffffe0; } #the-comment-list .approve a { color: #006505; } #the-comment-list .unapprove a { color: #d98500; } #the-comment-list .delete a { color: #bc0b0b; } .widget, #widget-list .widget-top, .postbox, #titlediv, #poststuff .postarea, .stuffbox { border-color: #dfdfdf; } .widget, .postbox { background-color: #fff; } .ui-sortable .postbox h3 { color: #093e56; } .widget .widget-top, .ui-sortable .postbox h3:hover { color: #000; } .curtime #timestamp { background-image: url(../images/date-button.gif); } #quicktags #ed_link { color: #00f; } #rightnow .youhave { background-color: #f0f6fb; } #rightnow a { color: #448abd; } .tagchecklist span a, #bulk-titles div a { background: url(../images/xit.gif) no-repeat; } .tagchecklist span a:hover, #bulk-titles div a:hover { background: url(../images/xit.gif) no-repeat -10px 0; } #update-nag { background-color: #fffeeb; border-color: #ccc; color: #555; } .login #backtoblog a { color: #ccc; } #wphead { background-color: #1d507d; } body.login { border-top-color: #093e56; } #wphead h1 a { color: #fff; } #login form input { color: #555; } #user_info { color: #b6d1e4; } #user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited { color: #fff; text-decoration: none; } #user_info a:hover, #user_info a:active, #footer a:hover, #footer a:active { text-decoration: underline; } div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete a:hover { color: #f00; } /* password strength meter */ #pass-strength-result { background-color: #eee; border-color: #ddd !important; } #pass-strength-result.bad { background-color: #ffb78c; border-color: #ff853c !important; } #pass-strength-result.good { background-color: #ffec8b; border-color: #fc0 !important; } #pass-strength-result.short { background-color: #ffa0a0; border-color: #f04040 !important; } #pass-strength-result.strong { background-color: #c3ff88; border-color: #8dff1c !important; } /* editors */ #quicktags { border-color: #dfdfdf; background-color: #dfdfdf; } #ed_toolbar input { border-color: #c3c3c3; } #ed_toolbar input:hover { border-color: #aaa; background: #ddd; } #poststuff .wp_themeSkin .mceStatusbar { border-color: #ededed; } #poststuff #edButtonPreview, #poststuff #edButtonHTML { background-color: #f2f1eb; border-color: #dfdfdf; color: #999; } #poststuff #editor-toolbar .active { border-bottom-color: #e3eef7; background-color: #e3eef7; color: #333; } /* TinyMCE */ #post-status-info { background-color: #ededed; } .wp_themeSkin *, .wp_themeSkin a:hover, .wp_themeSkin a:link, .wp_themeSkin a:visited, .wp_themeSkin a:active { color: #000; } /* Containers */ .wp_themeSkin iframe { background: #fff; } /* Layout */ .wp_themeSkin .mceStatusbar { color: #000; background-color: #f5f5f5; } /* Button */ .wp_themeSkin .mceButton { background-color: #e9e8e8; border-color: #b2b2b2; } .wp_themeSkin a.mceButtonEnabled:hover, .wp_themeSkin a.mceButtonActive, .wp_themeSkin a.mceButtonSelected { background-color: #d5d5d5; border-color: #777 !important; } .wp_themeSkin .mceButtonDisabled { border-color: #ccc !important; } /* ListBox */ .wp_themeSkin .mceListBox .mceText, .wp_themeSkin .mceListBox .mceOpen { border-color: #b2b2b2; background-color: #d5d5d5; } .wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, .wp_themeSkin .mceListBoxHover .mceOpen, .wp_themeSkin .mceListBoxSelected .mceOpen, .wp_themeSkin .mceListBoxSelected .mceText { border-color: #777 !important; background-color: #d5d5d5; } .wp_themeSkin table.mceListBoxEnabled:hover .mceText, .wp_themeSkin .mceListBoxHover .mceText { border-color: #777 !important; } .wp_themeSkin select.mceListBox { border-color: #b2b2b2; background-color: #fff; } /* SplitButton */ .wp_themeSkin .mceSplitButton a.mceAction, .wp_themeSkin .mceSplitButton a.mceOpen { border-color: #b2b2b2; } .wp_themeSkin .mceSplitButton a.mceOpen:hover, .wp_themeSkin .mceSplitButtonSelected a.mceOpen, .wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction, .wp_themeSkin .mceSplitButton a.mceAction:hover { background-color: #d5d5d5; border-color: #777 !important; } .wp_themeSkin .mceSplitButtonActive { background-color: #b2b2b2; } /* ColorSplitButton */ .wp_themeSkin div.mceColorSplitMenu table { background-color: #ebebeb; border-color: #b2b2b2; } .wp_themeSkin .mceColorSplitMenu a { border-color: #b2b2b2; } .wp_themeSkin .mceColorSplitMenu a.mceMoreColors { border-color: #fff; } .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover { border-color: #0a246a; background-color: #b6bdd2; } .wp_themeSkin a.mceMoreColors:hover { border-color: #0a246a; } /* Menu */ .wp_themeSkin .mceMenu { border-color: #ddd; } .wp_themeSkin .mceMenu table { background-color: #ebeaeb; } .wp_themeSkin .mceMenu .mceText { color: #000; } .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover, .wp_themeSkin .mceMenu .mceMenuItemActive { background-color: #f5f5f5; } .wp_themeSkin td.mceMenuItemSeparator { background-color: #aaa; } .wp_themeSkin .mceMenuItemTitle a { background-color: #ccc; border-bottom-color: #aaa; } .wp_themeSkin .mceMenuItemTitle span.mceText { color: #000; } .wp_themeSkin .mceMenuItemDisabled .mceText { color: #888; } #quicktags, .wp_themeSkin tr.mceFirst td.mceToolbar { background: #e3eef7 url("../images/ed-bg-vs.gif") repeat-x scroll left top; } .wp_themeSkin tr.mceFirst td.mceToolbar { border-color: #dfdfdf; } .wp-admin #mceModalBlocker { background: #000; } .wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft { background: #444; border-left: 1px solid #999; border-top: 1px solid #999; -moz-border-radius: 4px 0 0 0; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } .wp-admin .clearlooks2 .mceFocus .mceTop .mceRight { background: #444; border-right: 1px solid #999; border-top: 1px solid #999; border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius: 0 4px 0 0; } .wp-admin .clearlooks2 .mceMiddle .mceLeft { background: #f1f1f1; border-left: 1px solid #999; } .wp-admin .clearlooks2 .mceMiddle .mceRight { background: #f1f1f1; border-right: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom { background: #f1f1f1; border-bottom: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceLeft { background: #f1f1f1; border-bottom: 1px solid #999; border-left: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceCenter { background: #f1f1f1; border-bottom: 1px solid #999; } .wp-admin .clearlooks2 .mceBottom .mceRight { background: #f1f1f1; border-bottom: 1px solid #999; border-right: 1px solid #999; } .wp-admin .clearlooks2 .mceFocus .mceTop span { color: #e5e5e5; } /* end TinyMCE */ #editorcontainer, #post-status-info, #titlediv #title, .editwidget .widget-inside { border-color: #dfdfdf; } #titlediv #title { background-color: #fff; } #tTips p#tTips_inside { background-color: #ddd; color: #333; } #timestampdiv input, #namediv input, #poststuff .inside .the-tagcloud { border-color: #dfdfdf; } /* menu */ #adminmenu * { border-color: #dfdfdf; } #adminmenu li.wp-menu-separator { background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px; } .folded #adminmenu li.wp-menu-separator { background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px; } #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -207px; } #adminmenu .wp-has-submenu:hover .wp-menu-toggle, #adminmenu .wp-menu-open .wp-menu-toggle { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px; } #adminmenu a.menu-top { background: #eaf3fa url(../images/menu-bits-vs.gif) repeat-x scroll left -379px; } #adminmenu .wp-submenu a { background: #fff url(../images/menu-bits-vs.gif) no-repeat scroll 0 -310px; } #adminmenu .wp-has-current-submenu ul li a { background: none; } #adminmenu .wp-has-current-submenu ul li a.current { background: url(../images/menu-dark.gif) top left no-repeat !important; } #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu, #adminmenu .menu-top .current { background: #3c6b95 url(../images/menu-bits-vs.gif) top left repeat-x; border-color: #1d507d; color: #fff; text-shadow: rgba(0,0,0,0.4) 0 -1px 0; } #adminmenu li.wp-has-current-submenu .wp-submenu, #adminmenu li.wp-has-current-submenu ul li a { border-color: #aaa !important; } #adminmenu li.wp-has-current-submenu ul li a { background: url(../images/menu-dark.gif) bottom left no-repeat !important; } #adminmenu li.wp-has-current-submenu ul { border-bottom-color: #aaa; } #adminmenu li.menu-top .current:hover { border-color: #6583c0; } #adminmenu .wp-submenu .current a.current { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll 0 -289px; } #adminmenu .wp-submenu a:hover { background-color: #eaf2fa !important; color: #333 !important; } #adminmenu .wp-submenu li.current, #adminmenu .wp-submenu li.current a, #adminmenu .wp-submenu li.current a:hover { color: #333; background-color: #f5f5f5; background-image: none; border-color: #e3e3e3; text-shadow: rgba(255,255,255,1) 0 1px 0; } #adminmenu .wp-submenu ul { background-color: #fff; } .folded #adminmenu li.menu-top, #adminmenu .wp-submenu .wp-submenu-head { background-color: #eaf2fa; } .folded #adminmenu li.wp-has-current-submenu, .folded #adminmenu li.menu-top.current { background-color: #bbd8e7; } #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head { background-color: #bbd8e7; border-color: #8cbdd5; } #adminmenu div.wp-submenu { background-color: transparent; } /* menu icons */ #adminmenu #menu-dashboard div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -33px; } #adminmenu #menu-dashboard:hover div.wp-menu-image, #adminmenu #menu-dashboard.wp-has-current-submenu div.wp-menu-image, #adminmenu #menu-dashboard.current div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -1px; } #adminmenu #menu-posts div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -33px; } #adminmenu #menu-posts:hover div.wp-menu-image, #adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -1px; } #adminmenu #menu-media div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -33px; } #adminmenu #menu-media:hover div.wp-menu-image, #adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -1px; } #adminmenu #menu-links div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -33px; } #adminmenu #menu-links:hover div.wp-menu-image, #adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -1px; } #adminmenu #menu-pages div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -33px; } #adminmenu #menu-pages:hover div.wp-menu-image, #adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -1px; } #adminmenu #menu-comments div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -33px; } #adminmenu #menu-comments:hover div.wp-menu-image, #adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image, #adminmenu #menu-comments.current div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -1px; } #adminmenu #menu-appearance div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -33px; } #adminmenu #menu-appearance:hover div.wp-menu-image, #adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -1px; } #adminmenu #menu-plugins div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -33px; } #adminmenu #menu-plugins:hover div.wp-menu-image, #adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -1px; } #adminmenu #menu-users div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -33px; } #adminmenu #menu-users:hover div.wp-menu-image, #adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -1px; } #adminmenu #menu-tools div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -33px; } #adminmenu #menu-tools:hover div.wp-menu-image, #adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -1px; } #adminmenu #menu-settings div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -33px; } #adminmenu #menu-settings:hover div.wp-menu-image, #adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image { background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -1px; } /* end menu */ /* Diff */ table.diff .diff-deletedline { background-color: #fdd; } table.diff .diff-deletedline del { background-color: #f99; } table.diff .diff-addedline { background-color: #dfd; } table.diff .diff-addedline ins { background-color: #9f9; } #att-info { background-color: #e4f2fd; } /* edit image */ #sidemenu a { background-color: #f9f9f9; border-color: #f9f9f9; border-bottom-color: #dfdfdf; } #sidemenu a.current { background-color: #fff; border-color: #dfdfdf #dfdfdf #fff; color: #d54e21; } #screen-options-wrap, #contextual-help-wrap { background-color: #eae9e4; border-color: #dfdfdf; } #screen-meta-links a.show-settings { color: #606060; } #screen-meta-links a.show-settings:hover { color: #000; } #replysubmit { background-color: #f1f1f1; border-top-color: #ddd; } #replyerror { border-color: #ddd; background-color: #f9f9f9; } #edithead, #replyhead { background-color: #f1f1f1; } #ed_reply_toolbar { background-color: #e9e9e9; } /* table vim shortcuts */ .vim-current, .vim-current th, .vim-current td { background-color: #e4f2fd !important; } /* Install Plugins */ .star-average, .star.star-rating { background-color: #fc0; } div.star.select:hover { background-color: #d00; } #plugin-information .fyi ul { background-color: #eaf3fa; } #plugin-information .fyi h2.mainheader { background-color: #cee1ef; } #plugin-information pre, #plugin-information code { background-color: #ededff; } #plugin-information pre { border: 1px solid #ccc; } /* inline editor */ .inline-edit-row fieldset input[type="text"], .inline-edit-row fieldset textarea, #bulk-titles, #replyrow input { border-color: #ddd; } .inline-editor div.title { background-color: #eaf3fa; } .inline-editor ul.cat-checklist { background-color: #fff; border-color: #ddd; } .inline-editor .categories .catshow, .inline-editor .categories .cathide { color: #21759b; } .inline-editor .quick-edit-save { background-color: #f1f1f1; } #replyrow #ed_reply_toolbar input:hover { border-color: #aaa; background: #ddd; } fieldset.inline-edit-col-right .inline-edit-col { border-color: #dfdfdf; } .attention { color: #d54e21; } .meta-box-sortables .postbox:hover .handlediv { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px; } #major-publishing-actions { background: #eaf2fa; } .tablenav .tablenav-pages { color: #555; } .tablenav .tablenav-pages a { border-color: #e3e3e3; background: #eee url('../images/menu-bits-vs.gif') repeat-x scroll left -379px; } .tablenav .tablenav-pages a:hover { color: #d54e21; border-color: #d54321; } .tablenav .tablenav-pages a:active { color: #fff !important; } .tablenav .tablenav-pages .current { background: #dfdfdf; border-color: #d3d3d3; } #availablethemes, #availablethemes td { border-color: #ddd; } #current-theme img { border-color: #999; } #TB_window #TB_title a.tb-theme-preview-link, #TB_window #TB_title a.tb-theme-preview-link:visited { color: #999; } #TB_window #TB_title a.tb-theme-preview-link:hover, #TB_window #TB_title a.tb-theme-preview-link:focus { color: #ccc; } .misc-pub-section { border-bottom-color: #eee; } #minor-publishing { border-bottom-color: #ddd; } #post-body .misc-pub-section { border-right-color: #eee; } .post-com-count span { background-color: #bbb; } .form-table .color-palette td { border-color: #fff; } .sortable-placeholder { border-color: #bbb; background-color: #f5f5f5; } #post-body ul#category-tabs li.tabs a { color: #333; } #wp_editimgbtn, #wp_delimgbtn, #wp_editgallery, #wp_delgallery { border-color: #999; background-color: #eee; } #wp_editimgbtn:hover, #wp_delimgbtn:hover, #wp_editgallery:hover, #wp_delgallery:hover { border-color: #555; background-color: #ccc; } #favorite-first { background: #5580a6 url(../images/fav-vs.png) repeat-x 0 center; border-color: #517ea5 !important; border-bottom-color: #416686 !important; } #favorite-actions .slide-down { background-image: url(../images/fav-top-vs.gif); background-position:0 0; background-repeat: repeat-x; } #favorite-inside { border-color: #5b86ac; background-color: #5580a6; } #favorite-toggle { background: transparent url(../images/fav-arrow-vs.gif) no-repeat 0 -4px; } #favorite-actions a { color: #ddd; } #favorite-actions a:hover { color: #fff; } #favorite-inside a:hover { text-decoration: underline; } #favorite-actions .slide-down { border-bottom-color: #626262; } .submit input, .button, .button-primary, .button-secondary, .button-highlighted, #postcustomstuff .submit input { text-shadow: rgba(255,255,255,1) 0 1px 0; } .button-primary, .submit .button-primary { text-shadow: rgba(0,0,0,0.3) 0 -1px 0; } #screen-meta a.show-settings { background-color: transparent; text-shadow: rgba(255,255,255,0.7) 0 1px 0; } #icon-edit, #icon-post { background: transparent url(../images/icons32-vs.png) no-repeat -552px -5px; } #icon-index { background: transparent url(../images/icons32-vs.png) no-repeat -137px -5px; } #icon-upload { background: transparent url(../images/icons32-vs.png) no-repeat -251px -5px; } #icon-link-manager, #icon-link, #icon-link-category { background: transparent url(../images/icons32-vs.png) no-repeat -190px -5px; } #icon-edit-pages, #icon-page { background: transparent url(../images/icons32-vs.png) no-repeat -312px -5px; } #icon-edit-comments { background: transparent url(../images/icons32-vs.png) no-repeat -72px -5px; } #icon-themes { background: transparent url(../images/icons32-vs.png) no-repeat -11px -5px; } #icon-plugins { background: transparent url(../images/icons32-vs.png) no-repeat -370px -5px; } #icon-users, #icon-profile, #icon-user-edit { background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px; } #icon-tools, #icon-admin { background: transparent url(../images/icons32-vs.png) no-repeat -432px -5px; } #icon-options-general { background: transparent url(../images/icons32-vs.png) no-repeat -492px -5px; } .view-switch #view-switch-list { background: transparent url(../images/list-vs.png) no-repeat 0 0; } .view-switch #view-switch-list.current { background: transparent url(../images/list-vs.png) no-repeat -40px 0; } .view-switch #view-switch-excerpt { background: transparent url(../images/list-vs.png) no-repeat -20px 0; } .view-switch #view-switch-excerpt.current { background: transparent url(../images/list-vs.png) no-repeat -60px 0; } #header-logo { background: transparent url(../images/wp-logo-vs.gif) no-repeat scroll center center; } #wphead #site-visit-button { background-color: #3c6b95; background-image: url(../images/visit-site-button-grad-vs.gif); color: #b6d1e4; text-shadow: #3f3f3f 0 -1px 0; } #wphead a:hover #site-visit-button { color: #fff; } #wphead a:focus #site-visit-button, #wphead a:active #site-visit-button { background-position: 0 -27px; } .popular-tags, .feature-filter { background-color: #fff; border-color: #dfdfdf; } #theme-information .action-button { border-top-color: #dfdfdf; } .theme-listing br.line { border-bottom-color: #ccc; } div.widgets-sortables, #widgets-left .inactive { background-color: #f1f1f1; border-color: #ddd; } #available-widgets .widget-holder { background-color: #fff; border-color: #ddd; } #widgets-left .sidebar-name { background-color: #aaa; background-image: url(../images/ed-bg-vs.gif); text-shadow: #FFFFFF 0 1px 0; border-color: #dfdfdf; } #widgets-right .sidebar-name { background-image: url(../images/fav-vs.png); text-shadow: #3f3f3f 0 -1px 0; background-color: #636363; border-color: #636363; color: #fff; } .sidebar-name:hover, #removing-widget { color: #d54e21; } #removing-widget span { color: black; } #widgets-left .sidebar-name-arrow { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px; } #widgets-right .sidebar-name-arrow { background: transparent url(../images/fav-arrow-vs.gif) no-repeat scroll 0 -1px; } .in-widget-title { color: #606060; } .deleting .widget-title * { color: #aaa; } thebrutalagenda/wp-admin/css/theme-editor.css0000644001761300176130000000163611214074650022056 0ustar mustardamustarda#template textarea { font-family: Consolas, Monaco, Courier, monospace; font-size: 12px; width: 97%; } #template p { width: 97%; } #templateside { float: right; width: 190px; } #templateside h3, #postcustomstuff p.submit { margin: 0; } h3#bordertitle { margin-bottom: 10px; } #templateside h4 { margin-bottom: 0; } #templateside ol, #templateside ul { list-style: none; margin: .5em; padding: 0; } #templateside ol li, #templateside ul li { margin: 1px 0; } #themeselector { padding-right: 5px; float: right; position: relative; bottom: 25px; top:20px; } #themeselector select { margin: 0; padding: 0; } .nonessential { font-size: small; } .highlight { padding: 1px; } div.bordertitle h2 { border: none; padding-bottom: 0; } div.tablenav { margin-right: 210px; } #documentation { margin-top: 10px; } #documentation label { line-height: 22px; vertical-align: top; font-weight: bold; }thebrutalagenda/wp-admin/css/ie.css0000644001761300176130000001343611214074650020066 0ustar mustardamustarda/* Fixes for IE bugs */ input.button, input.button-secondary, input.button-highlighted { padding: 0; } #minor-publishing-actions input, #major-publishing-actions input { min-width: auto; padding-left: 0; padding-right: 0; } #wpbody-content .postbox { border: 1px solid #dfdfdf; } #wpbody-content .postbox h3 { margin-bottom: -1px; } * html .inner-sidebar #side-sortables, * html .postbox-container .meta-box-sortables { height: 300px; } * html #wpbody-content #screen-options-link-wrap { display: inline-block; width: 150px; text-align: center; } * html #wpbody-content #contextual-help-link-wrap { display: inline-block; width: 100px; text-align: center; } * html #adminmenu { margin-left: -80px; } * html .folded #adminmenu { margin-left: -22px; } * html #wpcontent #adminmenu li.menu-top { display: inline; padding: 0; margin: 0; } * html #footer { margin: 0; } .folded #adminmenu li.menu-top { display: block; zoom: 100%; } ul#adminmenu { z-index: 99; } #adminmenu li.menu-top a.menu-top { min-width: auto; width: auto; } #wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu { font-style: normal; } * html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle { background: none; } * html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle { background: url(../images/menu-bits.gif) no-repeat scroll left -109px; } * html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle { background: url(../images/menu-bits.gif) no-repeat scroll left -206px; } * html #adminmenu div.wp-menu-image { height: 29px; } #wpcontent #adminmenu .wp-submenu li { padding: 0; } #adminmenu, .wp-submenu, .wp-submenu li, .wp-menu-toggle { zoom: 100%; } .folded #adminmenu li.wp-menu-separator { width: 28px; } #wpcontent #adminmenu .wp-submenu li.wp-submenu-head { padding: 3px 4px 4px 10px; zoom: 100%; } .folded #adminmenu .menu-top { height: 30px; } .folded #adminmenu .wp-submenu { margin: -1px 0 0 0; } #template, #template div, #editcat, #addcat, * html .stuffbox h3 { zoom: 100%; } .submitbox { margin-top: 10px; } /* Inline Editor */ #wpbody-content .quick-edit-row-post .inline-edit-col-left { width: 39%; } #wpbody-content .inline-edit-row-post .inline-edit-col-center { width: 19%; } #wpbody-content .quick-edit-row-page .inline-edit-col-left { width: 49%; } #wpbody-content .bulk-edit-row .inline-edit-col-left { width: 29%; } .inline-edit-row p.submit { zoom: 100%; } .inline-edit-row fieldset label span.title { display: block; float: left; width: 5em; } .inline-edit-row fieldset label span.input-text-wrap { margin-left: 0; zoom: 100%; } #wpbody-content .inline-edit-row fieldset label span.input-text-wrap input { line-height: 130%; } #wpbody-content .inline-edit-row .input-text-wrap input { width: 95%; } #wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input { width: 8em; } /* end Inline Editor */ input { line-height: 1; } * html .row-actions { visibility: visible; } #dashboard-widgets h3 a { height: 20px; line-height: 20px; } #wphead-info { float: right; } #titlediv #title { width: 98%; } a.button { line-height: 1.4em; margin: 1px; padding: 4px 6px; } * html div.widget-liquid-left, * html div.widget-liquid-right { display: block; position: relative; } #screen-options-wrap { overflow: hidden; } #favorite-actions { z-index: 12; } #favorite-inside, #favorite-inside a, .favorite-action { zoom: 100%; } #the-comment-list .comment-item, #post-status-info, #wpwrap, #wpcontent, #wrap, #postdivrich, #postdiv, #poststuff, .metabox-holder, #titlediv, #post-body, #editorcontainer, .tablenav, .widget-liquid-left, .widget-liquid-right, #widgets-left, .widgets-sortables, #dragHelper, .widget .widget-top, .widget, .widget-control-actions, .tagchecklist, #col-container, #col-left, #col-right { display: block; zoom: 100%; } p.search-box { position: static; float: right; margin: -3px 0 4px; } * html #editorcontainer { padding: 0; } #editorcontainer #content { overflow: auto; margin: auto; width: 98%; } form#template div { width: 100%; } #ed_toolbar input, #ed_reply_toolbar input { overflow: visible; padding: 0 4px; } #poststuff h2 { font-size: 1.6em; } * html #poststuff h2 { margin-left: 0; } #bh { margin: 7px 10px 0 0; float: right; } /* without this dashboard widgets appear in one column for some screen widths */ div#dashboard-widgets { padding-right: 1px; } .tagchecklist span, .tagchecklist span a { display: inline-block; display: block; } .tagchecklist span a { margin: 4px 0 0 -9px; } .tablenav .button-secondary, .nav .button-secondary { padding: 0 1px; vertical-align: middle; } .tablenav select { font-size: 13px; display: inline-block; vertical-align: top; margin-top: 2px; } table.ie-fixed { table-layout: fixed; } .widefat tr, .widefat th { margin-bottom: 0; border-spacing: 0; } .widefat th input { margin: 0 0 0 5px; } .widefat .check-column { padding: 6px 0 2px; } .widefat tbody th.check-column { padding: 4px 0 22px; } .tablenav a.button-secondary { display: inline-block; padding: 2px 5px; } * html .stuffbox, * html .stuffbox input, * html .stuffbox textarea { border: 1px solid #DFDFDF; } * html .feature-filter .feature-group li { width: 145px; } * html .widget-top .widget-title-action a { background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px; } * html div.widget-liquid-left { width: 99%; } #wp_inactive_widgets { padding-bottom: 8px; } * html .widgets-sortables { height: 50px; } * html a#content_resize { right: -2px; } * html .widget-title h4 { width: 205px; } * html #removing-widget .in-widget-title { display: none; } #available-widgets .widget-holder { padding-bottom: 65px; } #widgets-left .inactive { padding-bottom: 10px; } .widget-liquid-right .widget, #wp_inactive_widgets .widget { position: relative; } thebrutalagenda/wp-admin/admin-ajax.php0000644001761300176130000011721511214074650020711 0ustar mustardamustardaALERT: You are logged out! Could not save draft. Please log in again.'), wp_login_url() ); $x = new WP_Ajax_Response( array( 'what' => 'autosave', 'id' => $id, 'data' => $message ) ); $x->send(); } if ( !empty( $_POST['action']) ) do_action( 'wp_ajax_nopriv_' . $_POST['action'] ); die('-1'); } if ( isset( $_GET['action'] ) ) : switch ( $action = $_GET['action'] ) : case 'ajax-tag-search' : if ( !current_user_can( 'edit_posts' ) ) die('-1'); $s = $_GET['q']; // is this slashed already? if ( isset($_GET['tax']) ) $taxonomy = sanitize_title($_GET['tax']); else die('0'); if ( false !== strpos( $s, ',' ) ) { $s = explode( ',', $s ); $s = $s[count( $s ) - 1]; } $s = trim( $s ); if ( strlen( $s ) < 2 ) die; // require 2 chars for matching $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%')" ); echo join( $results, "\n" ); die; break; case 'wp-compression-test' : if ( !current_user_can( 'manage_options' ) ) die('-1'); if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) { update_site_option('can_compress_scripts', 0); die('0'); } if ( isset($_GET['test']) ) { header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); header( 'Pragma: no-cache' ); header('Content-Type: application/x-javascript; charset=UTF-8'); $force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP ); $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; if ( 1 == $_GET['test'] ) { echo $test_str; die; } elseif ( 2 == $_GET['test'] ) { if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { header('Content-Encoding: deflate'); $out = gzdeflate( $test_str, 1 ); } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) { header('Content-Encoding: gzip'); $out = gzencode( $test_str, 1 ); } else { die('-1'); } echo $out; die; } elseif ( 'no' == $_GET['test'] ) { update_site_option('can_compress_scripts', 0); } elseif ( 'yes' == $_GET['test'] ) { update_site_option('can_compress_scripts', 1); } } die('0'); break; default : do_action( 'wp_ajax_' . $_GET['action'] ); die('0'); break; endswitch; endif; /** * Sends back current comment total and new page links if they need to be updated. * * Contrary to normal success AJAX response ("1"), die with time() on success. * * @since 2.7 * * @param int $comment_id * @return die */ function _wp_ajax_delete_comment_response( $comment_id ) { $total = (int) @$_POST['_total']; $per_page = (int) @$_POST['_per_page']; $page = (int) @$_POST['_page']; $url = esc_url_raw( @$_POST['_url'] ); // JS didn't send us everything we need to know. Just die with success message if ( !$total || !$per_page || !$page || !$url ) die( (string) time() ); if ( --$total < 0 ) // Take the total from POST and decrement it (since we just deleted one) $total = 0; if ( 0 != $total % $per_page && 1 != mt_rand( 1, $per_page ) ) // Only do the expensive stuff on a page-break, and about 1 other time per page die( (string) time() ); $status = 'total_comments'; // What type of comment count are we looking for? $parsed = parse_url( $url ); if ( isset( $parsed['query'] ) ) { parse_str( $parsed['query'], $query_vars ); if ( !empty( $query_vars['comment_status'] ) ) $status = $query_vars['comment_status']; } $comment_count = wp_count_comments(); $time = time(); // The time since the last comment count if ( isset( $comment_count->$status ) ) // We're looking for a known type of comment count $total = $comment_count->$status; // else use the decremented value from above $page_links = paginate_links( array( 'base' => add_query_arg( 'apage', '%#%', $url ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($total / $per_page), 'current' => $page ) ); $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $comment_id, // here for completeness - not used 'supplemental' => array( 'pageLinks' => $page_links, 'total' => $total, 'time' => $time ) ) ); $x->send(); } $id = isset($_POST['id'])? (int) $_POST['id'] : 0; switch ( $action = $_POST['action'] ) : case 'delete-comment' : // On success, die with time() instead of 1 check_ajax_referer( "delete-comment_$id" ); if ( !$comment = get_comment( $id ) ) die( (string) time() ); if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) die('-1'); if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) ) die( (string) time() ); $r = wp_set_comment_status( $comment->comment_ID, 'spam' ); } else { $r = wp_delete_comment( $comment->comment_ID ); } if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts _wp_ajax_delete_comment_response( $comment->comment_ID ); die( '0' ); break; case 'delete-cat' : check_ajax_referer( "delete-category_$id" ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $cat = get_category( $id ); if ( !$cat || is_wp_error( $cat ) ) die('1'); if ( wp_delete_category( $id ) ) die('1'); else die('0'); break; case 'delete-tag' : check_ajax_referer( "delete-tag_$id" ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); if ( !empty($_POST['taxonomy']) ) $taxonomy = $_POST['taxonomy']; else $taxonomy = 'post_tag'; $tag = get_term( $id, $taxonomy ); if ( !$tag || is_wp_error( $tag ) ) die('1'); if ( wp_delete_term($id, $taxonomy)) die('1'); else die('0'); break; case 'delete-link-cat' : check_ajax_referer( "delete-link-category_$id" ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $cat = get_term( $id, 'link_category' ); if ( !$cat || is_wp_error( $cat ) ) die('1'); $cat_name = get_term_field('name', $id, 'link_category'); $default = get_option('default_link_category'); // Don't delete the default cats. if ( $id == $default ) { $x = new WP_AJAX_Response( array( 'what' => 'link-cat', 'id' => $id, 'data' => new WP_Error( 'default-link-cat', sprintf(__("Can’t delete the %s category: this is the default one"), $cat_name) ) ) ); $x->send(); } $r = wp_delete_term($id, 'link_category', array('default' => $default)); if ( !$r ) die('0'); if ( is_wp_error($r) ) { $x = new WP_AJAX_Response( array( 'what' => 'link-cat', 'id' => $id, 'data' => $r ) ); $x->send(); } die('1'); break; case 'delete-link' : check_ajax_referer( "delete-bookmark_$id" ); if ( !current_user_can( 'manage_links' ) ) die('-1'); $link = get_bookmark( $id ); if ( !$link || is_wp_error( $link ) ) die('1'); if ( wp_delete_link( $id ) ) die('1'); else die('0'); break; case 'delete-meta' : check_ajax_referer( "delete-meta_$id" ); if ( !$meta = get_post_meta_by_id( $id ) ) die('1'); if ( !current_user_can( 'edit_post', $meta->post_id ) ) die('-1'); if ( delete_meta( $meta->meta_id ) ) die('1'); die('0'); break; case 'delete-post' : check_ajax_referer( "{$action}_$id" ); if ( !current_user_can( 'delete_post', $id ) ) die('-1'); if ( !get_post( $id ) ) die('1'); if ( wp_delete_post( $id ) ) die('1'); else die('0'); break; case 'delete-page' : check_ajax_referer( "{$action}_$id" ); if ( !current_user_can( 'delete_page', $id ) ) die('-1'); if ( !get_page( $id ) ) die('1'); if ( wp_delete_post( $id ) ) die('1'); else die('0'); break; case 'dim-comment' : // On success, die with time() instead of 1 if ( !$comment = get_comment( $id ) ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id)) ) ); $x->send(); } if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) ) die('-1'); if ( !current_user_can( 'moderate_comments' ) ) die('-1'); $current = wp_get_comment_status( $comment->comment_ID ); if ( $_POST['new'] == $current ) die( (string) time() ); $r = 0; if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) { check_ajax_referer( "approve-comment_$id" ); $result = wp_set_comment_status( $comment->comment_ID, 'approve', true ); } else { check_ajax_referer( "unapprove-comment_$id" ); $result = wp_set_comment_status( $comment->comment_ID, 'hold', true ); } if ( is_wp_error($result) ) { $x = new WP_Ajax_Response( array( 'what' => 'comment', 'id' => $result ) ); $x->send(); } // Decide if we need to send back '1' or a more complicated response including page links and comment counts _wp_ajax_delete_comment_response( $comment->comment_ID ); die( '0' ); break; case 'add-category' : // On the Fly check_ajax_referer( $action ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $names = explode(',', $_POST['newcat']); if ( 0 > $parent = (int) $_POST['newcat_parent'] ) $parent = 0; $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array(); $checked_categories = array_map( 'absint', (array) $post_category ); $popular_ids = isset( $_POST['popular_ids'] ) ? array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) : false; $x = new WP_Ajax_Response(); foreach ( $names as $cat_name ) { $cat_name = trim($cat_name); $category_nicename = sanitize_title($cat_name); if ( '' === $category_nicename ) continue; $cat_id = wp_create_category( $cat_name, $parent ); $checked_categories[] = $cat_id; if ( $parent ) // Do these all at once in a second continue; $category = get_category( $cat_id ); ob_start(); wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids ); $data = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'category', 'id' => $cat_id, 'data' => $data, 'position' => -1 ) ); } if ( $parent ) { // Foncy - replace the parent and all its children $parent = get_category( $parent ); ob_start(); dropdown_categories( 0, $parent ); $data = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'category', 'id' => $parent->term_id, 'old_id' => $parent->term_id, 'data' => $data, 'position' => -1 ) ); } $x->send(); break; case 'add-link-category' : // On the Fly check_ajax_referer( $action ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); $names = explode(',', $_POST['newcat']); $x = new WP_Ajax_Response(); foreach ( $names as $cat_name ) { $cat_name = trim($cat_name); $slug = sanitize_title($cat_name); if ( '' === $slug ) continue; if ( !$cat_id = is_term( $cat_name, 'link_category' ) ) { $cat_id = wp_insert_term( $cat_name, 'link_category' ); } $cat_id = $cat_id['term_id']; $cat_name = esc_html(stripslashes($cat_name)); $x->add( array( 'what' => 'link-category', 'id' => $cat_id, 'data' => "", 'position' => -1 ) ); } $x->send(); break; case 'add-cat' : // From Manage->Categories check_ajax_referer( 'add-category' ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); if ( '' === trim($_POST['cat_name']) ) { $x = new WP_Ajax_Response( array( 'what' => 'cat', 'id' => new WP_Error( 'cat_name', __('You did not enter a category name.') ) ) ); $x->send(); } if ( category_exists( trim( $_POST['cat_name'] ), $_POST['category_parent'] ) ) { $x = new WP_Ajax_Response( array( 'what' => 'cat', 'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ), ) ); $x->send(); } $cat = wp_insert_category( $_POST, true ); if ( is_wp_error($cat) ) { $x = new WP_Ajax_Response( array( 'what' => 'cat', 'id' => $cat ) ); $x->send(); } if ( !$cat || (!$cat = get_category( $cat )) ) die('0'); $level = 0; $cat_full_name = $cat->name; $_cat = $cat; while ( $_cat->parent ) { $_cat = get_category( $_cat->parent ); $cat_full_name = $_cat->name . ' — ' . $cat_full_name; $level++; } $cat_full_name = esc_attr($cat_full_name); $x = new WP_Ajax_Response( array( 'what' => 'cat', 'id' => $cat->term_id, 'position' => -1, 'data' => _cat_row( $cat, $level, $cat_full_name ), 'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category %s added' ), "cat-$cat->term_id", $cat_full_name)) ) ); $x->send(); break; case 'add-link-cat' : // From Blogroll -> Categories check_ajax_referer( 'add-link-category' ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); if ( '' === trim($_POST['name']) ) { $x = new WP_Ajax_Response( array( 'what' => 'link-cat', 'id' => new WP_Error( 'name', __('You did not enter a category name.') ) ) ); $x->send(); } $r = wp_insert_term($_POST['name'], 'link_category', $_POST ); if ( is_wp_error( $r ) ) { $x = new WP_AJAX_Response( array( 'what' => 'link-cat', 'id' => $r ) ); $x->send(); } extract($r, EXTR_SKIP); if ( !$link_cat = link_cat_row( $term_id ) ) die('0'); $x = new WP_Ajax_Response( array( 'what' => 'link-cat', 'id' => $term_id, 'position' => -1, 'data' => $link_cat ) ); $x->send(); break; case 'add-tag' : // From Manage->Tags check_ajax_referer( 'add-tag' ); if ( !current_user_can( 'manage_categories' ) ) die('-1'); if ( '' === trim($_POST['name']) ) { $x = new WP_Ajax_Response( array( 'what' => 'tag', 'id' => new WP_Error( 'name', __('You did not enter a tag name.') ) ) ); $x->send(); } if ( !empty($_POST['taxonomy']) ) $taxonomy = $_POST['taxonomy']; else $taxonomy = 'post_tag'; $tag = wp_insert_term($_POST['name'], $taxonomy, $_POST ); if ( is_wp_error($tag) ) { $x = new WP_Ajax_Response( array( 'what' => 'tag', 'id' => $tag ) ); $x->send(); } if ( !$tag || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) die('0'); $tag_full_name = $tag->name; $tag_full_name = esc_attr($tag_full_name); $x = new WP_Ajax_Response( array( 'what' => 'tag', 'id' => $tag->term_id, 'position' => '-1', 'data' => _tag_row( $tag, '', $taxonomy ), 'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag %s added' ), "tag-$tag->term_id", $tag_full_name)) ) ); $x->send(); break; case 'get-tagcloud' : if ( !current_user_can( 'edit_posts' ) ) die('-1'); if ( isset($_POST['tax']) ) $taxonomy = sanitize_title($_POST['tax']); else die('0'); $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); if ( empty( $tags ) ) die( __('No tags found!') ); if ( is_wp_error($tags) ) die($tags->get_error_message()); foreach ( $tags as $key => $tag ) { $tags[ $key ]->link = '#'; $tags[ $key ]->id = $tag->term_id; } // We need raw tag names here, so don't filter the output $return = wp_generate_tag_cloud( $tags, array('filter' => 0) ); if ( empty($return) ) die('0'); echo $return; exit; break; case 'add-comment' : check_ajax_referer( $action ); if ( !current_user_can( 'edit_post', $id ) ) die('-1'); $search = isset($_POST['s']) ? $_POST['s'] : false; $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24; $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false; $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail'; $p = isset($_POST['p']) ? $_POST['p'] : 0; $comment_type = isset($_POST['comment_type']) ? $_POST['comment_type'] : ''; list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1, $p, $comment_type ); if ( get_option('show_avatars') ) add_filter( 'comment_author', 'floated_admin_avatar' ); if ( !$comments ) die('1'); $x = new WP_Ajax_Response(); foreach ( (array) $comments as $comment ) { get_comment( $comment ); ob_start(); _wp_comment_row( $comment->comment_ID, $mode, $status, true, true ); $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item ) ); } $x->send(); break; case 'get-comments' : check_ajax_referer( $action ); $post_ID = (int) $_POST['post_ID']; if ( !current_user_can( 'edit_post', $post_ID ) ) die('-1'); $start = isset($_POST['start']) ? intval($_POST['start']) : 0; $num = isset($_POST['num']) ? intval($_POST['num']) : 10; list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID ); if ( !$comments ) die('1'); $comment_list_item = ''; $x = new WP_Ajax_Response(); foreach ( (array) $comments as $comment ) { get_comment( $comment ); ob_start(); _wp_comment_row( $comment->comment_ID, 'single', false, false ); $comment_list_item .= ob_get_contents(); ob_end_clean(); } $x->add( array( 'what' => 'comments', 'data' => $comment_list_item ) ); $x->send(); break; case 'replyto-comment' : check_ajax_referer( $action ); $comment_post_ID = (int) $_POST['comment_post_ID']; if ( !current_user_can( 'edit_post', $comment_post_ID ) ) die('-1'); $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); if ( empty($status) ) die('1'); elseif ( in_array($status, array('draft', 'pending') ) ) die( __('Error: you are replying to a comment on a draft post.') ); $user = wp_get_current_user(); if ( $user->ID ) { $comment_author = $wpdb->escape($user->display_name); $comment_author_email = $wpdb->escape($user->user_email); $comment_author_url = $wpdb->escape($user->user_url); $comment_content = trim($_POST['content']); if ( current_user_can('unfiltered_html') ) { if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); // start with a clean slate kses_init_filters(); // set up the filters } } } else { die( __('Sorry, you must be logged in to reply to a comment.') ); } if ( '' == $comment_content ) die( __('Error: please type a comment.') ); $comment_parent = absint($_POST['comment_ID']); $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); $comment_id = wp_new_comment( $commentdata ); $comment = get_comment($comment_id); if ( ! $comment ) die('1'); $modes = array( 'single', 'detail', 'dashboard' ); $mode = isset($_POST['mode']) && in_array( $_POST['mode'], $modes ) ? $_POST['mode'] : 'detail'; $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; if ( get_option('show_avatars') && 'single' != $mode ) add_filter( 'comment_author', 'floated_admin_avatar' ); $x = new WP_Ajax_Response(); ob_start(); if ( 'dashboard' == $mode ) { require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); _wp_dashboard_recent_comments_row( $comment, false ); } else { _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox ); } $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position )); $x->send(); break; case 'edit-comment' : check_ajax_referer( 'replyto-comment' ); $comment_post_ID = (int) $_POST['comment_post_ID']; if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) die('-1'); if ( '' == $_POST['content'] ) die( __('Error: please type a comment.') ); $comment_id = (int) $_POST['comment_ID']; $_POST['comment_status'] = $_POST['status']; edit_comment(); $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail'; $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0; $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : ''; if ( get_option('show_avatars') && 'single' != $mode ) add_filter( 'comment_author', 'floated_admin_avatar' ); $x = new WP_Ajax_Response(); ob_start(); _wp_comment_row( $comment_id, $mode, $comments_listing, $checkbox ); $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( 'what' => 'edit_comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position )); $x->send(); break; case 'add-meta' : check_ajax_referer( 'add-meta' ); $c = 0; $pid = (int) $_POST['post_id']; if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) { if ( !current_user_can( 'edit_post', $pid ) ) die('-1'); if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) ) die('1'); if ( $pid < 0 ) { $now = current_time('timestamp', 1); if ( $pid = wp_insert_post( array( 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) ) ) ) { if ( is_wp_error( $pid ) ) { $x = new WP_Ajax_Response( array( 'what' => 'meta', 'data' => $pid ) ); $x->send(); } if ( !$mid = add_meta( $pid ) ) die(__('Please provide a custom field value.')); } else { die('0'); } } else if ( !$mid = add_meta( $pid ) ) { die(__('Please provide a custom field value.')); } $meta = get_post_meta_by_id( $mid ); $pid = (int) $meta->post_id; $meta = get_object_vars( $meta ); $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'data' => _list_meta_row( $meta, $c ), 'position' => 1, 'supplemental' => array('postid' => $pid) ) ); } else { $mid = (int) array_pop(array_keys($_POST['meta'])); $key = $_POST['meta'][$mid]['key']; $value = $_POST['meta'][$mid]['value']; if ( !$meta = get_post_meta_by_id( $mid ) ) die('0'); // if meta doesn't exist if ( !current_user_can( 'edit_post', $meta->post_id ) ) die('-1'); if ( !$u = update_meta( $mid, $key, $value ) ) die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). $key = stripslashes($key); $value = stripslashes($value); $x = new WP_Ajax_Response( array( 'what' => 'meta', 'id' => $mid, 'old_id' => $mid, 'data' => _list_meta_row( array( 'meta_key' => $key, 'meta_value' => $value, 'meta_id' => $mid ), $c ), 'position' => 0, 'supplemental' => array('postid' => $meta->post_id) ) ); } $x->send(); break; case 'add-user' : check_ajax_referer( $action ); if ( !current_user_can('create_users') ) die('-1'); require_once(ABSPATH . WPINC . '/registration.php'); if ( !$user_id = add_user() ) die('0'); elseif ( is_wp_error( $user_id ) ) { $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id ) ); $x->send(); } $user_object = new WP_User( $user_id ); $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, 'data' => user_row( $user_object, '', $user_object->roles[0] ), 'supplemental' => array( 'show-link' => sprintf(__( 'User %s added' ), "user-$user_id", $user_object->user_login), 'role' => $user_object->roles[0] ) ) ); $x->send(); break; case 'autosave' : // The name of this action is hardcoded in edit_post() define( 'DOING_AUTOSAVE', true ); $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' ); global $current_user; $_POST['post_category'] = explode(",", $_POST['catslist']); if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) unset($_POST['post_category']); $do_autosave = (bool) $_POST['autosave']; $do_lock = true; $data = ''; /* translators: draft saved date format, see http://php.net/date */ $draft_saved_date_format = __('g:i:s a'); $message = sprintf( __('Draft Saved at %s.'), date_i18n( $draft_saved_date_format ) ); $supplemental = array(); $id = $revision_id = 0; if($_POST['post_ID'] < 0) { $_POST['post_status'] = 'draft'; $_POST['temp_ID'] = $_POST['post_ID']; if ( $do_autosave ) { $id = wp_write_post(); $data = $message; } } else { $post_ID = (int) $_POST['post_ID']; $_POST['ID'] = $post_ID; $post = get_post($post_ID); if ( $last = wp_check_post_lock( $post->ID ) ) { $do_autosave = $do_lock = false; $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); $data = new WP_Error( 'locked', sprintf( $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ), esc_html( $last_user_name ) ) ); $supplemental['disable_autosave'] = 'disable'; } if ( 'page' == $post->post_type ) { if ( !current_user_can('edit_page', $post_ID) ) die(__('You are not allowed to edit this page.')); } else { if ( !current_user_can('edit_post', $post_ID) ) die(__('You are not allowed to edit this post.')); } if ( $do_autosave ) { // Drafts are just overwritten by autosave if ( 'draft' == $post->post_status ) { $id = edit_post(); } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. $revision_id = wp_create_post_autosave( $post->ID ); if ( is_wp_error($revision_id) ) $id = $revision_id; else $id = $post->ID; } $data = $message; } else { $id = $post->ID; } } if ( $do_lock && $id && is_numeric($id) ) wp_set_post_lock( $id ); if ( $nonce_age == 2 ) { $supplemental['replace-autosavenonce'] = wp_create_nonce('autosave'); $supplemental['replace-getpermalinknonce'] = wp_create_nonce('getpermalink'); $supplemental['replace-samplepermalinknonce'] = wp_create_nonce('samplepermalink'); $supplemental['replace-closedpostboxesnonce'] = wp_create_nonce('closedpostboxes'); if ( $id ) { if ( $_POST['post_type'] == 'post' ) $supplemental['replace-_wpnonce'] = wp_create_nonce('update-post_' . $id); elseif ( $_POST['post_type'] == 'page' ) $supplemental['replace-_wpnonce'] = wp_create_nonce('update-page_' . $id); } } $x = new WP_Ajax_Response( array( 'what' => 'autosave', 'id' => $id, 'data' => $id ? $data : '', 'supplemental' => $supplemental ) ); $x->send(); break; case 'autosave-generate-nonces' : check_ajax_referer( 'autosave', 'autosavenonce' ); $ID = (int) $_POST['post_ID']; if($_POST['post_type'] == 'post') { if(current_user_can('edit_post', $ID)) die(wp_create_nonce('update-post_' . $ID)); } if($_POST['post_type'] == 'page') { if(current_user_can('edit_page', $ID)) { die(wp_create_nonce('update-page_' . $ID)); } } die('0'); break; case 'closed-postboxes' : check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); $closed = isset( $_POST['closed'] ) ? $_POST['closed'] : ''; $closed = explode( ',', $_POST['closed'] ); $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : ''; $hidden = explode( ',', $_POST['hidden'] ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( !preg_match( '/^[a-z_-]+$/', $page ) ) die('-1'); if ( ! $user = wp_get_current_user() ) die('-1'); if ( is_array($closed) ) update_usermeta($user->ID, 'closedpostboxes_'.$page, $closed); if ( is_array($hidden) ) { $hidden = array_diff( $hidden, array('submitdiv', 'pagesubmitdiv', 'linksubmitdiv') ); // postboxes that are always shown update_usermeta($user->ID, 'meta-box-hidden_'.$page, $hidden); } die('1'); break; case 'hidden-columns' : check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' ); $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : ''; $hidden = explode( ',', $_POST['hidden'] ); $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( !preg_match( '/^[a-z_-]+$/', $page ) ) die('-1'); if ( ! $user = wp_get_current_user() ) die('-1'); if ( is_array($hidden) ) update_usermeta($user->ID, "manage-$page-columns-hidden", $hidden); die('1'); break; case 'meta-box-order': check_ajax_referer( 'meta-box-order' ); $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false; $page_columns = isset( $_POST['page_columns'] ) ? (int) $_POST['page_columns'] : 0; $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; if ( !preg_match( '/^[a-z_-]+$/', $page ) ) die('-1'); if ( ! $user = wp_get_current_user() ) die('-1'); if ( $order ) update_user_option($user->ID, "meta-box-order_$page", $order); if ( $page_columns ) update_usermeta($user->ID, "screen_layout_$page", $page_columns); die('1'); break; case 'get-permalink': check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; die(add_query_arg(array('preview' => 'true'), get_permalink($post_id))); break; case 'sample-permalink': check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; $title = isset($_POST['new_title'])? $_POST['new_title'] : ''; $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : ''; die(get_sample_permalink_html($post_id, $title, $slug)); break; case 'inline-save': check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) ) exit; if ( 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_ID ) ) die( __('You are not allowed to edit this page.') ); } else { if ( ! current_user_can( 'edit_post', $post_ID ) ) die( __('You are not allowed to edit this post.') ); } if ( $last = wp_check_post_lock( $post_ID ) ) { $last_user = get_userdata( $last ); $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), esc_html( $last_user_name ) ); exit; } $data = &$_POST; $post = get_post( $post_ID, ARRAY_A ); $post = add_magic_quotes($post); //since it is from db $data['content'] = $post['post_content']; $data['excerpt'] = $post['post_excerpt']; // rename $data['user_ID'] = $GLOBALS['user_ID']; if ( isset($data['post_parent']) ) $data['parent_id'] = $data['post_parent']; // status if ( isset($data['keep_private']) && 'private' == $data['keep_private'] ) $data['post_status'] = 'private'; else $data['post_status'] = $data['_status']; if ( empty($data['comment_status']) ) $data['comment_status'] = 'closed'; if ( empty($data['ping_status']) ) $data['ping_status'] = 'closed'; // update the post edit_post(); $post = array(); if ( 'page' == $_POST['post_type'] ) { $post[] = get_post($_POST['post_ID']); page_rows($post); } elseif ( 'post' == $_POST['post_type'] ) { $mode = $_POST['post_view']; $post[] = get_post($_POST['post_ID']); post_rows($post); } exit; break; case 'inline-save-tax': check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); if ( ! current_user_can('manage_categories') ) die( __('Cheatin’ uh?') ); if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) ) die(-1); switch ($_POST['tax_type']) { case 'cat' : $data = array(); $data['cat_ID'] = $id; $data['cat_name'] = $_POST['name']; $data['category_nicename'] = $_POST['slug']; if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 ) $data['category_parent'] = $_POST['parent']; $cat = get_category($id, ARRAY_A); $data['category_description'] = $cat['category_description']; $updated = wp_update_category($data); if ( $updated && !is_wp_error($updated) ) echo _cat_row( $updated, 0 ); else die( __('Category not updated.') ); break; case 'link-cat' : $updated = wp_update_term($id, 'link_category', $_POST); if ( $updated && !is_wp_error($updated) ) echo link_cat_row($updated['term_id']); else die( __('Category not updated.') ); break; case 'tag' : if ( !empty($_POST['taxonomy']) ) $taxonomy = $_POST['taxonomy']; else $taxonomy = 'post_tag'; $tag = get_term( $id, $taxonomy ); $_POST['description'] = $tag->description; $updated = wp_update_term($id, $taxonomy, $_POST); if ( $updated && !is_wp_error($updated) ) { $tag = get_term( $updated['term_id'], $taxonomy ); if ( !$tag || is_wp_error( $tag ) ) die( __('Tag not updated.') ); echo _tag_row($tag); } else { die( __('Tag not updated.') ); } break; } exit; break; case 'find_posts': check_ajax_referer( 'find-posts' ); if ( empty($_POST['ps']) ) exit; $what = isset($_POST['pages']) ? 'page' : 'post'; $s = stripslashes($_POST['ps']); preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]); $searchand = $search = ''; foreach( (array) $search_terms as $term) { $term = addslashes_gpc($term); $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))"; $searchand = ' AND '; } $term = $wpdb->escape($s); if ( count($search_terms) > 1 && $search_terms[0] != $s ) $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')"; $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date_gmt DESC LIMIT 50" ); if ( ! $posts ) exit( __('No posts found.') ); $html = ''; foreach ( $posts as $post ) { switch ( $post->post_status ) { case 'publish' : case 'private' : $stat = __('Published'); break; case 'future' : $stat = __('Scheduled'); break; case 'pending' : $stat = __('Pending Review'); break; case 'draft' : $stat = __('Unpublished'); break; } if ( '0000-00-00 00:00:00' == $post->post_date ) { $time = ''; } else { /* translators: date format in table columns, see http://php.net/date */ $time = mysql2date(__('Y/m/d'), $post->post_date); } $html .= ''; $html .= ''."\n\n"; } $html .= '

    '.__('Title').''.__('Time').''.__('Status').'
    '.esc_html( $time ).''.esc_html( $stat ).'
    '; $x = new WP_Ajax_Response(); $x->add( array( 'what' => $what, 'data' => $html )); $x->send(); break; case 'lj-importer' : check_ajax_referer( 'lj-api-import' ); if ( !current_user_can( 'publish_posts' ) ) die('-1'); if ( empty( $_POST['step'] ) ) die( '-1' ); define('WP_IMPORTING', true); include( ABSPATH . 'wp-admin/import/livejournal.php' ); $result = $lj_api_import->{ 'step' . ( (int) $_POST['step'] ) }(); if ( is_wp_error( $result ) ) echo $result->get_error_message(); die; break; case 'widgets-order' : check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( !current_user_can('switch_themes') ) die('-1'); unset( $_POST['savewidgets'], $_POST['action'] ); // save widgets order for all sidebars if ( is_array($_POST['sidebars']) ) { $sidebars = array(); foreach ( $_POST['sidebars'] as $key => $val ) { $sb = array(); if ( !empty($val) ) { $val = explode(',', $val); foreach ( $val as $k => $v ) { if ( strpos($v, 'widget-') === false ) continue; $sb[$k] = substr($v, strpos($v, '_') + 1); } } $sidebars[$key] = $sb; } wp_set_sidebars_widgets($sidebars); die('1'); } die('-1'); break; case 'save-widget' : check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); if ( !current_user_can('switch_themes') || !isset($_POST['id_base']) ) die('-1'); unset( $_POST['savewidgets'], $_POST['action'] ); do_action('load-widgets.php'); do_action('widgets.php'); do_action('sidebar_admin_setup'); $id_base = $_POST['id_base']; $widget_id = $_POST['widget-id']; $sidebar_id = $_POST['sidebar']; $multi_number = !empty($_POST['multi_number']) ? (int) $_POST['multi_number'] : 0; $settings = isset($_POST['widget-' . $id_base]) && is_array($_POST['widget-' . $id_base]) ? $_POST['widget-' . $id_base] : false; $error = '

    ' . __('An error has occured. Please reload the page and try again.') . '

    '; $sidebars = wp_get_sidebars_widgets(); $sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array(); // delete if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { if ( !isset($wp_registered_widgets[$widget_id]) ) die($error); $sidebar = array_diff( $sidebar, array($widget_id) ); $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) { if ( !$multi_number ) die($error); $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) ); $widget_id = $id_base . '-' . $multi_number; $sidebar[] = $widget_id; } $_POST['widget-id'] = $sidebar; foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name == $id_base ) { if ( !is_callable( $control['callback'] ) ) continue; ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { $sidebars[$sidebar_id] = $sidebar; wp_set_sidebars_widgets($sidebars); echo "deleted:$widget_id"; die(); } if ( !empty($_POST['add_new']) ) die(); if ( $form = $wp_registered_widget_controls[$widget_id] ) call_user_func_array( $form['callback'], $form['params'] ); die(); break; default : do_action( 'wp_ajax_' . $_POST['action'] ); die('0'); break; endswitch; ?> thebrutalagenda/wp-admin/update-core.php0000644001761300176130000001744611214074650021115 0ustar mustardamustardalocale ? $update->current : sprintf("%s–%s", $update->current, $update->locale); $current = false; if ( !isset($update->response) || 'latest' == $update->response ) $current = true; $submit = __('Upgrade Automatically'); $form_action = 'update-core.php?action=do-core-upgrade'; if ( 'development' == $update->response ) { $message = __('You are using a development version of WordPress. You can upgrade to the latest nightly build automatically or download the nightly build and install it manually:'); $download = __('Download nightly build'); } else { if ( $current ) { $message = sprintf(__('You have the latest version of WordPress. You do not need to upgrade. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string); $submit = __('Re-install Automatically'); $form_action = 'update-core.php?action=do-core-reinstall'; } else { $message = sprintf(__('You can upgrade to version %s automatically or download the package and install it manually:'), $version_string); } $download = sprintf(__('Download %s'), $version_string); } echo '

    '; echo $message; echo '

    '; echo '
    '; wp_nonce_field('upgrade-core'); echo '

    '; echo ' '; echo ''; echo ''; echo '' . $download . ' '; if ( 'en_US' != $update->locale ) if ( !isset( $update->dismissed ) || !$update->dismissed ) echo ''; else echo ''; echo '

    '; if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) echo '

    '.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'

    '; echo '
    '; } function dismissed_updates() { $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); if ( $dismissed ) { $show_text = esc_js(__('Show hidden updates')); $hide_text = esc_js(__('Hide hidden updates')); ?> '.__('Show hidden updates').'

    '; echo '
      '; foreach( (array) $dismissed as $update) { echo '
    • '; list_core_update( $update ); echo '
    • '; } echo '
    '; } } /** * Display upgrade WordPress for downloading latest or upgrading automatically form. * * @since 2.7 * * @return null */ function core_upgrade_preamble() { $updates = get_core_updates(); ?>

    response) || 'latest' == $updates[0]->response ) { echo '

    '; _e('You have the latest version of WordPress. You do not need to upgrade'); echo '

    '; } else { echo '

    '; _e('Important: before upgrading, please backup your database and files.'); echo '

    '; echo '

    '; _e( 'There is a new version of WordPress available for upgrade' ); echo '

    '; } echo '
      '; $alternate = true; foreach( (array) $updates as $update ) { $class = $alternate? ' class="alternate"' : ''; $alternate = !$alternate; echo "
    • "; list_core_update( $update ); echo '
    • '; } echo '
    '; dismissed_updates(); echo '
    '; } /** * Upgrade WordPress core display. * * @since 2.7 * * @return null */ function do_core_upgrade( $reinstall = false ) { global $wp_filesystem; if ( $reinstall ) $url = 'update-core.php?action=do-core-reinstall'; else $url = 'update-core.php?action=do-core-upgrade'; $url = wp_nonce_url($url, 'upgrade-core'); if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) ) return; $version = isset( $_POST['version'] )? $_POST['version'] : false; $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; $update = find_core_update( $version, $locale ); if ( !$update ) return; if ( ! WP_Filesystem($credentials, ABSPATH) ) { request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again return; } ?>

    errors->get_error_code() ) { foreach ( $wp_filesystem->errors->get_error_messages() as $message ) show_message($message); echo '
    '; return; } if ( $reinstall ) $update->response = 'reinstall'; $result = wp_update_core($update, 'show_message'); if ( is_wp_error($result) ) { show_message($result); if ('up_to_date' != $result->get_error_code() ) show_message( __('Installation Failed') ); } else { show_message( __('WordPress upgraded successfully') ); } echo ''; } function do_dismiss_core_update() { $version = isset( $_POST['version'] )? $_POST['version'] : false; $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; $update = find_core_update( $version, $locale ); if ( !$update ) return; dismiss_core_update( $update ); wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); } function do_undismiss_core_update() { $version = isset( $_POST['version'] )? $_POST['version'] : false; $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; $update = find_core_update( $version, $locale ); if ( !$update ) return; undismiss_core_update( $version, $locale ); wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); } $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; if ( 'upgrade-core' == $action ) { wp_version_check(); $title = __('Upgrade WordPress'); $parent_file = 'tools.php'; require_once('admin-header.php'); core_upgrade_preamble(); include('admin-footer.php'); } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { check_admin_referer('upgrade-core'); $title = __('Upgrade WordPress'); $parent_file = 'tools.php'; // do the (un)dismiss actions before headers, // so that they can redirect if ( isset( $_POST['dismiss'] ) ) do_dismiss_core_update(); elseif ( isset( $_POST['undismiss'] ) ) do_undismiss_core_update(); require_once('admin-header.php'); if ( 'do-core-reinstall' == $action ) $reinstall = true; else $reinstall = false; if ( isset( $_POST['upgrade'] ) ) do_core_upgrade($reinstall); include('admin-footer.php'); }?> thebrutalagenda/wp-admin/menu-header.php0000644001761300176130000001226511214074650021071 0ustar mustardamustarda $item ) { $admin_is_parent = false; $class = array(); if ( $first ) { $class[] = 'wp-first-item'; $first = false; } if ( !empty($submenu[$item[2]]) ) $class[] = 'wp-has-submenu'; if ( ( $parent_file && $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) { if ( !empty($submenu[$item[2]]) ) $class[] = 'wp-has-current-submenu wp-menu-open'; else $class[] = 'current'; } if ( isset($item[4]) && ! empty($item[4]) ) $class[] = $item[4]; $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; $tabindex = ' tabindex="1"'; $id = isset($item[5]) && ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; $img = ''; if ( isset($item[6]) && ! empty($item[6]) ) { if ( 'div' === $item[6] ) $img = '
    '; else $img = ''; } $toggle = ''; echo "\n\t"; if ( false !== strpos($class, 'wp-menu-separator') ) { echo '
    '; } elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) { $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") ) || !empty($menu_hook)) { $admin_is_parent = true; echo "$toggle{$item[0]}"; } else { echo "\n\t$toggle{$item[0]}"; } } else if ( current_user_can($item[1]) ) { $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) { $admin_is_parent = true; echo "\n\t$toggle{$item[0]}"; } else { echo "\n\t$toggle{$item[0]}"; } } if ( !empty($submenu[$item[2]]) ) { echo "\n\t
    {$item[0]}
      "; $first = true; foreach ( $submenu[$item[2]] as $sub_key => $sub_item ) { if ( !current_user_can($sub_item[1]) ) continue; $class = array(); if ( $first ) { $class[] = 'wp-first-item'; $first = false; } if ( isset($submenu_file) ) { if ( $submenu_file == $sub_item[2] ) $class[] = 'current'; // If plugin_page is set the parent must either match the current page or not physically exist. // This allows plugin pages with the same hook to exist under different parents. } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) { $class[] = 'current'; } $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") ) || ! empty($menu_hook) ) { // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]); if ( $parent_exists ) echo "{$sub_item[0]}"; elseif ( 'admin.php' == $pagenow || !$parent_exists ) echo "{$sub_item[0]}"; else echo "{$sub_item[0]}"; } else { echo "{$sub_item[0]}"; } } echo "
    "; } echo ""; } } ?>
    thebrutalagenda/wp-admin/options-general.php0000644001761300176130000002477111214074650022012 0ustar mustardamustarda

    = 0) ? '+' : '') . $offnum; } ?>
    " />
    " /> to be different from the directory you installed WordPress.'); ?>
    UTC time is %s'), date_i18n( $time_format, false, 'gmt')); ?> %2$s'), $current_offset_name, date_i18n($time_format)); ?>
    UTC time is %s'), date_i18n($timezone_format, false, 'gmt')); ?> %1$s'), date_i18n($timezone_format)); ?>


    time()) { $found = true; break; } } if ( isset($found) && $found === true ) { echo ' '; $message = $tr['isdst'] ? __('Daylight savings time begins on: %s.') : __('Standard time begins on: %s.'); $tz = new DateTimeZone($tzstring); $d = new DateTime( "@{$tr['ts']}" ); $d->setTimezone($tz); printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $d->format('U') ) ); } else { _e('This timezone does not observe daylight savings time.'); } } ?>
    ' . date_i18n( $format ) . "
    \n"; } echo ' ' . date_i18n( get_option('date_format') ) . "\n"; echo "\t

    " . __('Documentation on date formatting. Click “Save Changes” to update sample output.') . "

    \n"; ?>
    ' . date_i18n( $format ) . "
    \n"; } echo ' ' . date_i18n( get_option('time_format') ) . "\n"; ?>

    thebrutalagenda/wp-content/plugins/simplescripts_footer.php0000644001761300176130000000442111214074647025222 0ustar mustardamustarda'.$tmp_footer.'

    '; } } return print ''; } //set the initial options function ss_set_options() { update_option('simplescripts_footer_text', ss_grab_footer()); update_option('simplescripts_footer_expire',date('U', strtotime('+24 hours'))); update_option('simplescripts_footer_host', 'ss_host_key'); //default host } //grab the current footer by host, update the cache function ss_grab_footer() { $host = get_option('simplescripts_footer_host'); if (empty($host) || $host == 'ss_host_key') { $host = 'bNMiW8DfI9Is'; } $sig = md5(trim(str_replace('http://','',get_option('siteurl')),'/ ')); $contents = maybe_unserialize(wp_remote_fopen('http://www.simplescripts.com/api/host_footer.php?host='.$host.'&sig='.$sig)); update_option('simplescripts_footer_expire', ((empty($contents['expire'])) ? date('U', strtotime('+24 hours')) : date('U', strtotime($contents['expire'])))); $text = (is_array($contents) && isset($contents['text'])) ? strval($contents['text']) : strval($contents); update_option('simplescripts_footer_text', $text); return $text; } //register the plugin register_activation_hook(__FILE__, 'ss_set_options'); add_action('wp_footer', 'ss_show_footer'); ?> thebrutalagenda/wp-content/plugins/akismet/akismet.php0000644001761300176130000011056611214074647024045 0ustar mustardamustardaWordPress.com API key to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <?php akismet_counter(); ?> in your template. See also: WP Stats plugin. Version: 2.2.4 Author: Matt Mullenweg Author URI: http://ma.tt/ */ // If you hardcode a WP.com API key here, all key config screens will be hidden $wpcom_api_key = ''; function akismet_init() { global $wpcom_api_key, $akismet_api_host, $akismet_api_port; if ( $wpcom_api_key ) $akismet_api_host = $wpcom_api_key . '.rest.akismet.com'; else $akismet_api_host = get_option('wordpress_api_key') . '.rest.akismet.com'; $akismet_api_port = 80; add_action('admin_menu', 'akismet_config_page'); add_action('admin_menu', 'akismet_stats_page'); } add_action('init', 'akismet_init'); function akismet_admin_init() { if ( function_exists( 'get_plugin_page_hook' ) ) $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' ); else $hook = 'dashboard_page_akismet-stats-display'; add_action('admin_head-'.$hook, 'akismet_stats_script'); } add_action('admin_init', 'akismet_admin_init'); if ( !function_exists('wp_nonce_field') ) { function akismet_nonce_field($action = -1) { return; } $akismet_nonce = -1; } else { function akismet_nonce_field($action = -1) { return wp_nonce_field($action); } $akismet_nonce = 'akismet-update-key'; } if ( !function_exists('number_format_i18n') ) { function number_format_i18n( $number, $decimals = null ) { return number_format( $number, $decimals ); } } function akismet_config_page() { if ( function_exists('add_submenu_page') ) add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); } function akismet_conf() { global $akismet_nonce, $wpcom_api_key; if ( isset($_POST['submit']) ) { if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(__('Cheatin’ uh?')); check_admin_referer( $akismet_nonce ); $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); if ( empty($key) ) { $key_status = 'empty'; $ms[] = 'new_key_empty'; delete_option('wordpress_api_key'); } else { $key_status = akismet_verify_key( $key ); } if ( $key_status == 'valid' ) { update_option('wordpress_api_key', $key); $ms[] = 'new_key_valid'; } else if ( $key_status == 'invalid' ) { $ms[] = 'new_key_invalid'; } else if ( $key_status == 'failed' ) { $ms[] = 'new_key_failed'; } if ( isset( $_POST['akismet_discard_month'] ) ) update_option( 'akismet_discard_month', 'true' ); else update_option( 'akismet_discard_month', 'false' ); } if ( $key_status != 'valid' ) { $key = get_option('wordpress_api_key'); if ( empty( $key ) ) { if ( $key_status != 'failed' ) { if ( akismet_verify_key( '1234567890ab' ) == 'failed' ) $ms[] = 'no_connection'; else $ms[] = 'key_empty'; } $key_status = 'empty'; } else { $key_status = akismet_verify_key( $key ); } if ( $key_status == 'valid' ) { $ms[] = 'key_valid'; } else if ( $key_status == 'invalid' ) { delete_option('wordpress_api_key'); $ms[] = 'key_empty'; } else if ( !empty($key) && $key_status == 'failed' ) { $ms[] = 'key_failed'; } } $messages = array( 'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), 'new_key_valid' => array('color' => '2d2', 'text' => __('Your key has been verified. Happy blogging!')), 'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please double-check it.')), 'new_key_failed' => array('color' => 'd22', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), 'no_connection' => array('color' => 'd22', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), 'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (Get your key.)'), 'http://wordpress.com/profile/')), 'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')), 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.'))); ?>

    Akismet will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have a WordPress.com account yet, you can get one at WordPress.com.'), 'http://akismet.com/', 'http://wordpress.com/api-keys/'); ?>

    (What is this?'); ?>)

    ".__('Akismet is almost ready.')." ".sprintf(__('You must enter your WordPress.com API key for it to work.'), "plugins.php?page=akismet-key-config")."

    "; } add_action('admin_notices', 'akismet_warning'); return; } // Returns array with headers in $response[0] and body in $response[1] function akismet_http_post($request, $host, $path, $port = 80) { global $wp_version; $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n"; $http_request .= "Content-Length: " . strlen($request) . "\r\n"; $http_request .= "User-Agent: WordPress/$wp_version | Akismet/2.0\r\n"; $http_request .= "\r\n"; $http_request .= $request; $response = ''; if( false != ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { fwrite($fs, $http_request); while ( !feof($fs) ) $response .= fgets($fs, 1160); // One TCP-IP packet fclose($fs); $response = explode("\r\n\r\n", $response, 2); } return $response; } function akismet_auto_check_comment( $comment ) { global $akismet_api_host, $akismet_api_port; $comment['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $comment['referrer'] = $_SERVER['HTTP_REFERER']; $comment['blog'] = get_option('home'); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option('blog_charset'); $comment['permalink'] = get_permalink($comment['comment_post_ID']); $ignore = array( 'HTTP_COOKIE' ); foreach ( $_SERVER as $key => $value ) if ( !in_array( $key, $ignore ) ) $comment["$key"] = $value; $query_string = ''; foreach ( $comment as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); if ( 'true' == $response[1] ) { add_filter('pre_comment_approved', create_function('$a', 'return \'spam\';')); update_option( 'akismet_spam_count', get_option('akismet_spam_count') + 1 ); do_action( 'akismet_spam_caught' ); $post = get_post( $comment['comment_post_ID'] ); $last_updated = strtotime( $post->post_modified_gmt ); $diff = time() - $last_updated; $diff = $diff / 86400; if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' ) die; } akismet_delete_old(); return $comment; } function akismet_delete_old() { global $wpdb; $now_gmt = current_time('mysql', 1); $wpdb->query("DELETE FROM $wpdb->comments WHERE DATE_SUB('$now_gmt', INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam'"); $n = mt_rand(1, 5000); if ( $n == 11 ) // lucky number $wpdb->query("OPTIMIZE TABLE $wpdb->comments"); } function akismet_submit_nonspam_comment ( $comment_id ) { global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); if ( !$comment ) // it was deleted return; $comment->blog = get_option('home'); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink($comment->comment_post_ID); if ( is_object($current_user) ) { $comment->reporter = $current_user->user_login; } if ( is_object($current_site) ) { $comment->site_domain = $current_site->domain; } $query_string = ''; foreach ( $comment as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port); } function akismet_submit_spam_comment ( $comment_id ) { global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; $comment_id = (int) $comment_id; $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); if ( !$comment ) // it was deleted return; if ( 'spam' != $comment->comment_approved ) return; $comment->blog = get_option('home'); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink($comment->comment_post_ID); if ( is_object($current_user) ) { $comment->reporter = $current_user->user_login; } if ( is_object($current_site) ) { $comment->site_domain = $current_site->domain; } $query_string = ''; foreach ( $comment as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port); } add_action('wp_set_comment_status', 'akismet_submit_spam_comment'); add_action('edit_comment', 'akismet_submit_spam_comment'); add_action('preprocess_comment', 'akismet_auto_check_comment', 1); function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); } add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' ); // Total spam in queue // get_option( 'akismet_spam_count' ) is the total caught ever function akismet_spam_count( $type = false ) { global $wpdb; if ( !$type ) { // total $count = wp_cache_get( 'akismet_spam_count', 'widget' ); if ( false === $count ) { if ( function_exists('wp_count_comments') ) { $count = wp_count_comments(); $count = $count->spam; } else { $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'"); } wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 ); } return $count; } elseif ( 'comments' == $type || 'comment' == $type ) { // comments $type = ''; } else { // pingback, trackback, ... $type = $wpdb->escape( $type ); } return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type'"); } function akismet_spam_comments( $type = false, $page = 1, $per_page = 50 ) { global $wpdb; $page = (int) $page; if ( $page < 2 ) $page = 1; $per_page = (int) $per_page; if ( $per_page < 1 ) $per_page = 50; $start = ( $page - 1 ) * $per_page; $end = $start + $per_page; if ( $type ) { if ( 'comments' == $type || 'comment' == $type ) $type = ''; else $type = $wpdb->escape( $type ); return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type' ORDER BY comment_date DESC LIMIT $start, $end"); } // All return $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = 'spam' ORDER BY comment_date DESC LIMIT $start, $end"); } // Totals for each comment type // returns array( type => count, ... ) function akismet_spam_totals() { global $wpdb; $totals = $wpdb->get_results( "SELECT comment_type, COUNT(*) AS cc FROM $wpdb->comments WHERE comment_approved = 'spam' GROUP BY comment_type" ); $return = array(); foreach ( $totals as $total ) $return[$total->comment_type ? $total->comment_type : 'comment'] = $total->cc; return $return; } function akismet_manage_page() { global $wpdb, $submenu, $wp_db_version; // WP 2.7 has its own spam management page if ( 8645 <= $wp_db_version ) return; $count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count()); if ( isset( $submenu['edit-comments.php'] ) ) add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' ); elseif ( function_exists('add_management_page') ) add_management_page(__('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught'); } function akismet_caught() { global $wpdb, $comment, $akismet_caught, $akismet_nonce; akismet_recheck_queue(); if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) { check_admin_referer( $akismet_nonce ); if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) die(__('You do not have sufficient permission to moderate comments.')); $i = 0; foreach ($_POST['not_spam'] as $comment): $comment = (int) $comment; if ( function_exists('wp_set_comment_status') ) wp_set_comment_status($comment, 'approve'); else $wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment'"); akismet_submit_nonspam_comment($comment); ++$i; endforeach; $to = add_query_arg( 'recovered', $i, $_SERVER['HTTP_REFERER'] ); wp_redirect( $to ); exit; } if ('delete' == $_POST['action']) { check_admin_referer( $akismet_nonce ); if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) die(__('You do not have sufficient permission to moderate comments.')); $delete_time = $wpdb->escape( $_POST['display_time'] ); $nuked = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); wp_cache_delete( 'akismet_spam_count', 'widget' ); $to = add_query_arg( 'deleted', 'all', $_SERVER['HTTP_REFERER'] ); wp_redirect( $to ); exit; } if ( isset( $_GET['recovered'] ) ) { $i = (int) $_GET['recovered']; echo '

    ' . sprintf(__('%1$s comments recovered.'), $i) . "

    "; } if (isset( $_GET['deleted'] ) ) echo '

    ' . __('All spam deleted.') . '

    '; if ( isset( $GLOBALS['submenu']['edit-comments.php'] ) ) $link = 'edit-comments.php'; else $link = 'edit.php'; ?>

    %1$s spam for you since you first installed it.'), number_format_i18n($count) ); ?>

    '.__('You have no spam currently in the queue. Must be your lucky day. :)').'

    '; echo '
    '; } else { echo '

    '.__('You can delete all of the spam from your database with a single click. This operation cannot be undone, so you may wish to check to ensure that no legitimate comments got through first. Spam is automatically deleted after 15 days, so don’t sweat it.').'

    '; ?>
       

    '.__('These are the latest comments identified as spam by Akismet. If you see any mistakes, simply mark the comment as "not spam" and Akismet will learn from the submission. If you wish to recover a comment from spam, simply select the comment, and click Not Spam. After 15 days we clean out the junk for you.').'

    '; ?> escape($_POST['s']); $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE (comment_author LIKE '%$s%' OR comment_author_email LIKE '%$s%' OR comment_author_url LIKE ('%$s%') OR comment_author_IP LIKE ('%$s%') OR comment_content LIKE ('%$s%') ) AND comment_approved = 'spam' ORDER BY comment_date DESC"); } else { if ( isset( $_GET['apage'] ) ) $page = (int) $_GET['apage']; else $page = 1; if ( $page < 2 ) $page = 1; $current_type = false; if ( isset( $_GET['ctype'] ) ) $current_type = preg_replace( '|[^a-z]|', '', $_GET['ctype'] ); $comments = akismet_spam_comments( $current_type, $page ); $total = akismet_spam_count( $current_type ); $totals = akismet_spam_totals(); ?>
    • >
    • $type_count ) { if ( 'comment' == $type ) { $type = 'comments'; $show = __('Comments'); } else { $show = ucwords( $type ); } $type_count = number_format_i18n( $type_count ); $extra = $current_type === $type ? ' class="active"' : ''; echo "
    • $show ($type_count)
    • "; } do_action( 'akismet_tabs' ); // so plugins can add more tabs easily ?>
    " id="akismetsearch">

    50 ) { $total_pages = ceil( $total / 50 ); $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; $r .= '' . "\n"; } if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : if ( $page == $page_num ) : $r .= "$page_num\n"; else : $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? '' : $page_num; $r .= '' . ( $page_num ) . "\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; $in = false; endif; endif; endfor; } if ( ( $page ) * 50 < $total || -1 == $total ) { $args['apage'] = $page + 1; $r .= '' . "\n"; } echo "

    $r

    "; ?>
      comment_date); $post = get_post($comment->comment_post_ID); $post_title = $post->post_title; if ($i % 2) $class = 'class="alternate"'; else $class = ''; echo "\n\t
    • "; ?>

      comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

      — [ comment_post_ID); $post_title = wp_specialchars( $post->post_title, 'double' ); $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; ?> ]

    50 ) { $total_pages = ceil( $total / 50 ); $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? '' : $page - 1; $r .= '' . "\n"; } if ( ( $total_pages = ceil( $total / 50 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : if ( $page == $page_num ) : $r .= "$page_num\n"; else : $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? '' : $page_num; $r .= '' . ( $page_num ) . "\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; $in = false; endif; endif; endfor; } if ( ( $page ) * 50 < $total || -1 == $total ) { $args['apage'] = $page + 1; $r .= '' . "\n"; } echo "

    $r

    "; } ?>

       

    '.__('Spam').''; global $submenu; if ( isset( $submenu['edit-comments.php'] ) ) $link = 'edit-comments.php'; else $link = 'edit.php'; echo '

    '.sprintf(__('Akismet has protected your site from %3$s spam comments.'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'

    '; } add_action('activity_box_end', 'akismet_stats'); // WP 2.5+ function akismet_rightnow() { global $submenu, $wp_db_version; if ( 8645 < $wp_db_version ) // 2.7 $link = 'edit-comments.php?comment_status=spam'; elseif ( isset( $submenu['edit-comments.php'] ) ) $link = 'edit-comments.php?page=akismet-admin'; else $link = 'edit.php?page=akismet-admin'; if ( $count = get_option('akismet_spam_count') ) { $intro = sprintf( __ngettext( 'Akismet has protected your site from %2$s spam comment already,', 'Akismet has protected your site from %2$s spam comments already,', $count ), 'http://akismet.com/', number_format_i18n( $count ) ); } else { $intro = sprintf( __('Akismet blocks spam from getting to your blog,'), 'http://akismet.com/' ); } if ( $queue_count = akismet_spam_count() ) { $queue_text = sprintf( __ngettext( 'and there\'s %1$s comment in your spam queue right now.', 'and there are %1$s comments in your spam queue right now.', $queue_count ), number_format_i18n( $queue_count ), clean_url($link) ); } else { $queue_text = sprintf( __( "but there's nothing in your spam queue at the moment." ), clean_url($link) ); } $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text ); echo "

    $text

    \n"; } add_action('rightnow_end', 'akismet_rightnow'); // For WP <= 2.3.x if ( 'moderation.php' == $pagenow ) { function akismet_recheck_button( $page ) { global $submenu; if ( isset( $submenu['edit-comments.php'] ) ) $link = 'edit-comments.php'; else $link = 'edit.php'; $button = "" . __('Recheck Queue for Spam') . ""; $page = str_replace( '
    ', '
    ' . $button, $page ); return $page; } if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ) ) ob_start( 'akismet_recheck_button' ); } // For WP >= 2.5 function akismet_check_for_spam_button($comment_status) { if ( 'approved' == $comment_status ) return; if ( function_exists('plugins_url') ) $link = 'admin.php?action=akismet_recheck_queue'; else $link = 'edit-comments.php?page=akismet-admin&recheckqueue=true&noheader=true'; echo "
    " . __('Check for Spam') . ""; } add_action('manage_comments_nav', 'akismet_check_for_spam_button'); function akismet_recheck_queue() { global $wpdb, $akismet_api_host, $akismet_api_port; if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) return; $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A ); foreach ( (array) $moderation as $c ) { $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; $c['blog'] = get_option('home'); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $id = (int) $c['comment_ID']; $query_string = ''; foreach ( $c as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); if ( 'true' == $response[1] ) { $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = $id" ); } } wp_redirect( $_SERVER['HTTP_REFERER'] ); exit; } add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue'); function akismet_check_db_comment( $id ) { global $wpdb, $akismet_api_host, $akismet_api_port; $id = (int) $id; $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A ); if ( !$c ) return; $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; $c['blog'] = get_option('home'); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $id = $c['comment_ID']; $query_string = ''; foreach ( $c as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); return $response[1]; } // This option causes tons of FPs, was removed in 2.1 function akismet_kill_proxy_check( $option ) { return 0; } add_filter('option_open_proxy_check', 'akismet_kill_proxy_check'); // Widget stuff function widget_akismet_register() { if ( function_exists('register_sidebar_widget') ) : function widget_akismet($args) { extract($args); $options = get_option('widget_akismet'); $count = number_format_i18n(get_option('akismet_spam_count')); ?>

    thebrutalagenda/wp-content/plugins/hello.php0000644001761300176130000000413711144426272022047 0ustar mustardamustardaHello, Dolly in the upper right of your admin screen on every page. Author: Matt Mullenweg Version: 1.5 Author URI: http://ma.tt/ */ function hello_dolly_get_lyric() { /** These are the lyrics to Hello Dolly */ $lyrics = "Hello, Dolly Well, hello, Dolly It's so nice to have you back where you belong You're lookin' swell, Dolly I can tell, Dolly You're still glowin', you're still crowin' You're still goin' strong We feel the room swayin' While the band's playin' One of your old favourite songs from way back when So, take her wrap, fellas Find her an empty lap, fellas Dolly'll never go away again Hello, Dolly Well, hello, Dolly It's so nice to have you back where you belong You're lookin' swell, Dolly I can tell, Dolly You're still glowin', you're still crowin' You're still goin' strong We feel the room swayin' While the band's playin' One of your old favourite songs from way back when Golly, gee, fellas Find her a vacant knee, fellas Dolly'll never go away Dolly'll never go away Dolly'll never go away again"; // Here we split it into lines $lyrics = explode("\n", $lyrics); // And then randomly choose a line return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] ); } // This just echoes the chosen line, we'll position it later function hello_dolly() { $chosen = hello_dolly_get_lyric(); echo "

    $chosen

    "; } // Now we set that function up to execute when the admin_footer action is called add_action('admin_footer', 'hello_dolly'); // We need some CSS to position the paragraph function dolly_css() { echo " "; } add_action('admin_head', 'dolly_css'); ?> thebrutalagenda/wp-includes/plugin.php0000644001761300176130000006013011214074650020705 0ustar mustardamustarda * function example_hook($example) { echo $example; } * add_filter('example_filter', 'example_hook'); * * * In WordPress 1.5.1+, hooked functions can take extra arguments that are set * when the matching do_action() or apply_filters() call is run. The * $accepted_args allow for calling functions only when the number of args * match. Hooked functions can take extra arguments that are set when the * matching do_action() or apply_filters() call is run. For example, the action * comment_id_not_found will pass any functions that hook onto it the ID of the * requested comment. * * Note: the function will return true no matter if the * function was hooked fails or not. There are no checks for whether the * function exists beforehand and no checks to whether the $function_to_add * is even a string. It is up to you to take care and this is done for * optimization purposes, so everything is as quick as possible. * * @package WordPress * @subpackage Plugin * @since 0.71 * @global array $wp_filter Stores all of the filters added in the form of * wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]'] * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process. * * @param string $tag The name of the filter to hook the $function_to_add to. * @param callback $function_to_add The name of the function to be called when the filter is applied. * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. * @param int $accepted_args optional. The number of arguments the function accept (default 1). * @return boolean true */ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) { global $wp_filter, $merged_filters; $idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority); $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); unset( $merged_filters[ $tag ] ); return true; } /** * Check if any filter has been registered for a hook. * * @package WordPress * @subpackage Plugin * @since 2.5 * @global array $wp_filter Stores all of the filters * * @param string $tag The name of the filter hook. * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. * @return int|boolean Optionally returns the priority on that hook for the specified function. */ function has_filter($tag, $function_to_check = false) { global $wp_filter; $has = !empty($wp_filter[$tag]); if ( false === $function_to_check || false == $has ) return $has; if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) ) return false; foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) { if ( isset($wp_filter[$tag][$priority][$idx]) ) return $priority; } return false; } /** * Call the functions added to a filter hook. * * The callback functions attached to filter hook $tag are invoked by calling * this function. This function can be used to create a new filter hook by * simply calling this function with the name of the new hook specified using * the $tag parameter. * * The function allows for additional arguments to be added and passed to hooks. * * function example_hook($string, $arg1, $arg2) * { * //Do stuff * return $string; * } * $value = apply_filters('example_filter', 'filter me', 'arg1', 'arg2'); * * * @package WordPress * @subpackage Plugin * @since 0.71 * @global array $wp_filter Stores all of the filters * @global array $merged_filters Merges the filter hooks using this function. * @global array $wp_current_filter stores the list of current filters with the current one last * * @param string $tag The name of the filter hook. * @param mixed $value The value on which the filters hooked to $tag are applied on. * @param mixed $var,... Additional variables passed to the functions hooked to $tag. * @return mixed The filtered value after all hooked functions are applied to it. */ function apply_filters($tag, $value) { global $wp_filter, $merged_filters, $wp_current_filter; $args = array(); $wp_current_filter[] = $tag; // Do 'all' actions first if ( isset($wp_filter['all']) ) { $args = func_get_args(); _wp_call_all_hook($args); } if ( !isset($wp_filter[$tag]) ) { array_pop($wp_current_filter); return $value; } // Sort if ( !isset( $merged_filters[ $tag ] ) ) { ksort($wp_filter[$tag]); $merged_filters[ $tag ] = true; } reset( $wp_filter[ $tag ] ); if ( empty($args) ) $args = func_get_args(); do { foreach( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ){ $args[1] = $value; $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args'])); } } while ( next($wp_filter[$tag]) !== false ); array_pop( $wp_current_filter ); return $value; } /** * Removes a function from a specified filter hook. * * This function removes a function attached to a specified filter hook. This * method can be used to remove default functions attached to a specific filter * hook and possibly replace them with a substitute. * * To remove a hook, the $function_to_remove and $priority arguments must match * when the hook was added. This goes for both filters and actions. No warning * will be given on removal failure. * * @package WordPress * @subpackage Plugin * @since 1.2 * * @param string $tag The filter hook to which the function to be removed is hooked. * @param callback $function_to_remove The name of the function which should be removed. * @param int $priority optional. The priority of the function (default: 10). * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). * @return boolean Whether the function existed before it was removed. */ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { $function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority); $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); if ( true === $r) { unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); if ( empty($GLOBALS['wp_filter'][$tag][$priority]) ) unset($GLOBALS['wp_filter'][$tag][$priority]); unset($GLOBALS['merged_filters'][$tag]); } return $r; } /** * Remove all of the hooks from a filter. * * @since 2.7 * * @param string $tag The filter to remove hooks from. * @param int $priority The priority number to remove. * @return bool True when finished. */ function remove_all_filters($tag, $priority = false) { global $wp_filter, $merged_filters; if( isset($wp_filter[$tag]) ) { if( false !== $priority && isset($$wp_filter[$tag][$priority]) ) unset($wp_filter[$tag][$priority]); else unset($wp_filter[$tag]); } if( isset($merged_filters[$tag]) ) unset($merged_filters[$tag]); return true; } /** * Retrieve the name of the current filter or action. * * @package WordPress * @subpackage Plugin * @since 2.5 * * @return string Hook name of the current filter or action. */ function current_filter() { global $wp_current_filter; return end( $wp_current_filter ); } /** * Hooks a function on to a specific action. * * Actions are the hooks that the WordPress core launches at specific points * during execution, or when specific events occur. Plugins can specify that * one or more of its PHP functions are executed at these points, using the * Action API. * * @uses add_filter() Adds an action. Parameter list and functionality are the same. * * @package WordPress * @subpackage Plugin * @since 1.2 * * @param string $tag The name of the action to which the $function_to_add is hooked. * @param callback $function_to_add The name of the function you wish to be called. * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. * @param int $accepted_args optional. The number of arguments the function accept (default 1). */ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) { return add_filter($tag, $function_to_add, $priority, $accepted_args); } /** * Execute functions hooked on a specific action hook. * * This function invokes all functions attached to action hook $tag. It is * possible to create new action hooks by simply calling this function, * specifying the name of the new hook using the $tag parameter. * * You can pass extra arguments to the hooks, much like you can with * apply_filters(). * * @see apply_filters() This function works similar with the exception that * nothing is returned and only the functions or methods are called. * * @package WordPress * @subpackage Plugin * @since 1.2 * @global array $wp_filter Stores all of the filters * @global array $wp_actions Increments the amount of times action was triggered. * * @param string $tag The name of the action to be executed. * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. * @return null Will return null if $tag does not exist in $wp_filter array */ function do_action($tag, $arg = '') { global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; if ( is_array($wp_actions) ) $wp_actions[] = $tag; else $wp_actions = array($tag); $wp_current_filter[] = $tag; // Do 'all' actions first if ( isset($wp_filter['all']) ) { $all_args = func_get_args(); _wp_call_all_hook($all_args); } if ( !isset($wp_filter[$tag]) ) { array_pop($wp_current_filter); return; } $args = array(); if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this) $args[] =& $arg[0]; else $args[] = $arg; for ( $a = 2; $a < func_num_args(); $a++ ) $args[] = func_get_arg($a); // Sort if ( !isset( $merged_filters[ $tag ] ) ) { ksort($wp_filter[$tag]); $merged_filters[ $tag ] = true; } reset( $wp_filter[ $tag ] ); do { foreach ( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ) call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); } while ( next($wp_filter[$tag]) !== false ); array_pop($wp_current_filter); } /** * Retrieve the number times an action is fired. * * @package WordPress * @subpackage Plugin * @since 2.1 * @global array $wp_actions Increments the amount of times action was triggered. * * @param string $tag The name of the action hook. * @return int The number of times action hook $tag is fired */ function did_action($tag) { global $wp_actions; if ( empty($wp_actions) ) return 0; return count(array_keys($wp_actions, $tag)); } /** * Execute functions hooked on a specific action hook, specifying arguments in an array. * * @see do_action() This function is identical, but the arguments passed to the * functions hooked to $tag are supplied using an array. * * @package WordPress * @subpackage Plugin * @since 2.1 * @global array $wp_filter Stores all of the filters * @global array $wp_actions Increments the amount of times action was triggered. * * @param string $tag The name of the action to be executed. * @param array $args The arguments supplied to the functions hooked to $tag * @return null Will return null if $tag does not exist in $wp_filter array */ function do_action_ref_array($tag, $args) { global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; if ( !is_array($wp_actions) ) $wp_actions = array($tag); else $wp_actions[] = $tag; $wp_current_filter[] = $tag; // Do 'all' actions first if ( isset($wp_filter['all']) ) { $all_args = func_get_args(); _wp_call_all_hook($all_args); } if ( !isset($wp_filter[$tag]) ) { array_pop($wp_current_filter); return; } // Sort if ( !isset( $merged_filters[ $tag ] ) ) { ksort($wp_filter[$tag]); $merged_filters[ $tag ] = true; } reset( $wp_filter[ $tag ] ); do { foreach( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ) call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); } while ( next($wp_filter[$tag]) !== false ); array_pop($wp_current_filter); } /** * Check if any action has been registered for a hook. * * @package WordPress * @subpackage Plugin * @since 2.5 * @see has_filter() has_action() is an alias of has_filter(). * * @param string $tag The name of the action hook. * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. * @return int|boolean Optionally returns the priority on that hook for the specified function. */ function has_action($tag, $function_to_check = false) { return has_filter($tag, $function_to_check); } /** * Removes a function from a specified action hook. * * This function removes a function attached to a specified action hook. This * method can be used to remove default functions attached to a specific filter * hook and possibly replace them with a substitute. * * @package WordPress * @subpackage Plugin * @since 1.2 * * @param string $tag The action hook to which the function to be removed is hooked. * @param callback $function_to_remove The name of the function which should be removed. * @param int $priority optional The priority of the function (default: 10). * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). * @return boolean Whether the function is removed. */ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) { return remove_filter($tag, $function_to_remove, $priority, $accepted_args); } /** * Remove all of the hooks from an action. * * @since 2.7 * * @param string $tag The action to remove hooks from. * @param int $priority The priority number to remove them from. * @return bool True when finished. */ function remove_all_actions($tag, $priority = false) { return remove_all_filters($tag, $priority); } // // Functions for handling plugins. // /** * Gets the basename of a plugin. * * This method extracts the name of a plugin from its filename. * * @package WordPress * @subpackage Plugin * @since 1.5 * * @access private * * @param string $file The filename of plugin. * @return string The name of a plugin. * @uses WP_PLUGIN_DIR */ function plugin_basename($file) { $file = str_replace('\\','/',$file); // sanitize for Win32 installs $file = preg_replace('|/+|','/', $file); // remove any duplicate slash $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir return $file; } /** * Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in * @package WordPress * @subpackage Plugin * @since 2.8 * * @param string $file The filename of the plugin (__FILE__) * @return string the filesystem path of the directory that contains the plugin */ function plugin_dir_path( $file ) { return trailingslashit( dirname( $file ) ); } /** * Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in * @package WordPress * @subpackage Plugin * @since 2.8 * * @param string $file The filename of the plugin (__FILE__) * @return string the URL path of the directory that contains the plugin */ function plugin_dir_url( $file ) { return trailingslashit( plugins_url( '', $file ) ); } /** * Set the activation hook for a plugin. * * When a plugin is activated, the action 'activate_PLUGINNAME' hook is * activated. In the name of this hook, PLUGINNAME is replaced with the name of * the plugin, including the optional subdirectory. For example, when the plugin * is located in wp-content/plugin/sampleplugin/sample.php, then the name of * this hook will become 'activate_sampleplugin/sample.php'. When the plugin * consists of only one file and is (as by default) located at * wp-content/plugin/sample.php the name of this hook will be * 'activate_sample.php'. * * @package WordPress * @subpackage Plugin * @since 2.0 * * @param string $file The filename of the plugin including the path. * @param callback $function the function hooked to the 'activate_PLUGIN' action. */ function register_activation_hook($file, $function) { $file = plugin_basename($file); add_action('activate_' . $file, $function); } /** * Set the deactivation hook for a plugin. * * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is * deactivated. In the name of this hook, PLUGINNAME is replaced with the name * of the plugin, including the optional subdirectory. For example, when the * plugin is located in wp-content/plugin/sampleplugin/sample.php, then * the name of this hook will become 'activate_sampleplugin/sample.php'. * * When the plugin consists of only one file and is (as by default) located at * wp-content/plugin/sample.php the name of this hook will be * 'activate_sample.php'. * * @package WordPress * @subpackage Plugin * @since 2.0 * * @param string $file The filename of the plugin including the path. * @param callback $function the function hooked to the 'activate_PLUGIN' action. */ function register_deactivation_hook($file, $function) { $file = plugin_basename($file); add_action('deactivate_' . $file, $function); } /** * Set the uninstallation hook for a plugin. * * Registers the uninstall hook that will be called when the user clicks on the * uninstall link that calls for the plugin to uninstall itself. The link won't * be active unless the plugin hooks into the action. * * The plugin should not run arbitrary code outside of functions, when * registering the uninstall hook. In order to run using the hook, the plugin * will have to be included, which means that any code laying outside of a * function will be run during the uninstall process. The plugin should not * hinder the uninstall process. * * If the plugin can not be written without running code within the plugin, then * the plugin should create a file named 'uninstall.php' in the base plugin * folder. This file will be called, if it exists, during the uninstall process * bypassing the uninstall hook. The plugin, when using the 'uninstall.php' * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before * executing. * * @since 2.7 * * @param string $file * @param callback $callback The callback to run when the hook is called. */ function register_uninstall_hook($file, $callback) { // The option should not be autoloaded, because it is not needed in most // cases. Emphasis should be put on using the 'uninstall.php' way of // uninstalling the plugin. $uninstallable_plugins = (array) get_option('uninstall_plugins'); $uninstallable_plugins[plugin_basename($file)] = $callback; update_option('uninstall_plugins', $uninstallable_plugins); } /** * Calls the 'all' hook, which will process the functions hooked into it. * * The 'all' hook passes all of the arguments or parameters that were used for * the hook, which this function was called for. * * This function is used internally for apply_filters(), do_action(), and * do_action_ref_array() and is not meant to be used from outside those * functions. This function does not check for the existence of the all hook, so * it will fail unless the all hook exists prior to this function call. * * @package WordPress * @subpackage Plugin * @since 2.5 * @access private * * @uses $wp_filter Used to process all of the functions in the 'all' hook * * @param array $args The collected parameters from the hook that was called. * @param string $hook Optional. The hook name that was used to call the 'all' hook. */ function _wp_call_all_hook($args) { global $wp_filter; reset( $wp_filter['all'] ); do { foreach( (array) current($wp_filter['all']) as $the_ ) if ( !is_null($the_['function']) ) call_user_func_array($the_['function'], $args); } while ( next($wp_filter['all']) !== false ); } /** * Build Unique ID for storage and retrieval. * * The old way to serialize the callback caused issues and this function is the * solution. It works by checking for objects and creating an a new property in * the class to keep track of the object and new objects of the same class that * need to be added. * * It also allows for the removal of actions and filters for objects after they * change class properties. It is possible to include the property $wp_filter_id * in your class and set it to "null" or a number to bypass the workaround. * However this will prevent you from adding new classes and any new classes * will overwrite the previous hook by the same class. * * Functions and static method callbacks are just returned as strings and * shouldn't have any speed penalty. * * @package WordPress * @subpackage Plugin * @access private * @since 2.2.3 * @link http://trac.wordpress.org/ticket/3875 * * @global array $wp_filter Storage for all of the filters and actions * @param string $tag Used in counting how many hooks were applied * @param callback $function Used for creating unique id * @param int|bool $priority Used in counting how many hooks were applied. If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise. * @param string $type filter or action * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id. */ function _wp_filter_build_unique_id($tag, $function, $priority) { global $wp_filter; static $filter_id_count = 0; // If function then just skip all of the tests and not overwrite the following. if ( is_string($function) ) return $function; // Object Class Calling else if (is_object($function[0]) ) { $obj_idx = get_class($function[0]).$function[1]; if ( !isset($function[0]->wp_filter_id) ) { if ( false === $priority ) return false; $obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0; $function[0]->wp_filter_id = $filter_id_count++; } else $obj_idx .= $function[0]->wp_filter_id; return $obj_idx; } // Static Calling else if ( is_string($function[0]) ) return $function[0].$function[1]; } ?> thebrutalagenda/wp-includes/js/tinymce/wp-tinymce.php0000644001761300176130000000141111214074647023572 0ustar mustardamustarda '', 'after' => '', 'echo' => true); $r = wp_parse_args($args, $defaults); extract( $r, EXTR_SKIP ); $title = $before . $title . $after; $title = esc_attr(strip_tags($title)); if ( $echo ) echo $title; else return $title; } /** * Retrieve post title. * * If the post is protected and the visitor is not an admin, then "Protected" * will be displayed before the post title. If the post is private, then * "Private" will be located before the post title. * * @since 0.71 * * @param int $id Optional. Post ID. * @return string */ function get_the_title( $id = 0 ) { $post = &get_post($id); $title = $post->post_title; if ( !is_admin() ) { if ( !empty($post->post_password) ) { $protected_title_format = apply_filters('protected_title_format', __('Protected: %s')); $title = sprintf($protected_title_format, $title); } else if ( isset($post->post_status) && 'private' == $post->post_status ) { $private_title_format = apply_filters('private_title_format', __('Private: %s')); $title = sprintf($private_title_format, $title); } } return apply_filters( 'the_title', $title, $post->ID ); } /** * Display the Post Global Unique Identifier (guid). * * The guid will appear to be a link, but should not be used as an link to the * post. The reason you should not use it as a link, is because of moving the * blog across domains. * * @since 1.5.0 * * @param int $id Optional. Post ID. */ function the_guid( $id = 0 ) { echo get_the_guid($id); } /** * Retrieve the Post Global Unique Identifier (guid). * * The guid will appear to be a link, but should not be used as an link to the * post. The reason you should not use it as a link, is because of moving the * blog across domains. * * @since 1.5.0 * * @param int $id Optional. Post ID. * @return string */ function get_the_guid( $id = 0 ) { $post = &get_post($id); return apply_filters('get_the_guid', $post->guid); } /** * Display the post content. * * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. * @param string $stripteaser Optional. Teaser content before the more text. * @param string $more_file Optional. Not used. */ function the_content($more_link_text = null, $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; } /** * Retrieve the post content. * * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. * @param string $stripteaser Optional. Teaser content before the more text. * @param string $more_file Optional. Not used. * @return string */ function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '') { global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; if ( null === $more_link_text ) $more_link_text = __( '(more...)' ); $output = ''; $hasTeaser = false; // If post password required and it doesn't match the cookie. if ( post_password_required($post) ) { $output = get_the_password_form(); return $output; } if ( $more_file != '' ) $file = $more_file; else $file = $pagenow; //$_SERVER['PHP_SELF']; if ( $page > count($pages) ) // if the requested page doesn't exist $page = count($pages); // give them the highest numbered page that DOES exist $content = $pages[$page-1]; if ( preg_match('//', $content, $matches) ) { $content = explode($matches[0], $content, 2); if ( !empty($matches[1]) && !empty($more_link_text) ) $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1]))); $hasTeaser = true; } else { $content = array($content); } if ( (false !== strpos($post->post_content, '') && ((!$multipage) || ($page==1))) ) $stripteaser = 1; $teaser = $content[0]; if ( ($more) && ($stripteaser) && ($hasTeaser) ) $teaser = ''; $output .= $teaser; if ( count($content) > 1 ) { if ( $more ) { $output .= '' . $content[1]; } else { if ( ! empty($more_link_text) ) $output .= apply_filters( 'the_content_more_link', ' $more_link_text", $more_link_text ); $output = force_balance_tags($output); } } if ( $preview ) // preview fix for javascript bug with foreign languages $output = preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output); return $output; } /** * Display the post excerpt. * * @since 0.71 * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt. */ function the_excerpt() { echo apply_filters('the_excerpt', get_the_excerpt()); } /** * Retrieve the post excerpt. * * @since 0.71 * * @param mixed $deprecated Not used. * @return string */ function get_the_excerpt($deprecated = '') { global $post; $output = ''; $output = $post->post_excerpt; if ( post_password_required($post) ) { $output = __('There is no excerpt because this is a protected post.'); return $output; } return apply_filters('get_the_excerpt', $output); } /** * Whether post has excerpt. * * @since 2.3.0 * * @param int $id Optional. Post ID. * @return bool */ function has_excerpt( $id = 0 ) { $post = &get_post( $id ); return ( !empty( $post->post_excerpt ) ); } /** * Display the classes for the post div. * * @since 2.7.0 * * @param string|array $class One or more classes to add to the class list. * @param int $post_id An optional post ID. */ function post_class( $class = '', $post_id = null ) { // Separates classes with a single space, collates classes for post DIV echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"'; } /** * Retrieve the classes for the post div as an array. * * The class names are add are many. If the post is a sticky, then the 'sticky' * class name. The class 'hentry' is always added to each post. For each * category, the class will be added with 'category-' with category slug is * added. The tags are the same way as the categories with 'tag-' before the tag * slug. All classes are passed through the filter, 'post_class' with the list * of classes, followed by $class parameter value, with the post ID as the last * parameter. * * @since 2.7.0 * * @param string|array $class One or more classes to add to the class list. * @param int $post_id An optional post ID. * @return array Array of classes. */ function get_post_class( $class = '', $post_id = null ) { $post = get_post($post_id); $classes = array(); $classes[] = 'post-' . $post->ID; $classes[] = $post->post_type; // sticky for Sticky Posts if ( is_sticky($post->ID) && is_home()) $classes[] = 'sticky'; // hentry for hAtom compliace $classes[] = 'hentry'; // Categories foreach ( (array) get_the_category($post->ID) as $cat ) { if ( empty($cat->slug ) ) continue; $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID); } // Tags foreach ( (array) get_the_tags($post->ID) as $tag ) { if ( empty($tag->slug ) ) continue; $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id); } if ( !empty($class) ) { if ( !is_array( $class ) ) $class = preg_split('#\s+#', $class); $classes = array_merge($classes, $class); } return apply_filters('post_class', $classes, $class, $post_id); } /** * Display the classes for the body element. * * @since 2.8.0 * * @param string|array $class One or more classes to add to the class list. */ function body_class( $class = '' ) { // Separates classes with a single space, collates classes for body element echo 'class="' . join( ' ', get_body_class( $class ) ) . '"'; } /** * Retrieve the classes for the body element as an array. * * @since 2.8.0 * * @param string|array $class One or more classes to add to the class list. * @return array Array of classes. */ function get_body_class( $class = '' ) { global $wp_query, $wpdb, $current_user; $classes = array(); if ( 'rtl' == get_bloginfo('text_direction') ) $classes[] = 'rtl'; if ( is_front_page() ) $classes[] = 'home'; if ( is_home() ) $classes[] = 'blog'; if ( is_archive() ) $classes[] = 'archive'; if ( is_date() ) $classes[] = 'date'; if ( is_search() ) $classes[] = 'search'; if ( is_paged() ) $classes[] = 'paged'; if ( is_attachment() ) $classes[] = 'attachment'; if ( is_404() ) $classes[] = 'error404'; if ( is_single() ) { $wp_query->post = $wp_query->posts[0]; setup_postdata($wp_query->post); $postID = $wp_query->post->ID; $classes[] = 'single postid-' . $postID; if ( is_attachment() ) { $mime_type = get_post_mime_type(); $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' ); $classes[] = 'attachmentid-' . $postID; $classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type); } } elseif ( is_archive() ) { if ( is_author() ) { $author = $wp_query->get_queried_object(); $classes[] = 'author'; $classes[] = 'author-' . sanitize_html_class($author->user_nicename , $author->user_id); } elseif ( is_category() ) { $cat = $wp_query->get_queried_object(); $classes[] = 'category'; $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID); } elseif ( is_tag() ) { $tags = $wp_query->get_queried_object(); $classes[] = 'tag'; $classes[] = 'tag-' . sanitize_html_class($tags->slug, $tags->term_id); } } elseif ( is_page() ) { $classes[] = 'page'; $wp_query->post = $wp_query->posts[0]; setup_postdata($wp_query->post); $pageID = $wp_query->post->ID; $classes[] = 'page-id-' . $pageID; if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) ) $classes[] = 'page-parent'; if ( $wp_query->post->post_parent ) $classes[] = 'page-child'; $classes[] = 'parent-pageid-' . $wp_query->post->post_parent; if ( is_page_template() ) $classes[] = 'page-template'; $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); } elseif ( is_search() ) { if ( !empty($wp_query->posts) ) $classes[] = 'search-results'; else $classes[] = 'search-no-results'; } if ( is_user_logged_in() ) $classes[] = 'logged-in'; $page = $wp_query->get('page'); if ( !$page || $page < 2) $page = $wp_query->get('paged'); if ( $page && $page > 1 ) { $classes[] = 'paged-' . $page; if ( is_single() ) $classes[] = 'single-paged-' . $page; elseif ( is_page() ) $classes[] = 'page-paged-' . $page; elseif ( is_category() ) $classes[] = 'category-paged-' . $page; elseif ( is_tag() ) $classes[] = 'tag-paged-' . $page; elseif ( is_date() ) $classes[] = 'date-paged-' . $page; elseif ( is_author() ) $classes[] = 'author-paged-' . $page; elseif ( is_search() ) $classes[] = 'search-paged-' . $page; } if ( !empty($class) ) { if ( !is_array( $class ) ) $class = preg_split('#\s+#', $class); $classes = array_merge($classes, $class); } return apply_filters('body_class', $classes, $class); } /** * Whether post requires password and correct password has been provided. * * @since 2.7.0 * * @param int|object $post An optional post. Global $post used if not provided. * @return bool false if a password is not required or the correct password cookie is present, true otherwise. */ function post_password_required( $post = null ) { $post = get_post($post); if ( empty($post->post_password) ) return false; if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) return true; if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) return true; return false; } /** * Display "sticky" CSS class, if a post is sticky. * * @since 2.7.0 * * @param int $post_id An optional post ID. */ function sticky_class( $post_id = null ) { if ( !is_sticky($post_id) ) return; echo " sticky"; } /** * Page Template Functions for usage in Themes * * @package WordPress * @subpackage Template */ /** * The formatted output of a list of pages. * * Displays page links for paginated posts (i.e. includes the . * Quicktag one or more times). This tag must be within The Loop. * * The defaults for overwriting are: * 'next_or_number' - Default is 'number' (string). Indicates whether page * numbers should be used. Valid values are number and next. * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. * of the bookmark. * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to * previous page, if available. * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in * the parameter string will be replaced with the page number, so Page % * generates "Page 1", "Page 2", etc. Defaults to %, just the page number. * 'before' - Default is '

    Pages:' (string). The html or text to prepend to * each bookmarks. * 'after' - Default is '

    ' (string). The html or text to append to each * bookmarks. * 'more_file' - Default is '' (string) Page the links should point to. Defaults * to the current page. * 'link_before' - Default is '' (string). The html or text to prepend to each * Pages link inside the tag. * 'link_after' - Default is '' (string). The html or text to append to each * Pages link inside the tag. * * @since 1.2.0 * @access private * * @param string|array $args Optional. Overwrite the defaults. * @return string Formatted output in HTML. */ function wp_link_pages($args = '') { $defaults = array( 'before' => '

    ' . __('Pages:'), 'after' => '

    ', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1 ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); global $post, $page, $numpages, $multipage, $more, $pagenow; if ( $more_file != '' ) $file = $more_file; else $file = $pagenow; $output = ''; if ( $multipage ) { if ( 'number' == $next_or_number ) { $output .= $before; for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { $j = str_replace('%',"$i",$pagelink); $output .= ' '; if ( ($i != $page) || ((!$more) && ($page==1)) ) { if ( 1 == $i ) { $output .= '
    '; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= ''; else $output .= ''; } } $output .= $link_before; $output .= $j; $output .= $link_after; if ( ($i != $page) || ((!$more) && ($page==1)) ) $output .= ''; } $output .= $after; } else { if ( $more ) { $output .= $before; $i = $page - 1; if ( $i && $more ) { if ( 1 == $i ) { $output .= '' . $link_before. $previouspagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $previouspagelink . $link_after . ''; else $output .= '' . $link_before. $previouspagelink . $link_after . ''; } } $i = $page + 1; if ( $i <= $numpages && $more ) { if ( 1 == $i ) { $output .= '' . $link_before. $nextpagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $nextpagelink . $link_after . ''; else $output .= '' . $link_before. $nextpagelink . $link_after . ''; } } $output .= $after; } } } if ( $echo ) echo $output; return $output; } // // Post-meta: Custom per-post fields. // /** * Retrieve post custom meta data field. * * @since 1.5.0 * * @param string $key Meta data key name. * @return string|array Array of values or single value, if only one element exists. */ function post_custom( $key = '' ) { $custom = get_post_custom(); if ( 1 == count($custom[$key]) ) return $custom[$key][0]; else return $custom[$key]; } /** * Display list of post custom fields. * * @internal This will probably change at some point... * @since 1.2.0 * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters. */ function the_meta() { if ( $keys = get_post_custom_keys() ) { echo "\n"; } } // // Pages // /** * Retrieve or display list of pages as a dropdown (select list). * * @since 2.1.0 * * @param array|string $args Optional. Override default arguments. * @return string HTML content, if not displaying. */ function wp_dropdown_pages($args = '') { $defaults = array( 'depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, 'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '' ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); $pages = get_pages($r); $output = ''; if ( ! empty($pages) ) { $output = "\n"; } $output = apply_filters('wp_dropdown_pages', $output); if ( $echo ) echo $output; return $output; } /** * Retrieve or display list of pages in list (li) format. * * @since 1.5.0 * * @param array|string $args Optional. Override default arguments. * @return string HTML content, if not displaying. */ function wp_list_pages($args = '') { $defaults = array( 'depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '' ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); $output = ''; $current_page = 0; // sanitize, mostly to keep spaces out $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']); // Allow plugins to filter an array of excluded pages $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude']))); // Query pages. $r['hierarchical'] = 0; $pages = get_pages($r); if ( !empty($pages) ) { if ( $r['title_li'] ) $output .= ''; } $output = apply_filters('wp_list_pages', $output); if ( $r['echo'] ) echo $output; else return $output; } /** * Display or retrieve list of pages with optional home link. * * The arguments are listed below and part of the arguments are for {@link * wp_list_pages()} function. Check that function for more info on those * arguments. * *
      *
    • sort_column - How to sort the list of pages. Defaults * to page title. Use column for posts table.
    • *
    • menu_class - Class to use for the div ID which contains * the page list. Defaults to 'menu'.
    • *
    • echo - Whether to echo list or return it. Defaults to * echo.
    • *
    • link_before - Text before show_home argument text.
    • *
    • link_after - Text after show_home argument text.
    • *
    • show_home - If you set this argument, then it will * display the link to the home page. The show_home argument really just needs * to be set to the value of the text of the link.
    • *
    * * @since 2.7.0 * * @param array|string $args */ function wp_page_menu( $args = array() ) { $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => ''); $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'wp_page_menu_args', $args ); $menu = ''; $list_args = $args; // Show Home in the menu if ( isset($args['show_home']) && ! empty($args['show_home']) ) { if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) $text = __('Home'); else $text = $args['show_home']; $class = ''; if ( is_front_page() && !is_paged() ) $class = 'class="current_page_item"'; $menu .= '
  • ' . $args['link_before'] . $text . $args['link_after'] . '
  • '; // If the front page is a page, add it to the exclude list if (get_option('show_on_front') == 'page') { if ( !empty( $list_args['exclude'] ) ) { $list_args['exclude'] .= ','; } else { $list_args['exclude'] = ''; } $list_args['exclude'] .= get_option('page_on_front'); } } $list_args['echo'] = false; $list_args['title_li'] = ''; $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) ); if ( $menu ) $menu = '
      ' . $menu . '
    '; $menu = '
    ' . $menu . "
    \n"; $menu = apply_filters( 'wp_page_menu', $menu, $args ); if ( $args['echo'] ) echo $menu; else return $menu; } // // Page helpers // /** * Retrieve HTML list content for page list. * * @uses Walker_Page to create HTML list content. * @since 2.1.0 * @see Walker_Page::walk() for parameters and return description. */ function walk_page_tree($pages, $depth, $current_page, $r) { if ( empty($r['walker']) ) $walker = new Walker_Page; else $walker = $r['walker']; $args = array($pages, $depth, $r, $current_page); return call_user_func_array(array(&$walker, 'walk'), $args); } /** * Retrieve HTML dropdown (select) content for page list. * * @uses Walker_PageDropdown to create HTML dropdown content. * @since 2.1.0 * @see Walker_PageDropdown::walk() for parameters and return description. */ function walk_page_dropdown_tree() { $args = func_get_args(); if ( empty($args[2]['walker']) ) // the user's options are the third parameter $walker = new Walker_PageDropdown; else $walker = $args[2]['walker']; return call_user_func_array(array(&$walker, 'walk'), $args); } // // Attachments // /** * Display an attachment page link using an image or icon. * * @since 2.0.0 * * @param int $id Optional. Post ID. * @param bool $fullsize Optional, default is false. Whether to use full size. * @param bool $deprecated Deprecated. Not used. * @param bool $permalink Optional, default is false. Whether to include permalink. */ function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) { if ( $fullsize ) echo wp_get_attachment_link($id, 'full', $permalink); else echo wp_get_attachment_link($id, 'thumbnail', $permalink); } /** * Retrieve an attachment page link using an image or icon, if possible. * * @since 2.5.0 * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. * * @param int $id Optional. Post ID. * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. * @param bool $permalink Optional, default is false. Whether to add permalink to image. * @param bool $icon Optional, default is false. Whether to include icon. * @param string $text Optional, default is false. If string, then will be link text. * @return string HTML content. */ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) { $id = intval($id); $_post = & get_post( $id ); if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) return __('Missing Attachment'); if ( $permalink ) $url = get_attachment_link($_post->ID); $post_title = esc_attr($_post->post_title); if ( $text ) { $link_text = esc_attr($text); } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { $link_text = wp_get_attachment_image($id, $size, $icon); } if( trim($link_text) == '' ) $link_text = $_post->post_title; return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text ); } /** * Retrieve HTML content of attachment image with link. * * @since 2.0.0 * @deprecated Use {@link wp_get_attachment_link()} * @see wp_get_attachment_link() Use instead. * * @param int $id Optional. Post ID. * @param bool $fullsize Optional, default is false. Whether to use full size image. * @param array $max_dims Optional. Max image dimensions. * @param bool $permalink Optional, default is false. Whether to include permalink to image. * @return string */ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { $id = (int) $id; $_post = & get_post($id); if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) return __('Missing Attachment'); if ( $permalink ) $url = get_attachment_link($_post->ID); $post_title = esc_attr($_post->post_title); $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); return "$innerHTML"; } /** * Retrieve icon URL and Path. * * @since 2.1.0 * @deprecated Use {@link wp_get_attachment_image_src()} * @see wp_get_attachment_image_src() Use instead. * * @param int $id Optional. Post ID. * @param bool $fullsize Optional, default to false. Whether to have full image. * @return array Icon URL and full path to file, respectively. */ function get_attachment_icon_src( $id = 0, $fullsize = false ) { $id = (int) $id; if ( !$post = & get_post($id) ) return false; $file = get_attached_file( $post->ID ); if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { // We have a thumbnail desired, specified and existing $src_file = basename($src); $class = 'attachmentthumb'; } elseif ( wp_attachment_is_image( $post->ID ) ) { // We have an image without a thumbnail $src = wp_get_attachment_url( $post->ID ); $src_file = & $file; $class = 'attachmentimage'; } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { // No thumb, no image. We'll look for a mime-related icon instead. $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); $src_file = $icon_dir . '/' . basename($src); } if ( !isset($src) || !$src ) return false; return array($src, $src_file); } /** * Retrieve HTML content of icon attachment image element. * * @since 2.0.0 * @deprecated Use {@link wp_get_attachment_image()} * @see wp_get_attachment_image() Use instead of. * * @param int $id Optional. Post ID. * @param bool $fullsize Optional, default to false. Whether to have full size image. * @param array $max_dims Optional. Dimensions of image. * @return string HTML content. */ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { $id = (int) $id; if ( !$post = & get_post($id) ) return false; if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) return false; list($src, $src_file) = $src; // Do we need to constrain the image? if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { $imagesize = getimagesize($src_file); if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { $actual_aspect = $imagesize[0] / $imagesize[1]; $desired_aspect = $max_dims[0] / $max_dims[1]; if ( $actual_aspect >= $desired_aspect ) { $height = $actual_aspect * $max_dims[0]; $constraint = "width='{$max_dims[0]}' "; $post->iconsize = array($max_dims[0], $height); } else { $width = $max_dims[1] / $actual_aspect; $constraint = "height='{$max_dims[1]}' "; $post->iconsize = array($width, $max_dims[1]); } } else { $post->iconsize = array($imagesize[0], $imagesize[1]); $constraint = ''; } } else { $constraint = ''; } $post_title = esc_attr($post->post_title); $icon = "$post_title"; return apply_filters( 'attachment_icon', $icon, $post->ID ); } /** * Retrieve HTML content of image element. * * @since 2.0.0 * @deprecated Use {@link wp_get_attachment_image()} * @see wp_get_attachment_image() Use instead. * * @param int $id Optional. Post ID. * @param bool $fullsize Optional, default to false. Whether to have full size image. * @param array $max_dims Optional. Dimensions of image. * @return string */ function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { $id = (int) $id; if ( !$post = & get_post($id) ) return false; if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) return $innerHTML; $innerHTML = esc_attr($post->post_title); return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); } /** * Wrap attachment in <

    > element before content. * * @since 2.0.0 * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content. * * @param string $content * @return string */ function prepend_attachment($content) { global $post; if ( empty($post->post_type) || $post->post_type != 'attachment' ) return $content; $p = '

    '; // show the medium sized image representation of the attachment if available, and link to the raw file $p .= wp_get_attachment_link(0, 'medium', false); $p .= '

    '; $p = apply_filters('prepend_attachment', $p); return "$p\n$content"; } // // Misc // /** * Retrieve protected post password form content. * * @since 1.0.0 * @uses apply_filters() Calls 'the_password_form' filter on output. * * @return string HTML content for password form for password protected post. */ function get_the_password_form() { global $post; $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID); $output = '

    ' . __("This post is password protected. To view it please enter your password below:") . '

    '; return apply_filters('the_password_form', $output); } /** * Whether currently in a page template. * * This template tag allows you to determine whether or not you are in a page * template. You can optional provide a template name and then the check will be * specific to that template. * * @since 2.5.0 * @uses $wp_query * * @param string $template The specific template name if specific matching is required. * @return bool False on failure, true if success. */ function is_page_template($template = '') { if (!is_page()) { return false; } global $wp_query; $page = $wp_query->get_queried_object(); $custom_fields = get_post_custom_values('_wp_page_template',$page->ID); $page_template = $custom_fields[0]; // We have no argument passed so just see if a page_template has been specified if ( empty( $template ) ) { if (!empty( $page_template ) ) { return true; } } elseif ( $template == $page_template) { return true; } return false; } /** * Retrieve formatted date timestamp of a revision (linked to that revisions's page). * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses date_i18n() * * @param int|object $revision Revision ID or revision object. * @param bool $link Optional, default is true. Link to revisions's page? * @return string i18n formatted datetimestamp or localized 'Current Revision'. */ function wp_post_revision_title( $revision, $link = true ) { if ( !$revision = get_post( $revision ) ) return $revision; if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) return false; /* translators: revision date format, see http://php.net/date */ $datef = _x( 'j F, Y @ G:i', 'revision date format'); /* translators: 1: date */ $autosavef = __( '%1$s [Autosave]' ); /* translators: 1: date */ $currentf = __( '%1$s [Current Revision]' ); $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) $date = "$date"; if ( !wp_is_post_revision( $revision ) ) $date = sprintf( $currentf, $date ); elseif ( wp_is_post_autosave( $revision ) ) $date = sprintf( $autosavef, $date ); return $date; } /** * Display list of a post's revisions. * * Can output either a UL with edit links or a TABLE with diff interface, and * restore action links. * * Second argument controls parameters: * (bool) parent : include the parent (the "Current Revision") in the list. * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' * outputs TABLE with UI. * (int) right : what revision is currently being viewed - used in * form-table format. * (int) left : what revision is currently being diffed against right - * used in form-table format. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses wp_get_post_revisions() * @uses wp_post_revision_title() * @uses get_edit_post_link() * @uses get_the_author_meta() * * @todo split into two functions (list, form-table) ? * * @param int|object $post_id Post ID or post object. * @param string|array $args See description {@link wp_parse_args()}. * @return null */ function wp_list_post_revisions( $post_id = 0, $args = null ) { if ( !$post = get_post( $post_id ) ) return; $defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' ); extract( wp_parse_args( $args, $defaults ), EXTR_SKIP ); switch ( $type ) { case 'autosave' : if ( !$autosave = wp_get_post_autosave( $post->ID ) ) return; $revisions = array( $autosave ); break; case 'revision' : // just revisions - remove autosave later case 'all' : default : if ( !$revisions = wp_get_post_revisions( $post->ID ) ) return; break; } /* translators: post revision: 1: when, 2: author name */ $titlef = _x( '%1$s by %2$s', 'post revision' ); if ( $parent ) array_unshift( $revisions, $post ); $rows = ''; $class = false; $can_edit_post = current_user_can( 'edit_post', $post->ID ); foreach ( $revisions as $revision ) { if ( !current_user_can( 'read_post', $revision->ID ) ) continue; if ( 'revision' === $type && wp_is_post_autosave( $revision ) ) continue; $date = wp_post_revision_title( $revision ); $name = get_the_author_meta( 'display_name', $revision->post_author ); if ( 'form-table' == $format ) { if ( $left ) $left_checked = $left == $revision->ID ? ' checked="checked"' : ''; else $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one) $right_checked = $right == $revision->ID ? ' checked="checked"' : ''; $class = $class ? '' : " class='alternate'"; if ( $post->ID != $revision->ID && $can_edit_post ) $actions = 'ID|$revision->ID" ) . '">' . __( 'Restore' ) . ''; else $actions = ''; $rows .= "\n"; $rows .= "\t\n"; $rows .= "\t$date\n"; $rows .= "\t$name\n"; $rows .= "\t$actions\n"; $rows .= "\n"; } else { $title = sprintf( $titlef, $date, $name ); $rows .= "\t
  • $title
  • \n"; } } if ( 'form-table' == $format ) : ?>

    \n"; echo $rows; echo ""; endif; } thebrutalagenda/wp-includes/update.php0000644001761300176130000002314611214074651020700 0ustar mustardamustardaupdates = array(); $current->version_checked = $wp_version; } $locale = apply_filters( 'core_version_check_locale', get_locale() ); // Update last_checked for current to prevent multiple blocking requests if request hangs $current->last_checked = time(); set_transient( 'update_core', $current ); if ( method_exists( $wpdb, 'db_version' ) ) $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users)); else $mysql_version = 'N/A'; $local_package = isset( $wp_local_package )? $wp_local_package : ''; $url = "http://api.wordpress.org/core/version-check/1.3/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package"; $options = array( 'timeout' => 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); $response = wp_remote_get($url, $options); if ( is_wp_error( $response ) ) return false; if ( 200 != $response['response']['code'] ) return false; $body = trim( $response['body'] ); $body = str_replace(array("\r\n", "\r"), "\n", $body); $new_options = array(); foreach( explode( "\n\n", $body ) as $entry) { $returns = explode("\n", $entry); $new_option = new stdClass(); $new_option->response = esc_attr( $returns[0] ); if ( isset( $returns[1] ) ) $new_option->url = esc_url( $returns[1] ); if ( isset( $returns[2] ) ) $new_option->package = esc_url( $returns[2] ); if ( isset( $returns[3] ) ) $new_option->current = esc_attr( $returns[3] ); if ( isset( $returns[4] ) ) $new_option->locale = esc_attr( $returns[4] ); $new_options[] = $new_option; } $updates = new stdClass(); $updates->updates = $new_options; $updates->last_checked = time(); $updates->version_checked = $wp_version; set_transient( 'update_core', $updates); } /** * Check plugin versions against the latest versions hosted on WordPress.org. * * The WordPress version, PHP version, and Locale is sent along with a list of * all plugins installed. Checks against the WordPress server at * api.wordpress.org. Will only check if WordPress isn't installing. * * @package WordPress * @since 2.3.0 * @uses $wp_version Used to notidy the WordPress version. * * @return mixed Returns null if update is unsupported. Returns false if check is too soon. */ function wp_update_plugins() { global $wp_version; if ( defined('WP_INSTALLING') ) return false; // If running blog-side, bail unless we've not checked in the last 12 hours if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $plugins = get_plugins(); $active = get_option( 'active_plugins' ); $current = get_transient( 'update_plugins' ); if ( ! is_object($current) ) $current = new stdClass; $new_option = new stdClass; $new_option->last_checked = time(); $timeout = 'load-plugins.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); $plugin_changed = false; foreach ( $plugins as $file => $p ) { $new_option->checked[ $file ] = $p['Version']; if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) ) $plugin_changed = true; } if ( isset ( $current->response ) && is_array( $current->response ) ) { foreach ( $current->response as $plugin_file => $update_details ) { if ( ! isset($plugins[ $plugin_file ]) ) { $plugin_changed = true; break; } } } // Bail if we've checked in the last 12 hours and if nothing has changed if ( $time_not_changed && !$plugin_changed ) return false; // Update last_checked for current to prevent multiple blocking requests if request hangs $current->last_checked = time(); set_transient( 'update_plugins', $current ); $to_send = (object)compact('plugins', 'active'); $options = array( 'timeout' => 3, 'body' => array( 'plugins' => serialize( $to_send ) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options); if ( is_wp_error( $raw_response ) ) return false; if( 200 != $raw_response['response']['code'] ) return false; $response = unserialize( $raw_response['body'] ); if ( false !== $response ) $new_option->response = $response; else $new_option->response = array(); set_transient( 'update_plugins', $new_option ); } /** * Check theme versions against the latest versions hosted on WordPress.org. * * A list of all themes installed in sent to WP. Checks against the * WordPress server at api.wordpress.org. Will only check if WordPress isn't * installing. * * @package WordPress * @since 2.7.0 * @uses $wp_version Used to notidy the WordPress version. * * @return mixed Returns null if update is unsupported. Returns false if check is too soon. */ function wp_update_themes( ) { global $wp_version; if( defined( 'WP_INSTALLING' ) ) return false; if( !function_exists( 'get_themes' ) ) require_once( ABSPATH . 'wp-includes/theme.php' ); $installed_themes = get_themes( ); $current_theme = get_transient( 'update_themes' ); if ( ! is_object($current_theme) ) $current_theme = new stdClass; $new_option = new stdClass; $new_option->last_checked = time( ); $timeout = 'load-themes.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked ); if( $time_not_changed ) return false; // Update last_checked for current to prevent multiple blocking requests if request hangs $current_theme->last_checked = time(); set_transient( 'update_themes', $current_theme ); $current_theme->template = get_option( 'template' ); $themes = array( ); $themes['current_theme'] = (array) $current_theme; foreach( (array) $installed_themes as $theme_title => $theme ) { $themes[$theme['Stylesheet']] = array( ); foreach( (array) $theme as $key => $value ) { $themes[$theme['Stylesheet']][$key] = $value; } } $options = array( 'timeout' => 3, 'body' => array( 'themes' => serialize( $themes ) ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options ); if( is_wp_error( $raw_response ) ) return false; if( 200 != $raw_response['response']['code'] ) return false; $response = unserialize( $raw_response['body'] ); if( $response ) $new_option->response = $response; set_transient( 'update_themes', $new_option ); } function _maybe_update_core() { global $wp_version; $current = get_transient( 'update_core' ); if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) && isset( $current->version_checked ) && $current->version_checked == $wp_version ) return; wp_version_check(); } /** * Check the last time plugins were run before checking plugin versions. * * This might have been backported to WordPress 2.6.1 for performance reasons. * This is used for the wp-admin to check only so often instead of every page * load. * * @since 2.7.0 * @access private */ function _maybe_update_plugins() { $current = get_transient( 'update_plugins' ); if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) ) return; wp_update_plugins(); } /** * Check themes versions only after a duration of time. * * This is for performance reasons to make sure that on the theme version * checker is not run on every page load. * * @since 2.7.0 * @access private */ function _maybe_update_themes( ) { $current = get_transient( 'update_themes' ); if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) ) return; wp_update_themes( ); } add_action( 'admin_init', '_maybe_update_core' ); add_action( 'wp_version_check', 'wp_version_check' ); add_action( 'load-plugins.php', 'wp_update_plugins' ); add_action( 'load-update.php', 'wp_update_plugins' ); add_action( 'admin_init', '_maybe_update_plugins' ); add_action( 'wp_update_plugins', 'wp_update_plugins' ); add_action( 'load-themes.php', 'wp_update_themes' ); add_action( 'load-update.php', 'wp_update_themes' ); add_action( 'admin_init', '_maybe_update_themes' ); add_action( 'wp_update_themes', 'wp_update_themes' ); if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') ) wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') ) wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') ) wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); ?> thebrutalagenda/wp-includes/post.php0000644001761300176130000034226311214074651020407 0ustar mustardamustarda (int) $GLOBALS['post']->post_parent ); } else { return false; } } elseif ( is_object( $args ) ) { $args = array('post_parent' => (int) $args->post_parent ); } elseif ( is_numeric( $args ) ) { $args = array('post_parent' => (int) $args); } $defaults = array( 'numberposts' => -1, 'post_type' => 'any', 'post_status' => 'any', 'post_parent' => 0, ); $r = wp_parse_args( $args, $defaults ); $children = get_posts( $r ); if ( !$children ) { $kids = false; return $kids; } update_post_cache($children); foreach ( $children as $key => $child ) $kids[$child->ID] =& $children[$key]; if ( $output == OBJECT ) { return $kids; } elseif ( $output == ARRAY_A ) { foreach ( (array) $kids as $kid ) $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]); return $weeuns; } elseif ( $output == ARRAY_N ) { foreach ( (array) $kids as $kid ) $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID])); return $babes; } else { return $kids; } } /** * Get extended entry info (). * * There should not be any space after the second dash and before the word * 'more'. There can be text or space(s) after the word 'more', but won't be * referenced. * * The returned array has 'main' and 'extended' keys. Main has the text before * the . The 'extended' key has the content after the * comment. * * @since 1.0.0 * * @param string $post Post content. * @return array Post before ('main') and after ('extended'). */ function get_extended($post) { //Match the new style more links if ( preg_match('//', $post, $matches) ) { list($main, $extended) = explode($matches[0], $post, 2); } else { $main = $post; $extended = ''; } // Strip leading and trailing whitespace $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); return array('main' => $main, 'extended' => $extended); } /** * Retrieves post data given a post ID or post object. * * See {@link sanitize_post()} for optional $filter values. Also, the parameter * $post, must be given as a variable, since it is passed by reference. * * @since 1.5.1 * @uses $wpdb * @link http://codex.wordpress.org/Function_Reference/get_post * * @param int|object $post Post ID or post object. * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N. * @param string $filter Optional, default is raw. * @return mixed Post data */ function &get_post(&$post, $output = OBJECT, $filter = 'raw') { global $wpdb; $null = null; if ( empty($post) ) { if ( isset($GLOBALS['post']) ) $_post = & $GLOBALS['post']; else return $null; } elseif ( is_object($post) && empty($post->filter) ) { _get_post_ancestors($post); wp_cache_add($post->ID, $post, 'posts'); $_post = &$post; } else { if ( is_object($post) ) $post = $post->ID; $post = (int) $post; if ( ! $_post = wp_cache_get($post, 'posts') ) { $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post)); if ( ! $_post ) return $null; _get_post_ancestors($_post); wp_cache_add($_post->ID, $_post, 'posts'); } } $_post = sanitize_post($_post, $filter); if ( $output == OBJECT ) { return $_post; } elseif ( $output == ARRAY_A ) { $__post = get_object_vars($_post); return $__post; } elseif ( $output == ARRAY_N ) { $__post = array_values(get_object_vars($_post)); return $__post; } else { return $_post; } } /** * Retrieve ancestors of a post. * * @since 2.5.0 * * @param int|object $post Post ID or post object * @return array Ancestor IDs or empty array if none are found. */ function get_post_ancestors($post) { $post = get_post($post); if ( !empty($post->ancestors) ) return $post->ancestors; return array(); } /** * Retrieve data from a post field based on Post ID. * * Examples of the post field will be, 'post_type', 'post_status', 'content', * etc and based off of the post object property or key names. * * The context values are based off of the taxonomy filter functions and * supported values are found within those functions. * * @since 2.3.0 * @uses sanitize_post_field() See for possible $context values. * * @param string $field Post field name * @param id $post Post ID * @param string $context Optional. How to filter the field. Default is display. * @return WP_Error|string Value in post field or WP_Error on failure */ function get_post_field( $field, $post, $context = 'display' ) { $post = (int) $post; $post = get_post( $post ); if ( is_wp_error($post) ) return $post; if ( !is_object($post) ) return ''; if ( !isset($post->$field) ) return ''; return sanitize_post_field($field, $post->$field, $post->ID, $context); } /** * Retrieve the mime type of an attachment based on the ID. * * This function can be used with any post type, but it makes more sense with * attachments. * * @since 2.0.0 * * @param int $ID Optional. Post ID. * @return bool|string False on failure or returns the mime type */ function get_post_mime_type($ID = '') { $post = & get_post($ID); if ( is_object($post) ) return $post->post_mime_type; return false; } /** * Retrieve the post status based on the Post ID. * * If the post ID is of an attachment, then the parent post status will be given * instead. * * @since 2.0.0 * * @param int $ID Post ID * @return string|bool Post status or false on failure. */ function get_post_status($ID = '') { $post = get_post($ID); if ( is_object($post) ) { if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) ) return get_post_status($post->post_parent); else return $post->post_status; } return false; } /** * Retrieve all of the WordPress supported post statuses. * * Posts have a limited set of valid status values, this provides the * post_status values and descriptions. * * @since 2.5.0 * * @return array List of post statuses. */ function get_post_statuses( ) { $status = array( 'draft' => __('Draft'), 'pending' => __('Pending Review'), 'private' => __('Private'), 'publish' => __('Published') ); return $status; } /** * Retrieve all of the WordPress support page statuses. * * Pages have a limited set of valid status values, this provides the * post_status values and descriptions. * * @since 2.5.0 * * @return array List of page statuses. */ function get_page_statuses( ) { $status = array( 'draft' => __('Draft'), 'private' => __('Private'), 'publish' => __('Published') ); return $status; } /** * Retrieve the post type of the current post or of a given post. * * @since 2.1.0 * * @uses $wpdb * @uses $posts The Loop post global * * @param mixed $post Optional. Post object or post ID. * @return bool|string post type or false on failure. */ function get_post_type($post = false) { global $posts; if ( false === $post ) $post = $posts[0]; elseif ( (int) $post ) $post = get_post($post, OBJECT); if ( is_object($post) ) return $post->post_type; return false; } /** * Updates the post type for the post ID. * * The page or post cache will be cleaned for the post ID. * * @since 2.5.0 * * @uses $wpdb * * @param int $post_id Post ID to change post type. Not actually optional. * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to * name a few. * @return int Amount of rows changed. Should be 1 for success and 0 for failure. */ function set_post_type( $post_id = 0, $post_type = 'post' ) { global $wpdb; $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db'); $return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) ); if ( 'page' == $post_type ) clean_page_cache($post_id); else clean_post_cache($post_id); return $return; } /** * Retrieve list of latest posts or posts matching criteria. * * The defaults are as follows: * 'numberposts' - Default is 5. Total number of posts to retrieve. * 'offset' - Default is 0. See {@link WP_Query::query()} for more. * 'category' - What category to pull the posts from. * 'orderby' - Default is 'post_date'. How to order the posts. * 'order' - Default is 'DESC'. The order to retrieve the posts. * 'include' - See {@link WP_Query::query()} for more. * 'exclude' - See {@link WP_Query::query()} for more. * 'meta_key' - See {@link WP_Query::query()} for more. * 'meta_value' - See {@link WP_Query::query()} for more. * 'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few. * 'post_parent' - The parent of the post or post type. * 'post_status' - Default is 'published'. Post status to retrieve. * * @since 1.2.0 * @uses $wpdb * @uses WP_Query::query() See for more default arguments and information. * @link http://codex.wordpress.org/Template_Tags/get_posts * * @param array $args Optional. Overrides defaults. * @return array List of posts. */ function get_posts($args = null) { $defaults = array( 'numberposts' => 5, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'post', 'suppress_filters' => true ); $r = wp_parse_args( $args, $defaults ); if ( empty( $r['post_status'] ) ) $r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish'; if ( ! empty($r['numberposts']) ) $r['posts_per_page'] = $r['numberposts']; if ( ! empty($r['category']) ) $r['cat'] = $r['category']; if ( ! empty($r['include']) ) { $incposts = preg_split('/[\s,]+/',$r['include']); $r['posts_per_page'] = count($incposts); // only the number of posts included $r['post__in'] = $incposts; } elseif ( ! empty($r['exclude']) ) $r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']); $r['caller_get_posts'] = true; $get_posts = new WP_Query; return $get_posts->query($r); } // // Post meta functions // /** * Add meta data field to a post. * * Post meta data is called "Custom Fields" on the Administration Panels. * * @since 1.5.0 * @uses $wpdb * @link http://codex.wordpress.org/Function_Reference/add_post_meta * * @param int $post_id Post ID. * @param string $key Metadata name. * @param mixed $value Metadata value. * @param bool $unique Optional, default is false. Whether the same key should not be added. * @return bool False for failure. True for success. */ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { if ( !$meta_key ) return false; global $wpdb; // make sure meta is added to the post, not a revision if ( $the_post = wp_is_post_revision($post_id) ) $post_id = $the_post; // expected_slashed ($meta_key) $meta_key = stripslashes($meta_key); if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) return false; $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); $wpdb->insert( $wpdb->postmeta, compact( 'post_id', 'meta_key', 'meta_value' ) ); wp_cache_delete($post_id, 'post_meta'); return true; } /** * Remove metadata matching criteria from a post. * * You can match based on the key, or key and value. Removing based on key and * value, will keep from removing duplicate metadata with the same key. It also * allows removing all metadata matching key, if needed. * * @since 1.5.0 * @uses $wpdb * @link http://codex.wordpress.org/Function_Reference/delete_post_meta * * @param int $post_id post ID * @param string $meta_key Metadata name. * @param mixed $meta_value Optional. Metadata value. * @return bool False for failure. True for success. */ function delete_post_meta($post_id, $meta_key, $meta_value = '') { global $wpdb; // make sure meta is added to the post, not a revision if ( $the_post = wp_is_post_revision($post_id) ) $post_id = $the_post; // expected_slashed ($meta_key, $meta_value) $meta_key = stripslashes( $meta_key ); $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); if ( !$meta_key ) return false; if ( empty( $meta_value ) ) $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) ); else $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) ); if ( !$meta_id ) return false; if ( empty( $meta_value ) ) $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) ); else $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) ); wp_cache_delete($post_id, 'post_meta'); return true; } /** * Retrieve post meta field for a post. * * @since 1.5.0 * @uses $wpdb * @link http://codex.wordpress.org/Function_Reference/get_post_meta * * @param int $post_id Post ID. * @param string $key The meta key to retrieve. * @param bool $single Whether to return a single value. * @return mixed Will be an array if $single is false. Will be value of meta data field if $single * is true. */ function get_post_meta($post_id, $key, $single = false) { if ( !$key ) return ''; $post_id = (int) $post_id; $meta_cache = wp_cache_get($post_id, 'post_meta'); if ( !$meta_cache ) { update_postmeta_cache($post_id); $meta_cache = wp_cache_get($post_id, 'post_meta'); } if ( isset($meta_cache[$key]) ) { if ( $single ) { return maybe_unserialize( $meta_cache[$key][0] ); } else { return array_map('maybe_unserialize', $meta_cache[$key]); } } return ''; } /** * Update post meta field based on post ID. * * Use the $prev_value parameter to differentiate between meta fields with the * same key and post ID. * * If the meta field for the post does not exist, it will be added. * * @since 1.5 * @uses $wpdb * @link http://codex.wordpress.org/Function_Reference/update_post_meta * * @param int $post_id Post ID. * @param string $key Metadata key. * @param mixed $value Metadata value. * @param mixed $prev_value Optional. Previous value to check before removing. * @return bool False on failure, true if success. */ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { global $wpdb; // make sure meta is added to the post, not a revision if ( $the_post = wp_is_post_revision($post_id) ) $post_id = $the_post; // expected_slashed ($meta_key) $meta_key = stripslashes($meta_key); if ( !$meta_key ) return false; if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) { return add_post_meta($post_id, $meta_key, $meta_value); } $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); $data = compact( 'meta_value' ); $where = compact( 'meta_key', 'post_id' ); if ( !empty( $prev_value ) ) { $prev_value = maybe_serialize($prev_value); $where['meta_value'] = $prev_value; } $wpdb->update( $wpdb->postmeta, $data, $where ); wp_cache_delete($post_id, 'post_meta'); return true; } /** * Delete everything from post meta matching meta key. * * @since 2.3.0 * @uses $wpdb * * @param string $post_meta_key Key to search for when deleting. * @return bool Whether the post meta key was deleted from the database */ function delete_post_meta_by_key($post_meta_key) { if ( !$post_meta_key ) return false; global $wpdb; $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); if ( $post_ids ) { $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); foreach ( $post_ids as $post_id ) wp_cache_delete($post_id, 'post_meta'); return true; } return false; } /** * Retrieve post meta fields, based on post ID. * * The post meta fields are retrieved from the cache, so the function is * optimized to be called more than once. It also applies to the functions, that * use this function. * * @since 1.2.0 * @link http://codex.wordpress.org/Function_Reference/get_post_custom * * @uses $id Current Loop Post ID * * @param int $post_id post ID * @return array */ function get_post_custom($post_id = 0) { global $id; if ( !$post_id ) $post_id = (int) $id; $post_id = (int) $post_id; if ( ! wp_cache_get($post_id, 'post_meta') ) update_postmeta_cache($post_id); return wp_cache_get($post_id, 'post_meta'); } /** * Retrieve meta field names for a post. * * If there are no meta fields, then nothing (null) will be returned. * * @since 1.2.0 * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys * * @param int $post_id post ID * @return array|null Either array of the keys, or null if keys could not be retrieved. */ function get_post_custom_keys( $post_id = 0 ) { $custom = get_post_custom( $post_id ); if ( !is_array($custom) ) return; if ( $keys = array_keys($custom) ) return $keys; } /** * Retrieve values for a custom post field. * * The parameters must not be considered optional. All of the post meta fields * will be retrieved and only the meta field key values returned. * * @since 1.2.0 * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values * * @param string $key Meta field key. * @param int $post_id Post ID * @return array Meta field values. */ function get_post_custom_values( $key = '', $post_id = 0 ) { if ( !$key ) return null; $custom = get_post_custom($post_id); return isset($custom[$key]) ? $custom[$key] : null; } /** * Check if post is sticky. * * Sticky posts should remain at the top of The Loop. If the post ID is not * given, then The Loop ID for the current post will be used. * * @since 2.7.0 * * @param int $post_id Optional. Post ID. * @return bool Whether post is sticky (true) or not sticky (false). */ function is_sticky($post_id = null) { global $id; $post_id = absint($post_id); if ( !$post_id ) $post_id = absint($id); $stickies = get_option('sticky_posts'); if ( !is_array($stickies) ) return false; if ( in_array($post_id, $stickies) ) return true; return false; } /** * Sanitize every post field. * * If the context is 'raw', then the post object or array will get minimal santization of the int fields. * * @since 2.3.0 * @uses sanitize_post_field() Used to sanitize the fields. * * @param object|array $post The Post Object or Array * @param string $context Optional, default is 'display'. How to sanitize post fields. * @return object|array The now sanitized Post Object or Array (will be the same type as $post) */ function sanitize_post($post, $context = 'display') { if ( is_object($post) ) { if ( !isset($post->ID) ) $post->ID = 0; foreach ( array_keys(get_object_vars($post)) as $field ) $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context); $post->filter = $context; } else { if ( !isset($post['ID']) ) $post['ID'] = 0; foreach ( array_keys($post) as $field ) $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); $post['filter'] = $context; } return $post; } /** * Sanitize post field based on context. * * Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' * when calling filters. * * @since 2.3.0 * @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and * $post_id if $context == 'edit' and field name prefix == 'post_'. * * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'. * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'. * @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'. * * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything * other than 'raw', 'edit' and 'db' and field name prefix == 'post_'. * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw', * 'edit' and 'db' and field name prefix != 'post_'. * * @param string $field The Post Object field name. * @param mixed $value The Post Object value. * @param int $post_id Post ID. * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', * 'attribute' and 'js'. * @return mixed Sanitized value. */ function sanitize_post_field($field, $value, $post_id, $context) { $int_fields = array('ID', 'post_parent', 'menu_order'); if ( in_array($field, $int_fields) ) $value = (int) $value; if ( 'raw' == $context ) return $value; $prefixed = false; if ( false !== strpos($field, 'post_') ) { $prefixed = true; $field_no_prefix = str_replace('post_', '', $field); } if ( 'edit' == $context ) { $format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password'); if ( $prefixed ) { $value = apply_filters("edit_$field", $value, $post_id); // Old school $value = apply_filters("${field_no_prefix}_edit_pre", $value, $post_id); } else { $value = apply_filters("edit_post_$field", $value, $post_id); } if ( in_array($field, $format_to_edit) ) { if ( 'post_content' == $field ) $value = format_to_edit($value, user_can_richedit()); else $value = format_to_edit($value); } else { $value = esc_attr($value); } } else if ( 'db' == $context ) { if ( $prefixed ) { $value = apply_filters("pre_$field", $value); $value = apply_filters("${field_no_prefix}_save_pre", $value); } else { $value = apply_filters("pre_post_$field", $value); $value = apply_filters("${field}_pre", $value); } } else { // Use display filters by default. if ( $prefixed ) $value = apply_filters($field, $value, $post_id, $context); else $value = apply_filters("post_$field", $value, $post_id, $context); } if ( 'attribute' == $context ) $value = esc_attr($value); else if ( 'js' == $context ) $value = esc_js($value); return $value; } /** * Make a post sticky. * * Sticky posts should be displayed at the top of the front page. * * @since 2.7.0 * * @param int $post_id Post ID. */ function stick_post($post_id) { $stickies = get_option('sticky_posts'); if ( !is_array($stickies) ) $stickies = array($post_id); if ( ! in_array($post_id, $stickies) ) $stickies[] = $post_id; update_option('sticky_posts', $stickies); } /** * Unstick a post. * * Sticky posts should be displayed at the top of the front page. * * @since 2.7.0 * * @param int $post_id Post ID. */ function unstick_post($post_id) { $stickies = get_option('sticky_posts'); if ( !is_array($stickies) ) return; if ( ! in_array($post_id, $stickies) ) return; $offset = array_search($post_id, $stickies); if ( false === $offset ) return; array_splice($stickies, $offset, 1); update_option('sticky_posts', $stickies); } /** * Count number of posts of a post type and is user has permissions to view. * * This function provides an efficient method of finding the amount of post's * type a blog has. Another method is to count the amount of items in * get_posts(), but that method has a lot of overhead with doing so. Therefore, * when developing for 2.5+, use this function instead. * * The $perm parameter checks for 'readable' value and if the user can read * private posts, it will display that for the user that is signed in. * * @since 2.5.0 * @link http://codex.wordpress.org/Template_Tags/wp_count_posts * * @param string $type Optional. Post type to retrieve count * @param string $perm Optional. 'readable' or empty. * @return object Number of posts for each status */ function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; $user = wp_get_current_user(); $cache_key = $type; $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ( 'readable' == $perm && is_user_logged_in() ) { if ( !current_user_can("read_private_{$type}s") ) { $cache_key .= '_' . $perm . '_' . $user->ID; $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))"; } } $query .= ' GROUP BY post_status'; $count = wp_cache_get($cache_key, 'counts'); if ( false !== $count ) return $count; $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0 ); foreach( (array) $count as $row_num => $row ) { $stats[$row['post_status']] = $row['num_posts']; } $stats = (object) $stats; wp_cache_set($cache_key, $stats, 'counts'); return $stats; } /** * Count number of attachments for the mime type(s). * * If you set the optional mime_type parameter, then an array will still be * returned, but will only have the item you are looking for. It does not give * you the number of attachments that are children of a post. You can get that * by counting the number of children that post has. * * @since 2.5.0 * * @param string|array $mime_type Optional. Array or comma-separated list of MIME patterns. * @return array Number of posts for each mime type. */ function wp_count_attachments( $mime_type = '' ) { global $wpdb; $and = wp_post_mime_type_where( $mime_type ); $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' $and GROUP BY post_mime_type", ARRAY_A ); $stats = array( ); foreach( (array) $count as $row ) { $stats[$row['post_mime_type']] = $row['num_posts']; } return (object) $stats; } /** * Check a MIME-Type against a list. * * If the wildcard_mime_types parameter is a string, it must be comma separated * list. If the real_mime_types is a string, it is also comma separated to * create the list. * * @since 2.5.0 * * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or * flash (same as *flash*). * @param string|array $real_mime_types post_mime_type values * @return array array(wildcard=>array(real types)) */ function wp_match_mime_types($wildcard_mime_types, $real_mime_types) { $matches = array(); if ( is_string($wildcard_mime_types) ) $wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types)); if ( is_string($real_mime_types) ) $real_mime_types = array_map('trim', explode(',', $real_mime_types)); $wild = '[-._a-z0-9]*'; foreach ( (array) $wildcard_mime_types as $type ) { $type = str_replace('*', $wild, $type); $patternses[1][$type] = "^$type$"; if ( false === strpos($type, '/') ) { $patternses[2][$type] = "^$type/"; $patternses[3][$type] = $type; } } asort($patternses); foreach ( $patternses as $patterns ) foreach ( $patterns as $type => $pattern ) foreach ( (array) $real_mime_types as $real ) if ( preg_match("#$pattern#", $real) && ( empty($matches[$type]) || false === array_search($real, $matches[$type]) ) ) $matches[$type][] = $real; return $matches; } /** * Convert MIME types into SQL. * * @since 2.5.0 * * @param string|array $mime_types List of mime types or comma separated string of mime types. * @return string The SQL AND clause for mime searching. */ function wp_post_mime_type_where($post_mime_types) { $where = ''; $wildcards = array('', '%', '%/%'); if ( is_string($post_mime_types) ) $post_mime_types = array_map('trim', explode(',', $post_mime_types)); foreach ( (array) $post_mime_types as $mime_type ) { $mime_type = preg_replace('/\s/', '', $mime_type); $slashpos = strpos($mime_type, '/'); if ( false !== $slashpos ) { $mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos)); $mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1)); if ( empty($mime_subgroup) ) $mime_subgroup = '*'; else $mime_subgroup = str_replace('/', '', $mime_subgroup); $mime_pattern = "$mime_group/$mime_subgroup"; } else { $mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type); if ( false === strpos($mime_pattern, '*') ) $mime_pattern .= '/*'; } $mime_pattern = preg_replace('/\*+/', '%', $mime_pattern); if ( in_array( $mime_type, $wildcards ) ) return ''; if ( false !== strpos($mime_pattern, '%') ) $wheres[] = "post_mime_type LIKE '$mime_pattern'"; else $wheres[] = "post_mime_type = '$mime_pattern'"; } if ( !empty($wheres) ) $where = ' AND (' . join(' OR ', $wheres) . ') '; return $where; } /** * Removes a post, attachment, or page. * * When the post and page goes, everything that is tied to it is deleted also. * This includes comments, post meta fields, and terms associated with the post. * * @since 1.0.0 * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'. * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'. * @uses wp_delete_attachment() if post type is 'attachment'. * * @param int $postid Post ID. * @return mixed False on failure */ function wp_delete_post($postid = 0) { global $wpdb, $wp_rewrite; if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) return $post; if ( 'attachment' == $post->post_type ) return wp_delete_attachment($postid); do_action('delete_post', $postid); /** @todo delete for pluggable post taxonomies too */ wp_delete_object_term_relationships($postid, array('category', 'post_tag')); $parent_data = array( 'post_parent' => $post->post_parent ); $parent_where = array( 'post_parent' => $postid ); if ( 'page' == $post->post_type) { // if the page is defined in option page_on_front or post_for_posts, // adjust the corresponding options if ( get_option('page_on_front') == $postid ) { update_option('show_on_front', 'posts'); delete_option('page_on_front'); } if ( get_option('page_for_posts') == $postid ) { delete_option('page_for_posts'); } // Point children of this page to its parent, also clean the cache of affected children $children_query = $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type='page'", $postid); $children = $wpdb->get_results($children_query); $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) ); } else { unstick_post($postid); } // Do raw query. wp_get_post_revisions() is filtered $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) ); // Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up. foreach ( $revision_ids as $revision_id ) wp_delete_post_revision( $revision_id ); // Point all attachments to this post up one level $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d", $postid )); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); if ( 'page' == $post->post_type ) { clean_page_cache($postid); foreach ( (array) $children as $child ) clean_page_cache($child->ID); $wp_rewrite->flush_rules(); } else { clean_post_cache($postid); } wp_clear_scheduled_hook('publish_future_post', $postid); do_action('deleted_post', $postid); return $post; } /** * Retrieve the list of categories for a post. * * Compatibility layer for themes and plugins. Also an easy layer of abstraction * away from the complexity of the taxonomy layer. * * @since 2.1.0 * * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here. * * @param int $post_id Optional. The Post ID. * @param array $args Optional. Overwrite the defaults. * @return array */ function wp_get_post_categories( $post_id = 0, $args = array() ) { $post_id = (int) $post_id; $defaults = array('fields' => 'ids'); $args = wp_parse_args( $args, $defaults ); $cats = wp_get_object_terms($post_id, 'category', $args); return $cats; } /** * Retrieve the tags for a post. * * There is only one default for this function, called 'fields' and by default * is set to 'all'. There are other defaults that can be overridden in * {@link wp_get_object_terms()}. * * @package WordPress * @subpackage Post * @since 2.3.0 * * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here * * @param int $post_id Optional. The Post ID * @param array $args Optional. Overwrite the defaults * @return array List of post tags. */ function wp_get_post_tags( $post_id = 0, $args = array() ) { return wp_get_post_terms( $post_id, 'post_tag', $args); } /** * Retrieve the terms for a post. * * There is only one default for this function, called 'fields' and by default * is set to 'all'. There are other defaults that can be overridden in * {@link wp_get_object_terms()}. * * @package WordPress * @subpackage Post * @since 2.8.0 * * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here * * @param int $post_id Optional. The Post ID * @param string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag. * @param array $args Optional. Overwrite the defaults * @return array List of post tags. */ function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) { $post_id = (int) $post_id; $defaults = array('fields' => 'all'); $args = wp_parse_args( $args, $defaults ); $tags = wp_get_object_terms($post_id, $taxonomy, $args); return $tags; } /** * Retrieve number of recent posts. * * @since 1.0.0 * @uses $wpdb * * @param int $num Optional, default is 10. Number of posts to get. * @return array List of posts. */ function wp_get_recent_posts($num = 10) { global $wpdb; // Set the limit clause, if we got a limit $num = (int) $num; if ($num) { $limit = "LIMIT $num"; } $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit"; $result = $wpdb->get_results($sql,ARRAY_A); return $result ? $result : array(); } /** * Retrieve a single post, based on post ID. * * Has categories in 'post_category' property or key. Has tags in 'tags_input' * property or key. * * @since 1.0.0 * * @param int $postid Post ID. * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. * @return object|array Post object or array holding post contents and information */ function wp_get_single_post($postid = 0, $mode = OBJECT) { $postid = (int) $postid; $post = get_post($postid, $mode); // Set categories and tags if($mode == OBJECT) { $post->post_category = wp_get_post_categories($postid); $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names')); } else { $post['post_category'] = wp_get_post_categories($postid); $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names')); } return $post; } /** * Insert a post. * * If the $postarr parameter has 'ID' set to a value, then post will be updated. * * You can set the post date manually, but setting the values for 'post_date' * and 'post_date_gmt' keys. You can close the comments or open the comments by * setting the value for 'comment_status' key. * * The defaults for the parameter $postarr are: * 'post_status' - Default is 'draft'. * 'post_type' - Default is 'post'. * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. * 'ping_status' - Default is the value in 'default_ping_status' option. * Whether the attachment can accept pings. * 'post_parent' - Default is 0. Set this for the post it belongs to, if any. * 'menu_order' - Default is 0. The order it is displayed. * 'to_ping' - Whether to ping. * 'pinged' - Default is empty string. * 'post_password' - Default is empty string. The password to access the attachment. * 'guid' - Global Unique ID for referencing the attachment. * 'post_content_filtered' - Post content filtered. * 'post_excerpt' - Post excerpt. * * @since 1.0.0 * @link http://core.trac.wordpress.org/ticket/9084 Bug report on 'wp_insert_post_data' filter. * @uses $wpdb * @uses $wp_rewrite * @uses $user_ID * * @uses do_action() Calls 'pre_post_update' on post ID if this is an update. * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update. * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before * returning. * * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database * update or insert. * @uses wp_transition_post_status() * * @param array $postarr Optional. Overrides defaults. * @param bool $wp_error Optional. Allow return of WP_Error on failure. * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. */ function wp_insert_post($postarr = array(), $wp_error = false) { global $wpdb, $wp_rewrite, $user_ID; $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0); $postarr = wp_parse_args($postarr, $defaults); $postarr = sanitize_post($postarr, 'db'); // export array as variables extract($postarr, EXTR_SKIP); // Are we updating or creating? $update = false; if ( !empty($ID) ) { $update = true; $previous_status = get_post_field('post_status', $ID); } else { $previous_status = 'new'; } if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) { if ( $wp_error ) return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); else return 0; } // Make sure we set a valid category if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { $post_category = array(get_option('default_category')); } //Set the default tag list if ( !isset($tags_input) ) $tags_input = array(); if ( empty($post_author) ) $post_author = $user_ID; if ( empty($post_status) ) $post_status = 'draft'; if ( empty($post_type) ) $post_type = 'post'; $post_ID = 0; // Get the post ID and GUID if ( $update ) { $post_ID = (int) $ID; $guid = get_post_field( 'guid', $post_ID ); } // Don't allow contributors to set to set the post slug for pending review posts if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) ) $post_name = ''; // Create a valid post name. Drafts and pending posts are allowed to have an empty // post name. if ( !isset($post_name) || empty($post_name) ) { if ( !in_array( $post_status, array( 'draft', 'pending' ) ) ) $post_name = sanitize_title($post_title); else $post_name = ''; } else { $post_name = sanitize_title($post_name); } // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) $post_date = current_time('mysql'); if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) { if ( !in_array( $post_status, array( 'draft', 'pending' ) ) ) $post_date_gmt = get_gmt_from_date($post_date); else $post_date_gmt = '0000-00-00 00:00:00'; } if ( $update || '0000-00-00 00:00:00' == $post_date ) { $post_modified = current_time( 'mysql' ); $post_modified_gmt = current_time( 'mysql', 1 ); } else { $post_modified = $post_date; $post_modified_gmt = $post_date_gmt; } if ( 'publish' == $post_status ) { $now = gmdate('Y-m-d H:i:59'); if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) $post_status = 'future'; } if ( empty($comment_status) ) { if ( $update ) $comment_status = 'closed'; else $comment_status = get_option('default_comment_status'); } if ( empty($ping_status) ) $ping_status = get_option('default_ping_status'); if ( isset($to_ping) ) $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; if ( ! isset($pinged) ) $pinged = ''; if ( isset($post_parent) ) $post_parent = (int) $post_parent; else $post_parent = 0; if ( !empty($post_ID) ) { if ( $post_parent == $post_ID ) { // Post can't be its own parent $post_parent = 0; } elseif ( !empty($post_parent) ) { $parent_post = get_post($post_parent); // Check for circular dependency if ( $parent_post->post_parent == $post_ID ) $post_parent = 0; } } if ( isset($menu_order) ) $menu_order = (int) $menu_order; else $menu_order = 0; if ( !isset($post_password) || 'private' == $post_status ) $post_password = ''; $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); // expected_slashed (everything!) $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) ); $data = apply_filters('wp_insert_post_data', $data, $postarr); $data = stripslashes_deep( $data ); $where = array( 'ID' => $post_ID ); if ($update) { do_action( 'pre_post_update', $post_ID ); if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { if ( $wp_error ) return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error); else return 0; } } else { if ( isset($post_mime_type) ) $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update // If there is a suggested ID, use it if not already present if ( !empty($import_id) ) { $import_id = (int) $import_id; if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) { $data['ID'] = $import_id; } } if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { if ( $wp_error ) return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error); else return 0; } $post_ID = (int) $wpdb->insert_id; // use the newly generated $post_ID $where = array( 'ID' => $post_ID ); } if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending' ) ) ) { $data['post_name'] = sanitize_title($data['post_title'], $post_ID); $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); } wp_set_post_categories( $post_ID, $post_category ); // old-style tags_input if ( !empty($tags_input) ) wp_set_post_tags( $post_ID, $tags_input ); // new-style support for all tag-like taxonomies if ( !empty($tax_input) ) { foreach ( $tax_input as $taxonomy => $tags ) { wp_set_post_terms( $post_ID, $tags, $taxonomy ); } } $current_guid = get_post_field( 'guid', $post_ID ); if ( 'page' == $data['post_type'] ) clean_page_cache($post_ID); else clean_post_cache($post_ID); // Set GUID if ( !$update && '' == $current_guid ) $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where ); $post = get_post($post_ID); if ( !empty($page_template) && 'page' == $data['post_type'] ) { $post->page_template = $page_template; $page_templates = get_page_templates(); if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) { if ( $wp_error ) return new WP_Error('invalid_page_template', __('The page template is invalid.')); else return 0; } update_post_meta($post_ID, '_wp_page_template', $page_template); } wp_transition_post_status($data['post_status'], $previous_status, $post); if ( $update) do_action('edit_post', $post_ID, $post); do_action('save_post', $post_ID, $post); do_action('wp_insert_post', $post_ID, $post); return $post_ID; } /** * Update a post with new post data. * * The date does not have to be set for drafts. You can set the date and it will * not be overridden. * * @since 1.0.0 * * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not. * @return int 0 on failure, Post ID on success. */ function wp_update_post($postarr = array()) { if ( is_object($postarr) ) { // non-escaped post was passed $postarr = get_object_vars($postarr); $postarr = add_magic_quotes($postarr); } // First, get all of the original fields $post = wp_get_single_post($postarr['ID'], ARRAY_A); // Escape data pulled from DB. $post = add_magic_quotes($post); // Passed post category list overwrites existing category list if not empty. if ( isset($postarr['post_category']) && is_array($postarr['post_category']) && 0 != count($postarr['post_category']) ) $post_cats = $postarr['post_category']; else $post_cats = $post['post_category']; // Drafts shouldn't be assigned a date unless explicitly done so by the user if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && ('0000-00-00 00:00:00' == $post['post_date_gmt']) ) $clear_date = true; else $clear_date = false; // Merge old and new fields with new fields overwriting old ones. $postarr = array_merge($post, $postarr); $postarr['post_category'] = $post_cats; if ( $clear_date ) { $postarr['post_date'] = current_time('mysql'); $postarr['post_date_gmt'] = ''; } if ($postarr['post_type'] == 'attachment') return wp_insert_attachment($postarr); return wp_insert_post($postarr); } /** * Publish a post by transitioning the post status. * * @since 2.1.0 * @uses $wpdb * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data. * * @param int $post_id Post ID. * @return null */ function wp_publish_post($post_id) { global $wpdb; $post = get_post($post_id); if ( empty($post) ) return; if ( 'publish' == $post->post_status ) return; $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post_id ) ); $old_status = $post->post_status; $post->post_status = 'publish'; wp_transition_post_status('publish', $old_status, $post); // Update counts for the post's terms. foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); wp_update_term_count($tt_ids, $taxonomy); } do_action('edit_post', $post_id, $post); do_action('save_post', $post_id, $post); do_action('wp_insert_post', $post_id, $post); } /** * Publish future post and make sure post ID has future post status. * * Invoked by cron 'publish_future_post' event. This safeguard prevents cron * from publishing drafts, etc. * * @since 2.5.0 * * @param int $post_id Post ID. * @return null Nothing is returned. Which can mean that no action is required or post was published. */ function check_and_publish_future_post($post_id) { $post = get_post($post_id); if ( empty($post) ) return; if ( 'future' != $post->post_status ) return; $time = strtotime( $post->post_date_gmt . ' GMT' ); if ( $time > time() ) { // Uh oh, someone jumped the gun! wp_clear_scheduled_hook( 'publish_future_post', $post_id ); // clear anything else in the system wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) ); return; } return wp_publish_post($post_id); } /** * Given the desired slug and some post details computes a unique slug for the post. * * @param string $slug the desired slug (post_name) * @param integer $post_ID * @param string $post_status no uniqueness checks are made if the post is still draft or pending * @param string $post_type * @param integer $post_parent * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) */ function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) { if ( in_array( $post_status, array( 'draft', 'pending' ) ) ) return $slug; global $wpdb, $wp_rewrite; $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page')); if ( 'attachment' == $post_type ) { // Attachment slugs must be unique across all types. $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID)); if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { $suffix = 2; do { $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID)); $suffix++; } while ($post_name_check); $slug = $alt_post_name; } } elseif ( in_array($post_type, $hierarchical_post_types) ) { // Page slugs must be unique within their own trees. Pages are in a // separate namespace than posts so page slugs are allowed to overlap post slugs. $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { $suffix = 2; do { $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID, $post_parent)); $suffix++; } while ($post_name_check); $slug = $alt_post_name; } } else { // Post slugs must be unique across all posts. $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID)); if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { $suffix = 2; do { $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID)); $suffix++; } while ($post_name_check); $slug = $alt_post_name; } } return $slug; } /** * Adds tags to a post. * * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true. * * @package WordPress * @subpackage Post * @since 2.3.0 * * @param int $post_id Post ID * @param string $tags The tags to set for the post, separated by commas. * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise */ function wp_add_post_tags($post_id = 0, $tags = '') { return wp_set_post_tags($post_id, $tags, true); } /** * Set the tags for a post. * * @since 2.3.0 * @uses wp_set_object_terms() Sets the tags for the post. * * @param int $post_id Post ID. * @param string $tags The tags to set for the post, separated by commas. * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise */ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { return wp_set_post_terms( $post_id, $tags, 'post_tag', $append); } /** * Set the terms for a post. * * @since 2.8.0 * @uses wp_set_object_terms() Sets the tags for the post. * * @param int $post_id Post ID. * @param string $tags The tags to set for the post, separated by commas. * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise */ function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { $post_id = (int) $post_id; if ( !$post_id ) return false; if ( empty($tags) ) $tags = array(); $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); wp_set_object_terms($post_id, $tags, $taxonomy, $append); } /** * Set categories for a post. * * If the post categories parameter is not set, then the default category is * going used. * * @since 2.1.0 * * @param int $post_ID Post ID. * @param array $post_categories Optional. List of categories. * @return bool|mixed */ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { $post_ID = (int) $post_ID; // If $post_categories isn't already an array, make it one: if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) $post_categories = array(get_option('default_category')); else if ( 1 == count($post_categories) && '' == $post_categories[0] ) return true; $post_categories = array_map('intval', $post_categories); $post_categories = array_unique($post_categories); return wp_set_object_terms($post_ID, $post_categories, 'category'); } /** * Transition the post status of a post. * * Calls hooks to transition post status. * * The first is 'transition_post_status' with new status, old status, and post data. * * The next action called is 'OLDSTATUS_to_NEWSTATUS' the 'NEWSTATUS' is the * $new_status parameter and the 'OLDSTATUS' is $old_status parameter; it has the * post data. * * The final action is named 'NEWSTATUS_POSTTYPE', 'NEWSTATUS' is from the $new_status * parameter and POSTTYPE is post_type post data. * * @since 2.3.0 * @link http://codex.wordpress.org/Post_Status_Transitions * * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and * $post if there is a status change. * @uses do_action() Calls '${old_status}_to_$new_status' on $post if there is a status change. * @uses do_action() Calls '${new_status}_$post->post_type' on post ID and $post. * * @param string $new_status Transition to this post status. * @param string $old_status Previous post status. * @param object $post Post data. */ function wp_transition_post_status($new_status, $old_status, $post) { do_action('transition_post_status', $new_status, $old_status, $post); do_action("${old_status}_to_$new_status", $post); do_action("${new_status}_$post->post_type", $post->ID, $post); } // // Trackback and ping functions // /** * Add a URL to those already pung. * * @since 1.5.0 * @uses $wpdb * * @param int $post_id Post ID. * @param string $uri Ping URI. * @return int How many rows were updated. */ function add_ping($post_id, $uri) { global $wpdb; $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); $pung = trim($pung); $pung = preg_split('/\s/', $pung); $pung[] = $uri; $new = implode("\n", $pung); $new = apply_filters('add_ping', $new); // expected_slashed ($new) $new = stripslashes($new); return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) ); } /** * Retrieve enclosures already enclosed for a post. * * @since 1.5.0 * @uses $wpdb * * @param int $post_id Post ID. * @return array List of enclosures */ function get_enclosed($post_id) { $custom_fields = get_post_custom( $post_id ); $pung = array(); if ( !is_array( $custom_fields ) ) return $pung; foreach ( $custom_fields as $key => $val ) { if ( 'enclosure' != $key || !is_array( $val ) ) continue; foreach( $val as $enc ) { $enclosure = split( "\n", $enc ); $pung[] = trim( $enclosure[ 0 ] ); } } $pung = apply_filters('get_enclosed', $pung); return $pung; } /** * Retrieve URLs already pinged for a post. * * @since 1.5.0 * @uses $wpdb * * @param int $post_id Post ID. * @return array */ function get_pung($post_id) { global $wpdb; $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); $pung = trim($pung); $pung = preg_split('/\s/', $pung); $pung = apply_filters('get_pung', $pung); return $pung; } /** * Retrieve URLs that need to be pinged. * * @since 1.5.0 * @uses $wpdb * * @param int $post_id Post ID * @return array */ function get_to_ping($post_id) { global $wpdb; $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); $to_ping = trim($to_ping); $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY); $to_ping = apply_filters('get_to_ping', $to_ping); return $to_ping; } /** * Do trackbacks for a list of URLs. * * @since 1.0.0 * * @param string $tb_list Comma separated list of URLs * @param int $post_id Post ID */ function trackback_url_list($tb_list, $post_id) { if ( ! empty( $tb_list ) ) { // get post data $postdata = wp_get_single_post($post_id, ARRAY_A); // import postdata as variables extract($postdata, EXTR_SKIP); // form an excerpt $excerpt = strip_tags($post_excerpt ? $post_excerpt : $post_content); if (strlen($excerpt) > 255) { $excerpt = substr($excerpt,0,252) . '...'; } $trackback_urls = explode(',', $tb_list); foreach( (array) $trackback_urls as $tb_url) { $tb_url = trim($tb_url); trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); } } } // // Page functions // /** * Get a list of page IDs. * * @since 2.0.0 * @uses $wpdb * * @return array List of page IDs. */ function get_all_page_ids() { global $wpdb; if ( ! $page_ids = wp_cache_get('all_page_ids', 'posts') ) { $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); wp_cache_add('all_page_ids', $page_ids, 'posts'); } return $page_ids; } /** * Retrieves page data given a page ID or page object. * * @since 1.5.1 * * @param mixed $page Page object or page ID. Passed by reference. * @param string $output What to output. OBJECT, ARRAY_A, or ARRAY_N. * @param string $filter How the return value should be filtered. * @return mixed Page data. */ function &get_page(&$page, $output = OBJECT, $filter = 'raw') { if ( empty($page) ) { if ( isset( $GLOBALS['page'] ) && isset( $GLOBALS['page']->ID ) ) { return get_post($GLOBALS['page'], $output, $filter); } else { $page = null; return $page; } } $the_page = get_post($page, $output, $filter); return $the_page; } /** * Retrieves a page given its path. * * @since 2.1.0 * @uses $wpdb * * @param string $page_path Page path * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. * @return mixed Null when complete. */ function get_page_by_path($page_path, $output = OBJECT) { global $wpdb; $page_path = rawurlencode(urldecode($page_path)); $page_path = str_replace('%2F', '/', $page_path); $page_path = str_replace('%20', ' ', $page_path); $page_paths = '/' . trim($page_path, '/'); $leaf_path = sanitize_title(basename($page_paths)); $page_paths = explode('/', $page_paths); $full_path = ''; foreach( (array) $page_paths as $pathdir) $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = 'page' OR post_type = 'attachment')", $leaf_path )); if ( empty($pages) ) return null; foreach ($pages as $page) { $path = '/' . $leaf_path; $curpage = $page; while ($curpage->post_parent != 0) { $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type='page'", $curpage->post_parent )); $path = '/' . $curpage->post_name . $path; } if ( $path == $full_path ) return get_page($page->ID, $output); } return null; } /** * Retrieve a page given its title. * * @since 2.1.0 * @uses $wpdb * * @param string $page_title Page title * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. * @return mixed */ function get_page_by_title($page_title, $output = OBJECT) { global $wpdb; $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='page'", $page_title )); if ( $page ) return get_page($page, $output); return null; } /** * Retrieve child pages from list of pages matching page ID. * * Matches against the pages parameter against the page ID. Also matches all * children for the same to retrieve all children of a page. Does not make any * SQL queries to get the children. * * @since 1.5.1 * * @param int $page_id Page ID. * @param array $pages List of pages' objects. * @return array */ function &get_page_children($page_id, $pages) { $page_list = array(); foreach ( (array) $pages as $page ) { if ( $page->post_parent == $page_id ) { $page_list[] = $page; if ( $children = get_page_children($page->ID, $pages) ) $page_list = array_merge($page_list, $children); } } return $page_list; } /** * Order the pages with children under parents in a flat list. * * @since 2.0.0 * * @param array $posts Posts array. * @param int $parent Parent page ID. * @return array A list arranged by hierarchy. Children immediately follow their parents. */ function get_page_hierarchy($posts, $parent = 0) { $result = array ( ); if ($posts) { foreach ( (array) $posts as $post) { if ($post->post_parent == $parent) { $result[$post->ID] = $post->post_name; $children = get_page_hierarchy($posts, $post->ID); $result += $children; //append $children to $result } } } return $result; } /** * Builds URI for a page. * * Sub pages will be in the "directory" under the parent page post name. * * @since 1.5.0 * * @param int $page_id Page ID. * @return string Page URI. */ function get_page_uri($page_id) { $page = get_page($page_id); $uri = $page->post_name; // A page cannot be it's own parent. if ( $page->post_parent == $page->ID ) return $uri; while ($page->post_parent != 0) { $page = get_page($page->post_parent); $uri = $page->post_name . "/" . $uri; } return $uri; } /** * Retrieve a list of pages. * * The defaults that can be overridden are the following: 'child_of', * 'sort_order', 'sort_column', 'post_title', 'hierarchical', 'exclude', * 'include', 'meta_key', 'meta_value','authors', 'number', and 'offset'. * * @since 1.5.0 * @uses $wpdb * * @param mixed $args Optional. Array or string of options that overrides defaults. * @return array List of pages matching defaults or $args */ function &get_pages($args = '') { global $wpdb; $defaults = array( 'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0 ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); $number = (int) $number; $offset = (int) $offset; $cache = array(); $key = md5( serialize( compact(array_keys($defaults)) ) ); if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { if ( is_array($cache) && isset( $cache[ $key ] ) ) { $pages = apply_filters('get_pages', $cache[ $key ], $r ); return $pages; } } if ( !is_array($cache) ) $cache = array(); $inclusions = ''; if ( !empty($include) ) { $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include $parent = -1; $exclude = ''; $meta_key = ''; $meta_value = ''; $hierarchical = false; $incpages = preg_split('/[\s,]+/',$include); if ( count($incpages) ) { foreach ( $incpages as $incpage ) { if (empty($inclusions)) $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage); else $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage); } } } if (!empty($inclusions)) $inclusions .= ')'; $exclusions = ''; if ( !empty($exclude) ) { $expages = preg_split('/[\s,]+/',$exclude); if ( count($expages) ) { foreach ( $expages as $expage ) { if (empty($exclusions)) $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage); else $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage); } } } if (!empty($exclusions)) $exclusions .= ')'; $author_query = ''; if (!empty($authors)) { $post_authors = preg_split('/[\s,]+/',$authors); if ( count($post_authors) ) { foreach ( $post_authors as $post_author ) { //Do we have an author id or an author login? if ( 0 == intval($post_author) ) { $post_author = get_userdatabylogin($post_author); if ( empty($post_author) ) continue; if ( empty($post_author->ID) ) continue; $post_author = $post_author->ID; } if ( '' == $author_query ) $author_query = $wpdb->prepare(' post_author = %d ', $post_author); else $author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author); } if ( '' != $author_query ) $author_query = " AND ($author_query)"; } } $join = ''; $where = "$exclusions $inclusions "; if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) { $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; // meta_key and meta_value might be slashed $meta_key = stripslashes($meta_key); $meta_value = stripslashes($meta_value); if ( ! empty( $meta_key ) ) $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key); if ( ! empty( $meta_value ) ) $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value); } if ( $parent >= 0 ) $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where "; $query .= $author_query; $query .= " ORDER BY " . $sort_column . " " . $sort_order ; if ( !empty($number) ) $query .= ' LIMIT ' . $offset . ',' . $number; $pages = $wpdb->get_results($query); if ( empty($pages) ) { $pages = apply_filters('get_pages', array(), $r); return $pages; } // Update cache. update_page_cache($pages); if ( $child_of || $hierarchical ) $pages = & get_page_children($child_of, $pages); if ( !empty($exclude_tree) ) { $exclude = array(); $exclude = (int) $exclude_tree; $children = get_page_children($exclude, $pages); $excludes = array(); foreach ( $children as $child ) $excludes[] = $child->ID; $excludes[] = $exclude; $total = count($pages); for ( $i = 0; $i < $total; $i++ ) { if ( in_array($pages[$i]->ID, $excludes) ) unset($pages[$i]); } } $cache[ $key ] = $pages; wp_cache_set( 'get_pages', $cache, 'posts' ); $pages = apply_filters('get_pages', $pages, $r); return $pages; } // // Attachment functions // /** * Check if the attachment URI is local one and is really an attachment. * * @since 2.0.0 * * @param string $url URL to check * @return bool True on success, false on failure. */ function is_local_attachment($url) { if (strpos($url, get_bloginfo('url')) === false) return false; if (strpos($url, get_bloginfo('url') . '/?attachment_id=') !== false) return true; if ( $id = url_to_postid($url) ) { $post = & get_post($id); if ( 'attachment' == $post->post_type ) return true; } return false; } /** * Insert an attachment. * * If you set the 'ID' in the $object parameter, it will mean that you are * updating and attempt to update the attachment. You can also set the * attachment name or title by setting the key 'post_name' or 'post_title'. * * You can set the dates for the attachment manually by setting the 'post_date' * and 'post_date_gmt' keys' values. * * By default, the comments will use the default settings for whether the * comments are allowed. You can close them manually or keep them open by * setting the value for the 'comment_status' key. * * The $object parameter can have the following: * 'post_status' - Default is 'draft'. Can not be overridden, set the same as parent post. * 'post_type' - Default is 'post', will be set to attachment. Can not override. * 'post_author' - Default is current user ID. The ID of the user, who added the attachment. * 'ping_status' - Default is the value in default ping status option. Whether the attachment * can accept pings. * 'post_parent' - Default is 0. Can use $parent parameter or set this for the post it belongs * to, if any. * 'menu_order' - Default is 0. The order it is displayed. * 'to_ping' - Whether to ping. * 'pinged' - Default is empty string. * 'post_password' - Default is empty string. The password to access the attachment. * 'guid' - Global Unique ID for referencing the attachment. * 'post_content_filtered' - Attachment post content filtered. * 'post_excerpt' - Attachment excerpt. * * @since 2.0.0 * @uses $wpdb * @uses $user_ID * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. * * @param string|array $object Arguments to override defaults. * @param string $file Optional filename. * @param int $post_parent Parent post ID. * @return int Attachment ID. */ function wp_insert_attachment($object, $file = false, $parent = 0) { global $wpdb, $user_ID; $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0); $object = wp_parse_args($object, $defaults); if ( !empty($parent) ) $object['post_parent'] = $parent; $object = sanitize_post($object, 'db'); // export array as variables extract($object, EXTR_SKIP); // Make sure we set a valid category if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) { $post_category = array(get_option('default_category')); } if ( empty($post_author) ) $post_author = $user_ID; $post_type = 'attachment'; $post_status = 'inherit'; // Are we updating or creating? if ( !empty($ID) ) { $update = true; $post_ID = (int) $ID; } else { $update = false; $post_ID = 0; } // Create a valid post name. if ( empty($post_name) ) $post_name = sanitize_title($post_title); else $post_name = sanitize_title($post_name); // expected_slashed ($post_name) $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); if ( empty($post_date) ) $post_date = current_time('mysql'); if ( empty($post_date_gmt) ) $post_date_gmt = current_time('mysql', 1); if ( empty($post_modified) ) $post_modified = $post_date; if ( empty($post_modified_gmt) ) $post_modified_gmt = $post_date_gmt; if ( empty($comment_status) ) { if ( $update ) $comment_status = 'closed'; else $comment_status = get_option('default_comment_status'); } if ( empty($ping_status) ) $ping_status = get_option('default_ping_status'); if ( isset($to_ping) ) $to_ping = preg_replace('|\s+|', "\n", $to_ping); else $to_ping = ''; if ( isset($post_parent) ) $post_parent = (int) $post_parent; else $post_parent = 0; if ( isset($menu_order) ) $menu_order = (int) $menu_order; else $menu_order = 0; if ( !isset($post_password) ) $post_password = ''; if ( ! isset($pinged) ) $pinged = ''; // expected_slashed (everything!) $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) ); $data = stripslashes_deep( $data ); if ( $update ) { $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) ); } else { // If there is a suggested ID, use it if not already present if ( !empty($import_id) ) { $import_id = (int) $import_id; if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) { $data['ID'] = $import_id; } } $wpdb->insert( $wpdb->posts, $data ); $post_ID = (int) $wpdb->insert_id; } if ( empty($post_name) ) { $post_name = sanitize_title($post_title, $post_ID); $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) ); } wp_set_post_categories($post_ID, $post_category); if ( $file ) update_attached_file( $post_ID, $file ); clean_post_cache($post_ID); if ( $update) { do_action('edit_attachment', $post_ID); } else { do_action('add_attachment', $post_ID); } return $post_ID; } /** * Delete an attachment. * * Will remove the file also, when the attachment is removed. Removes all post * meta fields, taxonomy, comments, etc associated with the attachment (except * the main post). * * @since 2.0.0 * @uses $wpdb * @uses do_action() Calls 'delete_attachment' hook on Attachment ID. * * @param int $postid Attachment ID. * @return mixed False on failure. Post data on success. */ function wp_delete_attachment($postid) { global $wpdb; if ( !$post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) return $post; if ( 'attachment' != $post->post_type ) return false; $meta = wp_get_attachment_metadata( $postid ); $file = get_attached_file( $postid ); do_action('delete_attachment', $postid); /** @todo Delete for pluggable post taxonomies too */ wp_delete_object_term_relationships($postid, array('category', 'post_tag')); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); $uploadPath = wp_upload_dir(); if ( ! empty($meta['thumb']) ) { // Don't delete the thumb if another attachment uses it if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['thumb'].'%', $postid)) ) { $thumbfile = str_replace(basename($file), $meta['thumb'], $file); $thumbfile = apply_filters('wp_delete_file', $thumbfile); @ unlink( path_join($uploadPath['basedir'], $thumbfile) ); } } // remove intermediate images if there are any $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large')); foreach ( $sizes as $size ) { if ( $intermediate = image_get_intermediate_size($postid, $size) ) { $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); @ unlink( path_join($uploadPath['basedir'], $intermediate_file) ); } } $file = apply_filters('wp_delete_file', $file); if ( ! empty($file) ) @ unlink($file); clean_post_cache($postid); return $post; } /** * Retrieve attachment meta field for attachment ID. * * @since 2.1.0 * * @param int $post_id Attachment ID * @param bool $unfiltered Optional, default is false. If true, filters are not run. * @return string|bool Attachment meta field. False on failure. */ function wp_get_attachment_metadata( $post_id, $unfiltered = false ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); if ( $unfiltered ) return $data; return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); } /** * Update metadata for an attachment. * * @since 2.1.0 * * @param int $post_id Attachment ID. * @param array $data Attachment data. * @return int */ function wp_update_attachment_metadata( $post_id, $data ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); return update_post_meta( $post->ID, '_wp_attachment_metadata', $data); } /** * Retrieve the URL for an attachment. * * @since 2.1.0 * * @param int $post_id Attachment ID. * @return string */ function wp_get_attachment_url( $post_id = 0 ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; $url = ''; if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) { //Get attached file if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location elseif ( false !== strpos($file, 'wp-content/uploads') ) $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 ); else $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir. } } if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this. $url = get_the_guid( $post->ID ); if ( 'attachment' != $post->post_type || empty($url) ) return false; return apply_filters( 'wp_get_attachment_url', $url, $post->ID ); } /** * Retrieve thumbnail for an attachment. * * @since 2.1.0 * * @param int $post_id Attachment ID. * @return mixed False on failure. Thumbnail file path on success. */ function wp_get_attachment_thumb_file( $post_id = 0 ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) ) return false; $file = get_attached_file( $post->ID ); if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); return false; } /** * Retrieve URL for an attachment thumbnail. * * @since 2.1.0 * * @param int $post_id Attachment ID * @return string|bool False on failure. Thumbnail URL on success. */ function wp_get_attachment_thumb_url( $post_id = 0 ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; if ( !$url = wp_get_attachment_url( $post->ID ) ) return false; $sized = image_downsize( $post_id, 'thumbnail' ); if ( $sized ) return $sized[0]; if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) ) return false; $url = str_replace(basename($url), basename($thumb), $url); return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); } /** * Check if the attachment is an image. * * @since 2.1.0 * * @param int $post_id Attachment ID * @return bool */ function wp_attachment_is_image( $post_id = 0 ) { $post_id = (int) $post_id; if ( !$post =& get_post( $post_id ) ) return false; if ( !$file = get_attached_file( $post->ID ) ) return false; $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false; $image_exts = array('jpg', 'jpeg', 'gif', 'png'); if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) ) return true; return false; } /** * Retrieve the icon for a MIME type. * * @since 2.1.0 * * @param string $mime MIME type * @return string|bool */ function wp_mime_type_icon( $mime = 0 ) { if ( !is_numeric($mime) ) $icon = wp_cache_get("mime_type_icon_$mime"); if ( empty($icon) ) { $post_id = 0; $post_mimes = array(); if ( is_numeric($mime) ) { $mime = (int) $mime; if ( $post =& get_post( $mime ) ) { $post_id = (int) $post->ID; $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid); if ( !empty($ext) ) { $post_mimes[] = $ext; if ( $ext_type = wp_ext2type( $ext ) ) $post_mimes[] = $ext_type; } $mime = $post->post_mime_type; } else { $mime = 0; } } else { $post_mimes[] = $mime; } $icon_files = wp_cache_get('icon_files'); if ( !is_array($icon_files) ) { $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') ); $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) ); $icon_files = array(); while ( $dirs ) { $dir = array_shift($keys = array_keys($dirs)); $uri = array_shift($dirs); if ( $dh = opendir($dir) ) { while ( false !== $file = readdir($dh) ) { $file = basename($file); if ( substr($file, 0, 1) == '.' ) continue; if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) { if ( is_dir("$dir/$file") ) $dirs["$dir/$file"] = "$uri/$file"; continue; } $icon_files["$dir/$file"] = "$uri/$file"; } closedir($dh); } } wp_cache_set('icon_files', $icon_files, 600); } // Icon basename - extension = MIME wildcard foreach ( $icon_files as $file => $uri ) $types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file]; if ( ! empty($mime) ) { $post_mimes[] = substr($mime, 0, strpos($mime, '/')); $post_mimes[] = substr($mime, strpos($mime, '/') + 1); $post_mimes[] = str_replace('/', '_', $mime); } $matches = wp_match_mime_types(array_keys($types), $post_mimes); $matches['default'] = array('default'); foreach ( $matches as $match => $wilds ) { if ( isset($types[$wilds[0]])) { $icon = $types[$wilds[0]]; if ( !is_numeric($mime) ) wp_cache_set("mime_type_icon_$mime", $icon); break; } } } return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id ); // Last arg is 0 if function pass mime type. } /** * Checked for changed slugs for published posts and save old slug. * * The function is used along with form POST data. It checks for the wp-old-slug * POST field. Will only be concerned with published posts and the slug actually * changing. * * If the slug was changed and not already part of the old slugs then it will be * added to the post meta field ('_wp_old_slug') for storing old slugs for that * post. * * The most logically usage of this function is redirecting changed posts, so * that those that linked to an changed post will be redirected to the new post. * * @since 2.1.0 * * @param int $post_id Post ID. * @return int Same as $post_id */ function wp_check_for_changed_slugs($post_id) { if ( !isset($_POST['wp-old-slug']) || !strlen($_POST['wp-old-slug']) ) return $post_id; $post = &get_post($post_id); // we're only concerned with published posts if ( $post->post_status != 'publish' || $post->post_type != 'post' ) return $post_id; // only bother if the slug has changed if ( $post->post_name == $_POST['wp-old-slug'] ) return $post_id; $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); // if we haven't added this old slug before, add it now if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) ) add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']); // if the new slug was used previously, delete it from the list if ( in_array($post->post_name, $old_slugs) ) delete_post_meta($post_id, '_wp_old_slug', $post->post_name); return $post_id; } /** * Retrieve the private post SQL based on capability. * * This function provides a standardized way to appropriately select on the * post_status of posts/pages. The function will return a piece of SQL code that * can be added to a WHERE clause; this SQL is constructed to allow all * published posts, and all private posts to which the user has access. * * It also allows plugins that define their own post type to control the cap by * using the hook 'pub_priv_sql_capability'. The plugin is expected to return * the capability the user must have to read the private post type. * * @since 2.2.0 * * @uses $user_ID * @uses apply_filters() Call 'pub_priv_sql_capability' filter for plugins with different post types. * * @param string $post_type currently only supports 'post' or 'page'. * @return string SQL code that can be added to a where clause. */ function get_private_posts_cap_sql($post_type) { global $user_ID; $cap = ''; // Private posts if ($post_type == 'post') { $cap = 'read_private_posts'; // Private pages } elseif ($post_type == 'page') { $cap = 'read_private_pages'; // Dunno what it is, maybe plugins have their own post type? } else { $cap = apply_filters('pub_priv_sql_capability', $cap); if (empty($cap)) { // We don't know what it is, filters don't change anything, // so set the SQL up to return nothing. return '1 = 0'; } } $sql = '(post_status = \'publish\''; if (current_user_can($cap)) { // Does the user have the capability to view private posts? Guess so. $sql .= ' OR post_status = \'private\''; } elseif (is_user_logged_in()) { // Users can view their own private posts. $sql .= ' OR post_status = \'private\' AND post_author = \'' . $user_ID . '\''; } $sql .= ')'; return $sql; } /** * Retrieve the date the the last post was published. * * The server timezone is the default and is the difference between GMT and * server time. The 'blog' value is the date when the last post was posted. The * 'gmt' is when the last post was posted in GMT formatted date. * * @since 0.71 * * @uses $wpdb * @uses $blog_id * @uses apply_filters() Calls 'get_lastpostdate' filter * * @global mixed $cache_lastpostdate Stores the last post date * @global mixed $pagenow The current page being viewed * * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. * @return string The date of the last post. */ function get_lastpostdate($timezone = 'server') { global $cache_lastpostdate, $wpdb, $blog_id; $add_seconds_server = date('Z'); if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) { switch(strtolower($timezone)) { case 'gmt': $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1"); break; case 'blog': $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1"); break; case 'server': $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1"); break; } $cache_lastpostdate[$blog_id][$timezone] = $lastpostdate; } else { $lastpostdate = $cache_lastpostdate[$blog_id][$timezone]; } return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone ); } /** * Retrieve last post modified date depending on timezone. * * The server timezone is the default and is the difference between GMT and * server time. The 'blog' value is just when the last post was modified. The * 'gmt' is when the last post was modified in GMT time. * * @since 1.2.0 * @uses $wpdb * @uses $blog_id * @uses apply_filters() Calls 'get_lastpostmodified' filter * * @global mixed $cache_lastpostmodified Stores the date the last post was modified * * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. * @return string The date the post was last modified. */ function get_lastpostmodified($timezone = 'server') { global $cache_lastpostmodified, $wpdb, $blog_id; $add_seconds_server = date('Z'); if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) { switch(strtolower($timezone)) { case 'gmt': $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1"); break; case 'blog': $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1"); break; case 'server': $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1"); break; } $lastpostdate = get_lastpostdate($timezone); if ( $lastpostdate > $lastpostmodified ) { $lastpostmodified = $lastpostdate; } $cache_lastpostmodified[$blog_id][$timezone] = $lastpostmodified; } else { $lastpostmodified = $cache_lastpostmodified[$blog_id][$timezone]; } return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone ); } /** * Updates posts in cache. * * @usedby update_page_cache() Aliased by this function. * * @package WordPress * @subpackage Cache * @since 1.5.1 * * @param array $posts Array of post objects */ function update_post_cache(&$posts) { if ( !$posts ) return; foreach ( $posts as $post ) wp_cache_add($post->ID, $post, 'posts'); } /** * Will clean the post in the cache. * * Cleaning means delete from the cache of the post. Will call to clean the term * object cache associated with the post ID. * * clean_post_cache() will call itself recursively for each child post. * * This function not run if $_wp_suspend_cache_invalidation is not empty. See * wp_suspend_cache_invalidation(). * * @package WordPress * @subpackage Cache * @since 2.0.0 * * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any). * * @param int $id The Post ID in the cache to clean */ function clean_post_cache($id) { global $_wp_suspend_cache_invalidation, $wpdb; if ( !empty($_wp_suspend_cache_invalidation) ) return; $id = (int) $id; wp_cache_delete($id, 'posts'); wp_cache_delete($id, 'post_meta'); clean_object_term_cache($id, 'post'); wp_cache_delete( 'wp_get_archives', 'general' ); do_action('clean_post_cache', $id); if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) { foreach( $children as $cid ) clean_post_cache( $cid ); } } /** * Alias of update_post_cache(). * * @see update_post_cache() Posts and pages are the same, alias is intentional * * @package WordPress * @subpackage Cache * @since 1.5.1 * * @param array $pages list of page objects */ function update_page_cache(&$pages) { update_post_cache($pages); } /** * Will clean the page in the cache. * * Clean (read: delete) page from cache that matches $id. Will also clean cache * associated with 'all_page_ids' and 'get_pages'. * * @package WordPress * @subpackage Cache * @since 2.0.0 * * @uses do_action() Will call the 'clean_page_cache' hook action. * * @param int $id Page ID to clean */ function clean_page_cache($id) { clean_post_cache($id); wp_cache_delete( 'all_page_ids', 'posts' ); wp_cache_delete( 'get_pages', 'posts' ); do_action('clean_page_cache', $id); } /** * Call major cache updating functions for list of Post objects. * * @package WordPress * @subpackage Cache * @since 1.5.0 * * @uses $wpdb * @uses update_post_cache() * @uses update_object_term_cache() * @uses update_postmeta_cache() * * @param array $posts Array of Post objects */ function update_post_caches(&$posts) { // No point in doing all this work if we didn't match any posts. if ( !$posts ) return; update_post_cache($posts); $post_ids = array(); for ($i = 0; $i < count($posts); $i++) $post_ids[] = $posts[$i]->ID; update_object_term_cache($post_ids, 'post'); update_postmeta_cache($post_ids); } /** * Updates metadata cache for list of post IDs. * * Performs SQL query to retrieve the metadata for the post IDs and updates the * metadata cache for the posts. Therefore, the functions, which call this * function, do not need to perform SQL queries on their own. * * @package WordPress * @subpackage Cache * @since 2.1.0 * * @uses $wpdb * * @param array $post_ids List of post IDs. * @return bool|array Returns false if there is nothing to update or an array of metadata. */ function update_postmeta_cache($post_ids) { global $wpdb; if ( empty( $post_ids ) ) return false; if ( !is_array($post_ids) ) { $post_ids = preg_replace('|[^0-9,]|', '', $post_ids); $post_ids = explode(',', $post_ids); } $post_ids = array_map('intval', $post_ids); $ids = array(); foreach ( (array) $post_ids as $id ) { if ( false === wp_cache_get($id, 'post_meta') ) $ids[] = $id; } if ( empty( $ids ) ) return false; // Get post-meta info $id_list = join(',', $ids); $cache = array(); if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN ($id_list)", ARRAY_A) ) { foreach ( (array) $meta_list as $metarow) { $mpid = (int) $metarow['post_id']; $mkey = $metarow['meta_key']; $mval = $metarow['meta_value']; // Force subkeys to be array type: if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) ) $cache[$mpid] = array(); if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) ) $cache[$mpid][$mkey] = array(); // Add a value to the current pid/key: $cache[$mpid][$mkey][] = $mval; } } foreach ( (array) $ids as $id ) { if ( ! isset($cache[$id]) ) $cache[$id] = array(); } foreach ( (array) array_keys($cache) as $post) wp_cache_set($post, $cache[$post], 'post_meta'); return $cache; } // // Hooks // /** * Hook for managing future post transitions to published. * * @since 2.3.0 * @access private * @uses $wpdb * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call. * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. * * @param string $new_status New post status * @param string $old_status Previous post status * @param object $post Object type containing the post information */ function _transition_post_status($new_status, $old_status, $post) { global $wpdb; if ( $old_status != 'publish' && $new_status == 'publish' ) { // Reset GUID if transitioning to publish and it is empty if ( '' == get_the_guid($post->ID) ) $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); do_action('private_to_published', $post->ID); // Deprecated, use private_to_publish // do generic pings once per hour at most if ( !wp_next_scheduled('do_generic_ping') ) wp_schedule_single_event(time() + 3600, 'do_generic_ping'); } // Always clears the hook in case the post status bounced from future to draft. wp_clear_scheduled_hook('publish_future_post', $post->ID); } /** * Hook used to schedule publication for a post marked for the future. * * The $post properties used and must exist are 'ID' and 'post_date_gmt'. * * @since 2.3.0 * @access private * * @param int $deprecated Not Used. Can be set to null. * @param object $post Object type containing the post information */ function _future_post_hook($deprecated = '', $post) { wp_clear_scheduled_hook( 'publish_future_post', $post->ID ); wp_schedule_single_event(strtotime($post->post_date_gmt. ' GMT'), 'publish_future_post', array($post->ID)); } /** * Hook to schedule pings and enclosures when a post is published. * * @since 2.3.0 * @access private * @uses $wpdb * @uses XMLRPC_REQUEST and APP_REQUEST constants. * @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined. * @uses do_action() Calls 'app_publish_post' on post ID if APP_REQUEST is defined. * * @param int $post_id The ID in the database table of the post being published */ function _publish_post_hook($post_id) { global $wpdb; if ( defined('XMLRPC_REQUEST') ) do_action('xmlrpc_publish_post', $post_id); if ( defined('APP_REQUEST') ) do_action('app_publish_post', $post_id); if ( defined('WP_IMPORTING') ) return; $data = array( 'post_id' => $post_id, 'meta_value' => '1' ); if ( get_option('default_pingback_flag') ) $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_pingme' ) ); $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_encloseme' ) ); wp_schedule_single_event(time(), 'do_pings'); } /** * Hook used to prevent page/post cache and rewrite rules from staying dirty. * * Does two things. If the post is a page and has a template then it will * update/add that template to the meta. For both pages and posts, it will clean * the post cache to make sure that the cache updates to the changes done * recently. For pages, the rewrite rules of WordPress are flushed to allow for * any changes. * * The $post parameter, only uses 'post_type' property and 'page_template' * property. * * @since 2.3.0 * @access private * @uses $wp_rewrite Flushes Rewrite Rules. * * @param int $post_id The ID in the database table for the $post * @param object $post Object type containing the post information */ function _save_post_hook($post_id, $post) { if ( $post->post_type == 'page' ) { clean_page_cache($post_id); // Avoid flushing rules for every post during import. if ( !defined('WP_IMPORTING') ) { global $wp_rewrite; $wp_rewrite->flush_rules(); } } else { clean_post_cache($post_id); } } /** * Retrieve post ancestors and append to post ancestors property. * * Will only retrieve ancestors once, if property is already set, then nothing * will be done. If there is not a parent post, or post ID and post parent ID * are the same then nothing will be done. * * The parameter is passed by reference, so nothing needs to be returned. The * property will be updated and can be referenced after the function is * complete. The post parent will be an ancestor and the parent of the post * parent will be an ancestor. There will only be two ancestors at the most. * * @since unknown * @access private * @uses $wpdb * * @param object $_post Post data. * @return null When nothing needs to be done. */ function _get_post_ancestors(&$_post) { global $wpdb; if ( isset($_post->ancestors) ) return; $_post->ancestors = array(); if ( empty($_post->post_parent) || $_post->ID == $_post->post_parent ) return; $id = $_post->ancestors[] = $_post->post_parent; while ( $ancestor = $wpdb->get_var( $wpdb->prepare("SELECT `post_parent` FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id) ) ) { if ( $id == $ancestor ) break; $id = $_post->ancestors[] = $ancestor; } } /** * Determines which fields of posts are to be saved in revisions. * * Does two things. If passed a post *array*, it will return a post array ready * to be insterted into the posts table as a post revision. Otherwise, returns * an array whose keys are the post fields to be saved for post revisions. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * @access private * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields. * * @param array $post Optional a post array to be processed for insertion as a post revision. * @param bool $autosave optional Is the revision an autosave? * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned. */ function _wp_post_revision_fields( $post = null, $autosave = false ) { static $fields = false; if ( !$fields ) { // Allow these to be versioned $fields = array( 'post_title' => __( 'Title' ), 'post_content' => __( 'Content' ), 'post_excerpt' => __( 'Excerpt' ), ); // Runs only once $fields = apply_filters( '_wp_post_revision_fields', $fields ); // WP uses these internally either in versioning or elsewhere - they cannot be versioned foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) unset( $fields[$protect] ); } if ( !is_array($post) ) return $fields; $return = array(); foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) $return[$field] = $post[$field]; $return['post_parent'] = $post['ID']; $return['post_status'] = 'inherit'; $return['post_type'] = 'revision'; $return['post_name'] = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision"; $return['post_date'] = isset($post['post_modified']) ? $post['post_modified'] : ''; $return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : ''; return $return; } /** * Saves an already existing post as a post revision. * * Typically used immediately prior to post updates. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses _wp_put_post_revision() * * @param int $post_id The ID of the post to save as a revision. * @return mixed Null or 0 if error, new revision ID, if success. */ function wp_save_post_revision( $post_id ) { // We do autosaves manually with wp_create_post_autosave() if ( @constant( 'DOING_AUTOSAVE' ) ) return; // WP_POST_REVISIONS = 0, false if ( !constant('WP_POST_REVISIONS') ) return; if ( !$post = get_post( $post_id, ARRAY_A ) ) return; if ( !in_array( $post['post_type'], array( 'post', 'page' ) ) ) return; $return = _wp_put_post_revision( $post ); // WP_POST_REVISIONS = true (default), -1 if ( !is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 ) return $return; // all revisions and (possibly) one autosave $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); // WP_POST_REVISIONS = (int) (# of autasaves to save) $delete = count($revisions) - WP_POST_REVISIONS; if ( $delete < 1 ) return $return; $revisions = array_slice( $revisions, 0, $delete ); for ( $i = 0; isset($revisions[$i]); $i++ ) { if ( false !== strpos( $revisions[$i]->post_name, 'autosave' ) ) continue; wp_delete_post_revision( $revisions[$i]->ID ); } return $return; } /** * Retrieve the autosaved data of the specified post. * * Returns a post object containing the information that was autosaved for the * specified post. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param int $post_id The post ID. * @return object|bool The autosaved data or false on failure or when no autosave exists. */ function wp_get_post_autosave( $post_id ) { if ( !$post = get_post( $post_id ) ) return false; $q = array( 'name' => "{$post->ID}-autosave", 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ); // Use WP_Query so that the result gets cached $autosave_query = new WP_Query; add_action( 'parse_query', '_wp_get_post_autosave_hack' ); $autosave = $autosave_query->query( $q ); remove_action( 'parse_query', '_wp_get_post_autosave_hack' ); if ( $autosave && is_array($autosave) && is_object($autosave[0]) ) return $autosave[0]; return false; } /** * Internally used to hack WP_Query into submission. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param object $query WP_Query object */ function _wp_get_post_autosave_hack( $query ) { $query->is_single = false; } /** * Determines if the specified post is a revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param int|object $post Post ID or post object. * @return bool|int False if not a revision, ID of revision's parent otherwise. */ function wp_is_post_revision( $post ) { if ( !$post = wp_get_post_revision( $post ) ) return false; return (int) $post->post_parent; } /** * Determines if the specified post is an autosave. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param int|object $post Post ID or post object. * @return bool|int False if not a revision, ID of autosave's parent otherwise */ function wp_is_post_autosave( $post ) { if ( !$post = wp_get_post_revision( $post ) ) return false; if ( "{$post->post_parent}-autosave" !== $post->post_name ) return false; return (int) $post->post_parent; } /** * Inserts post data into the posts table as a post revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses wp_insert_post() * * @param int|object|array $post Post ID, post object OR post array. * @param bool $autosave Optional. Is the revision an autosave? * @return mixed Null or 0 if error, new revision ID if success. */ function _wp_put_post_revision( $post = null, $autosave = false ) { if ( is_object($post) ) $post = get_object_vars( $post ); elseif ( !is_array($post) ) $post = get_post($post, ARRAY_A); if ( !$post || empty($post['ID']) ) return; if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); $post = _wp_post_revision_fields( $post, $autosave ); $post = add_magic_quotes($post); //since data is from db $revision_id = wp_insert_post( $post ); if ( is_wp_error($revision_id) ) return $revision_id; if ( $revision_id ) do_action( '_wp_put_post_revision', $revision_id ); return $revision_id; } /** * Gets a post revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses get_post() * * @param int|object $post Post ID or post object * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. * @param string $filter Optional sanitation filter. @see sanitize_post() * @return mixed Null if error or post object if success */ function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') { $null = null; if ( !$revision = get_post( $post, OBJECT, $filter ) ) return $revision; if ( 'revision' !== $revision->post_type ) return $null; if ( $output == OBJECT ) { return $revision; } elseif ( $output == ARRAY_A ) { $_revision = get_object_vars($revision); return $_revision; } elseif ( $output == ARRAY_N ) { $_revision = array_values(get_object_vars($revision)); return $_revision; } return $revision; } /** * Restores a post to the specified revision. * * Can restore a past revision using all fields of the post revision, or only selected fields. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses wp_get_post_revision() * @uses wp_update_post() * @uses do_action() Calls 'wp_restore_post_revision' on post ID and revision ID if wp_update_post() * is successful. * * @param int|object $revision_id Revision ID or revision object. * @param array $fields Optional. What fields to restore from. Defaults to all. * @return mixed Null if error, false if no fields to restore, (int) post ID if success. */ function wp_restore_post_revision( $revision_id, $fields = null ) { if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) return $revision; if ( !is_array( $fields ) ) $fields = array_keys( _wp_post_revision_fields() ); $update = array(); foreach( array_intersect( array_keys( $revision ), $fields ) as $field ) $update[$field] = $revision[$field]; if ( !$update ) return false; $update['ID'] = $revision['post_parent']; $update = add_magic_quotes( $update ); //since data is from db $post_id = wp_update_post( $update ); if ( is_wp_error( $post_id ) ) return $post_id; if ( $post_id ) do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] ); return $post_id; } /** * Deletes a revision. * * Deletes the row from the posts table corresponding to the specified revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses wp_get_post_revision() * @uses wp_delete_post() * * @param int|object $revision_id Revision ID or revision object. * @param array $fields Optional. What fields to restore from. Defaults to all. * @return mixed Null if error, false if no fields to restore, (int) post ID if success. */ function wp_delete_post_revision( $revision_id ) { if ( !$revision = wp_get_post_revision( $revision_id ) ) return $revision; $delete = wp_delete_post( $revision->ID ); if ( is_wp_error( $delete ) ) return $delete; if ( $delete ) do_action( 'wp_delete_post_revision', $revision->ID, $revision ); return $delete; } /** * Returns all revisions of specified post. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses get_children() * * @param int|object $post_id Post ID or post object * @return array empty if no revisions */ function wp_get_post_revisions( $post_id = 0, $args = null ) { if ( !constant('WP_POST_REVISIONS') ) return array(); if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) ) return array(); $defaults = array( 'order' => 'DESC', 'orderby' => 'date' ); $args = wp_parse_args( $args, $defaults ); $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) ); if ( !$revisions = get_children( $args ) ) return array(); return $revisions; } function _set_preview($post) { if ( ! is_object($post) ) return $post; $preview = wp_get_post_autosave($post->ID); if ( ! is_object($preview) ) return $post; $preview = sanitize_post($preview); $post->post_content = $preview->post_content; $post->post_title = $preview->post_title; $post->post_excerpt = $preview->post_excerpt; return $post; } function _show_post_preview() { if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) { $id = (int) $_GET['preview_id']; if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) wp_die( __('You do not have permission to preview drafts.') ); add_filter('the_preview', '_set_preview'); } } thebrutalagenda/wp-includes/script-loader.php0000644001761300176130000007403111214074651022165 0ustar mustardamustardaadd_data( 'script-handle', 'group', 1 ); queues the script for the footer * * @since 2.6.0 * * @param object $scripts WP_Scripts object. */ function wp_default_scripts( &$scripts ) { if ( !$guessurl = site_url() ) $guessurl = wp_guess_url(); $scripts->base_url = $guessurl; $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; $scripts->default_version = get_bloginfo( 'version' ); $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/'); $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' ); $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090609' ); $scripts->add_data( 'common', 'group', 1 ); $scripts->localize( 'common', 'commonL10n', array( 'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};' ) ); $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' ); $scripts->add_data( 'sack', 'group', 1 ); $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090307' ); $scripts->localize( 'quicktags', 'quicktagsL10n', array( 'quickLinks' => __('(Quick Links)'), 'wordLookup' => __('Enter a word to look up:'), 'dictionaryLookup' => esc_attr(__('Dictionary lookup')), 'lookup' => esc_attr(__('lookup')), 'closeAllOpenTags' => esc_attr(__('Close all open tags')), 'closeTags' => esc_attr(__('close tags')), 'enterURL' => __('Enter the URL'), 'enterImageURL' => __('Enter the URL of the image'), 'enterImageDescription' => __('Enter a description of the image'), 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};' ) ); $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' ); $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20090503' ); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090128' ); $scripts->add_data( 'wp-ajax-response', 'group', 1 ); $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 'noPerm' => __('You do not have permission to do that.'), 'broken' => __('An unidentified error has occurred.'), 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' ) ); $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090526' ); $scripts->add_data( 'autosave', 'group', 1 ); $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090504' ); $scripts->add_data( 'wp-lists', 'group', 1 ); $scripts->localize( 'wp-lists', 'wpListL10n', array( 'url' => admin_url('admin-ajax.php') ) ); $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0'); $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0'); $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0'); $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0'); $scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0'); $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' ); $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0'); $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0'); $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2'); $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.1' ); $scripts->add_data( 'jquery-ui-core', 'group', 1 ); $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-tabs', 'group', 1 ); $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-sortable', 'group', 1 ); $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-draggable', 'group', 1 ); $scripts->add( 'jquery-ui-droppable', '/wp-includes/js/jquery/ui.droppable.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-droppable', 'group', 1 ); $scripts->add( 'jquery-ui-selectable', '/wp-includes/js/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-selectable', 'group', 1 ); $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.7.1' ); $scripts->add_data( 'jquery-ui-resizable', 'group', 1 ); $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' ); $scripts->add_data( 'jquery-ui-dialog', 'group', 1 ); $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m'); $scripts->add_data( 'jquery-form', 'group', 1 ); $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m'); $scripts->add_data( 'jquery-color', 'group', 1 ); $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' ); $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125'); $scripts->add_data( 'suggest', 'group', 1 ); $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m'); $scripts->add_data( 'schedule', 'group', 1 ); $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' ); $scripts->add_data( 'jquery-hotkeys', 'group', 1 ); $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' ); $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 ); $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20090123'); $scripts->add_data( 'thickbox', 'group', 1 ); $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8'); $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.1'); $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201'); $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201'); $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201'); $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201'); if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { // queue all SWFUpload scripts that are used by default $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201'); } else { $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201'); } $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090515'); // these error messages came from the sample swfupload js, they might need changing. $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array( 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')), 'zero_byte_file' => __('This file is empty. Please try another.'), 'invalid_filetype' => __('This file type is not allowed. Please try another.'), 'default_error' => __('An error occurred in the upload. Please try again later.'), 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'), 'upload_limit_exceeded' => __('You may only upload 1 file.'), 'http_error' => __('HTTP error.'), 'upload_failed' => __('Upload failed.'), 'io_error' => __('IO error.'), 'security_error' => __('Security error.'), 'file_cancelled' => __('File cancelled.'), 'upload_stopped' => __('Upload stopped.'), 'dismiss' => __('Dismiss'), 'crunching' => __('Crunching…'), 'deleted' => __('Deleted'), 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};' ) ); $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102'); if ( is_admin() ) { $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); $scripts->add_data( 'ajaxcat', 'group', 1 ); $scripts->localize( 'ajaxcat', 'catL10n', array( 'add' => esc_attr(__('Add')), 'how' => __('Separate multiple categories with commas.'), 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' ) ); $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090207' ); $scripts->add_data( 'admin-categories', 'group', 1 ); $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090211' ); $scripts->add_data( 'admin-tags', 'group', 1 ); $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' ); $scripts->add_data( 'admin-custom-fields', 'group', 1 ); $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' ); $scripts->add_data( 'password-strength-meter', 'group', 1 ); $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 'empty' => __('Strength indicator'), 'short' => __('Very weak'), 'bad' => __('Weak'), /* translators: password strength */ 'good' => _x('Medium', 'password strength'), 'strong' => __('Strong'), 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' ) ); $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' ); $scripts->add_data( 'user-profile', 'group', 1 ); $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090209' ); $scripts->add_data( 'admin-comments', 'group', 1 ); $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) ) ); $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090327' ); $scripts->add_data( 'postbox', 'group', 1 ); $scripts->localize( 'postbox', 'postboxL10n', array( 'requestFile' => admin_url('admin-ajax.php') ) ); $scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090207' ); $scripts->add_data( 'slug', 'group', 1 ); $scripts->localize( 'slug', 'slugL10n', array( 'requestFile' => admin_url('admin-ajax.php'), 'save' => __('Save'), 'cancel' => __('Cancel'), 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};' ) ); $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090526' ); $scripts->add_data( 'post', 'group', 1 ); $scripts->localize( 'post', 'postL10n', array( 'tagsUsed' => __('Tags used on this post:'), 'add' => esc_attr(__('Add')), 'addTag' => esc_attr(__('Add new tag')), 'separate' => __('Separate tags with commas'), 'cancel' => __('Cancel'), 'edit' => __('Edit'), 'publishOn' => __('Publish on:'), 'publishOnFuture' => __('Schedule for:'), 'publishOnPast' => __('Published on:'), 'showcomm' => __('Show more comments'), 'endcomm' => __('No more comments found.'), 'publish' => __('Publish'), 'schedule' => __('Schedule'), 'update' => __('Update Post'), 'savePending' => __('Save as Pending'), 'saveDraft' => __('Save Draft'), 'private' => __('Private'), 'public' => __('Public'), 'publicSticky' => __('Public, Sticky'), 'password' => __('Password Protected'), 'privatelyPublished' => __('Privately Published'), 'published' => __('Published'), 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' ) ); $scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090526' ); $scripts->add_data( 'page', 'group', 1 ); $scripts->localize( 'page', 'postL10n', array( 'cancel' => __('Cancel'), 'edit' => __('Edit'), 'publishOn' => __('Publish on:'), 'publishOnFuture' => __('Schedule for:'), 'publishOnPast' => __('Published on:'), 'showcomm' => __('Show more comments'), 'endcomm' => __('No more comments found.'), 'publish' => __('Publish'), 'schedule' => __('Schedule'), 'update' => __('Update Page'), 'savePending' => __('Save as Pending'), 'saveDraft' => __('Save Draft'), 'private' => __('Private'), 'public' => __('Public'), 'password' => __('Password Protected'), 'privatelyPublished' => __('Privately Published'), 'published' => __('Published'), 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' ) ); $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090506' ); $scripts->add_data( 'link', 'group', 1 ); $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' ); $scripts->add_data( 'comment', 'group', 1 ); $scripts->localize( 'comment', 'commentL10n', array( 'cancel' => __('Cancel'), 'edit' => __('Edit'), 'submittedOn' => __('Submitted on:'), 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};' ) ); $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090516' ); $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' ); $scripts->add_data( 'media-upload', 'group', 1 ); $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090601' ); $scripts->add_data( 'admin-widgets', 'group', 1 ); $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' ); $scripts->add_data( 'word-count', 'group', 1 ); $scripts->localize( 'word-count', 'wordCountL10n', array( 'count' => __('Word count: %d'), 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};' )); $scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090102' ); $scripts->localize( 'wp-gears', 'wpGearsL10n', array( 'updateCompleted' => __('Update completed.'), 'error' => __('Error:'), 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};' )); $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' ); $scripts->add_data( 'theme-preview', 'group', 1 ); $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' ); $scripts->add_data( 'inline-edit-post', 'group', 1 ); $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 'error' => __('Error while saving the changes.'), 'ntdeltitle' => __('Remove From Bulk Edit'), 'notitle' => __('(no title)'), 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' ) ); $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090211' ); $scripts->add_data( 'inline-edit-tax', 'group', 1 ); $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 'error' => __('Error while saving the changes.'), 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' ) ); $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery' ), '20090520' ); $scripts->add_data( 'plugin-install', 'group', 1 ); $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 'plugin_information' => __('Plugin Information:'), 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};' ) ); $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090201' ); $scripts->add_data( 'dashboard', 'group', 1 ); $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' ); $scripts->add_data( 'hoverIntent', 'group', 1 ); $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' ); $scripts->add_data( 'media', 'group', 1 ); $scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' ); $scripts->add_data( 'codepress', 'group', 1 ); } } /** * Assign default styles to $styles object. * * Nothing is returned, because the $styles parameter is passed by reference. * Meaning that whatever object is passed will be updated without having to * reassign the variable that was passed back to the same value. This saves * memory. * * Adding default styles is not the only task, it also assigns the base_url * property, the default version, and text direction for the object. * * @since 2.6.0 * * @param object $styles */ function wp_default_styles( &$styles ) { // This checks to see if site_url() returns something and if it does not // then it assigns $guess_url to wp_guess_url(). Strange format, but it works. if ( ! $guessurl = site_url() ) $guessurl = wp_guess_url(); $styles->base_url = $guessurl; $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; $styles->default_version = get_bloginfo( 'version' ); $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr'; $styles->default_dirs = array('/wp-admin/'); $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' ); // all colors stylesheets need to have the same query strings (cache manifest compat) $colors_version = '20090610'; $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090610' ); $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' ); $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090514' ); $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string. $styles->add( 'colors', true, array(), $colors_version ); // do not refer to these directly, the right one is queued by the above "meta" colors handle $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), $colors_version); $styles->add_data( 'colors-fresh', 'rtl', true ); $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), $colors_version); $styles->add_data( 'colors-classic', 'rtl', true ); $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090514' ); $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' ); $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' ); $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' ); $styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' ); $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090514' ); $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' ); $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' ); $styles->add( 'login', '/wp-admin/css/login.css', array(), '20090514' ); $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20090514' ); $styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090610' ); $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' ); $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); foreach ( $rtl_styles as $rtl_style ) $styles->add_data( $rtl_style, 'rtl', true ); } /** * Reorder JavaScript scripts array to place prototype before jQuery. * * @since 2.3.1 * * @param array $js_array JavaScript scripst array * @return array Reordered array, if needed. */ function wp_prototype_before_jquery( $js_array ) { if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) return $js_array; if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) return $js_array; if ( $prototype < $jquery ) return $js_array; unset($js_array[$prototype]); array_splice( $js_array, $jquery, 0, 'prototype' ); return $js_array; } /** * Load localized script just in time for MCE. * * These localizations require information that may not be loaded even by init. * * @since 2.5.0 */ function wp_just_in_time_script_localization() { wp_localize_script( 'autosave', 'autosaveL10n', array( 'autosaveInterval' => AUTOSAVE_INTERVAL, 'previewPageText' => __('Preview this Page'), 'previewPostText' => __('Preview this Post'), 'requestFile' => admin_url('admin-ajax.php'), 'savingText' => __('Saving Draft…'), 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' ) ); } /** * Administration Panel CSS for changing the styles. * * If installing the 'wp-admin/' directory will be replaced with './'. * * The $_wp_admin_css_colors global manages the Administration Panels CSS * stylesheet that is loaded. The option that is set is 'admin_color' and is the * color and key for the array. The value for the color key is an object with * a 'url' parameter that has the URL path to the CSS file. * * The query from $src parameter will be appended to the URL that is given from * the $_wp_admin_css_colors array value URL. * * @since 2.6.0 * @uses $_wp_admin_css_colors * * @param string $src Source URL. * @param string $handle Either 'colors' or 'colors-rtl'. * @return string URL path to CSS stylesheet for Administration Panels. */ function wp_style_loader_src( $src, $handle ) { if ( defined('WP_INSTALLING') ) return preg_replace( '#^wp-admin/#', './', $src ); if ( 'colors' == $handle || 'colors-rtl' == $handle ) { global $_wp_admin_css_colors; $color = get_user_option('admin_color'); if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) $color = 'fresh'; $color = $_wp_admin_css_colors[$color]; $parsed = parse_url( $src ); $url = $color->url; if ( isset($parsed['query']) && $parsed['query'] ) { wp_parse_str( $parsed['query'], $qv ); $url = add_query_arg( $qv, $url ); } return $url; } return $src; } /** * Prints the script queue in the HTML head on admin pages. * * Postpones the scripts that were queued for the footer. * print_footer_scripts() is called in the footer to print these scripts. * * @since 2.8 * @see wp_print_scripts() */ function print_head_scripts() { global $wp_scripts, $concatenate_scripts; if ( ! did_action('wp_print_scripts') ) do_action('wp_print_scripts'); if ( !is_a($wp_scripts, 'WP_Scripts') ) $wp_scripts = new WP_Scripts(); script_concat_settings(); $wp_scripts->do_concat = $concatenate_scripts; $wp_scripts->do_head_items(); if ( apply_filters('print_head_scripts', true) ) _print_scripts(); $wp_scripts->reset(); return $wp_scripts->done; } /** * Prints the scripts that were queued for the footer on admin pages. * * @since 2.8 */ function print_footer_scripts() { global $wp_scripts, $concatenate_scripts; if ( ! did_action('wp_print_footer_scripts') ) do_action('wp_print_footer_scripts'); if ( !is_a($wp_scripts, 'WP_Scripts') ) return array(); // No need to run if not instantiated. script_concat_settings(); $wp_scripts->do_concat = $concatenate_scripts; $wp_scripts->do_footer_items(); if ( apply_filters('print_footer_scripts', true) ) _print_scripts(); $wp_scripts->reset(); return $wp_scripts->done; } function _print_scripts() { global $wp_scripts, $compress_scripts; $zip = $compress_scripts ? 1 : 0; if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) $zip = 'gzip'; if ( !empty($wp_scripts->concat) ) { if ( !empty($wp_scripts->print_code) ) { echo "\n"; } $ver = md5("$wp_scripts->concat_version"); $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . "&ver=$ver"; echo "\n"; } if ( !empty($wp_scripts->print_html) ) echo $wp_scripts->print_html; } /** * Prints the script queue in the HTML head on the front end. * * Postpones the scripts that were queued for the footer. * wp_print_footer_scripts() is called in the footer to print these scripts. * * @since 2.8 */ function wp_print_head_scripts() { if ( ! did_action('wp_print_scripts') ) do_action('wp_print_scripts'); global $wp_scripts; if ( !is_a($wp_scripts, 'WP_Scripts') ) return array(); // no need to run if nothing is queued return print_head_scripts(); } /** * Prints the scripts that were queued for the footer on the front end. * * @since 2.8 */ function wp_print_footer_scripts() { return print_footer_scripts(); } /** * Wrapper for do_action('wp_enqueue_scripts') * * Allows plugins to queue scripts for the front end using wp_enqueue_script(). * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available. * * @since 2.8 */ function wp_enqueue_scripts() { do_action('wp_enqueue_scripts'); } function print_admin_styles() { global $wp_styles, $concatenate_scripts, $compress_css; if ( !is_a($wp_styles, 'WP_Styles') ) $wp_styles = new WP_Styles(); script_concat_settings(); $wp_styles->do_concat = $concatenate_scripts; $zip = $compress_css ? 1 : 0; if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) $zip = 'gzip'; $wp_styles->do_items(false); if ( apply_filters('print_admin_styles', true) ) { if ( !empty($wp_styles->concat) ) { $dir = $wp_styles->text_direction; $ver = md5("$wp_styles->concat_version{$dir}"); $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver"; echo "\n"; } if ( !empty($wp_styles->print_html) ) echo $wp_styles->print_html; } $wp_styles->do_concat = false; $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = ''; return $wp_styles->done; } function script_concat_settings() { global $concatenate_scripts, $compress_scripts, $compress_css; $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ); if ( ! isset($concatenate_scripts) ) { $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; if ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) $concatenate_scripts = false; } if ( ! isset($compress_scripts) ) { $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) $compress_scripts = false; } if ( ! isset($compress_css) ) { $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) $compress_css = false; } } add_action( 'wp_default_scripts', 'wp_default_scripts' ); add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); add_action( 'wp_default_styles', 'wp_default_styles' ); add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); thebrutalagenda/wp-includes/functions.wp-styles.php0000644001761300176130000000506011214074651023367 0ustar mustardamustardado_items( $handles ); } /** * Register CSS style file. * * @since r79 * @see WP_Styles::add() For parameter and additional information. */ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { global $wp_styles; if ( !is_a($wp_styles, 'WP_Styles') ) $wp_styles = new WP_Styles(); $wp_styles->add( $handle, $src, $deps, $ver, $media ); } /** * Remove a registered CSS file. * * @since r79 * @see WP_Styles::remove() For parameter and additional information. */ function wp_deregister_style( $handle ) { global $wp_styles; if ( !is_a($wp_styles, 'WP_Styles') ) $wp_styles = new WP_Styles(); $wp_styles->remove( $handle ); } /** * Enqueue a CSS style file. * * @since r79 * @see WP_Styles::add(), WP_Styles::enqueue() */ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) { global $wp_styles; if ( !is_a($wp_styles, 'WP_Styles') ) $wp_styles = new WP_Styles(); if ( $src ) { $_handle = explode('?', $handle); $wp_styles->add( $_handle[0], $src, $deps, $ver, $media ); } $wp_styles->enqueue( $handle ); } /** * Check whether style has been added to WordPress Styles. * * The values for list defaults to 'queue', which is the same as enqueue for * styles. * * @since WP unknown; BP unknown * * @param string $handle Handle used to add style. * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do' * @return bool */ function wp_style_is( $handle, $list = 'queue' ) { global $wp_styles; if ( !is_a($wp_styles, 'WP_Scripts') ) $wp_styles = new WP_Styles(); $query = $wp_styles->query( $handle, $list ); if ( is_object( $query ) ) return true; return $query; } thebrutalagenda/wp-includes/link-template.php0000644001761300176130000014543611214074651022173 0ustar mustardamustardause_trailing_slashes ) $string = trailingslashit($string); else $string = untrailingslashit($string); // Note that $type_of_url can be one of following: // single, single_trackback, single_feed, single_paged, feed, category, page, year, month, day, paged $string = apply_filters('user_trailingslashit', $string, $type_of_url); return $string; } /** * Display permalink anchor for current post. * * The permalink mode title will use the post title for the 'a' element 'id' * attribute. The id mode uses 'post-' with the post ID for the 'id' attribute. * * @since 0.71 * * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'. */ function permalink_anchor($mode = 'id') { global $post; switch ( strtolower($mode) ) { case 'title': $title = sanitize_title($post->post_title) . '-' . $post->ID; echo ''; break; case 'id': default: echo ''; break; } } /** * Retrieve full permalink for current post or post ID. * * @since 1.0.0 * * @param int $id Optional. Post ID. * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. * @return string */ function get_permalink($id = 0, $leavename = false) { $rewritecode = array( '%year%', '%monthnum%', '%day%', '%hour%', '%minute%', '%second%', $leavename? '' : '%postname%', '%post_id%', '%category%', '%author%', $leavename? '' : '%pagename%', ); if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) { $post = $id; $sample = true; } else { $post = &get_post($id); $sample = false; } if ( empty($post->ID) ) return false; if ( $post->post_type == 'page' ) return get_page_link($post->ID, $leavename, $sample); elseif ($post->post_type == 'attachment') return get_attachment_link($post->ID); $permalink = get_option('permalink_structure'); if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending')) ) { $unixtime = strtotime($post->post_date); $category = ''; if ( strpos($permalink, '%category%') !== false ) { $cats = get_the_category($post->ID); if ( $cats ) { usort($cats, '_usort_terms_by_ID'); // order by ID $category = $cats[0]->slug; if ( $parent = $cats[0]->parent ) $category = get_category_parents($parent, false, '/', true) . $category; } // show default category in permalinks, without // having to assign it explicitly if ( empty($category) ) { $default_category = get_category( get_option( 'default_category' ) ); $category = is_wp_error( $default_category ) ? '' : $default_category->slug; } } $author = ''; if ( strpos($permalink, '%author%') !== false ) { $authordata = get_userdata($post->post_author); $author = $authordata->user_nicename; } $date = explode(" ",date('Y m d H i s', $unixtime)); $rewritereplace = array( $date[0], $date[1], $date[2], $date[3], $date[4], $date[5], $post->post_name, $post->ID, $category, $author, $post->post_name, ); $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink); $permalink = user_trailingslashit($permalink, 'single'); return apply_filters('post_link', $permalink, $post, $leavename); } else { // if they're not using the fancy permalink option $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID; return apply_filters('post_link', $permalink, $post, $leavename); } } /** * Retrieve permalink from post ID. * * @since 1.0.0 * * @param int $post_id Optional. Post ID. * @param mixed $deprecated Not used. * @return string */ function post_permalink($post_id = 0, $deprecated = '') { return get_permalink($post_id); } /** * Retrieve the permalink for current page or page ID. * * Respects page_on_front. Use this one. * * @since 1.5.0 * * @param int $id Optional. Post ID. * @param bool $leavename Optional, defaults to false. Whether to keep page name. * @param bool $sample Optional, defaults to false. Is it a sample permalink. * @return string */ function get_page_link( $id = false, $leavename = false, $sample = false ) { global $post; $id = (int) $id; if ( !$id ) $id = (int) $post->ID; if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) $link = get_option('home'); else $link = _get_page_link( $id , $leavename, $sample ); return apply_filters('page_link', $link, $id); } /** * Retrieve the page permalink. * * Ignores page_on_front. Internal use only. * * @since 2.1.0 * @access private * * @param int $id Optional. Post ID. * @param bool $leavename Optional. Leave name. * @param bool $sample Optional. Sample permalink. * @return string */ function _get_page_link( $id = false, $leavename = false, $sample = false ) { global $post, $wp_rewrite; if ( !$id ) $id = (int) $post->ID; else $post = &get_post($id); $pagestruct = $wp_rewrite->get_page_permastruct(); if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status ) || $sample ) ) { $link = get_page_uri($id); $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct); $link = trailingslashit(get_option('home')) . "$link"; $link = user_trailingslashit($link, 'page'); } else { $link = trailingslashit(get_option('home')) . "?page_id=$id"; } return apply_filters( '_get_page_link', $link, $id ); } /** * Retrieve permalink for attachment. * * This can be used in the WordPress Loop or outside of it. * * @since 2.0.0 * * @param int $id Optional. Post ID. * @return string */ function get_attachment_link($id = false) { global $post, $wp_rewrite; $link = false; if (! $id) { $id = (int) $post->ID; } $object = get_post($id); if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) { $parent = get_post($object->post_parent); if ( 'page' == $parent->post_type ) $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front else $parentlink = get_permalink( $object->post_parent ); if ( is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) $name = 'attachment/' . $object->post_name; // // is paged so we use the explicit attachment marker else $name = $object->post_name; if (strpos($parentlink, '?') === false) $link = user_trailingslashit( trailingslashit($parentlink) . $name ); } if (! $link ) { $link = trailingslashit(get_bloginfo('url')) . "?attachment_id=$id"; } return apply_filters('attachment_link', $link, $id); } /** * Retrieve the permalink for the year archives. * * @since 1.5.0 * * @param int|bool $year False for current year or year for permalink. * @return string */ function get_year_link($year) { global $wp_rewrite; if ( !$year ) $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); $yearlink = $wp_rewrite->get_year_permastruct(); if ( !empty($yearlink) ) { $yearlink = str_replace('%year%', $year, $yearlink); return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year); } else { return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year); } } /** * Retrieve the permalink for the month archives with year. * * @since 1.0.0 * * @param bool|int $year False for current year. Integer of year. * @param bool|int $month False for current month. Integer of month. * @return string */ function get_month_link($year, $month) { global $wp_rewrite; if ( !$year ) $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); if ( !$month ) $month = gmdate('m', time()+(get_option('gmt_offset') * 3600)); $monthlink = $wp_rewrite->get_month_permastruct(); if ( !empty($monthlink) ) { $monthlink = str_replace('%year%', $year, $monthlink); $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month); } else { return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month); } } /** * Retrieve the permalink for the day archives with year and month. * * @since 1.0.0 * * @param bool|int $year False for current year. Integer of year. * @param bool|int $month False for current month. Integer of month. * @param bool|int $day False for current day. Integer of day. * @return string */ function get_day_link($year, $month, $day) { global $wp_rewrite; if ( !$year ) $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); if ( !$month ) $month = gmdate('m', time()+(get_option('gmt_offset') * 3600)); if ( !$day ) $day = gmdate('j', time()+(get_option('gmt_offset') * 3600)); $daylink = $wp_rewrite->get_day_permastruct(); if ( !empty($daylink) ) { $daylink = str_replace('%year%', $year, $daylink); $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day); } else { return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); } } /** * Retrieve the permalink for the feed type. * * @since 1.5.0 * * @param string $feed Optional, defaults to default feed. Feed type. * @return string */ function get_feed_link($feed = '') { global $wp_rewrite; $permalink = $wp_rewrite->get_feed_permastruct(); if ( '' != $permalink ) { if ( false !== strpos($feed, 'comments_') ) { $feed = str_replace('comments_', '', $feed); $permalink = $wp_rewrite->get_comment_feed_permastruct(); } if ( get_default_feed() == $feed ) $feed = ''; $permalink = str_replace('%feed%', $feed, $permalink); $permalink = preg_replace('#/+#', '/', "/$permalink"); $output = get_option('home') . user_trailingslashit($permalink, 'feed'); } else { if ( empty($feed) ) $feed = get_default_feed(); if ( false !== strpos($feed, 'comments_') ) $feed = str_replace('comments_', 'comments-', $feed); $output = trailingslashit(get_option('home')) . "?feed={$feed}"; } return apply_filters('feed_link', $output, $feed); } /** * Retrieve the permalink for the post comments feed. * * @since 2.2.0 * * @param int $post_id Optional. Post ID. * @param string $feed Optional. Feed type. * @return string */ function get_post_comments_feed_link($post_id = '', $feed = '') { global $id; if ( empty($post_id) ) $post_id = (int) $id; if ( empty($feed) ) $feed = get_default_feed(); if ( '' != get_option('permalink_structure') ) { $url = trailingslashit( get_permalink($post_id) ) . 'feed'; if ( $feed != get_default_feed() ) $url .= "/$feed"; $url = user_trailingslashit($url, 'single_feed'); } else { $type = get_post_field('post_type', $post_id); if ( 'page' == $type ) $url = trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id"; else $url = trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id"; } return apply_filters('post_comments_feed_link', $url); } /** * Display the comment feed link for a post. * * Prints out the comment feed link for a post. Link text is placed in the * anchor. If no link text is specified, default text is used. If no post ID is * specified, the current post is used. * * @package WordPress * @subpackage Feed * @since 2.5.0 * * @param string $link_text Descriptive text. * @param int $post_id Optional post ID. Default to current post. * @param string $feed Optional. Feed format. * @return string Link to the comment feed for the current post. */ function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { $url = get_post_comments_feed_link($post_id, $feed); if ( empty($link_text) ) $link_text = __('Comments Feed'); echo apply_filters( 'post_comments_feed_link_html', "$link_text", $post_id, $feed ); } /** * Retrieve the feed link for a given author. * * Returns a link to the feed for all posts by a given author. A specific feed * can be requested or left blank to get the default feed. * * @package WordPress * @subpackage Feed * @since 2.5.0 * * @param int $author_id ID of an author. * @param string $feed Optional. Feed type. * @return string Link to the feed for the author specified by $author_id. */ function get_author_feed_link( $author_id, $feed = '' ) { $author_id = (int) $author_id; $permalink_structure = get_option('permalink_structure'); if ( empty($feed) ) $feed = get_default_feed(); if ( '' == $permalink_structure ) { $link = trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id; } else { $link = get_author_posts_url($author_id); if ( $feed == get_default_feed() ) $feed_link = 'feed'; else $feed_link = "feed/$feed"; $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); } $link = apply_filters('author_feed_link', $link, $feed); return $link; } /** * Retrieve the feed