Hi @dg12345,
will add some additional filter within the next days. But not as you suggested:
Dangerous Filter:
nsc_bar_filter_banner_config_array_init
class-nsc_bar_banner_configs.php:30
public function nsc_bar_get_banner_config_array()
{
if (empty($this->banner_config_array)) {
$banner_config_array = $this->initialise_banner_configs();
$banner_config_array = apply_filters('nsc_bar_filter_banner_config_array_init', $banner_config_array);
$this->banner_config_array = $banner_config_array;
}
return $this->banner_config_array;
}
Be carefull with this one: if your plugin/themes uses this filter it affects the settings as well and if someone updates the settings the output of your filter will be saved in the Database!
Save Filter
nsc_bar_filter_json_config_string_before_js
this is a string again, so you have to decode it, this is the way if you only want to filter the output
class-nsc_bar_frontend.php:96
public function nsc_bar_json_with_js_function()
{
$validator = new nsc_bar_input_validation();
$cleanedCookieTypes = $validator->esc_array_for_js($this->cookietypes);
$popUpCloseJsFunction = '"onPopupClose": function(){location.reload();}';
$pushToDLFunction = '"onStatusChange": function(status, chosenBefore) { var dataLayerName = "' . esc_js($this->dataLayerName) . '"; var cookieTypes = ' . json_encode($cleanedCookieTypes) . ';var cookieRootName = "' . esc_js($this->cookie_name) . '"; ' . file_get_contents(NSC_BAR_PLUGIN_DIR . "/public/onStatusChange.js") . '}';
$json_config_string_with_js = $this->json_config_string;
$json_config_string_with_js = apply_filters('nsc_bar_filter_json_config_string_before_js', $json_config_string_with_js);
if (!empty($this->container)) {
$setContainerPosition = '"container": document.querySelector("' . esc_js($this->container) . '")';
the difference to the filter implemented before, is that it returns a valid json which you can decode.
the old filter: nsc_bar_filter_json_config_string_with_js returns a valid JS object.
-
This reply was modified 3 years, 5 months ago by Support.
-
This reply was modified 3 years, 5 months ago by Support.
-
This reply was modified 3 years, 5 months ago by Support.