: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
f.appendChild(makeOptions(i,options[i].label,options[i]['has_query'],options[i]['selected']));
renderGeneral(options, vals,index) {
const wrap = document.createDocumentFragment(),
select = this.renderSelect(options,vals[key]),
selectChange=function(select){
select.addEventListener('change', function (e) {
const opt = TBP.conditions['options'][TBP.type][this.value],
p=this.closest('.selectwrapper'),
item=this.options[this.selectedIndex];
let isQury=item.getAttribute('data-hasQuery')=='1'?true:null,
const queryNext = next.nextSibling;
next.parentNode.removeChild(next);
queryNext.parentNode.removeChild(queryNext);
if(opt['options']!==undefined){
const query = t.renderSelect(opt['options'],vals['query']);
p.parentNode.insertBefore(t.addSelectWrapper(query, 'query'), next);
if(vals['query']!==undefined ){
Themify.triggerEvent(query,'change');
else if(isQury===null && !item.hasAttribute('data-hasQuery')){
const group=item.parentNode,
id=group.nodeName==='OPTGROUP'?group.getAttribute('data-id'):false;
isQury=id && 'all_'+id!==this.value;
p.parentNode.insertBefore( t.renderSinlgeItems(vals['detail'],index), next);
wrap.appendChild(this.addSelectWrapper(select, key));
Themify.triggerEvent(select,'change');
renderSinlgeItems(vals, index) {
const template = document.getElementById('tmpl-tbp_pagination'),
wrap = document.createElement('div'),
wrap.className = 'tbp_inner_block selectwrapper tbp_pagination_wrapper';
wrap.appendChild(template.content.cloneNode(true));
const checkbox = wrap.getElementsByClassName('tbp_pagination_all')[0],
header = wrap.getElementsByClassName('tbp_pagination_header')[0],
onChange = function (el, load) {
header.textContent = header.getAttribute('data-select');
header.textContent = header.getAttribute('data-all');
header.addEventListener('click', function (e) {
const p = this.parentNode,
if (checkbox.checked !== true) {
p.classList.remove('tbp_pagination_active');
document.removeEventListener('click', click, {passive: true});
if (!wrap.contains(e.target)) {
if (p.classList.contains('tbp_pagination_active')) {
p.classList.add('tbp_pagination_active');
if (checkbox.checked === false && !checkbox.hasAttribute('done')) {
checkbox.setAttribute('done', true);
document.addEventListener('click', click, {passive: true});
checkbox.addEventListener('change', function (e) {
if (vals !== undefined) {
checkbox.checked = false;
onChange(checkbox, null);
const repeat = wrap.closest('.tbp_condition_repeat');
index = repeat.getAttribute('data-index');
checkedItems[index] = vals;
loadData(wrap, page, search, callback) {
while (theSelected !== null) {
theSelected = theSelected.previousElementSibling;
if (theSelected.classList.contains('tbp_block_item') && theSelected.offsetParent !== null) {
if (theSelected !== null) {
const res = wrap.getElementsByClassName('tbp_pagination_result_wrap')[0],
type = theSelected.getElementsByTagName('select')[0].value,
finish = function (vals) {
const wrapResult = document.createElement('div'),
f = document.createDocumentFragment(),
index = wrap.closest('.tbp_condition_repeat').getAttribute('data-index'),
wrapResult.className = 'tbp_pagination_result tf_scrollbar';
let label = document.createElement('label'),
input = document.createElement('input');
if (checkedItems[index] !== undefined && checkedItems[index][i] !== undefined) {
label.appendChild(input);
label.insertAdjacentHTML('beforeend',data[i]);
wrapResult.appendChild(f);
res.appendChild(wrapResult);
const tbp_pagination_list = document.createElement('div'),
pf = document.createDocumentFragment();
tbp_pagination_list.className = 'tbp_pagination_list';
for (let i = 1, n = Math.ceil(count / limit); i <= n; ++i) {
let link = document.createElement('a');
link.className = 'page_numbers';
link.className += ' current';
link.setAttribute('data-number', i);
tbp_pagination_list.appendChild(pf);
tbp_pagination_list.addEventListener('click', function (e) {
const p = e.target.getAttribute('data-number');
self.saveCheckboxes(wrap);
self.loadData(wrap, p, search, callback);
res.appendChild(tbp_pagination_list);
const searchInput=wrapResult.closest('.tbp_pagination_search').getElementsByClassName('tbp_pagination_search_input')[0];
if(searchInput!==undefined && search === undefined){
searchInput.addEventListener('search', searchItem);
searchInput.addEventListener('input', searchItem);
callback(vals, res, page);
searchItem = function (e) {
self.saveCheckboxes(wrap);
self.loadData(wrap, 1, search, callback);
self.loadData(wrap, 1, null, callback);
if (cache[type] === undefined || cache[type][page] === undefined || self.isSearching) {
url: themifyBuilder.ajaxurl,
res.classList.add('tb_busy');
tb_load_nonce: themifyBuilder.tb_load_nonce
res.classList.remove('tb_busy');
if (cache[type] === undefined) {
cache[type][page] = resp;
if (resp && resp.count > 0) {
self.isSearching = false;
else if (cache[type][page].count > 0) {
finish(cache[type][page]);
const checkboxes = wrap.getElementsByTagName('input'),
index = wrap.closest('.tbp_condition_repeat').getAttribute('data-index');
if (checkedItems[index] === undefined) {
checkedItems[index] = {};
for (let i = checkboxes.length - 1; i > -1; --i) {
let v = checkboxes[i].value;
if (checkboxes[i].checked === true) {
checkedItems[index][v] = true;
else if (checkedItems[index][v] !== undefined) {
delete checkedItems[index][v];
renderRepeat(options, index, vals, self) {
const f = document.createDocumentFragment(),
repeat = document.createElement('div'),
repeatInner = document.createElement('div'),
deleteBtn = document.createElement('a');
repeat.className = 'tbp_condition_repeat';
repeatInner.className = 'tbp_condition_repeat_inner';
index=index !== null ? index : this.setIndex();
repeat.setAttribute('data-index', index);
deleteBtn.className = 'ti-close tbp_delete_repeater';
repeatInner.appendChild(this.includeRender(vals, self));
repeatInner.appendChild(this.renderGeneral(options, vals, index));
f.appendChild(repeatInner);
f.appendChild(deleteBtn);
deleteBtn.addEventListener('click', function (e) {
const index = repeat.closest('.tbp_condition_repeat').dataset['index'];
if (checkedItems[index] !== undefined) {
delete checkedItems[index];
repeat.parentNode.removeChild(repeat);
const wrap = document.createElement('div'),
add = document.createElement('a'),
wrap.className = 'tb_lb_option tbp_condition_wrap';
if(TBP.conditions===null){
if (data['options'][type] !== undefined) {
add.className = 'add_new tf_plus_icon';
add.textContent = _tbp_app.add_conition;
const f = document.createDocumentFragment();
let values = ThemifyConstructor.values[data.id];
if (values === undefined || values.length === 0) {
for (let i = 0, len = values.length; i < len; ++i) {
f.appendChild(this.renderRepeat(data['options'][type], i, values[i], self));
add.addEventListener('click', function (e) {
const repeat = this.renderRepeat(data['options'][type], null, {}, self);
e.currentTarget.before(repeat);
const repeats = _this.lightboxContainer.getElementsByClassName('tbp_condition_repeat');
let max = repeats[0] !== undefined ? (parseInt(repeats[0].getAttribute('data-index'))) : 0;
for (let i = repeats.length - 1; i > 0; --i) {
let index = parseInt(repeats[i].getAttribute('data-index'));
addSelectWrapper(select, key) {
const wrap = document.createElement('div');
wrap.className = 'selectwrapper tbp_inner_block';
wrap.className += ' tbp_block_item tbp_block_' + key;
select.setAttribute('data-id', key);
wrap.appendChild(select);
editBtn.addEventListener('click', function (e) {
const items = _this.lightbox.getElementsByClassName('tb_lb_option'),
for (let i = items.length - 1; i > -1; --i) {
if (items[i].classList.contains('tbp_condition_wrap')) {
let conditions = items[i].getElementsByClassName('tbp_condition_repeat'),
for (let j = 0, len = conditions.length; j < len; ++j) {
let conditionItems = conditions[j].getElementsByClassName('tbp_inner_block');
for (let k = conditionItems.length - 1; k > -1; --k) {
if (conditionItems[k].offsetParent !== null) {
let cl = conditionItems[k].classList;
if (cl.contains('tbp_include')) {
let select = conditionItems[k].getElementsByTagName('select')[0];
if (select.value !== 'in') {
conditionsData[j][select.getAttribute('data-id')] = select.value;
else if (cl.contains('tbp_pagination_wrapper')) {
if (conditionItems[k].getElementsByClassName('tbp_pagination_all')[0].checked !== true) {
let index = conditions[j].getAttribute('data-index');
if (checkedItems[index] !== undefined) {
conditionsData[j]['detail'] = checkedItems[index];
else if (cl.contains('tbp_block_item')) {
let select = conditionItems[k].getElementsByTagName('select')[0];
conditionsData[j][select.getAttribute('data-id')] = select.value;
result[items[i].getAttribute('id')] = conditionsData;
else if (items[i].offsetParent !== null || items[i].type === 'hidden' || items[i].classList.contains('tb_uploader_input')) {
result[items[i].getAttribute('id')] = items[i].value.trim();
setPredesgnedList(result);
saveLightbox(false, _this.id, result);
this.id = e.currentTarget.getAttribute('data-post-id');
if (this.isLoaded === null) {
Themify.LoadCss(themifyBuilder.builderToolbarUrl, themifyBuilder.v);
Themify.LoadCss(themifyBuilder.builderCombineUrl, themifyBuilder.v);
if (document.body.classList.contains('tbp_loading')) {
url: themifyBuilder.ajaxurl,
action: this.pageId + '_get_item',
tb_load_nonce: themifyBuilder.tb_load_nonce
_this.run(_tbp_app.edit_template, resp);
this.run(_tbp_app.add_template, {});
window.location.reload();
this.lightbox.classList.remove('tbp_lightbox');
while (this.lightboxContainer.firstChild !== null) {
this.lightboxContainer.removeChild(this.lightboxContainer.firstChild);
document.body.classList.remove('tbp_step_2');
if (title === undefined) {
ThemifyConstructor.values = data;
ThemifyConstructor.label = self.labels;
wrap_class: 'tb_options_tab_content'
if ('tbp_no_theme_activated' === self.options[0].id && !self.id) {
args[0].options = self.options.slice(0, 1);
self.lightbox.getElementsByClassName('builder_button_edit')[0].addEventListener('click', function (e) {
window.location.href = self.options[0].theme_page_url;
else if ('tbp_no_theme_activated' === args[0].options[0].id){
args[0].options = self.options.slice(1);
self.createCustomTypes();
self.lightbox.getElementsByClassName('tbp_lightbox_title')[0].innerHTML = title;
self.lightboxContainer.appendChild(ThemifyConstructor.create(args));
ThemifyConstructor.callbacks();
self.lightbox.classList.add('tbp_lightbox');
self.lightboxContainer.classList.add( 'tf_scrollbar' );
if (this.isLoaded === null) {
Themify.LoadCss(themifyBuilder.builderToolbarUrl, themifyBuilder.v);
Themify.LoadCss(themifyBuilder.builderCombineUrl, themifyBuilder.v);
Themify.LoadAsync(themifyBuilder.tbAppUrl, function() {
Themify.LoadAsync(themifyBuilder.constructorUrl, callback, themifyBuilder.v, null, function () {
return typeof ThemifyConstructor !== 'undefined';
}, themifyBuilder.v, null, function () {
return typeof tb_app !== 'undefined';
if ('undefined' !== typeof _tbp_pointers) {
for (let i = _tbp_pointers.pointers.length - 1; i >-1; --i) {
this.pointerOpen(_tbp_pointers.pointers[i]);