rebase on oct-10-2023
This commit is contained in:
@@ -28,6 +28,6 @@ class Model_Notice {
|
||||
$severityClass = 'notice-warning';
|
||||
}
|
||||
|
||||
echo '<div class="wfls-notice notice ' . $severityClass . '" data-notice-id="' . esc_attr($this->_id) . '" data-notice-type="' . esc_attr($this->_category) . '"><p>' . $this->_messageHTML . '</p><p>' . sprintf(__('<a class="wfls-btn wfls-btn-default wfls-btn-sm wfls-dismiss-link" href="#" onclick="GWFLS.dismiss_notice(\'%s\'); return false;">Dismiss</a>', 'wordfence-2fa'), esc_attr($this->_id)) . '</p></div>';
|
||||
echo '<div class="wfls-notice notice ' . $severityClass . '" data-notice-id="' . esc_attr($this->_id) . '" data-notice-type="' . esc_attr($this->_category) . '"><p>' . $this->_messageHTML . '</p><p>' . sprintf(__('<a class="wfls-btn wfls-btn-default wfls-btn-sm wfls-dismiss-link" href="#" onclick="GWFLS.dismiss_notice(\'%s\'); return false;">Dismiss</a>', 'wordfence'), esc_attr($this->_id)) . '</p></div>';
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@ namespace WordfenceLS;
|
||||
|
||||
class Model_Script extends Model_Asset {
|
||||
|
||||
private $translations = array();
|
||||
private $translationObjectName = null;
|
||||
|
||||
public function enqueue() {
|
||||
if ($this->registered) {
|
||||
wp_enqueue_script($this->handle);
|
||||
@@ -11,6 +14,9 @@ class Model_Script extends Model_Asset {
|
||||
else {
|
||||
wp_enqueue_script($this->handle, $this->source, $this->dependencies, $this->version);
|
||||
}
|
||||
if ($this->translationObjectName && !empty($this->translations)) {
|
||||
wp_localize_script($this->handle, $this->translationObjectName, $this->translations);
|
||||
}
|
||||
}
|
||||
|
||||
public function isEnqueued() {
|
||||
@@ -30,4 +36,19 @@ class Model_Script extends Model_Asset {
|
||||
return parent::register();
|
||||
}
|
||||
|
||||
public function withTranslation($placeholder, $translation) {
|
||||
$this->translations[$placeholder] = $translation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withTranslations($translations) {
|
||||
$this->translations = $translations;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTranslationObjectName($name) {
|
||||
$this->translationObjectName = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user