Skip to content

Commit

Permalink
Merge branch 'release/1.9.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 13, 2022
2 parents 467468d + 3f2e285 commit 7c8aaa2
Show file tree
Hide file tree
Showing 10 changed files with 2,868 additions and 323 deletions.
7 changes: 7 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"core": null,
"plugins": [
".",
"https://downloads.wordpress.org/plugin/query-monitor.zip"
]
}
2 changes: 1 addition & 1 deletion admin/dashboard/adminer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$pronamic_client = \Pronamic\WordPress\PronamicClient\Plugin::get_instance();

$adminer_url = plugins_url( 'adminer/index.php', $pronamic_client->file );
$adminer_url = plugins_url( 'adminer/', $pronamic_client->file );

?>
<form target="_blank" method="post" action="<?php echo esc_attr( $adminer_url ); ?>">
Expand Down
10 changes: 10 additions & 0 deletions adminer/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
Order Allow,Deny
Deny from all
</Files>

<Files index.php>
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>

<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Files>
3 changes: 3 additions & 0 deletions classes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ private function __construct( $file ) {

add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 );

add_action( 'pronamic_credits', 'pronamic_client_credits' );

// Filters
add_filter( 'wp_headers', array( $this, 'wp_headers' ) );

Expand All @@ -44,6 +46,7 @@ private function __construct( $file ) {
'gravityforms' => GravityFormsModule::get_instance( $this ),
'jetpack' => JetpackModule::get_instance( $this ),
'phpmailer' => PhpMailerModule::get_instance( $this ),
'query-monitor' => QueryMonitorModule::get_instance( $this ),
'scripts' => ScriptsModule::get_instance( $this ),
'yoast' => YoastModule::get_instance( $this ),
);
Expand Down
80 changes: 80 additions & 0 deletions classes/QueryMonitorModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace Pronamic\WordPress\PronamicClient;

class QueryMonitorModule {
/**
* Instance of this class.
*
* @var YoastModule
*/
protected static $instance = null;

/**
* Plugin
*
* @var Plugin
*/
private $plugin;

/**
* Constructs and initialize Yoast module.
*
* @param Plugin $plugin
*/
private function __construct( Plugin $plugin ) {
$this->plugin = $plugin;

\add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
}

/**
* Plugins loaded.
*
* @return void
*/
public function plugins_loaded() {
/**
* Check if Query Monitor is active.
*
* @link https://github.com/johnbillion/query-monitor/blob/60da795c040e0f08850891c74a36b2f566cee14d/query-monitor.php#L36
*/
if ( ! \defined( 'QM_VERSION' ) ) {
return;
}

\add_filter( 'plugin_locale', array( $this, 'plugin_locale' ), 10, 2 );
}

/**
* For English for Query Monitor plugin.
*
* @link https://github.com/johnbillion/query-monitor/blob/60da795c040e0f08850891c74a36b2f566cee14d/classes/QueryMonitor.php#L162-L167
* @link https://github.com/WordPress/wordpress-develop/blob/2bb5679d666474d024352fa53f07344affef7e69/src/wp-includes/l10n.php#L69-L71
* @param string $locale The plugin's current locale.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @return string
*/
public function plugin_locale( $locale, $domain ) {
if ( 'query-monitor' !== $domain ) {
return $locale;
}

return 'en_US';
}


/**
* Return an instance of this class.
*
* @return object A single instance of this class.
*/
public static function get_instance( $plugin = false ) {
// If the single instance hasn't been set, set it now.
if ( null === self::$instance ) {
self::$instance = new self( $plugin );
}

return self::$instance;
}
}
2 changes: 0 additions & 2 deletions includes/credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ function pronamic_client_get_credits() {
function pronamic_client_credits() {
echo pronamic_client_get_credits();
}

add_action( 'pronamic_credits', 'pronamic_client_credits' );
Loading

0 comments on commit 7c8aaa2

Please sign in to comment.