Remove early translation (fixes notice in WP 6.7).
This commit is contained in:
@@ -35,7 +35,7 @@ abstract class PluginBase {
|
|||||||
$this->setup_updater();
|
$this->setup_updater();
|
||||||
|
|
||||||
// Set Text Domain
|
// Set Text Domain
|
||||||
load_plugin_textdomain($this->get_textdomain(), false, plugin_basename(dirname($this->file)) . '/lang');
|
add_action('init', [$this, 'setup_textdomain']);
|
||||||
|
|
||||||
// Requirements Check
|
// Requirements Check
|
||||||
add_action('plugins_loaded', [$this, 'check_requirements'], 1, 0);
|
add_action('plugins_loaded', [$this, 'check_requirements'], 1, 0);
|
||||||
@@ -79,6 +79,10 @@ abstract class PluginBase {
|
|||||||
require_once($this->get_path() . 'lib/wp-package-updater-lib/package-updater.php');
|
require_once($this->get_path() . 'lib/wp-package-updater-lib/package-updater.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setup_textdomain() {
|
||||||
|
load_plugin_textdomain($this->get_textdomain(), false, plugin_basename(dirname($this->file)) . '/lang');
|
||||||
|
}
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
|
|
||||||
protected function add_requirement(string $key, array $data) {
|
protected function add_requirement(string $key, array $data) {
|
||||||
@@ -149,7 +153,7 @@ abstract class PluginBase {
|
|||||||
private function get_data(string $key):string {
|
private function get_data(string $key):string {
|
||||||
if (!function_exists('get_plugin_data')) require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
if (!function_exists('get_plugin_data')) require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||||
if (!is_array($this->plugin_data) || empty($this->plugin_data)) {
|
if (!is_array($this->plugin_data) || empty($this->plugin_data)) {
|
||||||
$this->plugin_data = get_plugin_data($this->file);
|
$this->plugin_data = get_plugin_data($this->file, translate: false);
|
||||||
}
|
}
|
||||||
if (!array_key_exists($key, $this->plugin_data)) return '';
|
if (!array_key_exists($key, $this->plugin_data)) return '';
|
||||||
return $this->plugin_data[$key];
|
return $this->plugin_data[$key];
|
||||||
|
|||||||
Reference in New Issue
Block a user