Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin page header
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Invalid request.' );
|
||||
}
|
||||
|
||||
$page = ( ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'settings' );
|
||||
|
||||
?>
|
||||
|
||||
<h1>jQuery Migrate</h1>
|
||||
|
||||
<div class="notice notice-info">
|
||||
<p>
|
||||
<?php _e( 'jQuery is a framework that makes creating interactive elements on your website quick and easy for theme and plugin authors.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php _e( 'Thanks to this versatility, WordPress has included a version of the jQuery library for a long time.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php _e( 'Due to the large amount of plugins and themes using the library, the version has not received any major upgrades to avoid breaking changes. This has unfortunately led to many plugins and themes just using obsolete code (even when WordPress has allowed for more modern code to be used).', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php _e( 'When WordPress facilitated for, and is performing, upgrades of the version of jQuery included, some themes and plugins may stop working as expected, because their code was outdated.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<nav class="nav-tab-wrapper" aria-label="Secondary menu">
|
||||
<a class="nav-tab <?php echo ( 'settings' === $page ? 'nav-tab-active' : '' ); ?>" href="<?php echo esc_url( admin_url( 'tools.php?page=jqmh' ) ); ?>"><?php _e( 'Settings', 'enable-jquery-migrate-helper' ); ?></a>
|
||||
<a class="nav-tab <?php echo ( 'logs' === $page ? 'nav-tab-active' : '' ); ?>" href="<?php echo esc_url( admin_url( 'tools.php?page=jqmh&tab=logs' ) ); ?>"><?php _e( 'Logged deprecations', 'enable-jquery-migrate-helper' ); ?></a>
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
switch ( $page ) {
|
||||
case 'logs':
|
||||
include_once __DIR__ . '/logs.php';
|
||||
break;
|
||||
case 'settings':
|
||||
default:
|
||||
include_once __DIR__ . '/settings.php';
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin logs page.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Invalid request.' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once trailingslashit( ABSPATH ) . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$plugins = array();
|
||||
|
||||
foreach ( get_plugins() as $slug => $plugin ) {
|
||||
$slug = explode( '/', $slug );
|
||||
$plugins[ $slug[0] ] = $plugin;
|
||||
}
|
||||
|
||||
$themes = wp_get_themes();
|
||||
|
||||
$logs = get_option( 'jqmh_logs', array() );
|
||||
?>
|
||||
|
||||
<h2>Logs</h2>
|
||||
|
||||
<div class="notice notice-info inline">
|
||||
<p>
|
||||
<?php _e( 'The following are deprecations logged from the front-end of your site, or while live deprecation notices were disabled in the admin area.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div style="text-align:right;">
|
||||
<button type="button" class="button jqmh-clear-deprecation-notices button-default"><?php _e( 'Clear logs', 'enable-jquery-migrate-helper' ); ?></button>
|
||||
</div>
|
||||
|
||||
<table class="widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _ex( 'Time', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Notice', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Plugin or theme', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'File location', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Triggered on page', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id="jqmh-logged-notices">
|
||||
<?php if ( empty( $logs ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<?php _e( 'No deprecations have been logged', 'enable-jquery-migrate-helper' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
foreach ( $logs as $log ) :
|
||||
|
||||
preg_match( '/\/plugins\/(?P<slug>.+?)\/.+?: (?P<notice>.+)/', $log['notice'], $plugin );
|
||||
preg_match( '/\/themes\/(?P<slug>.+?)\/.+?: (?P<notice>.+)/', $log['notice'], $theme );
|
||||
preg_match( '/\/wp-(admin|includes)\/.+?: (?P<notice>.+)/', $log['notice'], $core );
|
||||
|
||||
$notice = $log['notice'];
|
||||
$source = __( 'Undetermined', 'enable-jquery-migrate-helper' );
|
||||
$file = __( 'Inline code, unknown file location', 'enable-jquery-migrate-helper' );
|
||||
|
||||
if ( ! empty( $plugin ) ) {
|
||||
preg_match( '/(?P<path>https?:\/\/.+?):/', $log['notice'], $file );
|
||||
$file = $file['path'];
|
||||
|
||||
$plugin_link = '#';
|
||||
|
||||
if ( isset( $plugins[ $plugin['slug'] ] ) ) {
|
||||
$plugin_link = ( isset( $plugins[ $plugin['slug'] ]['PluginURI'] ) ? $plugins[ $plugin['slug'] ]['PluginURI'] : $plugins[ $plugin['slug'] ]['AuthorURI'] );
|
||||
}
|
||||
|
||||
$notice = $plugin['notice'];
|
||||
$source = sprintf(
|
||||
// translators: 1: Linked name of the plugin throwing notices.
|
||||
__( 'Plugin: %s', 'enable-jquery-migrate-helper' ),
|
||||
sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( $plugin_link ),
|
||||
esc_html( ( isset( $plugins[ $plugin['slug'] ] ) ? $plugins[ $plugin['slug'] ]['Name'] : $plugin['slug'] ) )
|
||||
)
|
||||
);
|
||||
} elseif ( ! empty( $theme ) ) {
|
||||
preg_match( '/(?P<path>https?:\/\/.+?):/', $log['notice'], $file );
|
||||
$file = $file['path'];
|
||||
|
||||
$theme_link = '#';
|
||||
|
||||
if ( isset( $themes[ $theme['slug'] ] ) ) {
|
||||
$theme_link = $themes[ $theme['slug'] ]->get( 'ThemeURI' );
|
||||
}
|
||||
|
||||
$notice = $theme['notice'];
|
||||
$source = sprintf(
|
||||
// translators: 1: Linked name of the theme throwing notices.
|
||||
__( 'Theme: %s', 'enable-jquery-migrate-helper' ),
|
||||
sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( $theme_link ),
|
||||
esc_html( ( isset( $themes[ $theme['slug'] ] ) ? $themes[ $theme['slug'] ]->get( 'Name' ) : $theme['slug'] ) )
|
||||
)
|
||||
);
|
||||
} elseif ( ! empty( $core ) ) {
|
||||
preg_match( '/(?P<path>https?:\/\/.+?):/', $log['notice'], $file );
|
||||
$file = $file['path'];
|
||||
|
||||
$notice = $core['notice'];
|
||||
$source = __( 'WordPress core', 'enable-jquery-migrate-helper' );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo esc_html( $log['registered'] ); ?></td>
|
||||
<td><?php echo esc_html( wp_unslash( $notice ) ); ?></td>
|
||||
<td><?php echo $source; ?></td>
|
||||
<td><?php echo esc_html( $file ); ?></td>
|
||||
<td><?php echo esc_html( $log['page'] ); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th><?php _ex( 'Time', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Notice', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Plugin or theme', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'File location', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
<th><?php _ex( 'Page', 'Admin deprecation notices', 'enable-jquery-migrate-helper' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div style="text-align:right;">
|
||||
<button type="button" class="button jqmh-clear-deprecation-notices button-default"><?php _e( 'Clear logs', 'enable-jquery-migrate-helper' ); ?></button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var i = 0,
|
||||
clear_nonce = '<?php echo esc_js( wp_create_nonce( 'jquery-migrate-previous-deprecations' ) ); ?>',
|
||||
clear_buttons = document.getElementsByClassName( 'jqmh-clear-deprecation-notices' );
|
||||
|
||||
for ( i = 0; i < clear_buttons.length; i++ ) {
|
||||
clear_buttons[ i ].addEventListener( 'click', function() {
|
||||
var o,
|
||||
xhr = new XMLHttpRequest(),
|
||||
displays = document.getElementsByClassName( 'jqmh-deprecations' );
|
||||
|
||||
xhr.open( 'POST', '<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>' );
|
||||
xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
|
||||
xhr.onload = function () {};
|
||||
|
||||
xhr.send( encodeURI( 'action=jquery-migrate-dismiss-notice¬ice=jquery-migrate-previous-deprecations&dismiss-notice-nonce=' + clear_nonce ) );
|
||||
|
||||
for ( o = 0; o < displays.length; o++ ) {
|
||||
displays[ o ].parentNode.removeChild( displays[ o ] );
|
||||
}
|
||||
|
||||
document.getElementById( 'jqmh-logged-notices' ).innerText = '';
|
||||
|
||||
} );
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin settings page.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( 'Invalid request.' );
|
||||
}
|
||||
|
||||
$downgraded = get_option( '_jquery_migrate_downgrade_version', 'no' );
|
||||
$show_deprecations = jQuery_Migrate_Helper::show_deprecated_scripts_notice();
|
||||
$public_deprecations = get_option( '_jquery_migrate_public_deprecation_logging', 'no' );
|
||||
$log_modern_deprecations = get_option( '_jquery_migrate_modern_deprecations', 'no' );
|
||||
$has_auto_downgraded = get_option( '_jquery_migrate_has_auto_downgraded', 'no' );
|
||||
?>
|
||||
|
||||
<h2>Settings</h2>
|
||||
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="jqmh-settings" value="true">
|
||||
<?php wp_nonce_field( 'jqmh-settings' ); ?>
|
||||
|
||||
<table class="form-table" role="presentation">
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="jquery-version">
|
||||
<?php _e( 'jQuery Version', 'enable-jquery-migrate-helper' ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<select name="jquery-version" id="jquery-version" <?php echo ( ! is_wp_version_compatible( '5.6-alpha' ) ? 'disabled="disabled"' : '' ); ?>>
|
||||
<option value="no" <?php selected( $downgraded, 'no') ?>>
|
||||
<?php _ex( 'Default from WordPress', 'jQuery version', 'enable-jquery-migrate-helper' ); ?>
|
||||
</option>
|
||||
<option value="yes" <?php selected( $downgraded, 'yes') ?>>
|
||||
<?php _ex( 'Legacy 1.12.4-wp', 'jQuery version', 'enable-jquery-migrate-helper' ); ?>
|
||||
</option>
|
||||
</select>
|
||||
<?php if ( ! is_wp_version_compatible( '5.6-alpha' ) ) : ?>
|
||||
<p class="description">
|
||||
<?php _e( 'You can only change jQuery versions in WordPress 5.6 or later', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Live deprecations', 'enable-jquery-migrate-helper' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="live-deprecations" type="checkbox" <?php checked( $show_deprecations ); ?>>
|
||||
<?php _e( 'Show deprecation notices, on each admin page, as they happen', 'enable-jquery-migrate-helper' ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( 'no' === $downgraded && is_wp_version_compatible( '5.6-alpha' ) ) : ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Automatic downgrades', 'enable-jquery-migrate-helper' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="automatic-downgrade" type="checkbox" <?php checked( ( 'no' === $has_auto_downgraded ) ); ?>>
|
||||
<?php _e( 'Allow website visitors to trigger an automatic downgrading to legacy jQuery, when a failure is detected', 'enable-jquery-migrate-helper' ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( 'no' === $downgraded && is_wp_version_compatible( '5.6-alpha' ) ) : ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Capture modern deprecations', 'enable-jquery-migrate-helper' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="modern-deprecations" type="checkbox" <?php checked( 'yes' === $log_modern_deprecations ); ?>>
|
||||
<?php _e( 'Detect and log deprecations in the default WordPress version of jQuery', 'enable-jquery-migrate-helper' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
<?php _e( 'This may report many entries from WordPress it self. This is expected, as WordPress continues to update its own code in the upcoming releases.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php _e( 'Public deprecation logging' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label>
|
||||
<input name="public-deprecation-logging" type="checkbox" <?php checked( 'yes' === $public_deprecations ); ?>>
|
||||
<?php _e( 'Log deprecations caused by anonymous users browsing your website', 'enable-jquery-migrate-helper' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
<?php _e( 'Caution: This option may lead to more deprecations being discovered, but will also increase the amount of database entries. Use sparingly and under supervision.', 'enable-jquery-migrate-helper' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php submit_button( __( 'Save settings', 'enable-jquery-migrate-helper' ) ); ?>
|
||||
</form>
|
||||
Reference in new issue
Block a user