-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
2,868 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"core": null, | ||
"plugins": [ | ||
".", | ||
"https://downloads.wordpress.org/plugin/query-monitor.zip" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.