Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
/*
Plugin Name: Ajax Search Pro
Plugin URI: https://ajaxsearchpro.com
Description: The most powerful live search engine for WordPress.
Version: 4.27.2
Requires PHP: 7.4
Requires at least: 6.0
Author: Ernest Marcinko
Author URI: https://codecanyon.net/user/wpdreams
Text Domain: ajax-search-pro
Domain Path: /languages/
*/
use WPDRMS\ASP\Core\Globals;
use WPDRMS\ASP\Core\Manager;
defined('ABSPATH') or die("You can't access this file directly.");
define('ASP_FILE', __FILE__);
define('ASP_PLUGIN_BASE', plugin_basename( ASP_FILE ) );
define('ASP_PATH', plugin_dir_path(__FILE__));
define('ASP_CSS_PATH', ASP_PATH . '/css/');
define('ASP_INCLUDES_PATH', ASP_PATH . '/includes/');
define('ASP_CLASSES_PATH', ASP_PATH . '/src/server/');
define('ASP_EXTERNALS_PATH', ASP_PATH . '/includes/externals/');
define('ASP_FUNCTIONS_PATH', ASP_PATH . '/includes/functions/');
define('ASP_DIR', 'ajax-search-pro');
define('ASP_PLUGIN_NAME', 'ajax-search-pro/ajax-search-pro.php');
define('ASP_SITE_IS_PROBABLY_SSL', strpos(home_url('/'), 'https://') !== false || strpos(plugin_dir_url(__FILE__), 'https://') !== false);
define(
'ASP_URL',
ASP_SITE_IS_PROBABLY_SSL ?
str_replace('http://', 'https://', plugin_dir_url(__FILE__)) : plugin_dir_url(__FILE__)
);
define('ASP_URL_NP', str_replace(array( 'http://', 'https://' ), '//', plugin_dir_url(__FILE__)));
define('ASP_CURR_VER', 5095);
define('ASP_CURR_VER_STRING', '4.27.2');
define('ASP_DEBUG', 0);
if ( !defined('ASP_DEMO') ) {
define('ASP_DEMO', false );
}
// The one and most important global
global $wd_asp;
require_once ASP_PATH . '/vendor/autoload.php';
require_once ASP_CLASSES_PATH . 'Autoloader.php';
$wd_asp = new Globals();
if ( !function_exists('wd_asp') ) {
/**
* Easy access of the global variable reference
*
* @return Globals
*/
function wd_asp() {
global $wd_asp;
return $wd_asp;
}
}
// Initialize the plugin
$wd_asp->manager = Manager::getInstance();

View File

@@ -0,0 +1,47 @@
<?php
// -- AJAX_SEARCH.PHP --
//mimic the actual admin-ajax
use WPDRMS\ASP\Hooks\AjaxManager;
define('DOING_AJAX', true);
if (!isset($_POST['action']))
die('-1');
//make sure you update this line
//to the relative location of the wp-load.php
if ( file_exists('../../../wp-load.php') ) {
require_once('../../../wp-load.php');
} else if ( file_exists(dirname('../../../index.php' ) . '/.wordpress/wp-load.php') ) {
// FLYWHEEL hosting
require_once( dirname('../../../index.php' ) . '/.wordpress/wp-load.php' );
} else {
// DEFAULT
require_once('../../../wp-load.php');
}
//Typical headers
header('Content-Type: text/plain');
send_nosniff_header();
//Disable caching
header('Cache-Control: no-cache');
header('Pragma: no-cache');
global $wd_asp;
$action = esc_attr(trim($_POST['action']));
//A bit of security
$allowed_actions = AjaxManager::getAll();
AjaxManager::registerAll(true);
if (in_array($action, $allowed_actions)) {
if (is_user_logged_in())
do_action('ASP_' . $action);
else
do_action('ASP_nopriv_' . $action);
} else {
die('-1');
}

View File

@@ -0,0 +1,97 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./backend/Assets/Options/dev/js/AbstractOption.ts":
/*!*********************************************************!*\
!*** ./backend/Assets/Options/dev/js/AbstractOption.ts ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Option = exports.$ = void 0;\n// @ts-ignore\nconst jquery_1 = __importDefault(__webpack_require__(/*! jquery */ \"jquery\"));\nexports.$ = jquery_1.default;\nclass Option {\n constructor(target) {\n this.node = target;\n this.node.optionController = this;\n (0, jquery_1.default)(this.node).on('wpd/options/state/change', this.changeHandler);\n (0, jquery_1.default)(this.node).on('wpd/options/state/update', () => { this.update.apply(this); });\n this.init();\n }\n changeHandler(n, ...args) {\n this.optionController.change.apply(this.optionController, args);\n }\n}\nexports.Option = Option;\n\n\n//# sourceURL=webpack://ajax-search-pro/./backend/Assets/Options/dev/js/AbstractOption.ts?");
/***/ }),
/***/ "./backend/Assets/Options/dev/js/App.ts":
/*!**********************************************!*\
!*** ./backend/Assets/Options/dev/js/App.ts ***!
\**********************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n// @ts-ignore\nconst jquery_1 = __importDefault(__webpack_require__(/*! jquery */ \"jquery\"));\nconst Text_1 = __importDefault(__webpack_require__(/*! ./Text */ \"./backend/Assets/Options/dev/js/Text.ts\"));\nconst YesNo_1 = __importDefault(__webpack_require__(/*! ./YesNo */ \"./backend/Assets/Options/dev/js/YesNo.ts\"));\n(0, jquery_1.default)(function ($) {\n $('div.wpdreamsText input[type=text]').each(function () {\n new Text_1.default(this);\n });\n $('.wpdreamsYesNo input[type=hidden]').each(function () {\n new YesNo_1.default(this);\n });\n});\n\n\n//# sourceURL=webpack://ajax-search-pro/./backend/Assets/Options/dev/js/App.ts?");
/***/ }),
/***/ "./backend/Assets/Options/dev/js/Text.ts":
/*!***********************************************!*\
!*** ./backend/Assets/Options/dev/js/Text.ts ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst AbstractOption_1 = __webpack_require__(/*! ./AbstractOption */ \"./backend/Assets/Options/dev/js/AbstractOption.ts\");\nclass Text extends AbstractOption_1.Option {\n init() {\n const _this = this, node = this.node;\n if (typeof ((0, AbstractOption_1.$)(node).data('regex')) != 'undefined' && (0, AbstractOption_1.$)(node).data('regex') != '') {\n this.setDefault();\n node.oldValue = node.value;\n (0, AbstractOption_1.$)(node).on('input contextmenu drop focusout', function (e) {\n _this.validate(e);\n });\n (0, AbstractOption_1.$)(node).on('focusout', function () {\n _this.setDefault();\n });\n }\n }\n change(v) {\n if (typeof v === 'undefined') {\n this.setDefault();\n }\n else {\n this.node.value = v;\n }\n }\n update() {\n this.node.setCustomValidity(\"\");\n }\n setDefault() {\n const node = this.node;\n if ((0, AbstractOption_1.$)(node).val() === '' &&\n (0, AbstractOption_1.$)(node).data('allow_empty') == 0 &&\n (0, AbstractOption_1.$)(node).data('default') !== '') {\n (0, AbstractOption_1.$)(node).val((0, AbstractOption_1.$)(node).data('default'));\n node.oldValue = (0, AbstractOption_1.$)(node).data('default');\n }\n }\n validate(e) {\n const node = this.node;\n node.setCustomValidity(\"\");\n if ((0, AbstractOption_1.$)(node).val() != \"\") {\n let pattern = (0, AbstractOption_1.$)(node).data('regex');\n let r = new RegExp(pattern, 'g');\n if (!r.test((0, AbstractOption_1.$)(node).val())) {\n if (e !== false) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n node.value = node.oldValue;\n node.setCustomValidity((0, AbstractOption_1.$)(node).data('validation_msg'));\n node.reportValidity();\n }\n else {\n node.oldValue = node.value;\n node.setCustomValidity(\"\");\n }\n }\n }\n}\nexports[\"default\"] = Text;\n\n\n//# sourceURL=webpack://ajax-search-pro/./backend/Assets/Options/dev/js/Text.ts?");
/***/ }),
/***/ "./backend/Assets/Options/dev/js/YesNo.ts":
/*!************************************************!*\
!*** ./backend/Assets/Options/dev/js/YesNo.ts ***!
\************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst AbstractOption_1 = __webpack_require__(/*! ./AbstractOption */ \"./backend/Assets/Options/dev/js/AbstractOption.ts\");\nclass YesNo extends AbstractOption_1.Option {\n init() {\n (0, AbstractOption_1.$)(this.node).parent().find('.wpdreamsYesNoInner').on('click', () => {\n this.change();\n this.update();\n });\n }\n change(v) {\n const $parent = (0, AbstractOption_1.$)(this.node).closest('.wpdreamsYesNo');\n if (typeof v === 'undefined') {\n v = !(this.node.value == '1');\n }\n if (v) {\n this.node.value = '1';\n }\n else {\n this.node.value = '0';\n }\n }\n update() {\n const $parent = (0, AbstractOption_1.$)(this.node).closest('.wpdreamsYesNo');\n if (this.node.value == '1') {\n $parent.addClass(\"active\");\n }\n else {\n $parent.removeClass(\"active\");\n }\n }\n}\nexports[\"default\"] = YesNo;\n\n\n//# sourceURL=webpack://ajax-search-pro/./backend/Assets/Options/dev/js/YesNo.ts?");
/***/ }),
/***/ "jquery":
/*!*************************!*\
!*** external "jQuery" ***!
\*************************/
/***/ ((module) => {
module.exports = jQuery;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__("./backend/Assets/Options/dev/js/App.ts");
/******/
/******/ })()
;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
/*!
* Select2 4.1.0-rc.0
* https://select2.github.io
*
* Released under the MIT license
* https://github.com/select2/select2/blob/master/LICENSE.md
*/

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,973 @@
/**
* This file should be the first in the order
*/
window.WPD = typeof window.WPD !== 'undefined' ? window.WPD : {};
window.WPD.Options = typeof window.WPD.Options !== 'undefined' ?window.WPD.Options : {};
window.WPD.Options._classes = typeof window.WPD.Options._classes !== 'undefined' ?window.WPD.Options._classes : {};
jQuery(function($){
const classes = window.WPD.Options._classes;window.WPD.Options._classes.AbstractOption = class {
constructor( target = null ) {
this.node = target;
this.init();
}
init() {}
};jQuery(function($){
/**
* Spectrum: color chooser
*/
$(".wpdreamsColorPicker .color").spectrum({
showInput: true,
showAlpha: true,
showPalette: true,
showSelectionPalette: true
}).on('wd_state_update', function () {
function hex2rgb(hex, opacity) {
let rgb = hex.replace('#', '').match(/(.{2})/g),
i = 3;
while (i--) {
rgb[i] = parseInt(rgb[i], 16);
}
if (typeof opacity == 'undefined') {
return 'rgb(' + rgb.join(', ') + ')';
}
return 'rgba(' + rgb.join(', ') + ', ' + opacity + ')';
}
let val = $(this).val();
if ( val.length <= 7 ) {
val = hex2rgb(val, 1);
}
$(this).spectrum("set", val);
});
});jQuery(function($) {
$('div.wd_cf_search').each(function () {
var timeout = null;
var parent = this;
var id = $(this).attr('id').match(/^wd_cf_search-(.*)/)[1];
var $res = $('.wd_cf_search_res', parent);
$("input.wd_cf_search", parent).on('keyup', function () {
var $this = $(this);
clearTimeout(timeout);
if ($this.val() == '') {
$('.wd_ts_close', parent).addClass("hiddend");
$('.loading-small', parent).addClass("hiddend");
return;
}
timeout = setTimeout(function () {
$('.loading-small', parent).removeClass("hiddend");
$('.wd_ts_close', parent).addClass("hiddend");
var data = {
'action': 'wd_search_cf',
'wd_phrase': $this.val(),
'wd_required': 1,
'wd_args': $("input.wd_args", parent).val()
};
$.post(ajaxurl, data, function (response) {
var o = JSON.parse(WD_Helpers.Base64.decode($("input.wd_args", parent).val()));
var reg = new RegExp(o.delimiter + '(.*[\s\S]*)' + o.delimiter);
var data_r = response.match(reg);
data_r = JSON.parse(data_r[1]);
if (typeof o.callback != 'undefined' && o.callback != '') {
if (typeof window[o.callback] != 'undefined')
window[o.callback].apply(null, [data_r, $this, o, parent, id]);
} else {
var html = '';
$.each(data_r, function (i, v) {
html += '<li key="' + v.meta_key + '">' + v.meta_key + '</li>';
});
if (html != '')
$res.html('<ul>' + html + '</ul>');
else
$res.html('<p>No results :(</p>');
$res.css('display', 'block');
var bottom_of_element = $this.offset().top + $res.outerHeight();
var bottom_of_screen = $(window).scrollTop() + window.innerHeight;
if ((bottom_of_element > bottom_of_screen)) {
$res.css({
left: $this.position().left + $this.outerWidth(true) + 5,
top: $this.position().top - (bottom_of_element - bottom_of_screen),
display: 'block',
minWidth: $this.width()
});
} else {
$res.css({
left: $this.position().left,
top: $this.position().top + $this.outerHeight(true) + 10,
display: 'block',
minWidth: $this.width()
});
}
$res.find('li').on('click', function (e) {
$this.val($(this).attr('key'));
$res.css({display: 'none'});
});
}
$('.loading-small', parent).addClass("hiddend");
$('.wd_ts_close', parent).removeClass("hiddend");
}, "text");
}, 350);
});
$('.wd_ts_close', parent).on('click', function () {
$("input.wd_cf_search", parent).val('');
$(this).addClass("hiddend");
$res.css({
display: 'none'
});
});
$("input.wd_cf_search", parent).on('click', function () {
$res.css({
display: 'block'
});
});
$("input.wd_cf_search", parent).on('blur', function () {
$(this).val($(this).val().trim());
});
$(parent).click("click", function (e) {
e.stopImmediatePropagation();
});
$(document).off('click.wpd_custom_field_search').on('click.wpd_custom_field_search', function () {
$('.wd_ts_close', parent).addClass("hiddend");
$res.css({display: 'none'});
});
});
/**
* EXAMPLE HANDLER
window.my_js_function_name = function(r, $node, o) {
//console.log(r, $node, o);
};
*/
});jQuery(function($) {
/**
* Custom field selectors
*/
window.wd_cf_ajax_callback = function(r, $node, o, parent) {
var $cf_parent = $node.closest('.wpdreamsCustomFields');
var $drg = $(".draggablecontainer ul", $cf_parent);
var id = $cf_parent.attr('id').match(/^wpdreamsCustomFields-(.*)/)[1];
var html = '';
var drag_opts = {
connectToSortable: "#sortable_conn" + id,
update: function (event, ui) {},
cancel: ".ui-state-disabled",
helper: "clone",
items: "> li"
};
if ( r.length > 0 ) {
$.each(r, function(i, v) {
var title = v.meta_key.replace('__pods__', '[PODs] ');
html += '<li class="ui-state-default" cf_name="'+v.meta_key+'">'+title+'<a class="deleteIcon"></a></li>';
});
$drg.html(html);
$("#sortable" + id + " li").draggable(drag_opts).disableSelection();
$("#sortable" + id + " li").trigger('sortupdate');
$("#sortable_conn" + id).trigger('sortupdate');
} else {
$drg.html('No results for this phrase.');
}
}
$('div.wpdreamsCustomFields').each(function(){
var id = $(this).attr('id').match(/^wpdreamsCustomFields-(.*)/)[1];
var name = $('input[isparam=1]', this).attr('name');
var parent = $(this);
var hidden = $('input[isparam=1]', this);
function list_update() {
$("#sortable" + id + " li").removeClass("ui-state-disabled");
$('ul[id*=sortable_conn] li', parent).each(function (i, v) {
$("#sortable" + id + " li[cf_name='"+$(this).attr('cf_name')+"']").addClass("ui-state-disabled");
});
}
function data_update() {
var items = $("#sortable_conn" + id + " li")
var val = "";
items.each(function () {
val += "|" + $(this).attr('cf_name');
});
val = val.substring(1);
hidden.val(val);
}
$("#sortable_conn" + id).sortable({
update: function (event, ui) {
var $item = $(ui.item);
$item.css({
"width": "",
"height": ""
});
list_update();
data_update();
},
items: "> li",
cancel: ".ui-state-disabled",
remove: function(event, ui) {}
}).disableSelection();
$("#sortable_conn" + id).on('sortupdate', function(event, ui) {
list_update();
data_update();
});
$("#sortable_conn" + id).on( "click", "li a.deleteIcon", function(e){
e.preventDefault();
$(this).parent().detach();
list_update();
data_update();
});
$("#draggablecontainer" + id + " .arrow-all-left").on('click', function(){
$("#sortable_conn" + id + " li").detach();
$("#sortable_conn" + id).trigger('sortupdate');
});
$("#draggablecontainer" + id + " .arrow-all-right").on('click', function(){
$("#sortable" + id + " li:not(.hiddend):not(.ui-state-disabled)").clone().appendTo("#sortable_conn" + id);
$("#sortable_conn" + id).trigger('sortupdate');
});
});
});jQuery(function($){
$('.wd_imageRadio img.image_radio').on('click', function() {
var $parent = $(this).parent();
var $hidden = $("input[isparam]", $parent);
$('img.selected', $parent).removeClass('selected');
$(this).addClass('selected');
$hidden.val($(this).data('value')).trigger('change')
});
$('.wd_imageRadio input[type=hidden]').on('wd_state_update', function () {
let $parent = $(this).closest('.wd_imageRadio');
$parent.find('img.selected').removeClass('selected');
$parent.find('img[data-value="' + $(this).val() + '"]').addClass('selected');
$(this).trigger('change');
});
});jQuery(function($){
/**
* @description determine if an array contains one or more items from another array.
* @param {array} haystack the array to search.
* @param {array} arr the array providing items to check for in the haystack.
* @return {boolean} true|false if haystack contains at least one item from arr.
*/
let findOne = function (haystack, arr) {
return arr.some(function (v) {
return haystack.indexOf(v) >= 0;
});
};
let mimes = {
'pdf': [
'application/pdf'
],
'text' : [
'text/plain',
'text/csv',
'text/tab-separated-values',
'text/calendar',
'text/css',
'text/html'
],
'richtext' : [
'text/richtext',
'application/rtf'
],
'mso_word' : [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-word.document.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.ms-word.template.macroEnabled.12',
'application/vnd.oasis.opendocument.text'
],
'mso_excel' : [
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel.sheet.macroEnabled.12',
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/vnd.ms-excel.template.macroEnabled.12',
'application/vnd.ms-excel.addin.macroEnabled.12',
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.chart',
'application/vnd.oasis.opendocument.database',
'application/vnd.oasis.opendocument.formula'
],
'mso_powerpoint' : [
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.presentationml.template',
'application/vnd.ms-powerpoint.template.macroEnabled.12',
'application/vnd.ms-powerpoint.addin.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.presentationml.slide',
'application/vnd.ms-powerpoint.slide.macroEnabled.12',
'application/vnd.oasis.opendocument.presentation',
'application/vnd.oasis.opendocument.graphics'
],
'image': [
'image/jpeg',
'image/gif',
'image/png',
'image/bmp',
'image/tiff',
'image/x-icon'
],
'video': [
'video/x-ms-asf',
'video/x-ms-wmv',
'video/x-ms-wmx',
'video/x-ms-wm',
'video/avi',
'video/divx',
'video/x-flv',
'video/quicktime',
'video/mpeg',
'video/mp4',
'video/ogg',
'video/webm',
'video/x-matroska'
],
'audio': [
'audio/mpeg',
'audio/x-realaudio',
'audio/wav',
'audio/ogg',
'audio/midi',
'audio/x-ms-wma',
'audio/x-ms-wax',
'audio/x-matroska'
]
};
$('.wd_MimeTypeSelect .file_mime_types_list select').select2().on('change', function(){
let values = [];
$(this).val().forEach(function(v){
values.push(mimes[v].join(','));
});
$(this).closest('.wd_MimeTypeSelect').find('.file_mime_types_input textarea')
.val(values.join(',')).trigger('input').trigger('click');
});
$('.wd_MimeTypeSelect .file_mime_types_input textarea').on('click keyup change cut paste', function(){
let val = $(this).val().toLowerCase().replace(' ', '');
let vals_arr = val.split(',');
let selected_mimes = [];
if ( vals_arr.length > 0 ) {
$.each(vals_arr, function(i, v){
vals_arr[i] = v.trim();
});
$.each(mimes, function(i, v){
$.each(v, function(ii, vv){
mimes[i][ii] = vv.toLowerCase();
});
});
$.each(mimes, function(k, arr){
if ( findOne(arr, vals_arr) ) {
selected_mimes.push(k);
}
});
}
$(this).closest('.wd_MimeTypeSelect')
.find('.file_mime_types_list select').val(selected_mimes).trigger('change.select2');
}).trigger('click');
$('span.mime_input_hide').on('click', function(){
let $p = $(this).closest('.wd_MimeTypeSelect');
$p.find('.file_mime_types_input').addClass('hiddend')
$p.find('.file_mime_types_list').removeClass('hiddend');
});
$('span.mime_list_hide').on('click', function(){
let $p = $(this).closest('.wd_MimeTypeSelect');
$p.find('.file_mime_types_input').removeClass('hiddend')
$p.find('.file_mime_types_list').addClass('hiddend');
$p.find('.file_mime_types_input textarea').trigger('input');
});
});jQuery(function($){
$('div.wd_cpt_search').each(function() {
var timeout = null;
var parent = this;
var id = $(this).attr('id').match(/^wd_cpt_search-(.*)/)[1];
var $res = $('.wd_cpt_search_res', parent);
var $param = $('input[isparam]', parent);
$("input.wd_cpt_search", parent).on('keyup', function() {
var $this = $(this);
clearTimeout(timeout);
if ( $this.val() == '' ) {
$('.wd_ts_close', parent).addClass("hiddend");
$('.loading-small', parent).addClass("hiddend");
return;
}
timeout = setTimeout(function () {
$('.loading-small', parent).removeClass("hiddend");
$('.wd_ts_close', parent).addClass("hiddend");
var data = {
'action': 'wd_search_cb_cpt',
'wd_phrase': $this.val(),
'wd_required': 1,
'wd_args': $("input.wd_args", parent).val()
};
$.post(ajaxurl, data, function (response) {
var o = JSON.parse(WD_Helpers.Base64.decode($("input.wd_args", parent).val()));
var reg = new RegExp(o.delimiter +'(.*[\s\S]*)'+ o.delimiter);
var data_r = response.match(reg);
data_r = JSON.parse(data_r[1]);
if ( typeof o.callback != 'undefined' && o.callback != '' ) {
if ( typeof window[o.callback] != 'undefined' )
window[o.callback].apply(null, [data_r, $this, o, parent, id]);
} else {
var html = '';
$.each(data_r, function(i, v){
html += '<li key="' + v.ID + '">' + v.post_title + ' (' + v.post_type + ')</li>';
});
if ( html != '')
$res.html('<ul>' + html + '</ul>');
else
$res.html('<p>No results :(</p>');
$res.css('display', 'block');
var bottom_of_element = $this.offset().top + $res.outerHeight();
var bottom_of_screen = $(window).scrollTop() + window.innerHeight;
if( ( bottom_of_element > bottom_of_screen ) ){
$res.css({
left: $this.position().left + $this.outerWidth(true) + 5,
top: $this.position().top - (bottom_of_element - bottom_of_screen),
display: 'block',
minWidth: $this.width()
});
} else {
$res.css({
left: $this.position().left,
top: $this.position().top + $this.outerHeight(true) + 10,
display: 'block',
minWidth: $this.width()
});
}
$res.find('li').on('click', function(e){
$this.val('');
$this.addClass('hiddend');
$(".wp_cpt_search_selected span:not(.fa)", parent).text($(this).text());
$(".wp_cpt_search_selected", parent).removeClass('hiddend');
$param.val($(this).attr('key'));
$res.css({display: 'none'});
$('.wd_ts_close', parent).addClass("hiddend");
});
}
$('.loading-small', parent).addClass("hiddend");
$('.wd_ts_close', parent).removeClass("hiddend");
}, "text");
}, 350);
});
$('.wd_ts_close', parent).on('click', function(){
$("input.wd_cpt_search", parent).val('');
$(this).addClass("hiddend");
$res.css({
display: 'none'
});
});
$("input.wd_cpt_search", parent).on('click', function() {
$res.css({
display: 'block'
});
});
$("input.wd_cpt_search", parent).on('blur', function () {
$(this).val($(this).val().trim());
});
$(parent).click("click", function (e) {
e.stopImmediatePropagation();
});
$(".wp_cpt_search_selected", parent).on('click', function () {
$param.val('');
$(this).addClass('hiddend');
$('.wd_ts_close', parent).trigger('click');
$("input.wd_cpt_search", parent).removeClass('hiddend');
});
if ( $(".wp_cpt_search_selected", parent).text().trim() == '' || $(".wp_cpt_search_selected", parent).text().trim() == '()' ) {
$(".wp_cpt_search_selected", parent).addClass('hiddend');
$("input.wd_cpt_search", parent).removeClass('hiddend');
}
$(document).on('click', function(){
$('.wd_ts_close', parent).addClass("hiddend");
$res.css({display: 'none'});
});
});
/**
* EXAMPLE HANDLER
window.my_js_function_name = function(r, $node, o) {
//console.log(r, $node, o);
};
*/
});jQuery(function($){
$('div.wd_post_type_sortalbe').each(function(){
var parent = $(this);
var id = $(this).attr('id').match(/^wd_post_type_sortalbe-(.*)/)[1];
var selector = "#sortable" + id +", #sortable_conn" + id;
var hidden = $('input[isparam=1]', parent);
$(selector).sortable({}, {
update: function (event, ui) {}
}).disableSelection();
$(selector).on('sortupdate', function(event, ui) {
var items = $('ul[id*=sortable] li', parent);
var val = [];
items.each(function () {
val.push($(this).html().trim());
});
hidden.val( '_decode_' + WD_Helpers.Base64.encode(JSON.stringify(val)) );
});
$(selector).trigger("sortupdate");
});
});jQuery(function($) {
$('div.wpdreamsCustomPostTypes').each(function () {
let id = $(this).data('id'),
selector = "#sortable" + id + ", #sortable_conn" + id,
parent = $(this),
hidden = $('input[isparam=1]', this);
$(selector).sortable({
connectWith: ".connectedSortable" + id
}).disableSelection();
$(selector).on('sortupdate', function(event, ui){
// Items need to be re-parsed!
let items = parent.find('ul[id*=sortable_conn] li'),
val = [];
items.each(function () {
val.push($(this).data('ptype'));
});
hidden.val("_decode_" + WD_Helpers.Base64.encode(JSON.stringify(val)));
});
$("#sortablecontainer" + id + " .arrow-all").on('click', function(){
if ( $(this).hasClass('arrow-all-left') ) {
$("#sortable_conn" + id + " li").detach().appendTo("#sortable" + id + "");
} else {
$("#sortable" + id + " li:not(.hiddend)").detach().appendTo("#sortable_conn" + id);
}
$(selector).trigger("sortupdate");
});
});
});jQuery(function($){
$('div.wpdreamsSortable').each(function(){
let id = $(this).data('id'),
selector = "#sortable" + id,
parent = $(this),
hidden = $('input[isparam=1]', this);
$(selector).sortable().disableSelection();
$(selector).on('sortupdate', function(event, ui){
// Items need to be re-parsed!
let items = parent.find('ul[id*=sortable_conn] li'),
val = [];
items.each(function () {
val.push($(this).data('value'));
});
hidden.val(val.join('|'));
});
});
});jQuery(function($){
$('div.wpdreamsTaxonomySelect').each(function () {
let id = $(this).data('id'),
selector = "#sortable" + id + ", #sortable_conn" + id,
parent = $(this),
hidden = $('input[isparam=1]', this);
$(selector).sortable({
connectWith: ".connectedSortable" + id
}).disableSelection();
$(selector).on('sortupdate', function(event, ui){
// Items need to be re-parsed!
let items = parent.find('ul[id*=sortable_conn] li'),
val = [];
items.each(function () {
val.push($(this).data('taxonomy'));
});
hidden.val(val.join('|'));
});
$("#sortablecontainer" + id + " .arrow-all").on('click', function(){
if ( $(this).hasClass('arrow-all-left') ) {
$("#sortable_conn" + id + " li").detach().appendTo("#sortable" + id + "");
} else {
$("#sortable" + id + " li:not(.hiddend)").detach().appendTo("#sortable_conn" + id);
}
$(selector).trigger("sortupdate");
});
});
});jQuery(function($){
// This needs to be triggered once the window is loaded, otherwise it may have no effect on init
$('textarea.wd_textarea_expandable').textareaAutoSize();
var textAuto;
$('.tabs a[tabid]').on('click', function(){
clearTimeout(textAuto);
textAuto = setTimeout(function(){
$('textarea.wd_textarea_expandable').trigger('input');
}, 50);
});
});import {AbstractOption} from './abstract-option.js';
export class Text extends AbstractOption {
init() {
const
_this = this,
node = this.node;
if ( typeof ($(node).data('regex')) != 'undefined' && $(node).data('regex') != '' ) {
this.setDefault();
node.oldValue = node.value;
$(node).on('input contextmenu drop focusout', function(e){
_this.validate(e);
});
$(node).on('focusout', function(e){
_this.setDefault();
});
}
}
setDefault() {
const node = this.node;
if (
$(node).val() === '' &&
$(node).data('allow_empty') == 0 &&
$(node).data('default') !== ''
) {
$(node).val($(node).data('default'));
node.oldValue = $(node).data('default');
}
}
validate(e = false) {
const node = this.node;
node.setCustomValidity("");
if ( $(node).val() != "" ) {
let pattern = $(node).data('regex');
let r = new RegExp(pattern, 'g');
if (!r.test($(node).val())) {
if ( e !== false ) {
validate(e = false) {
const node = this.node;
node.setCustomValidity("");
if ( $(node).val() != "" ) {
let pattern = $(node).data('regex');
let r = new RegExp(pattern, 'g');
if (!r.test($(node).val())) {
if ( e !== false ) {
e.preventDefault();
e.stopImmediatePropagation();
}
node.value = node.oldValue;
node.setCustomValidity($(node).data('validation_msg'));
node.reportValidity();
} else {
node.oldValue = node.value;
node.setCustomValidity("");
}
node.value = node.oldValue;
node.setCustomValidity($(node).data('validation_msg'));
node.reportValidity();
} else {
node.oldValue = node.value;
node.setCustomValidity("");
}
}
}
}jQuery(function($){
/**
* wpdreamsUpload - File uploader window
*/
var custom_uploader, $cup_text;
$('.wpdreamsUpload .wdUploadButton').on('click', function(e){
e.preventDefault();
$cup_text = $(this).parent().find('input.wdUploadText');
//If the uploader object has already been created, reopen the dialog
if ( custom_uploader ) {
custom_uploader.open();
return;
}
//Extend the wp.media object
custom_uploader = wp.media.frames.file_frame = wp.media({
title: 'Choose File',
button: {
text: 'Choose File'
},
multiple: false
});
//When a file is selected, grab the URL and set it as the text field's value
custom_uploader.on('select', function () {
var attachment = custom_uploader.state().get('selection').first().toJSON();
$cup_text.val(attachment.url).trigger('change');
});
//Open the uploader dialog
custom_uploader.open();
});
});jQuery(function ($){
window.wd_um_ajax_callback = function(r, $node, o, parent) {
var $cf_parent = $node.closest('.wd_UserMeta');
var $drg = $(".draggablecontainer ul", $cf_parent);
var id = $cf_parent.attr('id').match(/^wd_UserMeta-(.*)/)[1];
var html = '';
var drag_opts = {
connectToSortable: "#sortable_conn" + id,
update: function (event, ui) {},
cancel: ".ui-state-disabled",
helper: "clone",
items: "> li"
};
if ( r.length > 0 ) {
$.each(r, function(i, v) {
html += '<li class="ui-state-default" cf_name="'+v.meta_key+'">'+v.meta_key+'<a class="deleteIcon"></a></li>';
});
$drg.html(html);
$("#sortable" + id + " li").draggable(drag_opts).disableSelection();
$("#sortable" + id + " li").trigger('sortupdate');
$("#sortable_conn" + id).trigger('sortupdate');
} else {
$drg.html('No results for this phrase.');
}
}
$('div.wd_UserMeta').each(function(){
var id = $(this).attr('id').match(/^wd_UserMeta-(.*)/)[1];
var name = $('input[isparam=1]', this).attr('name');
var parent = $(this);
var hidden = $('input[isparam=1]', this);
function list_update() {
$("#sortable" + id + " li").removeClass("ui-state-disabled");
$('ul[id*=sortable_conn] li', parent).each(function (i, v) {
$("#sortable" + id + " li[cf_name='"+$(this).attr('cf_name')+"']").addClass("ui-state-disabled");
});
}
function data_update() {
var items = $("#sortable_conn" + id + " li")
var fields = [];
items.each(function () {
fields.push($(this).attr('cf_name'));
});
hidden.val("_decode_" + WD_Helpers.Base64.encode(JSON.stringify(fields)));
}
$("#sortable_conn" + id).sortable({
update: function (event, ui) {
var $item = $(ui.item);
$item.css({
"width": "",
"height": ""
});
list_update();
data_update();
},
items: "> li",
cancel: ".ui-state-disabled",
remove: function(event, ui) {}
}).disableSelection();
$("#sortable_conn" + id).on('sortupdate', function(event, ui) {
list_update();
data_update();
});
$("#sortable_conn" + id).on( "click", "li a.deleteIcon", function(e){
e.preventDefault();
$(this).parent().detach();
list_update();
data_update();
});
$("#draggablecontainer" + id + " .arrow-all-left").on('click', function(){
$("#sortable_conn" + id + " li").detach();
$("#sortable_conn" + id).trigger('sortupdate');
});
$("#draggablecontainer" + id + " .arrow-all-right").on('click', function(){
$("#sortable" + id + " li:not(.hiddend):not(.ui-state-disabled)").clone().appendTo("#sortable_conn" + id);
$("#sortable_conn" + id).trigger('sortupdate');
});
});
});jQuery(function($){
$('div.wpdreamsUserRoleSelect').each(function () {
let id = $(this).data('id'),
selector = "#sortable" + id + ", #sortable_conn" + id,
parent = $(this),
hidden = $('input[isparam=1]', this);
$(selector).sortable({
connectWith: ".connectedSortable" + id
}).disableSelection();
$(selector).on('sortupdate', function(event, ui){
// Items need to be re-parsed!
let items = parent.find('ul[id*=sortable_conn] li'),
val = [];
items.each(function () {
val.push($(this).data('role'));
});
hidden.val(val.join('|'));
});
$("#sortablecontainer" + id + " .arrow-all").on('click', function(){
if ( $(this).hasClass('arrow-all-left') ) {
$("#sortable_conn" + id + " li").detach().appendTo("#sortable" + id + "");
} else {
$("#sortable" + id + " li:not(.hiddend)").detach().appendTo("#sortable_conn" + id);
}
$(selector).trigger("sortupdate");
});
});
});jQuery(function($){
$('div.wd_userselect').each(function(){
var id = $(this).attr('id').match(/^wd_userselect-(.*)/)[1];
var selector = "#sortable" + id +", #sortable_conn" + id;
var hidden = $('input[isparam=1]', this);
var name = hidden.attr('name');
var parent = $(this);
var actualData = JSON.parse( WD_Helpers.Base64.decode(hidden.val().replace(/^(_decode_)/,"")) );
var _cache = "";
function tt_s_update( parent ) {
// Items need to be re-parsed!
var items = $('ul[id*=sortable_conn] li', parent);
var users = [];
var un_checked = [];
items.each(function (i, v) {
users.push($(this).data('userid'));
if ( $("input[type='checkbox']", this).length > 0 && !$("input[type='checkbox']", this).get(0).checked )
un_checked.push($(this).data('userid'));
});
actualData.users = users;
actualData.op_type = $(".tts_operation", parent).val();
actualData.un_checked = un_checked;
hidden.val("_decode_" + WD_Helpers.Base64.encode(JSON.stringify(actualData)));
}
function list_update() {
$("#sortable" + id + " li").removeClass("ui-state-disabled");
$('ul[id*=sortable_conn] li', parent).each(function (i, v) {
$("#sortable" + id + " li[data-userid='"+$(this).data('userid')+"']").addClass("ui-state-disabled");
});
}
var drag_opts = {
connectToSortable: "#sortable_conn" + id,
update: function (event, ui) {},
cancel: ".ui-state-disabled",
helper: "clone"
};
$("#sortable" + id + " li").draggable(drag_opts).disableSelection();
$("#sortable_conn" + id).sortable({
update: function (event, ui) {
var $item = $(ui.item);
$item.css({
"width": "",
"height": ""
});
if ( $item.data("userid") == '-1' ) {
$("#sortable_conn" + id + " li[data-userid!='-1']").detach();
} else {
$("#sortable_conn" + id + " li[data-userid='-1']").detach();
}
// Refresh cache with remaining
_cache = $("#sortable" + id).html();
tt_s_update( parent );
list_update();
},
cancel: ".ui-state-disabled",
remove: function(event, ui) {
var $item = $(ui.item);
_cache = "";
}
}).disableSelection();
var timeout = null;
$(".wd_user_search", parent).on('keyup', function(){
var $this = $(this);
clearTimeout(timeout);
timeout = setTimeout(function(){
$('.dragLoader', parent).removeClass("hiddend");
var data = {
'action': 'wd_search_users',
'wd_phrase': $this.val(),
'wd_required': 1,
'wd_args': $("input.wd_args", parent).val()
};
$.post(ajaxurl, data, function (response) {
if (response.length > 0) {
_cache = response;
$("#sortable" + id).html(response);
$("#sortable" + id + " li").draggable(drag_opts).disableSelection();
list_update();
$('.dragLoader', parent).addClass("hiddend");
$(".hide-children", parent).trigger('change');
}
}, "text");
}, 350);
});
$(selector).on('sortupdate', function(event, ui) {
tt_s_update( parent );
list_update();
});
$("#sortable_conn" + id +" li input").on('change', function(){
tt_s_update( parent );
list_update();
});
$("#sortable_conn" + id).on( "click", "li a.deleteIcon", function(e){
e.preventDefault();
$(this).parent().detach();
tt_s_update( parent );
list_update();
});
$(".tts_operation", parent).on('change', function(){
tt_s_update( parent );
list_update();
$(".tts_type", parent).html($(this).val());
});
tt_s_update( parent );
list_update();
});
});jQuery(function($){
$('div.wpdreamsBP_XProfileFields').each(function () {
let id = $(this).data('id'),
selector = "#sortable" + id + ", #sortable_conn" + id,
parent = $(this),
hidden = $('input[isparam=1]', this);
$(selector).sortable({
connectWith: ".connectedSortable" + id
}).disableSelection();
$(selector).on('sortupdate', function(event, ui){
// Items need to be re-parsed!
let items = parent.find('ul[id*=sortable_conn] li'),
val = [];
items.each(function () {
val.push($(this).data('bid'));
});
hidden.val(val.join('|'));
});
$("#sortablecontainer" + id + " .arrow-all").on('click', function(){
if ( $(this).hasClass('arrow-all-left') ) {
$("#sortable_conn" + id + " li").detach().appendTo("#sortable" + id + "");
} else {
$("#sortable" + id + " li:not(.hiddend)").detach().appendTo("#sortable_conn" + id);
}
$(selector).trigger("sortupdate");
});
});
});// window.WPD.Options._classes.Text
$('div.wpdreamsText input[type=text]').each(function(){
this.OptionController = new classes.Text(this);
});/**
* Last file in order, for closing bracket
*/
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,72 @@
<?php
namespace WPDRMS\ASP\Backend;
class Autoloader {
protected static $_instance;
protected $aliases = array(
//'ASP_Query' => 'WPDRMS\\ASP\\Query\\SearchQuery',
//'ASP_Helpers' => 'WPDRMS\\ASP\\Utils\\Str'
);
private function __construct() {
defined('ABSPATH') or die();
spl_autoload_register(array(
$this, 'loader'
));
}
function loader( $class ) {
// project-specific namespace prefix
$prefix = 'WPDRMS\\Backend\\';
// base directory for the namespace prefix
$base_dir = ASP_BACKEND_CLASSES_PATH;
// does the class use the namespace prefix?
$len = strlen($prefix);
if ( strncmp($prefix, $class, $len) !== 0 ) {
// is this an alias?
if ( isset($this->aliases[$class]) ) {
if ( !class_exists($this->aliases[$class]) ) {
$this->loader($this->aliases[$class]);
}
if ( class_exists($this->aliases[$class]) ) {
/**
* Create class alias for old class names
*/
class_alias($this->aliases[$class], $class);
}
}
} else {
// get the relative class name
$relative_class = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if ( file_exists($file) ) {
require $file;
}
}
}
// ------------------------------------------------------------
// ---------------- SINGLETON SPECIFIC --------------------
// ------------------------------------------------------------
public static function getInstance() {
if ( ! ( self::$_instance instanceof self ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
}
Autoloader::getInstance();

View File

@@ -0,0 +1,50 @@
<?php
namespace WPDRMS\Backend\Options;
if (!defined('ABSPATH')) die('-1');
abstract class AbstractOption {
protected $name, $label, $value, $args, $default_args = array();
protected static $num = 0;
function __construct($args) {
$args = array_merge(array(
'name' => 'option_name',
'label' => 'Option Label',
'value' => '',
'args' => array()
), $args);
$this->name = $args['name'];
$this->label = $args['label'];
$this->value = $args['value'];
$this->args = wp_parse_args($args['args'], $this->default_args);
++self::$num;
}
/**
* HTML Output for the option
*/
abstract public function render();
/**
* Get the option value based on the stored value from the database
*/
public static function value( $value, $default_value = null ) {
// Do the conversion here
return self::compatibility( $value );
}
/**
* Make the value output friendly for rendering
*/
protected static function outputValue($value ) {
return $value;
}
/**
* Check and convert the passed value through a backwards compatibility check
*/
protected static function compatibility( $value ) {
return $value;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace WPDRMS\Backend\Options;
class ColorPicker extends AbstractOption {
protected static function outputValue( $value ) {
return self::hex2rgba($value);
}
function render() {
?>
<div class='wpdreamsColorPicker'>
<label for="wpdreamscolorpicker_<?php echo self::$num; ?>"><?php echo $this->label; ?></label>
<input isparam=1
type='text'
class='color'
name="<?php echo $this->name; ?>"
value="<?php echo self::outputValue($this->value); ?>"
id="wpdreamscolorpicker_<?php echo self::$num; ?>">
</div>
<?php
}
protected static function hex2rgba($color) {
if (strlen($color)>7) return $color;
if (strlen($color)<3) return "rgba(0, 0, 0, 1)";
if ($color[0] == '#')
$color = substr($color, 1);
if (strlen($color) == 6)
list($r, $g, $b) = array($color[0].$color[1],
$color[2].$color[3],
$color[4].$color[5]);
elseif (strlen($color) == 3)
list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
else
return false;
$r = hexdec($r); $g = hexdec($g); $b = hexdec($b);
return "rgba(".$r.", ".$g.", ".$b.", 1)";
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace WPDRMS\Backend\Options;
class CustomField extends AbstractOption {
protected $default_args = array(
"show_pods" => false
);
public static function value( $value, $default_value = null ) {
if ( gettype($value) === 'string' ) {
if ( $value != '' ) {
$value = array_unique(array_filter(explode('|', $value)));
} else {
$value = array();
}
}
return self::compatibility( $value );
}
protected static function outputValue( $value ) {
// No need to decode
return implode('|', $value);
}
function render() {
?>
<div class='wpdreamsCustomFields' data-id="<?php echo self::$num; ?>" id='wpdreamsCustomFields-<?php echo self::$num; ?>'>
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="draggablecontainer" id="draggablecontainer<?php echo self::$num; ?>">
<div class="arrow-all arrow-all-left"></div>
<div class="arrow-all arrow-all-right"></div>
<div style="margin: -3px 0 5px -5px;">
<?php
Option::create('CustomFieldSearch', array(
'name' => 'wdcfs_' . self::$num,
'label' => '',
'value' => '',
'args' => array(
'callback' => 'wd_cf_ajax_callback',
'show_pods' => $this->args['show_pods'],
'limit' => 40
)
));
?>
</div>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php echo __('Use the search bar above to look for custom fields', 'ajax-search-pro'); ?>
</ul>
</div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the custom fields you want to use!', 'ajax-search-pro'); ?></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->value as $v ): ?>
<li class="ui-state-default" cf_name="<?php echo $v; ?>">
<?php echo str_replace('__pods__', '[PODs] ', $v); ?>
<a class="deleteIcon"></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,141 @@
<?php
namespace WPDRMS\Backend\Options;
use WPDRMS\ASP\Utils\Ajax;
class CustomFieldSearch extends AbstractOption {
protected $default_args = array(
'callback' => '', // javascript function name in the windows scope | if empty, shows results
'search_values' => 0,
'limit' => 15,
'delimiter' => '!!!CFRES!!!',
'controls_position' => 'right',
'class' => '',
'usermeta' => 0,
'show_pods' => false
);
public static function registerAjax() {
if ( !has_action('wp_ajax_wd_search_cf') ) {
add_action('wp_ajax_wd_search_cf', array(get_called_class(), 'search'));
}
}
function render() {
?>
<div class='wd_cf_search<?php echo $this->args['class'] != '' ? ' '.$this->args['class'] : "";?>'
id='wd_cf_search-<?php echo self::$num; ?>'>
<?php if ($this->args['controls_position'] == 'left') $this->printControls(); ?>
<?php echo $this->label; ?> <input type="search" name="<?php echo $this->name; ?>"
class="wd_cf_search"
value="<?php echo self::outputValue($this->value); ?>"
placeholder="<?php esc_attr_e('Search custom fields..', 'ajax-search-pro'); ?>"/>
<input type='hidden' value="<?php echo base64_encode(json_encode($this->args)); ?>" class="wd_args">
<?php if ($this->args['controls_position'] != 'left') $this->printControls(); ?>
<div class="wd_cf_search_res"></div>
</div>
<?php
}
private function printControls() {
?>
<span class="loading-small hiddend"></span>
<div class="wd_ts_close hiddend">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 512 512" xml:space="preserve">
<polygon id="x-mark-icon" points="438.393,374.595 319.757,255.977 438.378,137.348 374.595,73.607 255.995,192.225 137.375,73.622 73.607,137.352 192.246,255.983 73.622,374.625 137.352,438.393 256.002,319.734 374.652,438.378 "></polygon>
</svg>
</div>
<?php
}
public static function search() {
global $wpdb;
// Exact matches
$phrase = trim($_POST['wd_phrase']) . '%';
$data = json_decode(base64_decode($_POST['wd_args']), true);
if ($data['usermeta'])
$table = $wpdb->usermeta;
else
$table = $wpdb->postmeta;
if ($data['search_values'] == 1) {
$cf_query = $wpdb->prepare(
"SELECT DISTINCT(meta_key) FROM $table WHERE meta_key LIKE '%s' OR meta_value LIKE '%s' ORDER BY meta_key ASC LIMIT %d",
$phrase, $phrase, $data['limit']);
} else {
$cf_query = $wpdb->prepare(
"SELECT DISTINCT(meta_key) FROM $table WHERE meta_key LIKE '%s' ORDER BY meta_key ASC LIMIT %d",
$phrase, $data['limit']);
}
$cf_results = $wpdb->get_results( $cf_query );
$remaining_limit = $data['limit'] - count($cf_results);
if ( $remaining_limit > 0 ) {
// Fuzzy matches
$not_in_query = '';
$not_in = array();
foreach ($cf_results as $r) {
$not_in[] = $r->meta_key;
}
if (count($not_in) > 0) {
$not_in_query = " AND meta_key NOT IN ('" . implode("','", $not_in) . "')";
}
$phrase = '%' . trim($_POST['wd_phrase']) . '%';
if ($data['search_values'] == 1) {
$cf_query = $wpdb->prepare(
"SELECT DISTINCT(meta_key) FROM $table WHERE (meta_key LIKE '%s' OR meta_value LIKE '%s') $not_in_query ORDER BY meta_key ASC LIMIT %d",
$phrase, $phrase, $remaining_limit);
} else {
$cf_query = $wpdb->prepare(
"SELECT DISTINCT(meta_key) FROM $table WHERE (meta_key LIKE '%s') $not_in_query ORDER BY meta_key ASC LIMIT %d",
$phrase, $remaining_limit);
}
$cf_results = array_merge($cf_results, $wpdb->get_results($cf_query));
}
if ( $data['show_pods'] )
$pods_fields = self::searchPods($_POST['wd_phrase']);
else
$pods_fields = array();
Ajax::prepareHeaders();
print_r($data['delimiter'] . json_encode(array_merge($pods_fields, $cf_results)) . $data['delimiter']);
die();
}
private static function searchPods($s): array {
$ret = array();
if ( function_exists('pods_api') ) {
// Filter table storage based fields only
$pods = get_posts(array(
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => '_pods_pod',
'meta_query' => array(
array(
'key' => 'storage',
'value' => 'table',
'compare' => 'LIKE'
)
)
));
if ( !is_wp_error($pods) && !empty($pods) ) {
$pods_fields = get_posts(array(
'fields' => 'post_name',
'posts_per_page' => -1,
's' => $s,
'post_type' => '_pods_field',
'post_parent__in' => $pods // Only filtered parents by table storage type
));
if ( !is_wp_error($pods_fields) && !empty($pods_fields) ) {
foreach ($pods_fields as $f) {
$ret[] = array('meta_key' => '__pods__' . $f->post_name);
}
}
}
}
return $ret;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace WPDRMS\Backend\Options;
class CustomSelect extends AbstractOption {
private static $iconMsg;
protected $default_args = array(
'selects' => array(
array(
'label' => 'Label',
'value' => 'value',
'icon' => 'phone'
)
),
'icon' => 'none'
);
function __construct($args) {
parent::__construct($args);
if ( !isset(static::$iconMsg) ) {
static::$iconMsg = array(
'phone' => __('Phone devices, on 0px to 640px widths', 'ajax-search-pro'),
'tablet' => __('Tablet devices, on 641px to 1024px widths', 'ajax-search-pro'),
'desktop' => __('Desktop devices, 1025px width and higher', 'ajax-search-pro')
);
}
}
public function render() {
?>
<div class='wpdreamsCustomSelect'>
<label for="wpdreamscustomselect_<?php echo self::$num; ?>"><?php echo $this->label; ?></label>
<?php if ( $this->args['icon'] != 'none' ): ?>
<span
title="<?php echo $this->iconMsg[$this->args['icon']] ?? ''; ?>"
class="wpd-txt-small-icon wpd-txt-small-icon-<?php echo $this->args['icon'] ?>">
</span>
<?php endif; ?>
<select isparam=1 class='wpdreamscustomselect' id='wpdreamscustomselect_<?php echo self::$num; ?>' name="<?php echo $this->name; ?>">
<?php foreach($this->args['selects'] as $sel): ?>
<?php
$disabled = is_array($sel) && isset($sel['disabled']) ? ' disabled' : '';
$label = is_array($sel) ? $sel['label'] : $sel;
$value = is_array($sel) ? $sel['value'] : $sel;
$selected = $value == $this->value ? " selected='selected'" : '';
?>
<option value="<?php echo $value; ?>"<?php echo $selected . $disabled ?>><?php echo $label; ?></option>
<?php endforeach; ?>
</select>
</div>
<?php
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace WPDRMS\Backend\Options;
/**
* Alternatives for both wpdreamsImageRadio, wd_imageRadio options
*/
class ImageRadio extends AbstractOption {
public function render() {
?>
<div class='wd_imageRadio'>
<label class='image_radio'><?php echo $this->label; ?></label>
<?php
foreach ($this->args['images'] as $k => $image) {
$image = trim($image);
$value = is_string($k) ? $k : $image;
$selected = !(strpos($value, $this->value) === false);
echo "
<img data-value = '".$value."' src='" . plugins_url() . $image . "'
class='image_radio" . (($selected) ? ' selected' : '') . "'/>";
}
?>
<input isparam="1" type="hidden"
class='realvalue'
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</div>
<?php
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace WPDRMS\Backend\Options;
use WPDRMS\ASP\Utils\Str;
class MimeTypeSelect extends AbstractOption {
protected static function outputValue( $value ) {
// No need to decode
return stripslashes(esc_html($value));
}
function render() {
?>
<div class="wd_MimeTypeSelect">
<div class="file_mime_types_input hiddend">
<label class='wd_textarea_expandable'
for='wd_textareae_<?php echo self::$num; ?>'><?php echo __($this->label, 'ajax-search-pro'); ?>
<textarea rows='1' data-min-rows='1'
class='wd_textarea_expandable'
id='wd_textareae_<?php echo self::$num; ?>'
name='<?php echo $this->name; ?>'><?php echo self::outputValue($this->value); ?></textarea>
</label>
<span class="mime_input_hide"><?php echo __('>> Simplified view <<', 'ajax-search-pro'); ?></span>
</div>
<div class="file_mime_types_list">
<label>
<?php echo __($this->label, 'ajax-search-pro'); ?>
<select multiple attr="multi_attachment_mime_types_<?php echo self::$num; ?>"
id="multi_attachment_mime_types_<?php echo self::$num; ?>">
<option value="pdf">PDF</option>
<option value="text">Text</option>
<option value="richtext">Rich Text (rtf etc..)</option>
<option value="mso_word">Office Word</option>
<option value="mso_excel">Office Excel</option>
<option value="mso_powerpoint">Office PowerPoint</option>
<option value="image">Image</option>
<option value="video">Video</option>
<option value="audio">Audio</option>
</select>
</label>
<span class="mime_list_hide"><?php echo __('>> Enter manually <<', 'ajax-search-pro'); ?></span>
</div>
</div>
<?php
}
protected static function compatibility( $value ) {
// Older versions had base64 encoded inputs
if ( Str::isBase64Encoded($value) ) {
$value = base64_decode($value);
}
return $value;
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace WPDRMS\Backend\Options;
if (!defined('ABSPATH')) die('-1');
class Option {
public static function create($optionType, $args) {
$class = __NAMESPACE__ . "\\" . $optionType;
if ( !class_exists( $class ) ) {
$class = __NAMESPACE__ . "\\" . 'YesNo';
}
$c = new $class($args);
return $c->render();
}
public static function init() {
add_action('admin_enqueue_scripts', array( static::class, 'registerAssets' ));
CustomFieldSearch::registerAjax();
UserSelect::registerAjax();
PostSearch::registerAjax();
}
public static function getOptions() {
$all_options = array();
foreach ( OptionDefaults::getGlobalDefaults() as $option_group_key => $default_options ) {
$stored = get_site_option($option_group_key, array());
$options = array();
foreach ( $default_options as $key => $default_value ) {
if ( isset($stored[$key]) ) {
$options[$key] = self::optionValue($default_value, $stored[$key]);
} else {
$options[$key] = self::optionValue($default_value);
}
}
$all_options[$option_group_key] = $options;
}
foreach ( OptionDefaults::getLocalDefaults() as $option_group_key => $default_options ) {
$stored = get_option($option_group_key, array());
$options = array();
foreach ( $default_options as $key => $default_value ) {
if ( isset($stored[$key]) ) {
$options[$key] = self::optionValue($default_value, $stored[$key]);
} else {
$options[$key] = self::optionValue($default_value);
}
}
$all_options[$option_group_key] = $options;
}
return $all_options;
}
public static function optionValue($default_value, $stored_value = null) {
if ( is_array($default_value) && isset( $default_value['option_type'], $default_value['value'] ) ) {
if ( $stored_value === null ) {
return $default_value['value'];
} else {
$class = __NAMESPACE__ . "\\" . $default_value['option_type'];
return $class::value($stored_value, $default_value['value']);
}
} else {
if ( $stored_value === null ) {
return $default_value;
} else {
return $stored_value;
}
}
}
public static function saveOptions($group_key, $new_options) {
if ( isset(OptionDefaults::$global_defaults[$group_key]) ) {
return update_site_option($group_key, $new_options);
} else if ( isset(OptionDefaults::$local_defaults[$group_key]) ) {
return update_option($group_key, $new_options);
} else {
return false;
}
}
public static function registerAssets() {
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core', false, array('jquery'), false, true);
wp_enqueue_script('jquery-ui-slider', false, array('jquery-ui-core'), false, true);
wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core'), false, true);
wp_enqueue_script('jquery-ui-sortable', false, array('jquery-ui-core'), false, true);
wp_enqueue_script('jquery-ui-draggable', false, array('jquery-ui-core'), false, true);
wp_enqueue_script('jquery-ui-datepicker', false, array('jquery-ui-core'), false, true);
wp_enqueue_script('wpd-options-jquery-select2', ASP_URL_NP . 'backend/Assets/Options/dist/select2.min.js', array(
'jquery'
), $media_query, false);
wp_enqueue_style('wpd-options-jquery-select2', ASP_URL_NP . 'backend/Assets/Options/dist/select2.min.css', false, $media_query);
/*wp_enqueue_script('wpd-options', ASP_URL_NP . 'backend/Assets/Options/dist/options.min.js',
array('jquery', 'wpd-options-jquery-select2', 'jquery-ui-datepicker'), $media_query, true);*/
wp_enqueue_script('wpd-options', ASP_URL_NP . 'backend/Assets/Options/dist/App.js',
array('jquery', 'wpd-options-jquery-select2', 'jquery-ui-datepicker'), $media_query, true);
wp_enqueue_style('wpd-options', ASP_URL_NP . 'backend/Assets/Options/dist/options.min.css', array(), $media_query);
}
}

View File

@@ -0,0 +1,893 @@
<?php
namespace WPDRMS\Backend\Options;
class OptionDefaults {
public static function getGlobalDefaults(): array {
return array(
'asp_glob_d' => array(
'additional_tag_posts' => array() // Store post IDs that have additional tags
)
);
}
public static function getLocalDefaults(): array {
return array(
'asp_performance' => array(
'enabled' => 0
),
'asp_it_options' => array(
'it_index_title' => 1,
'it_index_content' => 1,
'it_index_excerpt' => 1,
'it_post_types' => array('post', 'page'),
'it_index_tags' => 0,
'it_index_categories' => 0,
'it_index_taxonomies' => '',
'it_attachment_mime_types' => 'image/jpeg, image/gif, image/png',
'it_index_pdf_content' => 0,
'it_index_pdf_method' => 'auto',
'it_index_text_content' => 0,
'it_index_richtext_content' => 0,
'it_index_msword_content' => 0,
'it_index_msexcel_content' => 0,
'it_index_msppt_content' => 0,
'it_media_service_send_file' => 1,
'it_synonyms_as_keywords' => 0,
'it_index_permalinks' => 0,
'it_index_customfields' => '',
'it_post_statuses' => 'publish',
'it_post_password_protected' => 1,
'it_index_author_name' => 0,
'it_index_author_bio' => 0,
'it_blog_ids' => '',
'it_limit' => 25,
'it_use_stopwords' => 0,
'it_stopwords' => 'a, about, above, across, after, afterwards, again, against, all, almost, alone, along, already, also, although, always, am, among, amongst, amoungst, amount, an, and, another, any, anyhow, anyone, anything, anyway, anywhere, are, around, as, at, back, be, became, because, become, becomes, becoming, been, before, beforehand, behind, being, below, beside, besides, between, beyond, bill, both, bottom, but, by, call, can, cannot, cant, co, con, could, couldnt, cry, de, describe, detail, do, done, down, due, during, each, eg, eight, either, eleven, else, elsewhere, empty, enough, etc, even, ever, every, everyone, everything, everywhere, except, few, fifteen, fify, fill, find, fire, first, five, for, former, formerly, forty, found, four, from, front, full, further, get, give, go, had, has, hasnt, have, he, hence, her, here, hereafter, hereby, herein, hereupon, hers, herself, him, himself, his, how, however, hundred, ie, if, in, inc, indeed, interest, into, is, it, its, itself, keep, last, latter, latterly, least, less, ltd, made, many, may, me, meanwhile, might, mill, mine, more, moreover, most, mostly, move, much, must, my, myself, name, namely, neither, never, nevertheless, next, nine, no, nobody, none, noone, nor, not, nothing, now, nowhere, of, off, often, on, once, one, only, onto, or, other, others, otherwise, our, ours, ourselves, out, over, own, part, per, perhaps, please, put, rather, re, same, see, seem, seemed, seeming, seems, serious, several, she, should, show, side, since, sincere, six, sixty, so, some, somehow, someone, something, sometime, sometimes, somewhere, still, such, system, take, ten, than, that, the, their, them, themselves, then, thence, there, thereafter, thereby, therefore, therein, thereupon, these, they, thickv, thin, third, this, those, though, three, through, throughout, thru, thus, to, together, too, top, toward, towards, twelve, twenty, two, un, under, until, up, upon, us, very, via, was, we, well, were, what, whatever, when, whence, whenever, where, whereafter, whereas, whereby, wherein, whereupon, wherever, whether, which, while, whither, who, whoever, whole, whom, whose, why, will, with, within, without, would, yet, you, your, yours, yourself, yourselves',
'it_min_word_length' => 1,
'it_extract_iframes' => 0,
'it_extract_gutenberg_blocks' => 1,
'it_extract_shortcodes' => 1,
'it_exclude_shortcodes' => 'wpdreams_rpl, wpdreams_rpp',
'it_index_on_save' => 1,
'it_index_on_update_post_meta' => 0,
'it_cron_enable' => 0,
'it_cron_period' => "asp_cr_five_minutes",
// performance
'it_pool_size_auto' => 1,
'it_pool_size_one' => 5000,
'it_pool_size_two' => 8000,
'it_pool_size_three' => 10000,
'it_pool_size_rest' => 10000
)
);
}
public static function getInstanceDefaults(): array {
return array(
// Generic
'owner' => 0, // Ownership 0, aka any administrator
// Behavior
'search_engine' => 'regular',
'trigger_on_facet' => 1,
'triggerontype' => 1,
'trigger_update_href' => 0,
'charcount' => 0,
'trigger_delay' => 300, // invisible
'autocomplete_trigger_delay' => 310, // invisible
'click_action' => 'results_page', // ajax_search, first_result, results_page, woo_results_page, custom_url
'return_action' => 'results_page', // ajax_search, first_result, results_page, woo_results_page, custom_url
'click_action_location' => 'same',
'return_action_location' => 'same',
'redirect_url' => '?s={phrase}',
'redirect_elementor' => '',
'override_default_results' => 1,
'override_method' => 'get',
'res_live_search' => 0,
'res_live_selector' => '#main',
'woo_shop_live_search' => 0,
'woo_shop_live_selector' => '#main',
'taxonomy_archive_live_search' => 0,
'taxonomy_archive_live_selector' => '#main',
'cpt_archive_live_search' => 0,
'cpt_archive_live_selector' => '#main',
'res_live_trigger_type' => 1,
'res_live_trigger_facet' => 1,
'res_live_trigger_click' => 0,
'res_live_trigger_return' => 0,
// Mobile Behavior
'mob_display_search' => 1,
'desktop_display_search' => 1,
'mob_trigger_on_type' => 1,
'mob_click_action' => 'same', // ajax_search, first_result, results_page, woo_results_page, custom_url
'mob_return_action' => 'same', // ajax_search, first_result, results_page, woo_results_page, custom_url
'mob_click_action_location' => 'same',
'mob_return_action_location' => 'same',
'mob_redirect_elementor' => '',
'mob_redirect_url' => '?s={phrase}',
'mob_auto_focus_menu_selector' => '#menu-toggle',
'mob_hide_keyboard' => 0,
'mob_force_res_hover' => 0,
'mob_force_sett_hover' => 0,
'mob_force_sett_state' => 'none',
'customtypes' => array('post', 'page'),
'searchinproducts' => 1,
'searchintitle' => 1,
'searchincontent' => 1,
'searchincomments' => 0,
'searchinexcerpt' => 1,
'search_in_permalinks' => 0,
'search_in_ids' => 0,
'search_all_cf' => 0,
'customfields' => "",
'searchinbpusers' => 0,
'searchinbpgroups' => 0,
'searchinbpforums' => 0,
'post_status' => 'publish',
'post_password_protected' => 1,
'exactonly' => 0,
'exact_m_secondary' => 0,
'exact_match_location' => 'anywhere',
'min_word_length' => 2,
'searchinterms' => 0,
// General/Sources 2
'return_categories' => 0,
'return_tags' => 0,
'return_terms' => '',
'search_term_meta' => 0,
'search_term_titles' => 1,
'search_term_descriptions' => 1,
'display_number_posts_affected' => 0,
'return_terms_exclude_empty' => 0,
'return_terms_exclude' => '',
// General / Attachments
'attachments_use_index' => 'regular',
'return_attachments' => 0,
'search_attachments_title' => 1,
'search_attachments_content' => 1,
'search_attachments_caption' => 1,
'search_attachments_terms' => 0,
'search_attachments_ids' => 1,
'search_attachments_cf_filters' => 0,
// base64: image/jpeg, image/gif, image/png, image/tiff, image/x-icon
'attachment_mime_types' => 'aW1hZ2UvanBlZywgaW1hZ2UvZ2lmLCBpbWFnZS9wbmcsIGltYWdlL3RpZmYsIGltYWdlL3gtaWNvbg==',
'attachment_use_image' => 1,
'attachment_link_to' => 'file',
'attachment_link_to_secondary' => 'page',
'attachment_exclude' => "",
// General / Ordering
'use_post_type_order' => 0,
'post_type_order' => get_post_types(array(
"public" => true,
"_builtin" => false
), "names", "OR"),
'results_order' => 'terms|blogs|bp_activities|comments|bp_groups|bp_users|post_page_cpt|attachments|peepso_groups|peepso_activities',
// General / Grouping
'groupby_cpt_title' => 0,
'groupby_term_title' => 0,
'groupby_user_title' => 0,
'groupby_attachment_title' => 0,
// General/Limits
'posts_limit' => 10,
'posts_limit_override' => 50,
'posts_limit_distribute' => 0,
'results_per_page' => "auto",
'taxonomies_limit' => 10,
'taxonomies_limit_override' => 20,
'users_limit' => 10,
'users_limit_override' => 20,
'blogs_limit' => 10,
'blogs_limit_override' => 20,
'buddypress_limit' => 10,
'buddypress_limit_override' => 20,
'comments_limit' => 10,
'comments_limit_override' => 20,
'attachments_limit' => 10,
'attachments_limit_override' => 20,
'peepso_groups_limit' => 10,
'peepso_groups_limit_override' => 20,
'peepso_activities_limit' => 10,
'peepso_activities_limit_override' => 20,
'keyword_logic' => 'and',
'secondary_kw_logic' => 'none',
'orderby_primary' => 'relevance DESC',
'orderby' => 'post_date DESC',
'orderby_primary_cf' => '',
'orderby_secondary_cf' => '',
'orderby_primary_cf_type' => 'numeric',
'orderby_secondary_cf_type' => 'numeric',
// General/Image
'show_images' => 1,
'image_transparency' => 1,
'image_bg_color' => "#FFFFFF",
'image_width' => 70,
'image_height' => 70,
'image_display_mode' => 'cover',
'image_apply_content_filter' => 0,
'image_sources' => array(
array('option' => __('Featured image', 'ajax-search-pro'), 'value' => 'featured'),
array('option' => __('Post Content', 'ajax-search-pro'), 'value' => 'content'),
array('option' => __('Post Excerpt', 'ajax-search-pro'), 'value' => 'excerpt'),
array('option' => __('Custom field', 'ajax-search-pro'), 'value' => 'custom'),
array('option' => __('Page Screenshot', 'ajax-search-pro'), 'value' => 'screenshot'),
array('option' => __('Default image', 'ajax-search-pro'), 'value' => 'default'),
array('option' => __('Post format icon', 'ajax-search-pro'), 'value' => 'post_format'),
array('option' => __('Disabled', 'ajax-search-pro'), 'value' => 'disabled')
),
'image_source1' => 'featured',
'image_source2' => 'content',
'image_source3' => 'excerpt',
'image_source4' => 'custom',
'image_source5' => 'default',
'image_source_featured' => 'original',
'image_default' => "",
'image_custom_field' => '',
'attachment_pdf_image' => 0,
'tax_image_custom_field' => '',
'tax_image_default' => '',
'user_image_default' => '',
'image_parser_image_number' => 1,
'image_parser_exclude_filenames' => '',
/* BuddyPress Options */
'search_in_bp_activities' => 0,
'search_in_bp_groups' => 0,
'search_in_bp_groups_public' => 0,
'search_in_bp_groups_private' => 0,
'search_in_bp_groups_hidden' => 0,
/* Peepso */
'peep_gs_public' => 0,
'peep_gs_closed' => 0,
'peep_gs_secret' => 0,
'peep_gs_title' => 1,
'peep_gs_content' => 1,
'peep_gs_categories' => 0,
'peep_gs_exclude' => '',
'peep_s_posts' => 0,
'peep_s_comments' => 0,
'peep_pc_follow' => 0,
'peep_pc_public' => 0,
'peep_pc_closed' => 0,
'peep_pc_secret' => 0,
/* User Search Options */
'user_search' => 0,
'user_login_search' => 1,
'user_display_name_search' => 1,
'user_first_name_search' => 1,
'user_last_name_search' => 1,
'user_bio_search' => 1,
'user_email_search' => 0,
'user_orderby_primary' => 'relevance DESC',
'user_orderby_secondary' => 'date DESC',
'user_orderby_primary_cf' => '',
'user_orderby_secondary_cf' => '',
'user_orderby_primary_cf_type' => 'numeric',
'user_orderby_secondary_cf_type' => 'numeric',
'user_search_exclude_roles' => "",
"user_search_exclude_users" => array(
"op_type" => "exclude",
"users" => array(),
"un_checked" => array()
),
'user_search_display_images' => 1,
'user_search_image_source' => 'default',
'user_search_meta_fields' => array(),
'user_bp_fields' => "",
'user_search_title_field' => 'display_name',
'user_search_description_field' => 'bio',
'user_search_advanced_title_field' => '{titlefield}',
'user_search_advanced_description_field' => '{descriptionfield}',
'user_search_url_source' => 'default',
'user_search_custom_url' => '?author={USER_ID}',
/* Multisite Options */
'searchinblogtitles' => 0,
'blogresultstext' => "Blogs",
'blogs' => "",
/* Frontend search settings Options */
// suggestions
'frontend_show_suggestions' => 0,
'frontend_suggestions_text' => "Try these:",
'frontend_suggestions_text_color' => "rgb(85, 85, 85)",
'frontend_suggestions_keywords' => "phrase 1, phrase 2, phrase 3",
'frontend_suggestions_keywords_color' => "rgb(255, 181, 86)",
// date
'date_filter_from' => 'disabled|2018-01-01|0,0,0',
'date_filter_from_t' => 'Content from',
'date_filter_from_placeholder' => 'Choose date',
'date_filter_from_format' => 'dd-mm-yy',
'date_filter_to' => 'disabled|2018-01-01|0,0,0',
'date_filter_to_t' => 'Content to',
'date_filter_to_placeholder' => 'Choose date',
'date_filter_to_format' => 'dd-mm-yy',
'date_filter_required' => 0,
'date_filter_invalid_input_text' => 'Please select a date!',
// general
'show_frontend_search_settings' => 0,
'frontend_search_settings_visible' => 0,
'frontend_search_settings_position' => 'hover',
'fss_hide_on_results' => 0,
'fss_column_layout' => 'flex',
'fss_hover_columns' => 1,
'fss_block_columns' => "auto",
'fss_column_width' => 200,
'searchinbpuserstext' => "Search in users",
'searchinbpgroupstext' => "Search in groups",
'searchinbpforumstext' => "Search in forums",
'showcustomtypes' => '',
'custom_types_label' => 'Filter by Custom Post Type',
'cpt_display_mode' => 'checkboxes',
'cpt_filter_default' => 'post',
'cpt_cbx_show_select_all' => 0,
'cpt_cbx_show_select_all_text' => 'Select all',
'cpt_required' => 0,
'cpt_invalid_input_text' => 'This field is required!',
'show_frontend_tags' => "0|checkboxes|all|checked|||",
'frontend_tags_placeholder' => 'Select tags',
'frontend_tags_required' => 0,
'frontend_tags_invalid_input_text' => 'This field is required!',
'frontend_tags_header' => "Filter by Tags",
'frontend_tags_logic' => "or",
'frontend_tags_empty' => 0,
'display_all_tags_option' => 0,
'all_tags_opt_text' => 'All tags',
'display_all_tags_check_opt' => 0,
'all_tags_check_opt_state' => 'checked',
'all_tags_check_opt_text' => 'Check/uncheck all',
'settings_boxes_height' => "220px",
'showsearchintaxonomies' => 1,
//'terms_display_mode' => "checkboxes",
//'showterms' => "",
'generic_filter_label' => 'Generic filters',
'frontend_fields' => array(
'display_mode' => 'checkboxes', // checkboxes, dropdown, radio
'labels' => array(
'exact' => 'Exact matches only',
'title' => 'Search in title',
'content' => 'Search in content',
'excerpt' => 'Search in excerpt'
),
'selected' => array(),
'unselected' => array('exact', 'title', 'content', 'excerpt'),
'checked' => array('title', 'content', 'excerpt')
),
'content_type_filter_label' => 'Filter by content type',
'content_type_filter' => array(
'display_mode' => 'checkboxes', // checkboxes, dropdown, radio
'labels' => array(
'any' => 'Choose One/Select all',
'cpt' => 'Custom post types',
'comments' => 'Comments',
'taxonomies' => 'Taxonomy terms',
'users' => 'Users',
'blogs' => 'Multisite blogs',
'buddypress' => 'BuddyPress content',
'attachments' => 'Attachments'
), // This is overwritten on save
'selected' => array(),
'unselected' => array(),
'checked' => array()
),
"show_terms" => array(
"op_type" => "include",
"display_mode" => array(),
"terms" => array(),
"un_checked" => array() // store unchecked instead of checked, less overhead
),
// Search button
'fe_search_button' => 0,
'fe_sb_action' => 'ajax_search',
'fe_sb_action_location' => 'same',
'fe_sb_redirect_elementor' => '',
'fe_sb_redirect_url' => '?s={phrase}',
'fe_sb_text' => 'Search!',
'fe_sb_align' => 'center',
'fe_sb_padding' => '6px 14px 6px 14px',
'fe_sb_margin' => '4px 0 0 0',
'fe_sb_bg' => 'rgb(212, 58, 50)',
'fe_sb_border' => 'border:1px solid rgb(179, 51, 51);border-radius:3px 3px 3px 3px;',
'fe_sb_boxshadow' => 'box-shadow:0px 0px 0px 0px rgba(255, 255, 255, 0);',
'fe_sb_font' => 'font-weight:normal;font-family:Open Sans;color:rgb(255, 255, 255);font-size:13px;line-height:16px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
// Reset button
'fe_reset_button' => 0,
'fe_rb_text' => 'Reset',
'fe_rb_action' => 'nothing',
'fe_rb_position' => 'before',
'fe_rb_align' => 'center',
'fe_rb_padding' => '6px 14px 6px 14px',
'fe_rb_margin' => '4px 0 0 0',
'fe_rb_bg' => 'rgb(255, 255, 255)',
'fe_rb_border' => 'border:1px solid rgb(179, 51, 51);border-radius:0px 0px 0px 0px;',
'fe_rb_boxshadow' => 'box-shadow:0px 0px 0px 0px rgba(255, 255, 255, 0);',
'fe_rb_font' => 'font-weight:normal;font-family:Open Sans;color:rgb(179, 51, 51);font-size:13px;line-height:16px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'term_logic' => 'and',
'taxonomy_logic' => 'and',
'frontend_terms_empty' => 1,
'frontend_terms_ignore_empty' => 1,
'frontend_terms_hide_children' => 0,
'frontend_term_hierarchy' => 1,
'frontend_terms_hide_empty' => 0,
'frontend_term_order' => 'name||ASC',
'custom_field_items' => '',
'cf_null_values' => 0,
'cf_logic' => 'AND',
'cf_allow_null' => 0,
'field_order' => 'general|custom_post_types|custom_fields|categories_terms|post_tags|date_filters|search_button',
/* Layout Options */
// Search box
'defaultsearchtext' => 'Search here...',
'focus_on_pageload' => 0,
'box_alignment' => 'inherit',
'box_sett_hide_box' => 0,
'auto_populate' => 'disabled',
'auto_populate_phrase' => '',
'auto_populate_count' => 10,
'resultstype' => 'vertical',
'resultsposition' => 'hover',
'results_snap_to' => 'left',
'results_margin' => '12px 0 0 0',
'results_width' => 'auto',
'results_width_phone' => 'auto',
'results_width_tablet' => 'auto',
'results_top_box' => 0,
'results_top_box_text' => 'Results for <strong>{phrase}</strong> (<strong>{results_count}</strong> of <strong>{results_count_total}</strong>)',
'results_top_box_text_nophrase' => 'Displaying <strong>{results_count}</strong> results of <strong>{results_count_total}</strong>',
'showmoreresults' => 0,
'showmoreresultstext' => 'More results...',
'more_results_infinite' => 1,
'more_results_action' => 'ajax', // ajax, redirect, results_page, woo_results_page
'more_redirect_elementor' => '',
'more_redirect_url' => '?s={phrase}',
'more_redirect_location' => 'same',
'showmorefont' => 'font-weight:normal;font-family:Open Sans;color:rgba(5, 94, 148, 1);font-size:12px;line-height:15px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'showmorefont_bg' => '#FFFFFF',
'results_click_blank' => 0,
'scroll_to_results' => 0,
'scroll_to_results_offset' => 0,
'resultareaclickable' => 1,
'close_on_document_click' => 1,
'show_close_icon' => 1,
'showauthor' => 0,
'author_field' => "display_name",
'showdate' => 0,
'custom_date' => 0,
'custom_date_format' => "Y-m-d H:i:s",
'showdescription' => 1,
'descriptionlength' => 130,
'description_context' => 1,
'description_context_depth' => 15000,
'tax_res_showdescription' => 1,
'tax_res_descriptionlength' => 130,
'user_res_showdescription' => 1,
'user_res_descriptionlength' => 130,
'noresultstext' => 'No results[ for "{phrase}"]!',
'didyoumeantext' => "Did you mean:",
'highlight' => 0,
'highlightwholewords' => 1,
'highlightcolor' => "#d9312b",
'highlightbgcolor' => "#eee",
'single_highlight' => 0,
'result_page_highlight' => 0,
'single_highlightwholewords' => 1,
'single_highlightcolor' => "#d9312b",
'single_highlightbgcolor' => "#eee",
'single_highlight_scroll' => 0,
'single_highlight_offset' => 0,
'single_highlight_selector' => "#content",
/* Layout Options / Compact Search Layout */
'box_compact_layout' => 0,
'box_compact_layout_desktop' => 1,
'box_compact_layout_tablet' => 1,
'box_compact_layout_mobile' => 1,
'box_compact_layout_focus_on_open' => 1,
'box_compact_close_on_magn' => 1,
'box_compact_close_on_document' => 0,
'box_compact_width' => "100%",
'box_compact_width_tablet' => "480px",
'box_compact_width_phone' => "320px",
'box_compact_overlay' => 0,
'box_compact_overlay_color' => "rgba(255, 255, 255, 0.5)",
'box_compact_float' => "inherit",
'box_compact_position' => "static",
'box_compact_screen_position' => '||20%||auto||0px||auto||',
'box_compact_position_z' => '1000',
/* Autocomplete & Keyword suggestion options */
'keywordsuggestions' => 1,
'result_suggestions' => 1,
'keyword_suggestion_source' => 'titles',
'kws_google_places_api' => '',
'keywordsuggestionslang' => "en",
'keyword_suggestion_count' => 10,
'keyword_suggestion_length' => 60,
'autocomplete' => 1,
'autocomplete_mode' => 'input',
'autocomplete_instant' => 'auto',
'autocomplete_instant_limit' => 1500,
'autocomplete_instant_status' => 0,
'autocomplete_instant_gen_config' => '',
'autocomplete_source' => 'google',
'autoc_trigger_charcount' => 0,
'autocompleteexceptions' => '',
'autoc_google_places_api' => '',
'autocomplete_length' => 60,
'autocomplete_google_lang' => "en",
// Advanced Options - Content
'striptagsexclude' => '<abbr><b>',
'shortcode_op' => 'remove',
'primary_titlefield' => 0,
'primary_titlefield_cf' => '',
'secondary_titlefield' => -1,
'secondary_titlefield_cf' => '',
'primary_descriptionfield' => 1,
'primary_descriptionfield_cf' => '',
'secondary_descriptionfield' => 0,
'secondary_descriptionfield_cf' => '',
'advtitlefield' => '{titlefield}',
'advdescriptionfield' => '{descriptionfield}',
"exclude_content_by_users" => array(
"op_type" => "exclude",
"users" => array(),
"un_checked" => array() // store unchecked instead of checked, less overhead
),
'exclude_post_tags' => '',
//'excludeterms' => '',
'exclude_by_terms' => array(
"op_type" => "exclude",
"display_mode" => array(),
"terms" => array(),
"un_checked" => array()
),
'include_by_terms' => array(
"op_type" => "include",
"display_mode" => array(),
"terms" => array(),
"un_checked" => array()
),
'excludeposts' => '',
'exclude_dates' => "exclude|disabled|date|2000-01-01|2000-01-01|0,0,0|0,0,0",
'exclude_dates_on' => 0,
'exclude_cpt' => array(
'ids' => array(),
'parent_ids' => array(),
'op_type' => 'exclude'
),
'include_cpt' => array(
'ids' => array(),
'parent_ids' => array(),
'op_type' => 'include'
),
// Advanced Options - Grouping
'group_by' => 'none',
'group_header_prefix' => 'Results from',
'group_header_suffix' => '',
"groupby_terms" => array(
"op_type" => "include",
"terms" => array(),
"ex_terms" => array(),
"un_checked" => array() // store unchecked instead of checked, less overhead
),
//"selected-groupby_terms" => array(),
'groupby_cpt' => array(),
"groupby_content_type" => array(
"terms" => "Taxonomy Terms",
"blogs" => "Blogs",
"bp_activities" => "BuddyPress Activities",
"comments" => "Comments",
"bp_groups" => "BuddyPress groups",
"users" => "Users",
"post_page_cpt" => "Blog Content",
"attachments" => "Attachments",
'peepso_groups' => 'Peepso Groups',
'peepso_activities' => 'Peepso Activities'
),
'group_reorder_by_pr' => 0,
'group_result_no_group' => 'display',
'group_other_location' => 'bottom',
'group_other_results_head' => 'Other results',
'group_exclude_duplicates' => 0,
'excludewoocommerceskus' => 0,
'group_result_count' => 1,
'group_show_empty' => 0,
'group_show_empty_position' => 'default', // default, bottom, top
'wpml_compatibility' => 1,
'polylang_compatibility' => 1,
// Advanced Options - Visibility
'visual_detect_visbility' => 0,
// Advanced Options - Other options
'jquery_select2_nores' => 'No results match',
// Advanced Options - Animations
// Desktop
'sett_box_animation' => "fadedrop",
'sett_box_animation_duration' => 300,
'res_box_animation' => "fadedrop",
'res_box_animation_duration' => 300,
'res_items_animation' => "fadeInDown",
// Mobile
'sett_box_animation_m' => "fadedrop",
'sett_box_animation_duration_m' => 300,
'res_box_animation_m' => "fadedrop",
'res_box_animation_duration_m' => 300,
'res_items_animation_m' => "voidanim",
// Exceptions
'kw_exceptions' => "",
'kw_exceptions_e' => "",
// Accessibility
'aria_search_form_label' => 'Search form',
'aria_settings_form_label' => 'Search settings form',
'aria_search_input_label' => 'Search input',
'aria_search_autocomplete_label' => 'Search autocomplete input',
'aria_magnifier_label' => 'Search magnifier button',
/* Theme options */
'themes' => 'Lite version - Simple red (default)',
'box_width' => '100%',
'box_width_tablet' => '100%',
'box_width_phone' => '100%',
'boxheight' => '34px',
'box_margin_top' => 0,
'box_margin_bottom' => 0,
'boxbackground' => '0-60-rgb(225, 99, 92)-rgb(225, 99, 92)',
'boxborder' => 'border:0px none rgb(141, 213, 239);border-radius:0px 0px 0px 0px;',
'boxshadow' => 'box-shadow:0px 0px 0px 0px #000000 ;',
'boxmargin' => '0px',
'inputbackground' => '0-60-rgba(0, 0, 0, 0)-rgba(0, 0, 0, 0)',
'inputborder' => 'border:0px solid rgb(104, 174, 199);border-radius:0px 0px 0px 0px;',
'inputshadow' => 'box-shadow:0px 0px 0px 0px rgb(181, 181, 181) inset;',
'inputfont' => 'font-weight:normal;font-family:Open Sans;color:rgb(255, 255, 255);font-size:12px;line-height:15px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'settingsimagepos' => 'right',
'settingsimage' => 'ajax-search-pro/img/svg/control-panel/cp4.svg',
'settingsimage_color' => 'rgb(255, 255, 255)',
'settingsbackground' => '1-185-rgb(190, 76, 70)-rgb(190, 76, 70)',
'settingsbackgroundborder' => 'border:0px solid rgb(104, 174, 199);border-radius:0px 0px 0px 0px;',
'settingsboxshadow' => 'box-shadow:0px 0px 0px 0px rgba(255, 255, 255, 0.63) ;',
'settings_overflow_autohide' => 0,
'settings_overflow_color' => '0-60-rgba(0, 0, 0, 0.5)-rgba(0, 0, 0, 0.5)',
'settingsdropbackground' => '1-185-rgb(190, 76, 70)-rgb(190, 76, 70)',
'settingsdropboxshadow' => 'box-shadow:0px 0px 0px 0px rgb(0, 0, 0) ;',
'settingsdropfont' => 'font-weight:bold;font-family:Open Sans;color:rgb(255, 255, 255);font-size:12px;line-height:15px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'exsearchincategoriestextfont' => 'font-weight:normal;font-family:Open Sans;color:rgb(31, 31, 31);font-size:13px;line-height:15px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'settingsdroptickcolor' => 'rgb(255, 255, 255)',
'settingsdroptickbggradient' => '1-180-rgb(34, 34, 34)-rgb(69, 72, 77)',
'magnifier_position' => 'right',
'magnifierimage' => 'ajax-search-pro/img/svg/magnifiers/magn6.svg',
'magnifierimage_color' => 'rgb(255, 255, 255)',
'magnifierbackground' => '1-180-rgb(190, 76, 70)-rgb(190, 76, 70)',
'magnifierbackgroundborder' => 'border:0px solid rgb(0, 0, 0);border-radius:0px 0px 0px 0px;',
'magnifierboxshadow' => 'box-shadow:0px 0px 0px 0px rgba(255, 255, 255, 0.61) ;',
'close_icon_background' => 'rgb(51, 51, 51)',
'close_icon_fill' => 'rgb(254, 254, 254)',
'close_icon_outline' => 'rgba(255, 255, 255, 0.9)',
'loader_display_location' => 'auto',
'loader_image' => 'simple-circle',
'loadingimage_color' => 'rgb(255, 255, 255)',
// Theme options - Search Text Button
'display_search_text' => '0',
'hide_magnifier' => '0',
'search_text' => "Search",
'search_text_position' => 'right',
'search_text_font' => 'font-weight:normal;font-family:Open Sans;color:rgba(51, 51, 51, 1);font-size:15px;line-height:normal;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
// Theme options - Results Information Box
'ritb_font' => 'font-weight:normal;font-family:Open Sans;color:rgb(74, 74, 74);font-size:13px;line-height:16px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'ritb_padding' => '6px 12px 6px 12px',
'ritb_margin' => '0 0 0 0',
'ritb_bg' => 'rgb(255, 255, 255)',
'ritb_border' => 'border:1px none rgb(81, 81, 81);border-radius:0px 0px 0px 0px;',
'vresultinanim' => 'rollIn',
'vresulthbg' => '0-60-rgb(245, 245, 245)-rgb(245, 245, 245)',
'resultsborder' => 'border:0px none #000000;border-radius:0px 0px 0px 0px;',
'resultshadow' => 'box-shadow:0px 0px 0px 0px #000000 ;',
'resultsbackground' => 'rgb(225, 99, 92)',
'resultscontainerbackground' => 'rgb(255, 255, 255)',
'resultscontentbackground' => '#ffffff',
'titlefont' => 'font-weight:bold;font-family:Open Sans;color:rgba(20, 84, 169, 1);font-size:14px;line-height:20px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'import-titlefont' => "@import url(https://fonts.googleapis.com/css?family=Open+Sans:300|Open+Sans:400|Open+Sans:700);",
'authorfont' => 'font-weight:bold;font-family:Open Sans;color:rgba(161, 161, 161, 1);font-size:12px;line-height:13px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'datefont' => 'font-weight:normal;font-family:Open Sans;color:rgba(173, 173, 173, 1);font-size:12px;line-height:15px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'descfont' => 'font-weight:normal;font-family:Open Sans;color:rgba(74, 74, 74, 1);font-size:13px;line-height:13px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'import-descfont' => "@import url(https://fonts.googleapis.com/css?family=Lato:300|Lato:400|Lato:700);",
'groupfont' => 'font-weight:normal;font-family:Open Sans;color:rgba(74, 74, 74, 1);font-size:13px;line-height:13px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'groupingbordercolor' => 'rgb(248, 248, 248)',
'spacercolor' => 'rgba(204, 204, 204, 1)',
// Theme options - Results Information Box
'kw_suggest_font' => 'font-weight:normal;font-family:inherit;color:rgba(74, 74, 74, 1);font-size:1rem;line-height:1.2rem;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'kw_suggest_kw_font_color' => 'rgba(20, 84, 169, 1)',
'kw_suggest_didyoumean_font_color' => 'rgba(234, 67, 53, 1)',
'kw_suggest_bg' => 'rgb(255, 255, 255)',
'kw_suggest_border' => 'border:0px solid rgb(0, 0, 0);border-radius:0px 0px 0px 0px;',
'kw_suggest_box_shadow' => 'box-shadow:0px 5px 5px -5px #dfdfdf;',
'kw_suggest_padding' => '6px 12px 6px 12px',
'kw_suggest_margin' => '0 0 0 0',
// Theme options - Vertical results
'resultitemheight' => "auto",
'itemscount' => 4,
'v_res_overflow_autohide' => 1,
'v_res_overflow_color' => '0-60-rgba(0, 0, 0, 0.5)-rgba(0, 0, 0, 0.5)',
'v_res_max_height' => 'none',
'v_res_show_scrollbar' => 1,
'v_res_max_height_tablet' => 'none',
'v_res_max_height_phone' => 'none',
'v_res_column_count' => 1,
'v_res_column_min_width' => '200px',
'v_res_column_min_width_tablet' => '200px',
'v_res_column_min_width_phone' => '200px',
// Theme options - Settings image
'settingsimage_custom' => "",
'magnifierimage_custom' => "",
'loadingimage' => "/ajax-search-pro/img/svg/loading/loading-spin.svg",
'loadingimage_custom' => "",
'groupbytextfont' => 'font-weight:bold;font-family:Open Sans;color:rgba(5, 94, 148, 1);font-size:11px;line-height:13px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'exsearchincategoriesboxcolor' => "rgb(246, 246, 246)",
'blogtitleorderby' => 'desc',
'hreswidth' => '150px',
'h_res_show_scrollbar' => 1,
'horizontal_res_height' => 'auto',
'hressidemargin' => '8px',
'hrespadding' => '7px',
'hresultinanim' => 'bounceIn',
'hboxbg' => '1-60-rgb(225, 99, 92)-rgb(225, 99, 92)',
'h_res_overflow_autohide' => 1,
'h_res_overflow_color' => '0-60-rgba(0, 0, 0, 0.5)-rgba(0, 0, 0, 0.5)',
'hboxborder' => 'border:0px solid rgb(219, 233, 238);border-radius:0px 0px 0px 0px;',
'hboxshadow' => 'box-shadow:0px 0px 4px -3px rgb(0, 0, 0) inset;',
'hresultbg' => '0-60-rgba(255, 255, 255, 1)-rgba(255, 255, 255, 1)',
'hresulthbg' => '0-60-rgba(255, 255, 255, 1)-rgba(255, 255, 255, 1)',
'hresultborder' => 'border:0px none rgb(250, 250, 250);border-radius:0px 0px 0px 0px;',
'hresultshadow' => 'box-shadow:0px 0px 6px -3px rgb(0, 0, 0);',
'hresultimageborder' => 'border:0px none rgb(250, 250, 250);border-radius:0px 0px 0px 0px;',
'hresultimageshadow' => 'box-shadow:0px 0px 9px -6px rgb(0, 0, 0) inset;',
'hhidedesc' => 0,
//Isotopic Syle options
'i_ifnoimage' => "description",
'i_item_width' => '200px',
'i_item_width_tablet' => '200px',
'i_item_width_phone' => '200px',
'i_item_height' => '200px',
'i_item_height_tablet' => '200px',
'i_item_height_phone' => '200px',
'i_item_margin' => 5,
'i_res_item_background' => 'rgb(255, 255, 255);',
'i_res_item_content_background' => 'rgba(0, 0, 0, 0.28);',
'i_res_magnifierimage' => "/ajax-search-pro/img/svg/magnifiers/magn4.svg",
'i_res_custom_magnifierimage' => "",
'i_overlay' => 1,
'i_overlay_blur' => 1,
'i_hide_content' => 1,
'i_animation' => 'bounceIn',
'i_pagination' => 1,
'i_rows' => 2,
'i_res_container_bg' => 'rgba(255, 255, 255, 0);',
'i_pagination_position' => "top",
'i_pagination_background' => "rgb(228, 228, 228);",
'i_pagination_arrow' => "/ajax-search-pro/img/svg/arrows/arrow1.svg",
'i_pagination_arrow_background' => "rgb(76, 76, 76);",
'i_pagination_arrow_color' => "rgb(255, 255, 255);",
'i_pagination_page_background' => "rgb(244, 244, 244);",
'i_pagination_font_color' => "rgb(126, 126, 126);",
//Polaroid Style options
'pifnoimage' => "removeres",
'pshowdesc' => 1,
'prescontainerheight' => '400px',
'preswidth' => '200px',
'presheight' => '300px',
'prespadding' => '25px',
'prestitlefont' => 'font-weight:normal;font-family:Open Sans;color:rgba(167, 160, 162, 1);font-size:16px;line-height:20px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'pressubtitlefont' => 'font-weight:normal;font-family:Open Sans;color:rgba(133, 133, 133, 1);font-size:13px;line-height:18px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'pshowsubtitle' => 0,
'presdescfont' => 'font-weight:normal;font-family:Open Sans;color:rgba(167, 160, 162, 1);font-size:14px;line-height:17px;text-shadow:0px 0px 0px rgba(255, 255, 255, 0);',
'prescontainerbg' => '0-60-rgba(221, 221, 221, 1)-rgba(221, 221, 221, 1)',
'pdotssmallcolor' => '0-60-rgba(170, 170, 170, 1)-rgba(170, 170, 170, 1)',
'pdotscurrentcolor' => '0-60-rgba(136, 136, 136, 1)-rgba(136, 136, 136, 1)',
'pdotsflippedcolor' => '0-60-rgba(85, 85, 85, 1)-rgba(85, 85, 85, 1)',
// Custom CSS
'custom_css' => '',
'custom_css_h' => '',
'res_z_index' => 11000,
'sett_z_index' => 11001,
//Relevance options
'userelevance' => 1,
'etitleweight' => 10,
'econtentweight' => 9,
'eexcerptweight' => 9,
'etermsweight' => 7,
'titleweight' => 3,
'contentweight' => 2,
'excerptweight' => 2,
'termsweight' => 2,
'it_title_weight' => 100,
'it_content_weight' => 20,
'it_excerpt_weight' => 10,
'it_terms_weight' => 10,
'it_cf_weight' => 8,
'it_author_weight' => 8
);
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace WPDRMS\Backend\Options;
use WPDRMS\ASP\Query\SearchQuery;
use WPDRMS\ASP\Utils\Ajax;
class PostSearch extends AbstractOption {
use PostTypeTrait;
protected $default_args = array(
'callback' => '', // javacsript function name in the windows scope | if empty, shows results
'placeholder' => 'Search in post types..',
'search_values' => 0,
'limit' => 10,
'delimiter' => '!!!CPTRES!!!',
'controls_position' => 'right',
'class' => ''
);
function render() {
$post_title = get_the_title($this->value) . " (" . get_post_type($this->value) . ")";
?>
<div class='wd_cpt_search<?php echo $this->args['class'] != '' ? ' '.$this->args['class'] : "";?>'
id='wd_cpt_search-<?php echo self::$num; ?>'>
<label for='wd_cpt_search-input-<?php echo self::$num; ?>'><?php echo $this->label; ?></label>
<?php if ($this->args['controls_position'] == 'left') $this->printControls(); ?>
<input type="search"
class="hiddend wd_cpt_search"
value=""
id='wd_cpt_search-input-<?php echo self::$num; ?>'
placeholder="<?php echo $this->args['placeholder']; ?>"/>
<input type='hidden'
name="<?php echo $this->name; ?>"
isparam="1"
value="<?php echo self::outputValue($this->value); ?>">
<input type='hidden' value="<?php echo base64_encode(json_encode($this->args)); ?>" class="wd_args">
<?php if ($this->args['controls_position'] != 'left') $this->printControls(); ?>
<div class="wd_cpt_search_res"></div>
<span class="wp_cpt_search_selected "><span class="fa fa-ban"></span><span><?php echo esc_html($post_title); ?></span></span>
</div>
<?php
}
private function printControls() {
?>
<span class="loading-small hiddend"></span>
<div class="wd_ts_close hiddend">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<polygon id="x-mark-icon" points="438.393,374.595 319.757,255.977 438.378,137.348 374.595,73.607 255.995,192.225 137.375,73.622 73.607,137.352 192.246,255.983 73.622,374.625 137.352,438.393 256.002,319.734 374.652,438.378 "></polygon>
</svg>
</div>
<?php
}
public static function search() {
global $wpdb;
$phrase = trim($_POST['wd_phrase']);
$data = json_decode(base64_decode($_POST['wd_args']), true);
$post_types = get_post_types(array(
"public" => true,
"_builtin" => false
), "names", "OR");
$post_types = array_diff($post_types, self::$NON_DISPLAYABLE_POST_TYPES);
$asp_query = new SearchQuery(array(
"s" => $phrase,
"_ajax_search" => false,
'keyword_logic' => 'and',
'secondary_logic' => 'or',
"posts_per_page" => 20,
'post_type' => $post_types,
'post_status' => array(),
'post_fields' => array(
'title', 'ids'
)
));
$results = $asp_query->posts;
Ajax::prepareHeaders();
print_r($data['delimiter'] . json_encode($results) . $data['delimiter']);
die();
}
public static function registerAjax() {
if ( !has_action('wp_ajax_wd_search_cb_cpt') ) {
add_action('wp_ajax_wd_search_cb_cpt', array(get_called_class(), 'search'));
}
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace WPDRMS\Backend\Options;
class PostType extends AbstractOption {
use PostTypeTrait;
protected $default_args = array(
"exclude" => array(),
"include" => array()
),
$postTypes;
function __construct($args) {
parent::__construct($args);
$this->value = array_filter($this->value, function($post_type){
return post_type_exists($post_type);
});
$this->args['exclude'] = array_unique(
array_merge($this->args['exclude'], self::$NON_DISPLAYABLE_POST_TYPES)
);
if ( !empty($this->args['exclude']) && !empty($this->args['include']) ) {
$this->args['exclude'] = array_diff($this->args['exclude'], $this->args['include']);
}
$this->postTypes = get_post_types('', "objects");
if ( !is_wp_error($this->postTypes) && is_array($this->postTypes) ) {
foreach ($this->postTypes as $k => $v) {
if ( count($this->args['exclude']) > 0 && in_array($k, $this->args['exclude']) ) {
unset($this->postTypes[$k]);
continue;
}
if ( $k == 'attachment' ) {
$v->labels->name = 'Attachment - Media';
}
}
} else {
$this->postTypes = array();
}
}
public static function value( $value, $default_value = null ) {
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
$value = substr($value, strlen('_decode_'));
$value = json_decode(base64_decode($value), true);
}
return self::compatibility( $value );
}
protected static function outputValue( $value ) {
// No need to decode
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
return $value;
} else {
return '_decode_' . base64_encode(json_encode($value));
}
}
function render() {
?>
<div class='wpdreamsCustomPostTypes' data-id="<?php echo self::$num; ?>" id='wpdreamsCustomPostTypes-<?php echo self::$num; ?>'>
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="sortablecontainer" id="sortablecontainer<?php echo self::$num; ?>">
<div class="arrow-all arrow-all-left"></div>
<div class="arrow-all arrow-all-right"></div>
<p><?php echo __('Available post types', 'ajax-search-pro'); ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->postTypes as $post_type => $data ): ?>
<?php if ( !in_array($post_type, $this->value) ): ?>
<li class="ui-state-default" data-ptype="<?php echo $post_type; ?>">
<?php echo $data->labels->name; ?>
<span class="extra_info">[<?php echo $post_type; ?>]</span>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the post types you want to use!', 'ajax-search-pro'); ?></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->value as $post_type ): ?>
<?php if ( isset($this->postTypes[$post_type]) ): ?>
<li class="ui-state-default" data-ptype="<?php echo $post_type; ?>">
<?php echo $this->postTypes[$post_type]->labels->name; ?>
<span class="extra_info">[<?php echo $post_type; ?>]</span>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace WPDRMS\Backend\Options;
class PostTypeSortable extends AbstractOption {
use PostTypeTrait;
function __construct($args) {
parent::__construct($args);
$post_types = get_post_types(array(
"public" => false,
"_builtin" => true
), "names", "OR");
$post_types = array_diff($post_types, self::$NON_DISPLAYABLE_POST_TYPES);
foreach ( $post_types as $type ) {
if ( !in_array($type, $this->value) ) {
$this->value[] = $type;
}
}
}
public static function value( $value, $default_value = null ) {
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
$value = substr($value, strlen('_decode_'));
$value = json_decode(base64_decode($value), true);
}
return self::compatibility( $value );
}
protected static function outputValue( $value ) {
// No need to decode
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
return $value;
} else {
return '_decode_' . base64_encode(json_encode($value));
}
}
function render() {
?>
<div class='wd_post_type_sortalbe' id='wd_post_type_sortalbe-<?php echo self::$num; ?>'>
<div class="sortablecontainer" style="float:right;">
<p><?php echo $this->label; ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable">
<?php foreach($this->value as $post_type ): ?>
<li class="ui-state-default" data-post_type="<?php echo esc_attr($post_type); ?>">
<?php echo esc_html($post_type); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<input isparam=1 type='hidden' value="<?php echo self::outputValue($this->value); ?>" name='<?php echo $this->name; ?>'>
<div class="clear"></div>
</div>
<?php
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace WPDRMS\Backend\Options;
trait PostTypeTrait {
private static $NON_DISPLAYABLE_POST_TYPES = array(
'revision',
'nav_menu_item',
'attachment',
'peepso-post',
'peepso-comment',
'acf',
'shop_order',
'shop_order_refund',
'elementor_library',
'elementor_font',
'elementor_icons',
'oembed_cache',
'user_request',
'wp_block',
'shop_coupon',
'avada_page_options',
'_pods_template',
'_pods_pod',
'_pods_field',
'bp-email',
'lbmn_archive',
'lbmn_footer',
'mc4wp-form',
'elementor-front',
'elementor-icon',
'tablepress_table',
'fusion_template',
'fusion_element',
'wc_product_tab',
'customize_changeset',
'wpcf7_contact_form',
'dslc_templates',
'acf-field',
'acf-group',
'acf-groups',
'acf-field-group',
'custom_css',
);
}

View File

@@ -0,0 +1,41 @@
<?php
namespace WPDRMS\Backend\Options;
class Sortable extends AbstractOption {
public static function value( $value, $default_value = null ) {
$value = array_filter(explode('|', $value));
if ( $default_value != null ) {
$missing_from_value = array_diff($default_value, $value);
$not_needed = array_diff($value, $default_value);
$value = array_diff($value, $not_needed);
$value = array_merge($value, $missing_from_value);
}
return $value;
}
protected static function outputValue( $value ) {
return implode('|', $value);
}
function render() {
?>
<div class='wpdreamsSortable' data-id="<?php echo self::$num; ?>" id='wpdreamsSortable-<?php echo self::$num; ?>'>
<div class="sortablecontainer" style="float:right;">
<p><?php echo $this->label; ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable">
<?php foreach($this->value as $value ): ?>
<li class="ui-state-default" data-value="<?php echo esc_attr($value); ?>">
<?php echo esc_html($value); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<input isparam=1 type='hidden' value="<?php echo self::outputValue($this->value); ?>" name='<?php echo $this->name; ?>'>
<div class="clear"></div>
</div>
<?php
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace WPDRMS\Backend\Options;
class TaxonomySelect extends AbstractOption {
protected
$default_args = array(
"type" => 'include'
),
$taxonomies = array(),
$selected = array(),
$exclude = array(
'product_visibility', 'product_type'
);
function __construct($args) {
parent::__construct($args);
$this->value = array_filter($this->value, function($taxonomy){
return taxonomy_exists($taxonomy);
});
$taxonomies = get_taxonomies(array('_builtin' => false), 'objects', 'and');
foreach ( $taxonomies as $taxonomy ) {
if ( !in_array($taxonomy->name, $this->exclude) ) {
$label = isset($tax->object_type, $tax->object_type[0]) ?
$tax->object_type[0] . ' - ' . $taxonomy->labels->name : $taxonomy->labels->name;
if ( !in_array($taxonomy->name, $this->value) ) {
$this->taxonomies[$taxonomy->name] = $label;
}
if ( in_array($taxonomy->name, $this->value) ) {
$this->selected[$taxonomy->name] = $label;
}
}
}
}
public static function value( $value, $default_value = null ) {
return array_filter(explode('|', $value));
}
protected static function outputValue( $value ) {
// No need to decode
return implode('|', $value);
}
function render() {
?>
<div class='wpdreamsTaxonomySelect' data-id="<?php echo self::$num; ?>" id='wpdreamsTaxonomySelect-<?php echo self::$num; ?>'>
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="sortablecontainer" id="sortablecontainer<?php echo self::$num; ?>">
<div class="arrow-all arrow-all-left"></div>
<div class="arrow-all arrow-all-right"></div>
<p><?php echo __('Available taxonomies', 'ajax-search-pro'); ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->taxonomies as $taxonomy => $label ): ?>
<li class="ui-state-default" data-taxonomy="<?php echo $taxonomy; ?>">
<?php echo $label; ?>
<span class="extra_info">[<?php echo $taxonomy; ?>]</span>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the post types you want to', 'ajax-search-pro'); ?><b><?php echo $this->args['type']; ?>!</b></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->selected as $taxonomy => $label ): ?>
<li class="ui-state-default" data-taxonomy="<?php echo $taxonomy; ?>">
<?php echo $label; ?>
<span class="extra_info">[<?php echo $taxonomy; ?>]</span>
</li>
<?php endforeach; ?>
</ul>
</div>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace WPDRMS\Backend\Options;
class Text extends AbstractOption {
protected $default_args = array(
"small" => false,
/**
* Always double escape!!
* Positive integers: ^\\d*$
* Any integer: ^-?\\d*\\.?\\d+$
*/
"regex" => '',
"allow_empty" => 0,
"default" => '', // Reverts when loses focus
'validation_msg' => ''
);
protected static function outputValue( $value ) {
// No need to decode
return stripslashes( esc_html($value)) ;
}
public function render() {
?>
<div class='wpdreamsText<?php echo $this->args['small'] ? " wpdreamsTextSmall":""; ?>'>
<label for="wpdreamstext_<?php echo self::$num; ?>"><?php echo $this->label; ?></label>
<input
isparam=1
<?php echo ' data-regex="'.esc_attr($this->args['regex']).'"'; ?>
<?php echo ' data-validation_msg="'.esc_attr($this->args['validation_msg']).'"'; ?>
<?php echo ' data-allow_empty="'.esc_attr($this->args['allow_empty']).'"'; ?>
<?php echo ' data-default="'.esc_attr($this->args['default']).'"'; ?>
value="<?php echo self::outputValue($this->value); ?>"
type='text'
name="<?php echo $this->name; ?>" id="wpdreamstext_<?php echo self::$num; ?>" />
</div>
<?php
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace WPDRMS\Backend\Options;
class TextArea extends AbstractOption {
protected $default_args = array(
"wide" => false
);
protected static function outputValue( $value ) {
// No need to decode
return stripslashes(esc_html($value));
}
public function render() {
$style = $this->args['wide'] ? 'style="min-width:85%;"' : '';
?>
<label class="wd_textarea_expandable" for="wd_textareae_<?php echo self::$num; ?>"><?php echo $this->label; ?></label>
<textarea rows='1' data-min-rows='2' id="wd_textareae_<?php echo self::$num; ?>"
class='wd_textarea_expandable'
name="<?php echo $this->name; ?>"
<?php echo $style; ?>
id="wd_textareae_<?php echo self::$num; ?>"><?php echo self::outputValue($this->value); ?></textarea>
<?php
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace WPDRMS\Backend\Options;
class Upload extends AbstractOption {
function render() {
?>
<div class='wpdreamsUpload' id='wpdreamsUpload<?php echo self::$num; ?>'>
<label for='wpdreamsUpload_input<?php echo self::$num; ?>'>
<?php echo $this->label; ?>
</label>
<input id="wpdreamsUpload_input<?php echo self::$num; ?>" type="text"
class="wdUploadText"
size="36" name="<?php echo $this->name; ?>"
value="<?php esc_attr_e(self::outputValue($this->value)); ?>"/>
<input id="wpdreamsUpload_button<?php echo self::$num; ?>"
class="wdUploadButton button" type="button"
value="<?php esc_attr_e('Upload', 'ajax-search-pro'); ?>"/>
</div>
<?php
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace WPDRMS\Backend\Options;
use wd_CFSearchCallBack;
class UserMeta extends AbstractOption {
public static function value( $value, $default_value = null ) {
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
$value = substr($value, strlen('_decode_'));
$value = json_decode(base64_decode($value), true);
}
return self::compatibility( $value );
}
protected static function outputValue( $value ) {
// No need to decode
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
return $value;
} else {
return '_decode_' . base64_encode(json_encode($value));
}
}
function render() {
?>
<div class='wd_UserMeta' id="wd_UserMeta-<?php echo self::$num; ?>">
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="draggablecontainer" id="draggablecontainer<?php echo self::$num; ?>">
<div class="arrow-all-left"></div>
<div class="arrow-all-right"></div><div style="margin: -3px 0 5px -5px;">
<?php
Option::create('CustomFieldSearch', array(
'name' => 'wdcfs_' . self::$num,
'label' => '',
'value' => '',
'args' => array(
'callback' => 'wd_um_ajax_callback',
'limit' => 250,
'usermeta' => 1
)
));
?>
</div><ul id="sortable<?php echo self::$num; ?>" class="connectedSortable">
<?php echo __('Use the search bar above to look for user meta fields', 'ajax-search-pro'); ?> :)
</ul></div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the user meta fields you want to use!', 'ajax-search-pro'); ?></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable">
<?php
foreach ($this->value as $k => $v) {
echo '<li class="ui-state-default" cf_name="' . $v . '">' . $v . '<a class="deleteIcon"></a></li>';
}
?>
</ul></div>
<input type='hidden' value="<?php echo base64_encode(json_encode($this->args)); ?>" class="wd_args">
<input isparam=1 type='hidden' value="<?php echo self::outputValue($this->value); ?>" name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace WPDRMS\Backend\Options;
class UserRoleSelect extends AbstractOption {
protected
$roles = array(),
$selected = array(),
$value = array();
function __construct($args) {
global $wp_roles;
parent::__construct($args);
// Check if role exists, if not, then remove it
$this->value = array_filter($this->value, function($role){
global $wp_roles;
return isset($wp_roles->roles[$role]);
});
foreach ( $wp_roles->roles as $role => $vv ) {
if ( !in_array($role, $this->value) ) {
$this->roles[] = $role;
}
if ( in_array($role, $this->value) ) {
$this->selected[] = $role;
}
}
}
public static function value( $value, $default_value = null ) {
return array_filter(explode('|', $value));
}
protected static function outputValue( $value ) {
// No need to decode
return implode('|', $value);
}
function render() {
global $wp_roles;
?>
<div class='wpdreamsUserRoleSelect' data-id="<?php echo self::$num; ?>" id='wpdreamsUserRoleSelect-<?php echo self::$num; ?>'>
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="sortablecontainer" id="sortablecontainer<?php echo self::$num; ?>">
<div class="arrow-all arrow-all-left"></div>
<div class="arrow-all arrow-all-right"></div>
<p><?php echo __('Available user roles', 'ajax-search-pro'); ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->roles as $role ): ?>
<li class="ui-state-default" data-role="<?php echo esc_attr($role); ?>">
<?php echo esc_html($wp_roles->roles[$role]['name']); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the user roles you want to exclude!', 'ajax-search-pro'); ?></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->selected as $role ): ?>
<li class="ui-state-default" data-role="<?php echo esc_attr($role); ?>">
<?php echo esc_html($wp_roles->roles[$role]['name']); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,142 @@
<?php
namespace WPDRMS\Backend\Options;
use WP_User_Query;
use WPDRMS\ASP\Utils\Ajax;
class UserSelect extends AbstractOption {
protected $default_args = array(
"show_type" => 0,
"show_checkboxes" => 0,
"show_all_users_option" => 1
);
public static function registerAjax() {
if ( !has_action('wp_ajax_wd_search_users') ) {
add_action('wp_ajax_wd_search_users', array(get_called_class(), 'search'));
}
}
public static function value( $value, $default_value = null ) {
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
$value = substr($value, strlen('_decode_'));
$value = json_decode(base64_decode($value), true);
}
return self::compatibility( $value );
}
protected static function outputValue( $value ) {
// No need to decode
if (gettype($value) === 'string' && substr($value, 0, strlen('_decode_')) === '_decode_') {
return $value;
} else {
return '_decode_' . base64_encode(json_encode($value));
}
}
public function render() {
?>
<div class='wd_userselect' id='wd_userselect-<?php echo self::$num; ?>'>
<fieldset>
<div style='margin:15px 30px;text-align: left; line-height: 45px;'>
<label>
<?php echo __('Search users:', 'ajax-search-pro'); ?>
<input type="text" class="wd_user_search" placeholder="<?php echo __('Type here..', 'ajax-search-pro'); ?>"/>
</label>
<label<?php echo ($this->args["show_type"] == 1) ? '' : ' class="hiddend"'; ?>>
<?php echo __('Operation:', 'ajax-search-pro'); ?>
<select class="tts_operation">
<option value="include"<?php echo $this->value['op_type'] == "include" ? ' selected="selected"' : ''; ?>><?php echo __('Include', 'ajax-search-pro'); ?></option>
<option value="exclude"<?php echo $this->value['op_type'] == "exclude" ? ' selected="selected"' : ''; ?>><?php echo __('Exclude', 'ajax-search-pro'); ?></option>
</select>
</label>
</div>
<legend><?php echo $this->label; ?></legend>
<div class="draggablecontainer" id="sortablecontainer<?php echo self::$num; ?>">
<div class="dragLoader hiddend"></div>
<p><?php echo __('User Results', 'ajax-search-pro'); ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable wd_csortable<?php echo self::$num; ?>">
<?php if ($this->args['show_all_users_option'] == 1): ?>
<li class="ui-state-default" data-userid="-1"><?php echo __('All users', 'ajax-search-pro'); ?><a class="deleteIcon"></a></li>
<?php endif; ?>
<li class="ui-state-default" data-userid="0"><?php echo __('Anonymous user (no user)', 'ajax-search-pro'); ?><a class="deleteIcon"></a></li>
<li class="ui-state-default" data-userid="-2"><?php echo __('Current logged in user', 'ajax-search-pro'); ?><a class="deleteIcon"></a></li>
<?php echo __('Use the search to look for users :)', 'ajax-search-pro'); ?>
</ul>
</div>
<div class="sortablecontainer"><p><?php echo __('Drag here the ones you want to', 'ajax-search-pro'); ?> <span style="font-weight: bold;" class="tts_type"><?php echo $this->value['op_type']; ?></span>!</p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable wd_csortable<?php echo self::$num; ?>">
<?php $this->printSelectedUsers(); ?>
</ul>
</div>
<input type='hidden' value="<?php echo base64_encode(json_encode($this->args)); ?>" class="wd_args">
<input isparam=1 type='hidden' value="<?php echo self::outputValue($this->value); ?>" name='<?php echo $this->name; ?>'>
</fieldset>
</div>
<?php
}
private function printSelectedUsers() {
foreach($this->value['users'] as $u) {
switch ($u) {
case -1:
echo '<li class="ui-state-default termlevel-0" data-userid="-1">' . __('All users', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>';
break;
case 0:
echo '<li class="ui-state-default" data-userid="0">' . __('Anonymous user (no user)', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>';
break;
case -2:
echo '<li class="ui-state-default" data-userid="-2">' . __('Current logged in user', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>';
break;
default:
$user = get_user_by("ID", $u);
if (empty($user) || is_wp_error($user))
break;
$checkbox = "";
if ($this->args['show_checkboxes'] == 1)
$checkbox = '<input style="float:left;" type="checkbox" value="' . $user->ID . '"
' . (!in_array($user->ID, $this->value['un_checked']) ? ' checked="checked"' : '') . '/>';
echo '
<li class="ui-state-default" data-userid="' . $user->ID . '">' . $user->user_login . ' ('.$user->display_name.')
' . $checkbox . '
<a class="deleteIcon"></a></li>';
break;
}
}
}
public static function search() {
$phrase = trim($_POST['wd_phrase']);
$data = json_decode(base64_decode($_POST['wd_args']), true);
$user_query = new WP_User_Query( array( 'search' => "*" . $phrase . "*", "number" => 100 ) );
Ajax::prepareHeaders();
if ( $data['show_all_users_option'] == 1 )
echo '<li class="ui-state-default termlevel-0" data-userid="-1">' . __('All users', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>';
echo '<li class="ui-state-default" data-userid="0">' . __('Anonymous user (no user)', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>
<li class="ui-state-default" data-userid="-2">' . __('Current logged in user', 'ajax-search-pro') . '</b><a class="deleteIcon"></a></li>';
// User Loop
$user_results = $user_query->get_results();
if ( ! empty( $user_results ) ) {
echo "Or select users:";
foreach ( $user_results as $user ) {
$checkbox = "";
if ($data['show_checkboxes'] == 1)
$checkbox = '<input style="float:left;" type="checkbox" value="' . $user->ID . '" checked="checked"/>';
echo '
<li class="ui-state-default" data-userid="' . $user->ID . '">' . $user->user_login . ' ('.$user->display_name.')
'.$checkbox.'
<a class="deleteIcon"></a></li>
';
}
} else {
echo __('No users found for term:', 'ajax-search-pro') . ' <b>' . $phrase .'</b>';
}
die();
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace WPDRMS\Backend\Options;
class UserXprofileSelect extends AbstractOption {
public static $all_fields = false;
private $fields;
function __construct($args) {
global $wpdb;
parent::__construct($args);
if ( self::$all_fields === false ) {
self::$all_fields = array();
$table_name = $wpdb->base_prefix . "bp_xprofile_fields";
if( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name ) {
$all_fields = $wpdb->get_results(
"SELECT * FROM $table_name LIMIT 400"
);
$all_fields = is_wp_error($all_fields) ? array() : $all_fields;
foreach ($all_fields as $pf) {
self::$all_fields[$pf->id] = $pf;
}
}
}
$this->fields = array_filter(self::$all_fields, function ($field) {
return !in_array($field->id, $this->value);
});
}
public static function value( $value, $default_value = null ) {
return array_filter(explode('|', $value));
}
protected static function outputValue( $value ) {
// No need to decode
return implode('|', $value);
}
function render() {
?>
<div class='wpdreamsBP_XProfileFields' data-id="<?php echo self::$num; ?>" id='wpdreamsBP_XProfileFields-<?php echo self::$num; ?>'>
<fieldset>
<legend><?php echo $this->label; ?></legend>
<div class="sortablecontainer" id="sortablecontainer<?php echo self::$num; ?>">
<div class="arrow-all arrow-all-left"></div>
<div class="arrow-all arrow-all-right"></div>
<p><?php echo __('Available profile fields', 'ajax-search-pro'); ?></p>
<ul id="sortable<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->fields as $field ): ?>
<li class="ui-state-default" data-bid="<?php echo $field->id; ?>">
<?php echo $field->name; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="sortablecontainer">
<p><?php echo __('Drag here the fields you want to search!', 'ajax-search-pro'); ?></p>
<ul id="sortable_conn<?php echo self::$num; ?>" class="connectedSortable connectedSortable<?php echo self::$num; ?>">
<?php foreach($this->value as $id ): ?>
<?php if ( isset(self::$all_fields[$id]) ): ?>
<li class="ui-state-default" data-bid="<?php echo $id; ?>">
<?php echo self::$all_fields[$id]->name; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
</fieldset>
</div>
<?php
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace WPDRMS\Backend\Options;
if (!defined('ABSPATH')) die('-1');
class YesNo extends AbstractOption {
public static function value( $value, $default_value = null ): int {
return $value == 1 ? 1 : 0;
}
/**
* HTML Output for the option
*/
public function render() {
?>
<div class="wpdreamsYesNo<?php echo $this->value == 1 ? ' active' : ''; ?>">
<label for="wpdreamstext_<?php echo self::$num; ?>"><?php echo $this->label; ?></label>
<input isparam="1" type="hidden"
value="<?php echo self::outputValue($this->value); ?>"
name="<?php echo $this->name; ?>">
<div class="wpdreamsYesNoInner"></div>
</div>
<?php
}
}

View File

@@ -0,0 +1,367 @@
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");
if (ASP_DEMO) $_POST = null;
$action_msg = '';
if (
isset($_POST, $_POST['asp_analytics'], $_POST['reset'], $_POST['asp_analytics_nonce']) &&
isset($_POST['asp_analytics_nonce'])
) {
if ( wp_verify_nonce( $_POST['asp_analytics_nonce'], 'asp_analytics_nonce' ) ) {
asp_reset_option('asp_analytics', false);
$action_msg = "<div class='infoMsg'><strong>" . __('Analytics settings were reset to defaults!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
} else {
$action_msg = "<div class='errorMsg'><strong>". __('<strong>ERROR Saving:</strong> Invalid NONCE, please try again!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
}
$_POST = array();
}
if (isset($_POST, $_POST['asp_analytics'], $_POST['submit'], $_POST['asp_analytics_nonce']) && (wpdreamsType::getErrorNum()==0)) {
if ( wp_verify_nonce( $_POST['asp_analytics_nonce'], 'asp_analytics_nonce' ) ) {
$values = array(
"analytics" => $_POST['analytics'],
"analytics_tracking_id" => $_POST['analytics_tracking_id'],
// Gtag on input focus
'gtag_focus' => $_POST['gtag_focus'],
'gtag_focus_action' => $_POST['gtag_focus_action'],
'gtag_focus_ec' => $_POST['gtag_focus_ec'],
'gtag_focus_el' => $_POST['gtag_focus_el'],
'gtag_focus_value' => $_POST['gtag_focus_value'],
// Gtag on search start
'gtag_search_start' => $_POST['gtag_search_start'],
'gtag_search_start_action' => $_POST['gtag_search_start_action'],
'gtag_search_start_ec' => $_POST['gtag_search_start_ec'],
'gtag_search_start_el' => $_POST['gtag_search_start_el'],
'gtag_search_start_value' => $_POST['gtag_search_start_value'],
// Gtag on search end
'gtag_search_end' => $_POST['gtag_search_end'],
'gtag_search_end_action' => $_POST['gtag_search_end_action'],
'gtag_search_end_ec' => $_POST['gtag_search_end_ec'],
'gtag_search_end_el' => $_POST['gtag_search_end_el'],
'gtag_search_end_value' => $_POST['gtag_search_end_value'],
// Gtag on magnifier
'gtag_magnifier' => $_POST['gtag_magnifier'],
'gtag_magnifier_action' => $_POST['gtag_magnifier_action'],
'gtag_magnifier_ec' => $_POST['gtag_magnifier_ec'],
'gtag_magnifier_el' => $_POST['gtag_magnifier_el'],
'gtag_magnifier_value' => $_POST['gtag_magnifier_value'],
// Gtag on return
'gtag_return' => $_POST['gtag_return'],
'gtag_return_action' => $_POST['gtag_return_action'],
'gtag_return_ec' => $_POST['gtag_return_ec'],
'gtag_return_el' => $_POST['gtag_return_el'],
'gtag_return_value' => $_POST['gtag_return_value'],
// Gtag on facet change
'gtag_try_this' => $_POST['gtag_try_this'],
'gtag_try_this_action' => $_POST['gtag_try_this_action'],
'gtag_try_this_ec' => $_POST['gtag_try_this_ec'],
'gtag_try_this_el' => $_POST['gtag_try_this_el'],
'gtag_try_this_value' => $_POST['gtag_try_this_value'],
// Gtag on facet change
'gtag_facet_change' => $_POST['gtag_facet_change'],
'gtag_facet_change_action' => $_POST['gtag_facet_change_action'],
'gtag_facet_change_ec' => $_POST['gtag_facet_change_ec'],
'gtag_facet_change_el' => $_POST['gtag_facet_change_el'],
'gtag_facet_change_value' => $_POST['gtag_facet_change_value'],
// Gtag on result click
'gtag_result_click' => $_POST['gtag_result_click'],
'gtag_result_click_action' => $_POST['gtag_result_click_action'],
'gtag_result_click_ec' => $_POST['gtag_result_click_ec'],
'gtag_result_click_el' => $_POST['gtag_result_click_el'],
'gtag_result_click_value' => $_POST['gtag_result_click_value']
);
update_option('asp_analytics', $values);
asp_parse_options();
wd_asp()->css_manager->generator->generate();
$action_msg = "<div class='infoMsg'><strong>" . __('Analytics settings saved!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
} else {
$action_msg = "<div class='errorMsg'><strong>". __('<strong>ERROR Saving:</strong> Invalid NONCE, please try again!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
$_POST = array();
}
}
$ana_options = wd_asp()->o['asp_analytics'];
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be asp-be-analytics wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="float:left;">
<?php ob_start(); ?>
<div class="item">
<?php $o = new wpdreamsCustomSelect("analytics", __("Google analytics integration method", 'ajax-search-pro'),
array(
'selects' => array(
array("option" => esc_attr__('Disabled', 'ajax-search-pro'), "value" => "0"),
array("option" => esc_attr__('Event Tracking (GTAG & GTM)', 'ajax-search-pro'), "value" => "event")
),
'value' => $ana_options["analytics"]
)
); ?>
<p class="descMsg">
<?php echo sprintf( __('To understand how this works, please read the <a href="%s">Analytics Integration Documentation</a>', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/analytics-integration'
); ?>
</p>
</div>
<div class="asp_al_both hiddend">
<div class="item">
<?php $o = new wpdreamsText("analytics_tracking_id", __('Google analytics Tracking ID (ex.: G-0123456789)', 'ajax-search-pro'), $ana_options["analytics_tracking_id"]); ?>
<p class='descMsg'>
<?php echo __('If you are using GTM (Google Tag Manager), then this is not required.', 'ajax-search-pro'); ?>
</p>
<p class='infoMsg'>
<?php echo __(sprintf(
'Please read this <a href="%s">google analytics documentation</a> to get your tracking ID.',
'https://support.google.com/analytics/answer/9539598'
), 'ajax-search-pro'); ?>
</p>
</div>
</div>
<div class="asp_al_event hiddend">
<fieldset>
<legend><?php echo __('Search input focus event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_focus", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_focus"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user clicks on the search input field.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_focus_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_focus_action"]);
$o = new wpdreamsText("gtag_focus_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_focus_ec"]);
$o = new wpdreamsText("gtag_focus_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_focus_el"]);
$o = new wpdreamsText("gtag_focus_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_focus_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Live search start event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_search_start", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_search_start"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the live search starts.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_search_start_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_search_start_action"]);
$o = new wpdreamsText("gtag_search_start_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_search_start_ec"]);
$o = new wpdreamsText("gtag_search_start_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_search_start_el"]);
$o = new wpdreamsText("gtag_search_start_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_search_start_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Live search end event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_search_end", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_search_end"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the live search ends.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_search_end_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_search_end_action"]);
$o = new wpdreamsText("gtag_search_end_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_search_end_ec"]);
$o = new wpdreamsText("gtag_search_end_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_search_end_el"]);
$o = new wpdreamsText("gtag_search_end_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_search_end_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Magnifier click event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_magnifier", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_magnifier"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user clicks the magnifier icon', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_magnifier_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_magnifier_action"]);
$o = new wpdreamsText("gtag_magnifier_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_magnifier_ec"]);
$o = new wpdreamsText("gtag_magnifier_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_magnifier_el"]);
$o = new wpdreamsText("gtag_magnifier_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_magnifier_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Return key event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_return", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_return"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user hits the enter button in the search input field', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_return_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_return_action"]);
$o = new wpdreamsText("gtag_return_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_return_ec"]);
$o = new wpdreamsText("gtag_return_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_return_el"]);
$o = new wpdreamsText("gtag_return_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_return_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('"Try this" keyword clicks', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_try_this", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_try_this"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user clicks on any of the "try this" keywords', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_try_this_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_try_this_action"]);
$o = new wpdreamsText("gtag_try_this_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_try_this_ec"]);
$o = new wpdreamsText("gtag_try_this_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_try_this_el"]);
$o = new wpdreamsText("gtag_try_this_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_try_this_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Facet change event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_facet_change", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_facet_change"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user changes any option on the front-end settings', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{option_label}, {option_value}, {search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_facet_change_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_facet_change_action"]);
$o = new wpdreamsText("gtag_facet_change_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_facet_change_ec"]);
$o = new wpdreamsText("gtag_facet_change_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_facet_change_el"]);
$o = new wpdreamsText("gtag_facet_change_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_facet_change_value"]);
?>
</div>
</fieldset>
<fieldset>
<legend><?php echo __('Results click event tracking', 'ajax-search-pro'); ?></legend>
<div class="item asp_gtag_switch">
<?php
$o = new wpdreamsYesNo("gtag_result_click", __('Enabled', 'ajax-search-pro'), $ana_options["gtag_result_click"]);
?>
<p class='descMsg'>
<?php echo __('Triggers, whenever the user changes any option on the front-end settings', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item item-flex item-flex-nogrow item-flex-wrap item-flex-two-column asp_gtag_inputs">
<div class='descMsg item-flex-grow item-flex-100'>
<?php echo sprintf(
__('Usable variables: %s', 'ajax-search-pro'),
'{result_title}, {result_url}, {search_id}, {search_name}, {phrase}'
); ?>
</div>
<?php
$o = new wpdreamsText("gtag_result_click_action", __('Event action', 'ajax-search-pro'), $ana_options["gtag_result_click_action"]);
$o = new wpdreamsText("gtag_result_click_ec", __('Event category', 'ajax-search-pro'), $ana_options["gtag_result_click_ec"]);
$o = new wpdreamsText("gtag_result_click_el", __('Event label', 'ajax-search-pro'), $ana_options["gtag_result_click_el"]);
$o = new wpdreamsText("gtag_result_click_value", __('Event value', 'ajax-search-pro'), $ana_options["gtag_result_click_value"]);
?>
</div>
</fieldset>
</div>
<div class="item">
<input name="reset"
class="asp_submit asp_submit_transparent asp_submit_reset"
type="submit" value="<?php echo esc_attr__('Restore defaults', 'ajax-search-pro'); ?>">
<input type='submit' name="submit" class='submit' value='<?php esc_attr_e('Save options', 'ajax-search-pro'); ?>'/>
</div>
<?php $_r = ob_get_clean(); ?>
<div class='wpdreams-slider'>
<?php if (ASP_DEMO): ?>
<p class="infoMsg">
DEMO MODE ENABLED - Please note, that these options are read-only
</p>
<?php endif; ?>
<form name='asp_analytics1' method='post'>
<?php echo $action_msg; ?>
<fieldset>
<legend><?php echo __('Analytics options', 'ajax-search-pro'); ?></legend>
<?php print $_r; ?>
<input type='hidden' name='asp_analytics' value='1' />
<input type="hidden" name="asp_analytics_nonce" id="asp_analytics_nonce" value="<?php echo wp_create_nonce( "asp_analytics_nonce" ); ?>">
</fieldset>
</form>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>
<?php
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
wp_enqueue_script('asp-backend-analytics', plugin_dir_url(__FILE__) . 'settings/assets/analytics.js', array(
'jquery', 'wpdreams-tabs'
), $media_query, true);

View File

@@ -0,0 +1,177 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Cache\TextCache;
defined( 'ABSPATH' ) or die( "You can't access this file directly." );
$cache_options = wd_asp()->o['asp_caching'];
if (ASP_DEMO) $_POST = null;
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="float:left;">
<?php ob_start(); ?>
<div class="item item-flex-nogrow item-flex-wrap">
<?php
$o = new wpdreamsYesNo( "caching", __('Caching activated', 'ajax-search-pro'), $cache_options["caching"]);
$o = new wpdreamsCustomSelect('caching_method', __('Caching method', 'ajax-search-pro'),
array(
'selects' => array(
//array('option' => __('Super File Cache', 'ajax-search-pro'), 'value' => 'sc_file'),
array('option' => __('File', 'ajax-search-pro'), 'value' => 'file'),
array('option' => __('Database', 'ajax-search-pro'), 'value' => 'db')
),
'value' => $cache_options["caching_method"]
));
?>
<p class="descMsg">
<a target="_blank" href="https://documentation.ajaxsearchpro.com/performance-tuning/cache">
<?php echo __('Documentation', 'ajax-search-pro'); ?>
</a><br>
<?php echo __('Not recommended, unless you have many search queries per minute.', 'ajax-search-pro'); ?>
<?php echo __('This will enable search results to be cached into files in the cache directory/options database to bypass the search database query. Useful if you experience many repetitive queries.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<p class='infoMsg'>
<?php echo __('Turn this OFF if you are experiencing performance issues.', 'ajax-search-pro'); ?>
</p>
<?php $o = new wpdreamsYesNo( "image_cropping", __('Crop images for caching?', 'ajax-search-pro'), $cache_options["image_cropping"] ); ?>
<p class="descMsg">
<?php echo __('This disables the thumbnail generator, and the full sized images are used as cover. Not much difference visually, but saves a lot of CPU.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<?php $o = new wpdreamsText( "cachinginterval", __('Caching interval (in minutes, default 43200, aka. 30 days)', 'ajax-search-pro'),
$cache_options["cachinginterval"] ); ?>
</div>
<div class="item">
<input type="hidden" name="asp_caching_nonce" value="<?php echo wp_create_nonce( 'asp_caching_nonce' ); ?>">
<input type='submit' class='submit' value='<?php esc_attr_e('Save options', 'ajax-search-pro'); ?>'/>
</div>
<?php $_r = ob_get_clean(); ?>
<?php
$updated = false;
if (
isset( $_POST['asp_caching'], $_POST['asp_caching_nonce'] ) &&
wp_verify_nonce( $_POST['asp_caching_nonce'], 'asp_caching_nonce' )
) {
$values = array(
"caching" => $_POST['caching'],
"caching_method" => $_POST['caching_method'],
"image_cropping" => $_POST['image_cropping'],
"cachinginterval" => $_POST['cachinginterval']
);
update_option( 'asp_caching', $values );
asp_parse_options();
$updated = true;
wd_asp()->css_manager->generator->generate();
TextCache::generateSCFiles();
}
?>
<div class='wpdreams-slider'>
<?php if (ASP_DEMO): ?>
<p class="infoMsg">DEMO MODE ENABLED - Please note, that these options are read-only</p>
<?php endif; ?>
<form name='asp_caching' method='post'>
<?php if ( $updated ): ?>
<div class='successMsg'>
<?php echo __('Search caching settings successfuly updated!', 'ajax-search-pro'); ?>
</div>
<?php endif; ?>
<fieldset>
<legend>
<?php echo __('Caching Options', 'ajax-search-pro'); ?>
</legend>
<?php print $_r; ?>
<input type='hidden' name='asp_caching' value='1'/>
</fieldset>
</form>
<fieldset>
<legend><?php echo __('Clear Cache'); ?></legend>
<div class="item">
<p class='infoMsg'><?php echo __('Will clear all the images and precached search phrases.', 'ajax-search-pro'); ?></p>
<input type="hidden" id="asp_delete_cache_request_nonce" value="<?php echo wp_create_nonce( 'asp_delete_cache_request_nonce' ); ?>">
<input type='submit' class="red" name='Clear Cache' id='clearcache' value='<?php echo esc_attr__('Clear the cache!', 'ajax-search-pro'); ?>'>
</div>
</fieldset>
</div>
<script>
jQuery(function ($) {
function format() {
var a, b, c;
a = arguments[0];
b = [];
for(c = 1; c < arguments.length; c++){
b.push(arguments[c]);
}
for (c in b) {
a = a.replace(/%[a-z]/, b[c]);
}
return a;
}
$('#clearcache').on('click', function () {
var r = confirm('<?php echo esc_html__('Do you really want to clear the cache?', 'ajax-search-pro'); ?>');
if (r !== true) return;
var button = $(this),
nonce = $('#asp_delete_cache_request_nonce').val();
var data = {
action: 'ajaxsearchpro_deletecache',
'asp_delete_cache_request_nonce': nonce
};
button.attr("disabled", true);
var oldVal = button.attr("value");
button.attr("value", "Loading...");
button.addClass('blink');
$.post(ASP.ajaxurl, data, function (response) {
var currentdate = new Date();
var datetime = currentdate.getDate() + "/"
+ (currentdate.getMonth() + 1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
button.attr("disabled", false);
button.removeClass('blink');
button.attr("value", oldVal);
var cleared = '<?php echo esc_html__('%s record(s) deleted at %s', 'ajax-search-pro'); ?>';
cleared = format(cleared, response, datetime);
button.parent().parent().append('<div class="successMsg">Cache succesfully cleared! ' + cleared + '</div>');
}, "json");
});
$('.item input[name="caching"]').on('change', function(e){
var $m = $(this).closest('.item').find('select[name=caching_method]');
if ( $(this).val() == 1 ) {
$m.removeClass('disabled');
} else {
$m.addClass('disabled');
}
});
$('.item input[name="caching"]').trigger('change');
});
</script>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>

View File

@@ -0,0 +1,137 @@
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");
$com_options = wd_asp()->o['asp_compatibility'];
if (ASP_DEMO) $_POST = null;
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="float:left; width: 690px;">
<?php ob_start(); ?>
<div tabid="1">
<fieldset>
<legend><?php echo __('CSS and JS compatibility', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/compatibility/cssjs_options.php"); ?>
</fieldset>
</div>
<div tabid="4">
<fieldset>
<legend><?php echo __('CSS and JS loading', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/compatibility/cssjs_loading.php"); ?>
</fieldset>
</div>
<div tabid="2">
<fieldset>
<legend><?php echo __('Query compatibility options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/compatibility/query_options.php"); ?>
</fieldset>
</div>
<div tabid="3">
<fieldset>
<legend><?php echo __('Other options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/compatibility/other.php"); ?>
</fieldset>
</div>
<?php $_r = ob_get_clean(); ?>
<?php
$updated = false;
if (isset($_POST) && isset($_POST['asp_compatibility']) && (wpdreamsType::getErrorNum() == 0)) {
$values = array(
// CSS and JS
"js_prevent_body_scroll" => $_POST['js_prevent_body_scroll'],
"js_source" => $_POST['js_source'],
"detect_ajax" => $_POST['detect_ajax'],
"css_compatibility_level" => $_POST['css_compatibility_level'],
'css_minify' => $_POST['css_minify'],
"load_google_fonts" => $_POST['load_google_fonts'],
"usecustomajaxhandler" => $_POST['usecustomajaxhandler'],
// Loading
"script_loading_method" => $_POST['script_loading_method'],
"init_instances_inviewport_only" => $_POST['init_instances_inviewport_only'],
"css_loading_method" => $_POST['css_loading_method'],
'selective_enabled' => $_POST['selective_enabled'],
'selective_front' => $_POST['selective_front'],
'selective_archive' => $_POST['selective_archive'],
'selective_exin_logic' => $_POST['selective_exin_logic'],
'selective_exin' => $_POST['selective_exin'],
// Query options
'query_soft_check' => $_POST['query_soft_check'],
'use_acf_getfield' => $_POST['use_acf_getfield'],
'db_force_case' => $_POST['db_force_case'],
'db_force_unicode' => $_POST['db_force_unicode'],
'db_force_utf8_like' => $_POST['db_force_utf8_like'],
// Other options
'rest_api_enabled' => $_POST['rest_api_enabled'],
'meta_box_post_types' => $_POST['meta_box_post_types']
);
update_option('asp_compatibility', $values);
asp_parse_options();
$updated = true;
wd_asp()->css_manager->generator->generate();
}
?>
<div class='wpdreams-slider'>
<?php if ($updated): ?>
<div class='successMsg'>
<?php echo __('Search compatibility settings successfuly updated!', 'ajax-search-pro'); ?>
</div>
<?php endif; ?>
<?php if (ASP_DEMO): ?>
<p class="infoMsg">DEMO MODE ENABLED - Please note, that these options are read-only</p>
<?php endif; ?>
<ul id="tabs" class='tabs'>
<li><a tabid="1" class='current multisite'><?php echo __('CSS & JS compatibility', 'ajax-search-pro'); ?></a></li>
<li><a tabid="4" class='general'><?php echo __('CSS & JS loading', 'ajax-search-pro'); ?></a></li>
<li><a tabid="2" class='general'><?php echo __('Query compatibility', 'ajax-search-pro'); ?></a></li>
<li><a tabid="3" class='general'><?php echo __('Other', 'ajax-search-pro'); ?></a></li>
</ul>
<div class='tabscontent'>
<!-- Compatibility form -->
<form name='compatibility' method='post'>
<?php print $_r; ?>
<div class="item">
<input type='submit' class='submit' value='<?php echo esc_attr__('Save options', 'ajax-search-pro'); ?>'/>
</div>
<input type='hidden' name='asp_compatibility' value='1'/>
</form>
</div>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
</div>
<?php
wp_enqueue_script('wpd-backend-compatibility', plugin_dir_url(__FILE__) . 'settings/assets/compatibility_settings.js', array(
'jquery'
), ASP_CURR_VER_STRING, true);

View File

@@ -0,0 +1,10 @@
<div class="wdo" id="wdo"><div id="asp-root"></div></div>
<?php
$metadata = require_once ASP_PATH . 'build/js/dev.asset.php';
wp_enqueue_script(
'wpd-asp-dev',
ASP_URL_NP . 'build/js/dev.js',
$metadata['dependencies'],
$metadata['version'],
array( 'in_footer' =>true ),
);

View File

@@ -0,0 +1,213 @@
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");
global $wpdb;
$errormsg = '';
$import_count = 0;
$sett_import_count = 0;
if ( isset($_POST['asp_import_textarea'], $_POST['asp_import_nonce1']) ) {
if ( wp_verify_nonce( $_POST['asp_import_nonce1'], 'asp_import_nonce1' ) ) {
if ( empty($_POST['asp_import_textarea']) ) {
$errormsg = __('Import data is empty.', 'ajax-search-pro');
} else {
$data = json_decode(stripcslashes($_POST['asp_import_textarea']));
if ( json_last_error() == 0 ) {
$import_count = wd_asp()->instances->import($data);
if ( is_wp_error($import_count) ) {
$errormsg = $import_count->get_error_message();
$import_count = 0;
}
} else {
$errormsg = __('Import data error.', 'ajax-search-pro');
}
}
} else {
$errormsg = __('Error importing: invalid NONCE, please try again', 'ajax-search-pro');
}
}
if ( isset($_POST['asp_import_textarea_sett'], $_POST['asp_import_nonce2']) ) {
if ( wp_verify_nonce( $_POST['asp_import_nonce2'], 'asp_import_nonce2' ) ) {
if ( empty($_POST['asp_import_textarea_sett']) ) {
$errormsg = __('Import data is empty.', 'ajax-search-pro');
} else {
$instance = json_decode(base64_decode(stripcslashes($_POST['asp_import_textarea_sett'])), true);
if ( json_last_error() == 0 && isset($instance['data']) ) {
wd_asp()->instances->update($_POST['asp_import_sett'], $instance['data']);
$sett_import_count = 1;
} else {
$errormsg = __('Cannot import. Invalid data! Please try again!', 'ajax-search-pro');
}
}
} else {
$errormsg = __('Error importing: invalid NONCE, please try again', 'ajax-search-pro');
}
}
$search_instances = wd_asp()->instances->get(-1, true);
if ( $import_count > 0 || $sett_import_count > 0) {
wd_asp()->css_manager->generator->generate();
}
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<div class="wpdreams-box" style="float:left;">
<?php if ($errormsg != ''): ?>
<div class="errorMsg"><?php echo $errormsg; ?></div>
<?php endif; ?>
<?php if ($import_count > 0): ?>
<div class='infoMsg'>
<?php echo sprintf( __('Succesfully imported <b>%s</b> search instances.', 'ajax-search-pro'), $import_count ); ?>
</div>
<?php endif; ?>
<?php if ($sett_import_count > 0): ?>
<div class='infoMsg'><?php echo __('Succesfully imported the search settings.', 'ajax-search-pro'); ?></div>
<?php endif; ?>
<ul id="tabs" class='tabs'>
<li><a tabid="1" class='current multisite'><?php echo __('Instances', 'ajax-search-pro'); ?></a></li>
<li><a tabid="2" class='general'><?php echo __('Settings Only', 'ajax-search-pro'); ?></a></li>
</ul>
<div class='tabscontent'>
<div tabid="1">
<fieldset>
<legend>Instances</legend>
<p class="biggerDescMsg">
<?php echo __('On this tab you can import complete search instances. If you prefer to import settings only, click on the Settings Only button on the top of this page.', 'ajax-search-pro'); ?>
</p>
<fieldset>
<legend><?php echo __('Export Search instances', 'ajax-search-pro'); ?></legend>
<label for="asp_export" style="width: 335px;display: inline-block;"><?php echo __('Select the search instances to export', 'ajax-search-pro'); ?></label>
<label style="text-align: right;" for="asp_export_textarea"><?php echo __('Copy and save the text appearing in this box', 'ajax-search-pro'); ?></label><br>
<select id="asp_export" multiple>
<?php foreach ($search_instances as $instance): ?>
<option value="<?php echo wd_asp()->instances->export($instance['id']); ?>"><?php echo esc_html( $instance['name'] ); ?></option>
<?php endforeach; ?>
</select>
<textarea id="asp_export_textarea" class="wd-export-import"></textarea>
<input id='asp_export_button' type='button' class='submit' value='Export!'/><span class="small-loading hiddend"></span>
</fieldset>
<form name="asp_import_instances" method="post" enctype='application/json'>
<fieldset>
<legend><?php echo __('Import Search instances', 'ajax-search-pro'); ?></legend>
<p class="biggerDescMsg">
<?php echo __('Please note that the search IDs may differ from the exported instances. The imported instance names will have the "Imported" string appended after their names.', 'ajax-search-pro'); ?>
</p>
<input type="hidden" name="asp_import_nonce1" id="asp_import_nonce1" value="<?php echo wp_create_nonce( "asp_import_nonce1" ); ?>">
<label for="asp_import_textarea"><?php echo __('Paste the exported code here', 'ajax-search-pro'); ?></label><br>
<textarea id="asp_import_textarea" name="asp_import_textarea" class="wd-export-import"></textarea>
<br><input id='asp_import_button' type='submit' class='submit' value='Import!'/>
</fieldset>
</form>
</fieldset>
</div>
<div tabid="2">
<fieldset>
<legend><?php echo __('Settings only', 'ajax-search-pro'); ?></legend>
<p class="biggerDescMsg">
<?php echo __('On this page you can import settings to existing search instances. The import process will overwrite your current search options!', 'ajax-search-pro'); ?>
</p>
<fieldset>
<legend><?php echo __('Export settings', 'ajax-search-pro'); ?></legend>
<label for="asp_export_sett" style="width: 335px;display: inline-block;"><?php echo __('Select the instance to export settings from', 'ajax-search-pro'); ?></label>
<label style="text-align: right;" for="asp_export_textarea_sett"><?php echo __('Copy and save the text appearing in this box', 'ajax-search-pro'); ?></label><br>
<select id="asp_export_sett">
<?php foreach ($search_instances as $instance): ?>
<option value="<?php echo wd_asp()->instances->export($instance['id']); ?>"><?php echo esc_html( $instance['name'] ); ?></option>
<?php endforeach; ?>
</select>
<textarea id="asp_export_textarea_sett" class="wd-export-import"></textarea>
<input id='asp_export_button_sett' type='button' class='submit' value='Export!'/><span class="small-loading hiddend"></span>
</fieldset>
<form name="asp_import_instances_sett" method="post" enctype='application/json'>
<fieldset>
<legend><?php echo __('Import settings', 'ajax-search-pro'); ?></legend>
<label for="asp_import_sett" style="width: 335px;display: inline-block;"><?php echo __('Select the instance to import settings to', 'ajax-search-pro'); ?></label>
<label style="text-align: right;" for="asp_import_textarea_sett"><?php echo __('Paste the exported settings code here', 'ajax-search-pro'); ?></label><br>
<select id="asp_import_sett" name="asp_import_sett">
<?php foreach ($search_instances as $instance): ?>
<option value="<?php echo $instance['id']; ?>"><?php echo esc_html( $instance['name'] ); ?></option>
<?php endforeach; ?>
</select>
<input type="hidden" name="asp_import_nonce2" id="asp_import_nonce2" value="<?php echo wp_create_nonce( "asp_import_nonce2" ); ?>">
<textarea id="asp_import_textarea_sett" name="asp_import_textarea_sett" class="wd-export-import"></textarea>
<br><input id='asp_import_button_sett' type='submit' class='submit' value='Import!'/>
</fieldset>
</form>
</fieldset>
</div>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>
<style>
#asp_export {
min-width: 350px;
max-width: 350px;
min-height: 150px;
max-height: 150px;
vertical-align: top;
}
#asp_export_sett,
#asp_import_sett {
min-width: 350px;
max-width: 350px;
vertical-align: top;
}
textarea.wd-export-import {
margin-left: 40px;
}
input#asp_export_button,
input#asp_import_button {
margin: 13px 6px;
}
input#asp_export_button[disabled] {
opacity: 0.6;
}
#wpdreams span.small-loading {
vertical-align: middle;
margin: 0 20px;
display: inline-block;
}
#wpdreams span.hiddend {
display: none;
}
#wpdreams .asp_succ_import {
display: inline;
vertical-align: top;
padding: 0 10px;
}
</style>
<?php
wp_enqueue_script('wpd-backend-export-import', ASP_URL_NP . 'backend/settings/assets/export_import.js', array(
'jquery'
), ASP_CURR_VER_STRING, true);
wp_localize_script('wpd-backend-export-import', 'ASP_EI_LOC', array(
"suc_msg" => __('Are you sure you want to import settings to that search instance?', 'ajax-search-pro')
));

View File

@@ -0,0 +1,714 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Index\Manager;
use WPDRMS\ASP\Utils\Script;
use Doctrine\Inflector\Language;
defined('ABSPATH') or die("You can't access this file directly.");
$it_options = wd_asp()->o['asp_it_options'];
$_args = array();
foreach ($it_options as $_k => $_opt) {
$_args[str_replace('it_', '', $_k)] = $_opt;
}
$index_obj = new Manager($_args);
$pool_sizes = Manager::suggestPoolSizes();
if (ASP_DEMO) {
$_POST = null;
}
if ( !$index_obj->isEmpty() || ASP_DEMO ) {
$_COOKIE['_asp_first_index'] = 1;
}
$asp_cron_data = get_option("asp_it_cron", array(
"last_run" => "",
"result" => array()
));
?>
<?php if ( !wd_asp()->db->exists('index', true) ): ?>
<div id='wpdreams' class='asp-be wpdreams wrap'>
<div class="wpdreams-box">
<p class="errorMsg">
<?php echo __('One or more plugin tables are appear to be missing from the database.', 'ajax-search-pro'); ?>
<?php echo sprintf( __('Please check <a href="%s" target="_blank">this article</a> to resolve the issue.', 'ajax-search-pro'),
'https://wp-dreams.com/go/?to=kb-asp-missing-tables' ); ?>
</p>
<p class="errorMsg">
<?php echo __('Please be <strong>very careful</strong>, before making any changes to your database. Make sure to have a full database back-up, just in case!', 'ajax-search-pro'); ?>
</p>
<p>
<fieldset>
<legend><?php echo __('Copy this SQL code in your database editor tool to create them manually', 'ajax-search-pro'); ?></legend>
<textarea style="width:100%;height:480px;"><?php echo wd_asp()->db->create(); ?></textarea>
</fieldset>
</p>
</div>
</div>
<?php return; ?>
<?php endif; ?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/font-awesome/font-awesome.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/jquery-tagging/tag-basic-style.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/index-table/index_table.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/index-table/synonyms.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="float:left;">
<?php ob_start(); ?>
<div tabid="1">
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_title", __('Index titles?', 'ajax-search-pro'),
$it_options['it_index_title']
); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_content", __('Index content?', 'ajax-search-pro'),
$it_options['it_index_content']
); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_excerpt", __('Index excerpt?', 'ajax-search-pro'),
$it_options['it_index_excerpt']
); ?>
</div>
<div class="item">
<?php
$o = new wpdreamsCustomPostTypes("it_post_types", __('Post types to index', 'ajax-search-pro'),
array(
"value"=> $it_options['it_post_types'],
"args"=> array(
"include" => array("attachment")
)
));
?>
</div>
<fieldset id="it_media_service">
<legend>
<?php echo __('Media Service - External File indexing feature (optional)', 'ajax-search-pro'); ?>
<span class="asp_legend_docs">
<a target="_blank" href="#"><span class="fa fa-book"></span>What is this?</a>
<a target="_blank" href="https://documentation.ajaxsearchpro.com/index-table/media-parser-subscription-feature"><span class="fa fa-book"></span>Documentation</a>
</span>
</legend>
<div class="item">
<?php new wd_MSLicenseActivator('', '', array()); ?>
<p class="descMsg">
<?php echo __('The <strong>Media Service</strong> is an external feature to handle very accurate file content indexing.', 'ajax-search-pro'); ?>
<?php echo sprintf( __('For more details, check the <a href="%s" target="_blank">addon page</a>.<br>There is a <strong>FREE</strong> version available as well.', 'ajax-search-pro'),
'https://ajaxsearchpro.com/media-service-subscription-addon/?ref=asp_backend' ); ?>
<?php echo sprintf( __('The documentation on how to activate, can be found <a href="%s" target="_blank">here</a>.', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/index-table/media-parser-subscription-feature' ); ?>
</p>
</div>
<div class="item">
<?php $o = new wpdreamsCustomSelect("it_media_service_send_file", "Media Service File Access Method",
array(
'selects' => array(
array("option" => esc_attr__('Send the file to the server (recommended)', 'ajax-search-pro'), "value" => 1),
array("option" => esc_attr__('Send only the URL to download the file', 'ajax-search-pro'), "value" => 0),
),
'value' => $it_options['it_media_service_send_file']
)
); ?>
</div>
</fieldset>
<fieldset id="it_file_indexing">
<legend><?php echo __('File indexing options', 'ajax-search-pro'); ?></legend>
<div class="item">
<?php $o = new wd_MimeTypeSelect("it_attachment_mime_types", __('Media mime types to index', 'ajax-search-pro'),
$it_options['it_attachment_mime_types']
); ?>
<p class="descMsg">
<?php echo __('<strong>Comma separated list</strong> of allowed mime types.', 'ajax-search-pro'); ?>
<?php echo sprintf( __('List of <a href="%s" target="_blank">default allowed mime types</a> in WordPress.', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/general-settings/search-in-attachments/mime-types-table' ); ?>
</p>
</div>
<div class="item">
<div class="descMsg">
<?php echo __('Please note, that reading useful content from media files via PHP is a <strong>very difficult task</strong>.', 'ajax-search-pro'); ?>
<?php echo __('The plugin uses external libraries as well as internal methods to get the best results, however it is still possible that some information might not be extracted properly.', 'ajax-search-pro'); ?>
</div>
</div>
<div class="item item-flex-nogrow item-flex-wrap item-conditional" wd-show-on="multi_attachment_mime_types_5:pdf">
<?php $o = new wpdreamsYesNo("it_index_pdf_content", __('Index PDF file contents?', 'ajax-search-pro'),
$it_options['it_index_pdf_content']
);
$o = new wpdreamsCustomSelect("it_index_pdf_method", __('method', 'ajax-search-pro'),
array(
'selects' => array(
array("option" => "Auto", "value" => "auto"),
array("option" => "Smalot parser (requires php5.3+)", "value" => "smalot"),
array("option" => "PDF2Txt", "value" => "pdf2txt")
),
'value' => $it_options['it_index_pdf_method']
)
);
?>
<div class="descMsg item-flex-grow item-flex-100">
<?php echo __('When set to \'Auto\', the plugin will try both methods if possible.', 'ajax-search-pro'); ?>
</div>
</div>
<div class="item" wd-show-on="multi_attachment_mime_types_7:text">
<?php $o = new wpdreamsYesNo("it_index_text_content", __('Index Text file contents?', 'ajax-search-pro'),
$it_options['it_index_text_content']
); ?>
</div>
<div class="item" wd-show-on="multi_attachment_mime_types_7:richtext">
<?php $o = new wpdreamsYesNo("it_index_richtext_content", __('Index RichText file contents?', 'ajax-search-pro'),
$it_options['it_index_richtext_content']
); ?>
</div>
<?php if( !class_exists('ZipArchive') ): ?>
<div class="errorMsg">NOTICE: The <a href="https://www.google.com/search?q=enable%20ZipArchive%20php" target="_blank">ZipArchive</a> module is not enabled on your server. The Office document parsers will not work without it!</div>
<?php endif; ?>
<?php if( !class_exists('DOMDocument') ): ?>
<div class="errorMsg">NOTICE: The <a href="https://www.google.com/search?q=enable%20DOMDocument%20php" target="_blank">DOMDocument</a> module is not enabled on your server. The Office document parsers will not work without it!</div>
<?php endif; ?>
<div class="item" wd-show-on="multi_attachment_mime_types_7:mso_word">
<?php $o = new wpdreamsYesNo("it_index_msword_content", __('Index Office Word document contents?', 'ajax-search-pro'),
$it_options['it_index_msword_content']
); ?>
</div>
<div class="item" wd-show-on="multi_attachment_mime_types_7:mso_excel">
<?php $o = new wpdreamsYesNo("it_index_msexcel_content", __('Index Office Excel document contents?', 'ajax-search-pro'),
$it_options['it_index_msexcel_content']
); ?>
</div>
<div class="item" wd-show-on="multi_attachment_mime_types_7:mso_powerpoint">
<?php $o = new wpdreamsYesNo("it_index_msppt_content", __('Index Office PowerPoint document contents?', 'ajax-search-pro'),
$it_options['it_index_msppt_content']
); ?>
</div>
<div id="wdo" class="wdo">
<div id="asp-it-attachment-directories"></div>
</div>
<div class="wd-hint">
<?php echo __('<p>These options are hidden unless the <strong>attachment</strong> custom post type is selected above.</p>', 'ajax-search-pro'); ?>
</div>
</fieldset>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_tags", __('Index post tags?', 'ajax-search-pro'),
$it_options['it_index_tags']
); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_categories", __('Index post categories?', 'ajax-search-pro'),
$it_options['it_index_categories']
); ?>
</div>
<div class="item">
<?php
$o = new wpdreamsTaxonomySelect("it_index_taxonomies", __('Index taxonomies', 'ajax-search-pro'), array(
"value" => $it_options['it_index_taxonomies'],
"type" => "include"
));
?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_permalinks", __('Index permalinks?', 'ajax-search-pro'),
$it_options['it_index_permalinks']
); ?>
</div>
<div class="item"><?php
$o = new wpdreamsCustomFields("it_index_customfields", __('Index custom fields', 'ajax-search-pro'),
array(
"value" => $it_options['it_index_customfields'],
"show_pods" => true
)
); ?>
</div>
<div class="item">
<?php $o = new wpdreamsText("it_post_statuses", __('Post statuses to index', 'ajax-search-pro'),
$it_options['it_post_statuses']
); ?>
<p class="descMsg">
<?php echo __('Comma separated list. WP Defaults: publish, future, draft, pending, private, trash, auto-draft', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item it_engine_index">
<?php $o = new wpdreamsYesNo("it_post_password_protected", __('Index password protected posts?', 'ajax-search-pro'), $it_options['it_post_password_protected']); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_author_name", __('Index post author name?', 'ajax-search-pro'),
$it_options['it_index_author_name']
); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_author_bio", __('Index post author bio (description)?', 'ajax-search-pro'),
$it_options['it_index_author_bio']
); ?>
</div>
</div>
<div tabid="2">
<div class="item<?php echo is_multisite() ? '' : ' hiddend' ?>"><?php
$o = new wpdreamsBlogselect("it_blog_ids", __('Blogs to index posts from', 'ajax-search-pro'),
$it_options['it_blog_ids']
); ?>
</div>
<div class="item item-flex-nogrow item-flex-wrap" id="it_inflections">
<?php
$o = new wpdreamsYesNo("it_inflections", __('Enable automated singularization/pluralization?', 'ajax-search-pro'),
$it_options['it_inflections']
);
?>
<div wd-enable-on="it_inflections:1">
<?php
$o = new wpdreamsCustomSelect("it_language", __('Main language', 'ajax-search-pro'),
array(
'selects' => array(
array("option" => "English", "value" => Language::ENGLISH),
array("option" => "French", "value" => Language::FRENCH),
array("option" => "Norwegian", "value" => Language::NORWEGIAN_BOKMAL),
array("option" => "Portuguese", "value" => Language::PORTUGUESE),
array("option" => "Spanish", "value" => Language::SPANISH),
array("option" => "Turkish", "value" => Language::TURKISH),
),
'value' => $it_options['it_language']
)
);
?>
</div>
<p class="descMsg item-flex-grow item-flex-100">
<?php echo __('Automatically singularize/pluralize all keywords for better matches via an Inflections library. Warning: this will increase the index size GREATLY.', 'ajax-search-pro'); ?>
</p>
<?php if ( defined('ICL_LANGUAGE_CODE') || function_exists('pll_default_language') ): ?>
<p class="descMsg item-flex-grow item-flex-100">
<?php echo __('The post language is automatically detected when using Polylang or WPML.', 'ajax-search-pro'); ?>
</p>
<?php endif; ?>
</div>
<div class="item">
<?php $o = new wpdreamsTextSmall("it_limit", __('Post limit per iteration', 'ajax-search-pro'),
$it_options['it_limit']
); ?>
<p class="descMsg"><?php echo __('Posts to index per ajax call. Reduce this number if the process fails. Default: 25', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_use_stopwords", __('Enable stop-words?', 'ajax-search-pro'),
$it_options['it_use_stopwords']
); ?>
<p class="descMsg"><?php echo __('Words from the list below (common words, stop words) will be excluded if enabled.', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wd_TextareaExpandable("it_stopwords", __('Stop words list', 'ajax-search-pro'),
$it_options['it_stopwords']
); ?>
<p class="descMsg"><?php echo __('<strong>Comma</strong> separated list of stop words.', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wpdreamsTextSmall("it_min_word_length", __('Min. word length', 'ajax-search-pro'),
$it_options['it_min_word_length']
); ?>
<p class="descMsg"><?php echo __('Words below this length will be ignored. Default: 2', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_extract_iframes", __('Extract IFRAME contents?', 'ajax-search-pro'),
$it_options['it_extract_iframes']
); ?>
<p class="descMsg"><?php echo __('Will try parsing IFRAME sources and extracting them. This <strong>may not work</strong> in some cases.', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_extract_gutenberg_blocks", __('Execute Gutenberg Editor Blocks?', 'ajax-search-pro'),
$it_options['it_extract_gutenberg_blocks']
); ?>
<p class="descMsg"><?php echo __('Will execute and parse contents of Gutenberg Editor Blocks.', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_extract_shortcodes", __('Execute shortcodes?', 'ajax-search-pro'),
$it_options['it_extract_shortcodes']
); ?>
<p class="descMsg"><?php echo __('Will execute shortcodes in content as well. Great if you have lots of content generated by shortcodes.', 'ajax-search-pro'); ?></p>
</div>
<div class="item">
<?php $o = new wd_TextareaExpandable("it_exclude_shortcodes", __('Remove these shortcodes', 'ajax-search-pro'),
$it_options['it_exclude_shortcodes']
); ?>
<p class="descMsg">
<?php echo __('<strong>Comma</strong> separated list of shortcodes to remove. Use this to exclude shortcodes, which does not reflect your content appropriately.', 'ajax-search-pro'); ?>
</p>
</div>
</div>
<div tabid="4">
<fieldset>
<legend><?php echo __('Pool sizes', 'ajax-search-pro'); ?></legend>
<div class="errorMsg">
<?php echo __('The pool size greatly affects the search performance in bigger databases (50k+ keywords). While high pool values may give more accurate results, lower values cause much better performance.', 'ajax-search-pro'); ?>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_pool_size_auto", __('Let the plugin determine the pool size values?', 'ajax-search-pro'),
$it_options['it_pool_size_auto']
); ?>
<p class="descMsg">
<?php echo __('When enabled (default), the plugin will adjust these values depending on the index table size and other factors.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item it_pool_size">
<?php $o = new wpdreamsTextSmall("it_pool_size_one", __("Pool size for keywords of one character long (recommended:", 'ajax-search-pro') . "<strong>".$pool_sizes['one']."</strong>)",
$it_options['it_pool_size_one']
); ?>
<p class="descMsg">
<?php echo __('The maximum number in a sub-set of results pool for a search phrase (or part of the phrase) that is one character long.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item it_pool_size">
<?php $o = new wpdreamsTextSmall("it_pool_size_two", __("Pool size for keywords of two characters long (recommended:", 'ajax-search-pro') . " <strong>".$pool_sizes['two']."</strong>)",
$it_options['it_pool_size_two']
); ?>
<p class="descMsg">
<?php echo __('The maximum number in a sub-set of results pool for a search phrase (or part of the phrase) that is one character long.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item it_pool_size">
<?php $o = new wpdreamsTextSmall("it_pool_size_three", __("Pool size for keywords of three characters long (recommended:", 'ajax-search-pro') . " <strong>".$pool_sizes['three']."</strong>)",
$it_options['it_pool_size_three']
); ?>
<p class="descMsg">
<?php echo __('The maximum number in a sub-set of results pool for a search phrase (or part of the phrase) that is one character long.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item it_pool_size">
<?php $o = new wpdreamsTextSmall("it_pool_size_rest", __("Pool size for keywords of four and more characters long (recommended:", 'ajax-search-pro') . " <strong>".$pool_sizes['rest']."</strong>)",
$it_options['it_pool_size_rest']
); ?>
<p class="descMsg">
<?php echo __('The maximum number in a sub-set of results pool for a search phrase (or part of the phrase) that is one character long.', 'ajax-search-pro'); ?>
</p>
</div>
</fieldset>
</div>
<div tabid="3">
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_on_save", __("Index new posts upon creation?", 'ajax-search-pro'),
$it_options['it_index_on_save']
); ?>
<p class="descMsg">
<?php echo __('When turned OFF, the posts will still be indexed only upon updating, or when the cron-job runs (if enabled) or when the index table is extended manually.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_index_on_update_post_meta", __("Refresh the index, whenever post meta (custom fields) are added or updated?", 'ajax-search-pro'),
$it_options['it_index_on_update_post_meta']
); ?>
<p class="errorMsg">
<strong><?php echo __('CAUTION:', 'ajax-search-pro'); ?></strong>
<?php echo __('Under normal cases this option should not be used and may cause major slowdown when saving posts.', 'ajax-search-pro');
?>
</p>
<p class="descMsg">
<?php echo __('(Default: OFF) May help when posts are imported and if you notice missing results for metadata keywords.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<?php $o = new wpdreamsYesNo("it_cron_enable", __("Use wp_cron() to extend the index table automatically?", 'ajax-search-pro'),
$it_options['it_cron_enable']
); ?>
<p class="descMsg">
<?php echo __('Will register a cron job with wp_cron() and run it periodically.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<?php $o = new wpdreamsCustomSelect("it_cron_period", "Period",
array(
'selects' => array(
array("option" => esc_attr__('Every 2 minutes', 'ajax-search-pro'), "value" => "asp_cr_two_minutes"),
array("option" => esc_attr__('Every 3 minutes', 'ajax-search-pro'), "value" => "asp_cr_three_minutes"),
array("option" => esc_attr__('Every 5 minutes', 'ajax-search-pro'), "value" => "asp_cr_five_minutes"),
array("option" => esc_attr__('Every 15 minutes', 'ajax-search-pro'), "value" => "asp_cr_fifteen_minutes"),
array("option" => esc_attr__('Every 30 minutes', 'ajax-search-pro'), "value" => "asp_cr_thirty_minutes"),
array("option" => esc_attr__('Hourly', 'ajax-search-pro'), "value" => "hourly"),
array("option" => esc_attr__('Twice Daily', 'ajax-search-pro'), "value" => "twicedaily"),
array("option" => esc_attr__('Daily', 'ajax-search-pro'), "value" => "daily")
),
'value' => $it_options['it_cron_period']
)
); ?>
<p class="descMsg">
<?php echo __('The periodicity of execution. wp_cron() only accepts these values.', 'ajax-search-pro'); ?>
</p>
</div>
<div class="item">
<fieldset class="asp-last-execution-info">
<legend><?php echo __('Last execution info', 'ajax-search-pro'); ?></legend>
<ul style="float:right;text-align:left;width:50%;">
<li>
<b><?php echo __('Last exeuction time:', 'ajax-search-pro'); ?> </b><?php echo $asp_cron_data['last_run'] != "" ? date("H:i:s, F j. Y", $asp_cron_data['last_run']) : "No information."; ?>
</li>
<li>
<b><?php echo __('Current system time:', 'ajax-search-pro'); ?> </b><?php echo date("H:i:s, F j. Y", time()); ?></li>
<li>
<b><?php echo __('Posts indexed:', 'ajax-search-pro'); ?> </b><?php echo w_isset_def($asp_cron_data['result']['postsIndexedNow'], "No information."); ?>
</li>
<li><b><?php echo __('Keywords found:', 'ajax-search-pro'); ?> </b><?php echo w_isset_def($asp_cron_data['result']['keywordsFound'], "No information."); ?>
</li>
</ul>
</fieldset>
</div>
</div>
<div tabid="5">
<?php include(ASP_PATH . "backend/tabs/index_table/synonyms.php"); ?>
</div>
<?php $_r = ob_get_clean(); ?>
<?php
$updated = false;
if (isset($_POST) && isset($_POST['submit_asp_index_options']) && (wpdreamsType::getErrorNum() == 0)) {
$values = array(
'it_index_title' => $_POST['it_index_title'],
'it_index_content' => $_POST['it_index_content'],
'it_index_excerpt' => $_POST['it_index_excerpt'],
'it_post_types' => $_POST['it_post_types'],
'it_index_tags' => $_POST['it_index_tags'],
'it_index_categories' => $_POST['it_index_categories'],
'it_index_taxonomies' => $_POST['it_index_taxonomies'],
'it_attachment_mime_types' => $_POST['it_attachment_mime_types'],
'options' => array(
'attachment_exclude_directories' => $_POST['attachment_exclude_directories'],
'attachment_include_directories' => $_POST['attachment_include_directories'],
),
'it_index_pdf_content' => $_POST['it_index_pdf_content'],
'it_index_pdf_method' => $_POST['it_index_pdf_method'],
'it_index_text_content' => $_POST['it_index_text_content'],
'it_index_richtext_content' => $_POST['it_index_richtext_content'],
'it_index_msword_content' => $_POST['it_index_msword_content'],
'it_index_msexcel_content' => $_POST['it_index_msexcel_content'],
'it_index_msppt_content' => $_POST['it_index_msppt_content'],
'it_media_service_send_file' => $_POST['it_media_service_send_file'],
'it_index_customfields' => $_POST['it_index_customfields'],
'it_post_statuses' => $_POST['it_post_statuses'],
'it_post_password_protected' => $_POST['it_post_password_protected'],
'it_index_author_name' => $_POST['it_index_author_name'],
'it_index_author_bio' => $_POST['it_index_author_bio'],
'it_blog_ids' => $_POST['it_blog_ids'],
'it_inflections' => $_POST['it_inflections'],
'it_language' => $_POST['it_language'],
'it_limit' => $_POST['it_limit'],
'it_use_stopwords' => $_POST['it_use_stopwords'],
'it_stopwords' => $_POST['it_stopwords'],
'it_min_word_length' => $_POST['it_min_word_length'],
'it_extract_iframes' => $_POST['it_extract_iframes'],
'it_extract_gutenberg_blocks' => $_POST['it_extract_gutenberg_blocks'],
'it_extract_shortcodes' => $_POST['it_extract_shortcodes'],
'it_exclude_shortcodes' => $_POST['it_exclude_shortcodes'],
'it_index_on_save' => $_POST['it_index_on_save'],
'it_index_on_update_post_meta' => $_POST['it_index_on_update_post_meta'],
'it_cron_enable' => $_POST['it_cron_enable'],
'it_cron_period' => $_POST['it_cron_period'],
'it_pool_size_auto' => $_POST['it_pool_size_auto'],
'it_pool_size_one' => $_POST['it_pool_size_one'],
'it_pool_size_two' => $_POST['it_pool_size_two'],
'it_pool_size_three' => $_POST['it_pool_size_three'],
'it_pool_size_rest' => $_POST['it_pool_size_rest'],
'it_synonyms_as_keywords' => $_POST['it_synonyms_as_keywords']
);
update_option('asp_it_options', $values);
wp_clear_scheduled_hook('asp_cron_it_extend');
asp_parse_options();
$updated = true;
update_option("asp_recreate_index", 1);
}
?>
<div class='wpdreams-slider'>
<?php if ($updated): ?>
<div class='errorMsg asp-notice-ri'>
<?php echo __('The options have changed, don\'t forget to re-create the index table with the <b>Create new index</b> button!', 'ajax-search-pro'); ?>
</div>
<?php endif; ?>
<?php if (ASP_DEMO): ?>
<p class="infoMsg">DEMO MODE ENABLED - Please note, that these options are read-only on the demo</p>
<?php endif; ?>
<form name='asp_indextable_settings' id='asp_indextable_settings' class="asp_indextable_settings"
method='post'>
<fieldset>
<legend>
<?php echo __('Index Table Operations', 'ajax-search-pro'); ?>
</legend>
<div id="index_buttons" style="margin: 0 0 15px 0;">
<input type="button" name="asp_index_new" id="asp_index_new" class="submit wd_button_green"
index_action='new' index_msg='<?php echo esc_attr__('Do you want to generate a new index table?', 'ajax-search-pro'); ?>'
value="<?php echo esc_attr__('Create new index', 'ajax-search-pro'); ?>">
<input type="button" name="asp_index_extend" id="asp_index_extend"
class="submit wd_button_blue"
index_action='extend' index_msg='<?php echo esc_attr__('Do you want to extend the index table?', 'ajax-search-pro'); ?>'
value="<?php echo esc_attr__('Continue existing index', 'ajax-search-pro'); ?>">
<input type="button" name="asp_index_delete" id="asp_index_delete" class="submit"
index_action='delete' index_msg='<?php echo esc_attr__('Do you really want to empty the index table?', 'ajax-search-pro'); ?>'
value="<?php echo esc_attr__('Delete the index', 'ajax-search-pro'); ?>">
<span id="it_timer"></span>
</div>
<div class="wd_progress_text hiddend"><?php echo __('Initializing, please wait. This might take a while.', 'ajax-search-pro'); ?></div>
<div class="wd_progress wd_progress_75 hiddend"><span style="width:0%;"></span></div>
<span class="wd_progress_stop hiddend"><?php echo __('Stop', 'ajax-search-pro'); ?></span>
<div id='asp_i_success' class="infoMsg hiddend"><?php echo __('100% - Index table successfully generated!', 'ajax-search-pro'); ?></div>
<div id='asp_i_error' class="errorMsg hiddend"><?php echo __('Something went wrong :(', 'ajax-search-pro'); ?></div>
<textarea id="asp_i_error_cont" class="hiddend"></textarea>
<p class="descMsg">
<?php echo sprintf( __('To read more about the index table, please read the <a href="%s">documentation chapter about Index table</a> usage.', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/index-table' ); ?>
</p>
<?php if (is_multisite()): ?>
<p class="descMsg" style="color:#666; ">
<?php echo __('Total keywords:', 'ajax-search-pro'); ?> <b
id="keywords_counter">0</b>
</p>
<?php else: ?>
<div class="descMsg index_stats_container" style="color:#666; ">
<div class="index_stats hiddend">
<?php echo __('<b>Stats</b> (reloads periodically)', 'ajax-search-pro'); ?> |
<?php echo __('Items Indexed:', 'ajax-search-pro'); ?> <b id="indexed_counter">0</b>
&nbsp;|&nbsp;<?php echo __('Items not indexed:', 'ajax-search-pro'); ?> <b
id="not_indexed_counter">0</b>
&nbsp;|&nbsp;<?php echo __('Total keywords:', 'ajax-search-pro'); ?> <b
id="keywords_counter">0</b>
</div>
<div class="index_stats_loader hiddend"><?php echo __('Loading stats', 'ajax-search-pro'); ?>&nbsp;&nbsp;<span class="loading-small"></span></div>
</div>
<p id='index_db_other_data' style="display:none !important;"></p>
<?php endif; ?>
<div id="asp_i_dontclose" class="hiddend">Please do not close this browser tab until the indexing is finished!</div>
</fieldset>
<fieldset id='asp_indextable_options'>
<div id="asp_it_disable" class="hiddend"></div>
<legend>
<?php echo __('Index Table options', 'ajax-search-pro'); ?>
</legend>
<?php if ($updated): ?>
<div class='infoMsg'><?php echo __('Index table options successfuly updated!', 'ajax-search-pro'); ?></div><?php endif; ?>
<ul id="tabs" class='tabs'>
<li><a tabid="1" class='current general'><?php echo __('General', 'ajax-search-pro'); ?></a></li>
<li><a tabid="2" class='advanced'><?php echo __('Advanced', 'ajax-search-pro'); ?></a></li>
<li><a tabid="5" class='advanced'><?php echo __('Synonyms', 'ajax-search-pro'); ?></a></li>
<li><a tabid="3" class='advanced'><?php echo __('Indexing & Cron', 'ajax-search-pro'); ?></a></li>
<li><a tabid="4" class='advanced'><?php echo __('Performance & Accuracy', 'ajax-search-pro'); ?></a></li>
</ul>
<div class='tabscontent'>
<?php print $_r; ?>
</div>
<input type="hidden" id="asp_it_request_nonce" value="<?php echo wp_create_nonce( 'asp_it_request_nonce' ); ?>">
<input type='hidden' name='asp_index_table_page' value='1'/>
<div class="item">
<input name="submit_asp_index_options" type="submit" value="<?php echo esc_attr__('Save options', 'ajax-search-pro'); ?>"/>
</div>
</fieldset>
</form>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>
<div class="hiddend">
<div id="it_first_modal">
<p><?php echo __("The index table had been created, so don't forget to enable it on the search instances, where you need it.", 'ajax-search-pro'); ?></p>
<p>
<?php echo __("If you don't know how to do that, these documentations will help (links open in new tab):", 'ajax-search-pro'); ?>
<ul>
<li><?php echo __("Enabling for", 'ajax-search-pro'); ?>&nbsp;
<a href="https://documentation.ajaxsearchpro.com/index-table/enabling-index-table-engine" target="_blank">
<?php echo __("Custom Post Types", 'ajax-search-pro'); ?>
</a>
</li>
<li><?php echo __("Enabling for", 'ajax-search-pro'); ?>&nbsp;
<a href="https://documentation.ajaxsearchpro.com/general-settings/search-in-attachment-contents-pdf-word-excel-etc..#step-2-search-instance-configuration" target="_blank">
<?php echo __("Attachments", 'ajax-search-pro'); ?>
</a>
</li>
</ul>
</p>
</div>
<div id="it_media_service_modal">
<p><?php echo __("It looks like you are planning on indexing media file contents.", 'ajax-search-pro'); ?></p>
<p><?php echo __("There is a <strong>Media Service</strong> feature to handle more accurate file indexing, and there is a <strong>FREE</strong> version available as well! (no credit card required!)", 'ajax-search-pro'); ?></p>
<p><?php echo __("Click", 'ajax-search-pro'); ?>&nbsp;
<a href="https://ajaxsearchpro.com/media-service-subscription-addon/?ref=asp_backend_popup" id="asp_media_service_link" target="_blank"><?php echo __("this link", 'ajax-search-pro'); ?></a>&nbsp;<?php echo __("or the blue button below to find out more.", 'ajax-search-pro'); ?>&nbsp;</p>
</p>
</div>
</div>
<?php
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
wp_enqueue_script('jquery');
wp_enqueue_script('asp-backend-synonyms', plugin_dir_url(__FILE__) . 'settings/assets/index-table/synonyms.js', array(
'jquery'
), $media_query, true);
wp_localize_script('asp-backend-synonyms', 'ASP_SYN_MSG', array(
"gen_ms1" => __('Success:', 'ajax-search-pro'),
"gen_ms2" => __('items were imported!', 'ajax-search-pro'),
"gen_er1" => __('Something went wrong, please try again later.', 'ajax-search-pro'),
"gen_er2" => __('There are no synonyms in the database to export.', 'ajax-search-pro'),
"gen_er3" => __('The file is empty or invalid. Please make sure to upload and choose the correct one.', 'ajax-search-pro'),
"gen_er4" => __('Nothing was imported. The items in this file are already in the database.', 'ajax-search-pro'),
"edt_er1" => __('Something went wrong, please check your connection, and try again.', 'ajax-search-pro'),
"edt_er2" => __('This keyword already exists in the database! (use the search above if you look to edit it)', 'ajax-search-pro'),
"edt_er3" => __('The keyword was not deleted, please try refreshing this page!', 'ajax-search-pro'),
"edt_er4" => __('The keyword field is empty, please enter a keyword!', 'ajax-search-pro'),
"edt_er5" => __('The synonyms field is missing, please enter some synonyms!', 'ajax-search-pro'),
"res_ms1" => __('Are you sure you want to delete this keyword?', 'ajax-search-pro'),
"del_all" => __('Are you sure you want to delete all of the synonyms?', 'ajax-search-pro'),
"mod_ms1" => __('Export Synonyms', 'ajax-search-pro'),
"mod_ms2" => __('Import Synonyms', 'ajax-search-pro'),
"mod_ms3" => __('Close', 'ajax-search-pro')
));
wp_enqueue_script('asp-backend-index-table', plugin_dir_url(__FILE__) . 'settings/assets/index_table.js', array(
'jquery', 'wpdreams-tabs'
), $media_query, true);
Script::objectToInlineScript('asp-backend-index-table', 'ASP_IT', array(
"current_blog_id" => array(get_current_blog_id()),
"first_index" => $index_obj->isEmpty() && !isset($_COOKIE['_asp_first_index']) ? 1 : 0
));
wp_localize_script('asp-backend-index-table', 'ASP_IT_MSG', array(
"mod_ms1" => __('Okay!', 'ajax-search-pro'),
"mod_ms2" => __('Yes, take me there!', 'ajax-search-pro'),
"mod_ms3" => __('Maybe later', 'ajax-search-pro'),
"mod_h1" => __('Congratulations, but wait!', 'ajax-search-pro'),
"mod_h2" => __('Did you know?', 'ajax-search-pro'),
"msg_pro" => __('Progress:', 'ajax-search-pro'),
"msg_kwf" => __('Keywords found so far:', 'ajax-search-pro'),
"msg_blo" => __('Processing blog no.', 'ajax-search-pro'),
"msg_skw" => __('Success. <strong>%s</strong> new keywords were added to the database.', 'ajax-search-pro'),
"msg_emp" => __('Success. The index table was emptied.', 'ajax-search-pro'),
"msg_er1" => __('Something went wrong. Here is the error message returned:', 'ajax-search-pro'),
"msg_er2" => __('Timeout error. Try lowering the <strong>Post limit per iteration</strong> option below.', 'ajax-search-pro'),
"msg_sta" => __('Status:', 'ajax-search-pro'),
"msg_cod" => __('Code:', 'ajax-search-pro'),
"msg_ini" => __('Initializing, please wait.', 'ajax-search-pro')
));
wp_enqueue_script('asp-backend-jquery-tag', plugin_dir_url(__FILE__) . 'settings/assets/jquery-tagging/tagging.min.js', array(
'jquery'
), $media_query, true);
$metadata = require_once ASP_PATH . 'build/js/index-table.asset.php';
wp_enqueue_script(
'wpd-asp-index-table',
ASP_URL_NP . 'build/js/index-table.js',
$metadata['dependencies'],
$metadata['version'],
array( 'in_footer' =>true ),
);

View File

@@ -0,0 +1,363 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Utils\FileManager;
defined('ABSPATH') or die("You can't access this file directly.");
if (isset($_GET) && isset($_GET['asp_sid'])) {
include('search.php');
return;
}
$metadata = require_once ASP_PATH . 'build/js/timed-modal.asset.php';
wp_enqueue_script(
'wpd-timed-modal',
ASP_URL_NP . 'build/js/timed-modal.js',
$metadata['dependencies'],
$metadata['version'],
array('in_footer'=>true)
);
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' style="display: flex; justify-content: start; align-items: flex-start; gap: 0;"
class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<div style="margin: 0;">
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if (defined('ASL_PATH')): ?>
<p class="errorMsg">
<?php echo __('Warning: Please deactivate the Ajax Search Lite to assure every PRO feature works properly.', 'ajax-search-pro'); ?>
</p>
<?php endif; ?>
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<?php if ( !wd_asp()->db->exists('main', true) ): ?>
<div id='wpdreams' class='asp-be wpdreams wrap'>
<div class="wpdreams-box">
<p class="errorMsg">
<?php echo __('One or more plugin tables are appear to be missing from the database.', 'ajax-search-pro'); ?>
<?php echo sprintf( __('Please check <a href="%s" target="_blank">this article</a> to resolve the issue.', 'ajax-search-pro'),
'https://wp-dreams.com/go/?to=kb-asp-missing-tables' ); ?>
</p>
<p class="errorMsg">
<?php echo __('Please be <strong>very careful</strong>, before making any changes to your database. Make sure to have a full database back-up, just in case!', 'ajax-search-pro'); ?>
</p>
<p>
<fieldset>
<legend><?php echo __('Copy this SQL code in your database editor tool to create them manually', 'ajax-search-pro'); ?></legend>
<textarea style="width:100%;height:480px;"><?php echo wd_asp()->db->create(); ?></textarea>
</fieldset>
</p>
</div>
</div>
<?php else: ?>
<div class="wpdreams-box" style="overflow: visible; float: left; position: relative;width: 920px;">
<form name="add-slider" action="" method="POST">
<fieldset>
<legend><?php echo __('Create a new search instance', 'ajax-search-pro'); ?></legend>
<?php
$new_slider = new wpdreamsText("addsearch", __('Search form name:', 'ajax-search-pro'), "", array(array("func" => "wd_isEmpty", "op" => "eq", "val" => false)), "Please enter a valid form name!");
?>
<input name="submit" type="submit" value="<?php esc_attr_e("Add", 'ajax-search-pro' ); ?>"/>
<?php if ( \WPDRMS\ASP\Utils\Plugin::hadLiteVersionInstalledBefore() ): ?>
<input name="import" type="submit" value="<?php echo __('Import from Ajax Search Lite', 'ajax-search-pro'); ?>">
<div class='descMsg' style="text-align: initial; margin-top: 8px;">
<?php echo sprintf(
__("Check <a target='_blank' href='%s'>this documentation</a> for more information about importing your settings from Ajax Search Lite.", 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/getting-started/importing-from-the-lite-version',
); ?>
</div>
<?php endif; ?>
<input type="hidden"
name="asp_new_nonce"
id="asp_new_nonce"
value="<?php echo wp_create_nonce( "asp_new_nonce" ); ?>">
<?php
if (isset($_POST['addsearch']) && !$new_slider->getError()) {
if ( !wp_verify_nonce($_POST['asp_new_nonce'], 'asp_new_nonce') ) {
echo "<div class='errorMsg'>" . __('Failure. Nonce invalid, please reload the page and try again.', 'ajax-search-pro') . "</div>";
} else {
if (isset($_POST['import'])) {
$id = wd_asp()->instances->importFromLite($_POST['addsearch'], get_current_user_id());
} else {
$id = wd_asp()->instances->add($_POST['addsearch'], get_current_user_id());
}
if ($id !== false) {
wd_asp()->css_manager->generator->generate();
echo "<div class='successMsg'>" . __('Search Form Successfuly added!', 'ajax-search-pro') . "</div>";
} else {
echo "<div class='errorMsg'>" . __('The search form was not created. Please contact support.', 'ajax-search-pro') . "</div>";
}
}
}
if (
isset($_POST['instance_new_name'], $_POST['instance_id'], $_POST['asp_name_nonce' . '_' . $_POST['instance_id']])
) {
if ( !wp_verify_nonce($_POST['asp_name_nonce' . '_' . $_POST['instance_id']], 'asp_name_nonce_' . $_POST['instance_id']) ) {
echo "<div class='errorMsg'>" . __('Failure. Nonce invalid, please reload the page and try again.', 'ajax-search-pro') . "</div>";
} else {
if ($_POST['instance_new_name'] != ''
&& strlen($_POST['instance_new_name']) > 0
) {
if ( wd_asp()->instances->rename($_POST['instance_new_name'], $_POST['instance_id']) !== false )
echo "<div class='infoMsg'>" . __('Form name changed!', 'ajax-search-pro') . "</div>";
else
echo "<div class='errorMsg'>" . __('Failure. Search could not be renamed.', 'ajax-search-pro') . "</div>";
} else {
echo "<div class='errorMsg'>" . __('Failure. Form name must be at least 1 character long', 'ajax-search-pro') . "</div>";
}
}
}
if ( isset($_POST['instance_copy_id']) ) {
if ($_POST['instance_copy_id'] != '') {
if ( wd_asp()->instances->duplicate($_POST['instance_copy_id']) !== false ) {
wd_asp()->css_manager->generator->generate();
echo "<div class='infoMsg'>" . __('Form duplicated!', 'ajax-search-pro') . "</div>";
} else {
echo "<div class='errorMsg'>" . __('Failure. Search form could not be duplicated.', 'ajax-search-pro') . "</div>";
}
} else {
echo "<div class='errorMsg'>" . __('Failure :(', 'ajax-search-pro') . "</div>";
}
}
?>
</fieldset>
</form>
<?php
if (
isset($_POST['delete'], $_POST['asp_del_nonce_' . $_POST['delete']]) &&
wp_verify_nonce($_POST['asp_del_nonce_' . $_POST['delete']], 'asp_del_nonce_' . $_POST['delete'] )
) {
$_POST['delete'] = $_POST['delete'] + 0;
wd_asp()->instances->delete( $_POST['delete'] );
FileManager::instance()->delFile( wd_asp()->cache_path . "search" . $_POST['delete'] . ".css");
wd_asp()->css_manager->generator->generate();
}
if ( isset($_POST['asp_st_override']) ) {
update_option("asp_st_override", $_POST['asp_st_override']);
}
if ( isset($_POST['asp_woo_override']) ) {
update_option("asp_woo_override", $_POST['asp_woo_override']);
}
if (
isset($_POST['instance_owner'], $_POST['instance_id'], $_POST['asp_owner_nonce' . '_' . $_POST['instance_id']]) &&
wp_verify_nonce($_POST['asp_owner_nonce_' . $_POST['instance_id']], 'asp_owner_nonce_' . $_POST['instance_id']) &&
is_super_admin() && is_multisite()
) {
wd_asp()->instances->update($_POST['instance_id'], array(), $_POST['instance_owner']);
}
if ( is_multisite() ) {
$searchforms = wd_asp()->instances->get(-1, false, true);
} else {
$searchforms = wd_asp()->instances->getWithoutData();
}
?>
<?php if ( !empty($searchforms) ): ?>
<?php
$asp_st_override = get_option("asp_st_override", -1);
$asp_woo_override = get_option("asp_woo_override", -1);
?>
<br>
<form name="sel-asp_st_override" action="" method="POST">
<fieldset>
<legend><?php echo __('Theme search bar replace', 'ajax-search-pro'); ?></legend>
<label><?php echo __('Replace the default theme search with:', 'ajax-search-pro'); ?> </label>
<select name="asp_st_override" style="max-width:90px;">
<option value="-1"><?php echo __('None', 'ajax-search-pro'); ?></option>
<?php foreach ($searchforms as $_searchform): ?>
<option value="<?php echo $_searchform["id"]; ?>"
<?php echo $asp_st_override == $_searchform["id"] ? " selected='selected'" : ""; ?>>
<?php echo esc_html( $_searchform["name"] ); ?>
</option>
<?php endforeach; ?>
</select>
<?php if (class_exists("WooCommerce")): ?>
<?php echo __('and the <strong>WooCommerce</strong> search with:', 'ajax-search-pro'); ?>
<select name="asp_woo_override" style="max-width:90px;">
<option value="-1"><?php echo __('None', 'ajax-search-pro'); ?></option>
<?php foreach ($searchforms as $_searchform): ?>
<option value="<?php echo $_searchform["id"]; ?>"
<?php echo $asp_woo_override == $_searchform["id"] ? " selected='selected'" : ""; ?>>
<?php echo esc_html($_searchform["name"] ); ?>
</option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<span style='
font-family: dashicons;
content: "\f348";
width: 24px;
height: 24px;
line-height: 24px;
font-size: 24px;
display: inline-block;
/* position: static; */
vertical-align: middle;
color: #167DB9;' class="dashicons dashicons-info">
<a href="#" style="display:block; width:24px; height: 24px; margin-top: -24px;"
class="tooltip-bottom" data-tooltip="<?php esc_attr_e('This might not work with all themes. If the default theme search bar is still visible after selection, then the only way is to replace the search within the theme code.', 'ajax-search-pro'); ?>"></a>
</span>
<input name="submit" type="submit" value="<?php esc_attr_e("Save", 'ajax-search-pro' ); ?>"/>
</fieldset>
</form>
<?php endif; ?>
</div>
<div class="clear"></div>
<?php
$i = 0;
if (is_array($searchforms)) {
$extra_classes = '';
if (is_multisite() && is_super_admin()) {
$the_users = get_users(array(
'role' => 'administrator'
));
$extra_classes = 'wpdreams-box-wide';
}
foreach ($searchforms as $search) {
$i++;
// Needed for the tabindex for the CSS :focus to work with div
?>
<div class="wpdreams-box <?php echo $extra_classes; ?>" tabindex="<?php echo $i; ?>" style="width: 920px;">
<div class="asp_search_list_item">
<a href='<?php echo get_admin_url() . "admin.php?page=asp_main_settings"; ?>&asp_sid=<?php echo $search['id']; ?>'><svg width="24" height="24" version="1.1" id="gear_icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 458.317 458.317" style="enable-background:new 0 0 458.317 458.317;" xml:space="preserve">
<g>
<path d="M446.185,179.159h-64.768c-2.536-7.702-5.636-15.15-9.26-22.29l45.818-45.818c4.737-4.737,4.737-12.416,0-17.152
L364.416,40.34c-4.737-4.737-12.416-4.737-17.152,0l-45.818,45.818c-7.14-3.624-14.587-6.724-22.289-9.26V12.131
c0.001-6.699-5.429-12.129-12.128-12.129h-75.743c-6.698,0-12.129,5.43-12.129,12.128v64.768
c-7.702,2.535-15.149,5.636-22.29,9.26L111.05,40.341c-4.737-4.737-12.416-4.737-17.152,0L40.339,93.9
c-4.737,4.736-4.737,12.416,0,17.152l45.817,45.817c-3.624,7.14-6.725,14.588-9.26,22.29H12.129C5.43,179.159,0,184.59,0,191.288
v75.743c0,6.698,5.43,12.128,12.129,12.128h64.768c2.536,7.702,5.636,15.149,9.26,22.29L40.34,347.266
c-4.737,4.736-4.737,12.416,0,17.152l53.559,53.559c4.737,4.736,12.416,4.736,17.152,0l45.817-45.817
c7.14,3.624,14.587,6.725,22.29,9.26v64.768c0,6.698,5.43,12.128,12.129,12.128h75.743c6.698,0,12.129-5.43,12.129-12.128v-64.768
c7.702-2.535,15.149-5.636,22.289-9.26l45.818,45.817c4.737,4.736,12.416,4.736,17.152,0l53.559-53.559
c4.737-4.737,4.737-12.416,0-17.152l-45.817-45.817c3.624-7.14,6.724-14.587,9.26-22.289h64.768
c6.698,0,12.129-5.43,12.129-12.128v-75.743C458.314,184.59,452.884,179.159,446.185,179.159z M229.157,289.542
c-33.349,0-60.384-27.035-60.384-60.384s27.035-60.384,60.384-60.384s60.384,27.035,60.384,60.384
S262.506,289.542,229.157,289.542z"/>
</g>
</svg></a>&nbsp;&nbsp;
<a href="#" class="asp_search_delete"><svg width="24" height="24" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<polygon style="fill:#E21B1B;" points="404.176,0 256,148.176 107.824,0 0,107.824 148.176,256 0,404.176 107.824,512 256,363.824
404.176,512 512,404.176 363.824,256 512,107.824 "/>
</svg></a>
<form action="" style="display:none;" method="POST">
<input type="hidden" name="delete" value=<?php echo $search['id']; ?>>
<input type="hidden"
name="asp_del_nonce<?php echo '_'.$search['id']; ?>"
id="asp_del_nonce<?php echo '_'.$search['id']; ?>"
value="<?php echo wp_create_nonce( "asp_del_nonce" . '_' . $search['id'] ); ?>">
</form>
<span class="wpd_instance_name"><?php
echo esc_html( $search['name'] );
?>
</span>
<form style="display: inline" name="instance_new_name_form" class="instance_new_name_form"
method="post">
<input type="text" class="instance_new_name" name="instance_new_name"
value="<?php echo esc_attr( $search['name'] ); ?>">
<input type="hidden" name="instance_id" value="<?php echo $search['id']; ?>"/>
<img title="<?php esc_attr_e('Click here to rename this form!', 'ajax-search-pro'); ?>"
src="<?php echo plugins_url('/settings/assets/icons/edit24x24.png', __FILE__) ?>"
class="wpd_instance_edit_icon"/>
<input type="hidden"
name="asp_name_nonce<?php echo '_'.$search['id']; ?>"
id="asp_name_nonce<?php echo '_'.$search['id']; ?>"
value="<?php echo wp_create_nonce( "asp_name_nonce" . '_' . $search['id'] ); ?>">
</form>
<form style="display: inline" name="instance_copy_form" class="instance_copy_form"
method="post">
<input type="hidden" name="instance_copy_id" value="<?php echo $search['id']; ?>"/>
<img title="<?php esc_attr_e('Click here to duplicate this form!', 'ajax-search-pro'); ?>"
src="<?php echo plugins_url('/settings/assets/icons/duplicate18x18.png', __FILE__) ?>"
class="wpd_instance_edit_icon"/>
</form>
<span style='margin-left: auto;min-width:540px;text-align:right;'>
<?php if (is_multisite() && is_super_admin()): ?>
<form style="display: inline" name="instance_owner_form" class="instance_owner_form"
method="post">
<label>Owner
<select name="instance_owner">
<option value="0"<?php echo $search['data']['owner'] == 0 ? ' selected="selected"' : ''; ?>>Anyone (admins only)</option>
<?php foreach ($the_users as $auser): ?>
<option
<?php echo $search['data']['owner'] == $auser->ID ? ' selected="selected"' : ''; ?>
value="<?php echo $auser->ID; ?>"><?php echo $auser->user_login; ?></option>
<?php endforeach; ?>
</select>
</label>
<input type="hidden" name="instance_id" value="<?php echo $search['id']; ?>"/>
<input type="hidden"
name="asp_owner_nonce<?php echo '_'.$search['id']; ?>"
id="asp_owner_nonce<?php echo '_'.$search['id']; ?>"
value="<?php echo wp_create_nonce( "asp_owner_nonce" . '_' . $search['id'] ); ?>">
<img title="<?php esc_attr_e('Click here to change the owner of this form!', 'ajax-search-pro'); ?>"
src="<?php echo plugins_url('/settings/assets/icons/edit24x24.png', __FILE__) ?>"
class="wpd_owner_edit_icon"/>
</form>
<?php endif; ?>
<label class="shortcode"><?php __('Quick shortcode:', 'ajax-search-pro'); ?></label>
<input type="text" class="quick_shortcode" value="[wd_asp id=<?php echo $search['id']; ?>]"
readonly="readonly"/>
</span>
</div>
<div class="clear"></div>
</div>
<?php
}
}
?>
<?php endif; ?>
<script>
jQuery(function ($) {
$('input.instance_new_name').on('focus', function () {
$(this).parent().prev().css('display', 'none');
}).blur(function () {
$(this).parent().prev().css('display', '');
});
$('.instance_new_name_form').on('submit', function () {
if (!confirm('<?php echo __('Do you want to change the name of this form?', 'ajax-search-pro'); ?>'))
return false;
});
$('.instance_owner_form').on('submit', function () {
if (!confirm('<?php echo __('Do you want to change the owner of this form?', 'ajax-search-pro'); ?>'))
return false;
});
$('.instance_copy_form').on('submit', function () {
if ( !confirm('<?php echo __('Do you want to duplicate this form?', 'ajax-search-pro'); ?>') )
return false;
});
$('.instance_new_name_form .wpd_instance_edit_icon').on('click', function () {
$(this).parent().submit();
});
$('.instance_copy_form .wpd_instance_edit_icon').on('click', function () {
$(this).parent().submit();
});
$('.instance_owner_form .wpd_owner_edit_icon').on('click', function () {
$(this).parent().submit();
});
});
</script>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
</div>

View File

@@ -0,0 +1,123 @@
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");
if (ASP_DEMO) $_POST = null;
?>
<style>
#wpdreams .asp_maintenance ul {
list-style-type: disc;
margin-bottom: 10px;
}
#wpdreams .asp_maintenance ul li {
list-style-type: disc;
margin-left: 30px;
margin-top: 10px;
}
</style>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box asp_maintenance" style="float: left;">
<?php if (ASP_DEMO): ?>
<p class="infoMsg"><strong>DEMO MODE ENABLED</strong> - Please note, that these options are read-only!</p>
<?php endif; ?>
<div id='asp_i_success' class="infoMsg<?php echo isset($_POST['asp_mnt_msg']) ? '' : ' hiddend'; ?>">
<?php echo isset($_POST['asp_mnt_msg']) ? esc_html(strip_tags($_POST['asp_mnt_msg'])) : ''; ?>
</div>
<div id='asp_i_error' class="errorMsg hiddend"></div>
<textarea id="asp_i_error_cont" class="hiddend"></textarea>
<form name="asp_index_defrag_form" id="asp_index_defrag_form" action="maintenance.php" method="POST">
<fieldset>
<legend><?php echo __('Index Table - Optimize and Defragment', 'ajax-search-pro'); ?></legend>
<p>
<?php echo __('This option will trigger a table defragmentation and optimization command. Usually it takes 1-2 minutes, and may slow down your site a bit for that time.', 'ajax-search-pro'); ?>
</p>
<div style="text-align: center;">
<?php if (ASP_DEMO): ?>
<input type="button" name="asp_index_defrag" id="asp_index_defrag" class="submit wd_button_blue" value="<?php echo esc_attr__('Optimize and Defragment the index table', 'ajax-search-pro'); ?>" disabled>
<?php else: ?>
<input type="hidden" name="asp_index_defrag_nonce" id="asp_index_defrag_nonce" value="<?php echo wp_create_nonce( "asp_index_defrag_nonce" ); ?>">
<input type="button" name="asp_index_defrag" id="asp_index_defrag" class="submit wd_button_blue" value="<?php echo esc_attr__('Optimize and Defragment the index table', 'ajax-search-pro'); ?>">
<span class="loading-small hiddend"></span>
<?php endif; ?>
</div>
</fieldset>
</form>
<form name="asp_reset_form" id="asp_reset_form" action="maintenance.php" method="POST">
<fieldset>
<legend><?php echo __('Maintencance - Reset', 'ajax-search-pro'); ?></legend>
<p>
<?php echo __('This option will reset all the plugin options to the defaults. Use this option if you want to keep using the plugin, but you need to reset the default options.', 'ajax-search-pro'); ?>
<ul>
<li><?php echo __('All plugin options <strong>will</strong> reset to defaults (caching, compatibility, index table and statistics options)', 'ajax-search-pro'); ?></li>
<li><?php echo __('The search instance options <strong>will not</strong> be changed', 'ajax-search-pro'); ?></li>
<li><?php echo __('The database tables, contents and the files <strong>will not</strong> be deleted either.', 'ajax-search-pro'); ?></li>
</ul>
</p>
<div style="text-align: center;">
<?php if (ASP_DEMO): ?>
<input type="button" name="asp_reset" id="asp_reset" class="submit wd_button_green" value="<?php echo esc_attr__('Reset all options to defaults', 'ajax-search-pro'); ?>" disabled>
<?php else: ?>
<input type="hidden" name="asp_reset_nonce" id="asp_reset_nonce" value="<?php echo wp_create_nonce( "asp_reset_nonce" ); ?>">
<input type="button" name="asp_reset" id="asp_reset" class="submit wd_button_green" value="<?php echo esc_attr__('Reset all options to defaults', 'ajax-search-pro'); ?>">
<span class="loading-small hiddend"></span>
<?php endif; ?>
</div>
</fieldset>
</form>
<form name="asp_wipe_form" id="asp_wipe_form" action="maintenance.php" method="POST">
<fieldset>
<legend><?php echo __('Maintencance - Wipe & Deactivate', 'ajax-search-pro'); ?></legend>
<p><?php echo __('This option will wipe everything related to Ajax Search Pro, as if it was never installed. Use this if you don\'t want to use the plugin anymore, or if you want to perform a clean installation.', 'ajax-search-pro'); ?>
<ul>
<li><?php echo __('All plugin options <strong>will be deleted</strong>', 'ajax-search-pro'); ?></li>
<li><?php echo __('The search instances <strong>will be deleted</strong>', 'ajax-search-pro'); ?></li>
<li><?php echo __('The database tables and the files <strong>will be deleted</strong>', 'ajax-search-pro'); ?></li>
<li><?php echo __('The plugin <strong>will deactivate</strong> and redirect to the plugin manager screen after, where you can delete it or re-install it again.', 'ajax-search-pro'); ?></li>
</ul>
</p>
<div style="text-align: center;">
<?php if (ASP_DEMO): ?>
<input type="button" name="asp_wipe" id="asp_wipe" class="submit" value="<?php echo esc_attr__('Wipe all plugin data & deactivate Ajax Search Pro', 'ajax-search-pro'); ?>" disabled>
<?php else: ?>
<input type="hidden" name="asp_wipe_nonce" id="asp_wipe_nonce" value="<?php echo wp_create_nonce( "asp_wipe_nonce" ); ?>">
<input type="button" name="asp_wipe" id="asp_wipe" class="submit" value="<?php echo esc_attr__('Wipe all plugin data & deactivate Ajax Search Pro', 'ajax-search-pro'); ?>">
<span class="loading-small hiddend"></span>
<?php endif; ?>
</div>
</fieldset>
</form>
<form name="asp_empty_redirect"id="asp_empty_redirect" method="post" style="display: none;">
<input type="hidden" name="asp_mnt_msg" value="">
</form>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>
<?php
if (!ASP_DEMO) {
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
wp_enqueue_script('asp-backend-maintenance', plugin_dir_url(__FILE__) . 'settings/assets/maintenance.js', array(
'jquery'
), $media_query, true);
wp_localize_script('asp-backend-maintenance', 'ASP_MNT', array(
"admin_url" => admin_url(),
"msg_res" => __('Are you sure you want to reset Ajax Search Pro to it\'s default state? All search instances will be deleted!', 'ajax-search-pro'),
"msg_rem" => __('Are you sure you want to completely remove Ajax Search Pro? (including instances, database content etc..)', 'ajax-search-pro'),
"msg_suc" => __('<strong>SUCCESS! </strong>Refreshing this page, please wait..', 'ajax-search-pro'),
"msg_ssc" => __('SUCCESS:', 'ajax-search-pro'),
"msg_fal" => __('FAILURE:', 'ajax-search-pro'),
"msg_err" => __('Something went wrong. Response returned:', 'ajax-search-pro'),
"msg_tim" => __('Timeout error. Please try again!', 'ajax-search-pro')
));
}

View File

@@ -0,0 +1,237 @@
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");
/**
* Calls the class on the post edit screen.
*/
function call_WD_ASP_DefaultMetaBox() {
new WD_ASP_DefaultMetaBox();
}
if ( is_admin() ) {
add_action( 'load-post.php', 'call_WD_ASP_DefaultMetaBox' );
add_action( 'load-post-new.php', 'call_WD_ASP_DefaultMetaBox' );
}
/**
* The Class.
*/
class WD_ASP_DefaultMetaBox {
private $asp_default_metadata = array(
"asp_suggested_phrases" =>"",
"asp_suggested_instances" => 0
);
/**
* Hook into the appropriate actions when the class is constructed.
*/
public function __construct() {
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
add_action( 'save_post', array( $this, 'save' ) );
add_action( 'edit_attachment', array( $this, 'save' ) );
}
/**
* Adds the meta box container.
*/
public function add_meta_box( $post_type ) {
$post_types = wd_asp()->o['asp_compatibility']['meta_box_post_types']; //Allow only for selected post types
$post_types = explode('|', $post_types);
if ( count($post_types) > 0 && in_array( $post_type, $post_types )) {
wp_register_style('wpdreams-style', ASP_URL_NP . 'backend/settings/assets/style.css', array(), ASP_CURR_VER_STRING);
wp_enqueue_style('wpdreams-style');
add_meta_box(
'asp_metadata'
,__( 'Ajax Search Pro settings', 'ajax-search-pro' )
,array( $this, 'render_meta_box_content' )
,$post_type
,'advanced'
,'high'
);
}
}
/**
* Save the meta when the post is saved.
*
* @param int $post_id The ID of the post being saved.
* @return int $post_id
*/
public function save( $post_id ) {
/*
* We need to verify this came from the our screen and with proper authorization,
* because save_post can be triggered at other times.
*/
// Check if our nonce is set.
if ( ! isset( $_POST['asp_meta_custom_box_nonce'] ) )
return $post_id;
$nonce = $_POST['asp_meta_custom_box_nonce'];
// Verify that the nonce is valid.
if ( ! wp_verify_nonce( $nonce, 'asp_meta_custom_box' ) )
return $post_id;
// If this is an autosave, our form has not been submitted,
// so we don't want to do anything.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return $post_id;
// Check the user's permissions.
if ( 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) )
return $post_id;
} else {
if ( ! current_user_can( 'edit_post', $post_id ) )
return $post_id;
}
$posted = array();
// Gather the posted data, but only the ones related to ASP
foreach ( $this->asp_default_metadata as $k => $v) {
if ( isset($_POST[$k]) )
$posted[$k] = $_POST[$k];
}
// If it is the defaults, no need to store it at all.
if ($posted == $this->asp_default_metadata) {
delete_post_meta($post_id, '_asp_metadata');
} else {
update_post_meta( $post_id, '_asp_metadata', $posted );
}
if ( isset($_POST['asp_additional_tags']) ) {
$blog_id = "x1";
if ( is_multisite() )
$blog_id = "x" . get_current_blog_id();
$add_tags = trim( preg_replace('/\s+/', ' ',$_POST['asp_additional_tags']) );
$add_tags = str_replace(array(',,'), ',', $add_tags);
$add_tags = str_replace(array(', ,'), ',', $add_tags);
if ( empty($add_tags) ) {
delete_post_meta($post_id, '_asp_additional_tags');
foreach (array_keys(wd_asp()->o['asp_glob']['additional_tag_posts'], $post_id.$blog_id, true) as $key) {
unset(wd_asp()->o['asp_glob']['additional_tag_posts'][$key]);
}
} else {
update_post_meta($post_id, '_asp_additional_tags', $add_tags);
if ( !in_array($post_id.$blog_id, wd_asp()->o['asp_glob']['additional_tag_posts']))
wd_asp()->o['asp_glob']['additional_tag_posts'][] = $post_id.$blog_id;
}
asp_save_option('asp_glob', true);
}
if ( isset($_POST['asp_negative_keywords']) ) {
$negative_keywords = str_replace(array(', ', ','), ' ', $_POST['asp_negative_keywords']);
$negative_keywords = trim( preg_replace('/\s+/', ' ',$negative_keywords) );
if ( empty($negative_keywords) ) {
delete_post_meta($post_id, '_asp_negative_keywords');
} else {
update_post_meta($post_id, '_asp_negative_keywords', $negative_keywords);
}
}
return $post_id;
}
/**
* Render Meta Box content.
*
* @param WP_Post $post The post object.
*/
public function render_meta_box_content( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( 'asp_meta_custom_box', 'asp_meta_custom_box_nonce' );
// Use get_post_meta to retrieve an existing value from the database.
$asp_metadata = get_post_meta( $post->ID, '_asp_metadata', true );
if ( !is_array($asp_metadata) )
$asp_metadata = array();
$asp_metadata = array_merge($this->asp_default_metadata, $asp_metadata);
?>
<style>
#wpdreams .asp_option_box {
border-bottom: 1px dashed #cacaca;
margin: 15px auto 0;
padding: 0 0 15px 0 !important;
}
#wpdreams .asp_option_box:first-child {
margin: 0 auto;
}
#wpdreams .asp_option_box:last-child {
border-bottom: none;
}
#wpdreams .asp_sugg_meta {
display: flex;
justify-content: flex-end;
align-items: flex-start;
}
#wpdreams .asp_sugg_meta>textarea {
height: 50px;
}
</style>
<div id='wpdreams' class='asp-be wpdreams wrap'>
<div class='wpdreams-box'>
<div class='asp_option_box'>
<div class="item asp_option_meta" style="vertical-align: top;">
<label style="vertical-align: top;">
<?php echo __('Additional search tags for this post (comma separated)', 'ajax-search-pro'); ?>
</label>
<textarea placeholder="<?php echo __('Enter phrases here, separated by comma', 'ajax-search-pro'); ?>"
style="background-image: none;background-position: 0% 0%;background-repeat: repeat;" name="asp_additional_tags"><?php echo get_post_meta( $post->ID, '_asp_additional_tags', true ); ?></textarea>
</div>
<p class="descMsg">
<?php echo __('Enter additional words here, which you also want to be able to search for.', 'ajax-search-pro'); ?>
</p>
</div>
<div class='asp_option_box'>
<div class="item asp_option_meta" style="vertical-align: top;">
<label style="vertical-align: top;">
<?php echo __('Negative keywords (space separated)', 'ajax-search-pro'); ?>
</label>
<textarea placeholder="<?php echo __('Enter keywords here, separated by space', 'ajax-search-pro'); ?>"
style="background-image: none;background-position: 0% 0%;background-repeat: repeat;" name="asp_negative_keywords"><?php echo get_post_meta( $post->ID, '_asp_negative_keywords', true ); ?></textarea>
</div>
<p class="descMsg">
<?php echo sprintf( __('This only works with the <a href="%s" target="_blank">index table engine!</a>', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/index-table'); ?>
&nbsp;<?php __('Negative keywords are excluded from indexing, within all fields of this post.', 'ajax-search-pro'); ?>
</p>
</div>
<div class='asp_option_box'>
<div class="item asp_sugg_meta" style="vertical-align: top;">
<label style="vertical-align: top;">
<?php echo __('"Try these" - custom phrase suggestions for this post (comma separated)', 'ajax-search-pro'); ?>
</label>
<textarea style=" background-image: none;background-position: 0% 0%;background-repeat: repeat;" name="asp_suggested_phrases"><?php echo $asp_metadata['asp_suggested_phrases']; ?></textarea>
<label style="vertical-align: top;"><?php echo __('for', 'ajax-search-pro'); ?></label>
<select name="asp_suggested_instances" style="vertical-align: top;">
<option value="0"<?php echo $asp_metadata['asp_suggested_instances'] == 0 ? " selected" : ""; ?>><?php echo __('All search instances', 'ajax-search-pro'); ?></option>
<?php foreach( wd_asp()->instances->getWithoutData() as $id=>$data ): ?>
<option value="<?php echo $id; ?>"<?php echo $asp_metadata['asp_suggested_instances'] == $id ? " selected" : ""; ?>><?php echo esc_html($data['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<p class="descMsg">
<?php echo __('These are the tags displaying under the search bar as suggestions if enabled.', 'ajax-search-pro'); ?>
<br><img src="<?php echo ASP_URL . "img/editor/kw_suggestions.png"; ?>">
</p>
</div>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,139 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Misc\Performance;
defined('ABSPATH') or die("You can't access this file directly.");
$perf_options = wd_asp()->o['asp_performance'];
if (ASP_DEMO) $_POST = null;
$pstats = new Performance('asp_performance_stats');
$asp_performance = $pstats->get_data();
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams asp_performance wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="float:left;">
<?php ob_start(); ?>
<div class="item">
<?php $o = new wpdreamsYesNo("enabled", __('Enable performance tracking?', 'ajax-search-pro'),
$perf_options['enabled']
); ?>
</div>
<?php $_r = ob_get_clean(); ?>
<?php
$updated = false;
if (
isset($_POST['asp_performance'], $_POST['asp_performance_nonce']) &&
wp_verify_nonce( $_POST['asp_performance_nonce'], 'asp_performance_nonce' )
) {
$values = array(
"enabled" => $_POST['enabled']
);
update_option('asp_performance', $values);
asp_parse_options();
$updated = true;
}
if (
isset($_POST['asp_perf_clear'], $_POST['asp_performance_clear_nonce']) &&
wp_verify_nonce( $_POST['asp_performance_clear_nonce'], 'asp_performance_clear_nonce' )
) {
$pstats = new Performance('asp_performance_stats');
$pstats->reset();
}
?>
<div class='wpdreams-slider'>
<?php if (ASP_DEMO): ?>
<p class="infoMsg">DEMO MODE ENABLED - Please note, that these options are read-only</p>
<?php endif; ?>
<form name='asp_performance_settings' class="asp_performance_settings" method='post'>
<?php if($updated): ?><div class='successMsg'><?php echo __('Performance options successfuly updated!', 'ajax-search-pro'); ?></div><?php endif; ?>
<fieldset>
<legend><?php echo __('Performance tracking options', 'ajax-search-pro'); ?></legend>
<?php print $_r; ?>
<input type='hidden' name='asp_performance' value='1' />
<input type="hidden" name="asp_performance_nonce"
value="<?php echo wp_create_nonce( 'asp_performance_nonce' ); ?>">
</fieldset>
</form>
<form name='asp_performance_settings_clear' class="asp_performance_settings_clear" method='post'>
<?php if (is_array($asp_performance)): ?>
<fieldset>
<legend><?php echo __('Performance statistics', 'ajax-search-pro'); ?></legend>
<ul>
<li><?php echo __('Search queries tracked:', 'ajax-search-pro'); ?> <strong><?php echo $asp_performance['run_count']; ?></strong></li>
<li><?php echo __('Average request runtime:', 'ajax-search-pro'); ?> <strong><?php echo number_format($asp_performance['average_runtime'], 3, '.', ''); ?> s</strong></li>
<li><?php echo __('Average request peak memory usage:', 'ajax-search-pro'); ?> <strong><?php echo wpd_mem_convert($asp_performance['average_memory']); ?></strong></li>
<li><?php echo __('Last request runtime:', 'ajax-search-pro'); ?> <strong><?php echo number_format($asp_performance['last_runtime'], 3, '.', ''); ?> s</strong></li>
<li><?php echo __('Last request peak memory usage:', 'ajax-search-pro'); ?> <strong><?php echo wpd_mem_convert($asp_performance['last_memory']); ?></strong></li>
</ul>
<div class="item">
<label for="perf_asp_submit"><?php echo __('Clear performace statistics?', 'ajax-search-pro'); ?></label>
<input type="hidden" name="asp_performance_clear_nonce"
value="<?php echo wp_create_nonce( 'asp_performance_clear_nonce' ); ?>">
<input type='submit' name="asp_perf_clear" id="asp_perf_clear" class='submit' value='<?php echo esc_attr__('Clear', 'ajax-search-pro'); ?>'/>
</div>
</fieldset>
<?php endif; ?>
</form>
<fieldset>
<legend><?php echo esc_attr__('Performance quick FAQ', 'ajax-search-pro'); ?></legend>
<dl>
<dt><?php echo esc_attr__('How come the performance tracker shows low runtime, yet the search results appear slower?', 'ajax-search-pro'); ?></dt>
<dd>
<?php echo __('The performance tracker only tracks the length of the search function.', 'ajax-search-pro'); ?><br>
<?php echo __('Before that WordPress initializes, loads all of the plugins, executes all the tasks needed and
then executes the search function. Depending on the number of plugins, server speed, this can take
some time. In this case not the search is slow, but actually the WordPress initialization.', 'ajax-search-pro'); ?>
</dd>
<dt><?php echo esc_attr__('How can I make the ajax request run faster?', 'ajax-search-pro'); ?></dt>
<dd>
<?php echo __('Using less plugins is usually the best solution. Lots of plugins will decrease the WordPress
performance - thus increasing the response time of ajax requests.', 'ajax-search-pro'); ?>
<?php echo sprintf( __('Running a <a href="%s">performance profiler plugin</a> might give you an insight on which plugins take the most
resources during loading - but it might be different for ajax requests.', 'ajax-search-pro'), 'https://wordpress.org/plugins/p3-profiler/' ); ?>
</dd>
<dt><?php echo esc_attr__('Can\'t the plugin bypass the WordPress initialization and just run the search query?', 'ajax-search-pro'); ?></dt>
<dd>
<?php echo __('Partially, yes. If you go to the <strong>Compatibility settings</strong> and enable the <strong>Use custom ajax handler</strong>
option, the search will use a custom handler, which bypasses some of the loading process.', 'ajax-search-pro'); ?><br>
<?php echo __('This might not work with some plugins or themes.', 'ajax-search-pro'); ?>
</dd>
</dl>
</fieldset>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
<script>
jQuery(function ($) {
$("form[name='asp_performance_settings'] .wpdreamsYesNoInner").on("click", function () {
setTimeout(function () {
$("form[name='asp_performance_settings']").get(0).submit();
}, 500);
});
$("form[name='asp_performance_settings_clear']").on("submit", function () {
if (!confirm('<?php echo __('Do you want to clear the performance statistics?', 'ajax-search-pro'); ?>')) {
return false;
}
});
});
</script>
</div>

View File

@@ -0,0 +1,96 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Misc\PriorityGroups;
defined('ABSPATH') or die("You can't access this file directly.");
if (ASP_DEMO) $_POST = null;
$args = array(
'public' => true,
'_builtin' => false
);
$output = 'names'; // names or objects, note names is the default
$operator = 'or'; // 'and' or 'or'
$post_types = array_merge(array('all'), get_post_types( $args, $output, $operator ));
$blogs = array();
if (function_exists('get_sites'))
$blogs = get_sites();
wd_asp()->priority_groups = PriorityGroups::getInstance();
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/priorities.css?v='.ASP_CURR_VER; ?>" />
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>'>
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<div class="wpdreams-box" style="position: relative; float:left;">
<ul id="tabs" class='tabs'>
<li><a tabid="1" class='current general'><?php echo __('Priority Groups', 'ajax-search-pro'); ?></a></li>
<li><a tabid="2" class='general'><?php echo __('Individual Priorities', 'ajax-search-pro'); ?></a></li>
</ul>
<div class='tabscontent'>
<div tabid="1">
<fieldset>
<legend><?php echo __('Priority Groups', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/priorities/priority_groups.php"); ?>
</fieldset>
</div>
<div tabid="2">
<fieldset>
<legend><?php echo __('Individual Priorities', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/priorities/priorities_individual.php"); ?>
</fieldset>
</div>
</div>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<div class="clear"></div>
</div>
<?php
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
wp_enqueue_script('asp-backend-priorities', plugin_dir_url(__FILE__) . 'settings/assets/priorities.js', array(
'jquery'
), $media_query, true);
wp_localize_script('asp-backend-priorities', 'ASP_PTS', array(
"admin_url" => admin_url(),
"ajax_url" => admin_url('admin-ajax.php'),
'msg_pda' => esc_attr__('Post Title/Date/Author', 'ajax-search-pro'),
'msg_sav' => esc_attr__('Save changes!', 'ajax-search-pro'),
'msg_pri' => esc_attr__('Priority', 'ajax-search-pro')
));
wp_enqueue_script('asp-backend-pg-controllers', plugin_dir_url(__FILE__) . 'settings/assets/priorities/controllers.js', array(
'jquery'
), $media_query, true);
wp_enqueue_script('asp-backend-pg-events', plugin_dir_url(__FILE__) . 'settings/assets/priorities/events.js', array(
'jquery',
'asp-backend-pg-controllers'
), $media_query, true);
wp_localize_script('asp-backend-pg-events', 'ASP_EVTS', array(
'msg_npg' => esc_attr__('Add new priority group', 'ajax-search-pro'),
'msg_sav' => esc_attr__('Save!', 'ajax-search-pro'),
'msg_can' => esc_attr__('Cancel', 'ajax-search-pro'),
'msg_epg' => esc_attr__('Edit priority group:', 'ajax-search-pro'),
'msg_del' => esc_attr__('Are you sure you want to delete %s ?', 'ajax-search-pro'),
'msg_dal' => esc_attr__('Are you sure you want to delete all groups? This is not reversible!', 'ajax-search-pro'),
'msg_dru' => esc_attr__('Are you sure you want to delete this rule?', 'ajax-search-pro'),
'msg_cru' => esc_attr__('Only 10 categories are allowed per rule!', 'ajax-search-pro'),
'msg_uns' => esc_attr__('You have unsaved changes! Are you sure you want to leave?', 'ajax-search-pro')
));

View File

@@ -0,0 +1,407 @@
<?php
/* Prevent direct access */
use WPDRMS\ASP\Hooks\Ajax\DeleteCache;
use WPDRMS\ASP\Misc\Themes;
use WPDRMS\ASP\Utils\Script;
defined('ABSPATH') or die("You can't access this file directly.");
$action_msg = '';
/**
* If safe mode is enabled because of the low max_input_vars value, then decode the params.
*/
if ( isset($_POST['asp_options_serialized'], $_GET['asp_sid'] ) ) {
// To bypass parse_str max_input_vars limitation
\WPDRMS\ASP\Utils\ParseStr::parse(base64_decode($_POST['asp_options_serialized']), $_POST);
$_POST['submit_' . intval($_GET['asp_sid'])] = 1;
}
if (
isset($_GET['asp_sid'], $_POST['reset_' . intval($_GET['asp_sid'])]) &&
isset($_POST['asp_sett_nonce'])
) {
if ( wp_verify_nonce( $_POST['asp_sett_nonce'], 'asp_sett_nonce' ) ) {
wd_asp()->instances->reset( intval($_GET['asp_sid']) );
wd_asp()->css_manager->generator->generate();
DeleteCache::getInstance()->handle(false);
$action_msg = "<div class='infoMsg'><strong>" . __('Search settings were reset to defaults!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
} else {
$action_msg = "<div class='errorMsg'><strong>". __('<strong>ERROR Saving:</strong> Invalid NONCE, please try again!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
$_POST = array();
}
}
if ( isset($_GET['asp_sid'], $_POST['submit_' . intval($_GET['asp_sid'])]) ) {
if ( wp_verify_nonce( $_POST['asp_sett_nonce'], 'asp_sett_nonce' ) ) {
$params = wpdreams_parse_params($_POST);
wd_asp()->instances->update(intval($_GET['asp_sid']), $params);
$style = $params;
$id = intval($_GET['asp_sid']);
wd_asp()->css_manager->generator->generate();
// Clear all the cache just in case
DeleteCache::getInstance()->handle(false);
// Do not clear cookies here, it might cause an error
// WD_ASP_Cookies_Action::forceUnsetCookies();
$action_msg = "<div class='infoMsg'><strong>" . __('Search settings saved!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
} else {
$action_msg = "<div class='errorMsg'><strong>". __('<strong>ERROR Saving:</strong> Invalid NONCE, please try again!', 'ajax-search-pro') . '</strong> (' . date("Y-m-d H:i:s") . ")</div>";
$_POST = array();
}
}
$params = array();
$_themes = Themes::get('search');
$_sb_themes = Themes::get('search_buttons');
if ( is_multisite() ) {
$search = wd_asp()->instances->get(intval($_GET['asp_sid']), false, true);
} else {
$search = wd_asp()->instances->get(intval($_GET['asp_sid']));
}
if ( empty($search) ) {
$s_id = $_GET['asp_sid'] + 0;
?>
<div id='wpdreams' class='asp-be wpdreams wrap'>
<div class="wpdreams-box">
<h1><?php echo __('Woops', 'ajax-search-pro'); ?></h1>
<div class="errorMsg"><?php echo esc_html(sprintf( __('This search instance (id=%s) does not exists.', 'ajax-search-pro'), $s_id )); ?></div>
</div>
</div>
<?php
return;
}
$metadata = require_once ASP_PATH . 'build/js/timed-modal.asset.php';
wp_enqueue_script(
'wpd-timed-modal',
ASP_URL_NP . 'build/js/timed-modal.js',
$metadata['dependencies'],
$metadata['version'],
array('in_footer'=>true)
);
/**
* The search data does not have unset option values as the
* $asp_globals->instances has it already merged with default options
*/
$sd = &$search['data'];
?>
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/font-awesome/font-awesome.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/sidebar.css?v='.ASP_CURR_VER; ?>" />
<link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'settings/assets/search_instance.css?v='.ASP_CURR_VER; ?>" />
<div id="wpd_body_loader"><div id="wpd_loading_msg"><?php echo __('Loading...', 'ajax-search-pro'); ?></div></div>
<div id='asp_preview_window'>
<span><?php echo __('Preview', 'ajax-search-pro'); ?></span>
<a name='refresh' class='refresh' searchid='0' href='#'><?php echo __('Refresh', 'ajax-search-pro'); ?></a>
<a name='hide' class='maximise'><?php echo __('Show', 'ajax-search-pro'); ?></a>
<input type="hidden" id="asp_backend_preview_nonce" value="<?php echo wp_create_nonce( 'asp_backend_preview_nonce' ); ?>">
<label><?php echo __('Background:', 'ajax-search-pro'); ?> </label><input type="text" id="bgcolorpicker" value="#ffffff"/>
<div style="text-align: center;
margin: 11px 0 17px;
font-size: 12px;
color: #aaa;">
<?php echo __('Please note, that some functions may not work in preview mode.<br>The first loading can take up to 15 seconds!', 'ajax-search-pro'); ?>
</div>
<div style="display: flex; justify-content: center; flex-wrap: nowrap; gap: 12px;">
<div style="cursor: pointer;" class="wpd-txt-small-icon wpd-txt-small-icon-desktop" data-device="desktop"></div>
<div style="cursor: pointer;" class="wpd-txt-small-icon wpd-txt-small-icon-tablet" data-device="tablet"></div>
<div style="cursor: pointer;" class="wpd-txt-small-icon wpd-txt-small-icon-phone" data-device="phone"></div>
</div>
<div class='big-loading hidden'></div>
<div class="data hidden asp_preview_data"></div>
</div>
<div id="wpd_white_fixed_bg"></div>
<div id="wpd_shortcode_modal_bg" class="wpd-modal-bg"></div>
<div id="wpd_shortcode_modal" sid="<?php echo $search['id']; ?>" class="wpd-modal hiddend">
<h3 style="flex-wrap: wrap; flex-basis: 100%; min-width: 100%;text-align: left; margin-top: 0;margin-left: 40px;"><?php echo __('Shortcode generator', 'ajax-search-pro'); ?></h3>
<div class="wpd-modal-close"></div>
<div class="sortablecontainer wpd_md_col">
<p class="descMsg"><?php echo sprintf( __('This tool is to help you generate a Column/Row based layout for the plugin. For more info on shortcodes, <a href="%s" target="_blank">check this video</a> tutorial.', 'ajax-search-pro'), 'https://documentation.ajaxsearchpro.com/getting-started/search-shortcodes' ); ?></p>
<ul class="ui-sortable">
<li item="search"><b><?php echo __('Search box', 'ajax-search-pro'); ?></b><br><label><?php echo __('Ratio:', 'ajax-search-pro'); ?> <input type="number" value="100" min="5" max="100"/>%</label><a class="deleteIcon"></a></li>
<li item="settings" class="hiddend"><b><?php echo __('Settings box', 'ajax-search-pro'); ?></b><br><label><?php echo __('Ratio:', 'ajax-search-pro'); ?> <input type="number" value="100" min="5" max="100"/>%</label><a class="deleteIcon"></a></li>
<li item="results" class="hiddend"><b><?php echo __('Results box', 'ajax-search-pro'); ?></b><br><label><?php echo __('Ratio:', 'ajax-search-pro'); ?> <input type="number" value="100" min="5" max="100"/>%</label><a class="deleteIcon"></a></li>
</ul>
</div>
<div class="wpd_generated_shortcode wpd_md_col">
<select style="max-width: 175px;">
<option disabled selected><?php echo __('Pre-defined variations', 'ajax-search-pro'); ?></option>
<option value="0,2|50,50"><?php echo __('Search/Results 50/50', 'ajax-search-pro'); ?></option>
<option value="0,1|50,50"><?php echo __('Search/Settings 50/50', 'ajax-search-pro'); ?></option>
<option value="0,1,2|33,33,33"><?php echo __('Search/Settings/Results in columns', 'ajax-search-pro'); ?></option>
<option value="0,1,2|100,50,50"><?php echo __('Search/Settings/Results in 100/50/50', 'ajax-search-pro'); ?></option>
<option value="0,1,2|50,50,100"><?php echo __('Search/Settings/Results in 50/50/100', 'ajax-search-pro'); ?></option>
</select>
<button item="search" disabled><< <?php echo __('Add the search box', 'ajax-search-pro'); ?></button>
<button item="settings"><< <?php echo __('Add the settings box', 'ajax-search-pro'); ?></button>
<button item="results"><< <?php echo __('Add the results box', 'ajax-search-pro'); ?></button>
<p style="margin-top: 10px;"><?php echo __('<b>Copy</b> the shorcode generated:', 'ajax-search-pro'); ?><br></p><textarea>[wd_asp='search' id=1]</textarea>
</div>
</div>
<div id='wpdreams' class='asp-be wpdreams wrap<?php echo isset($_COOKIE['asp-accessibility']) ? ' wd-accessible' : ''; ?>' style="min-width: 1280px;" data-searchid="<?php echo $search['id']; ?>">
<?php do_action('asp_admin_notices'); ?>
<!-- This forces custom Admin Notices location -->
<div style="display:none;"><h2 style="display: none;"></h2></div>
<!-- This forces custom Admin Notices location -->
<?php if (ASP_DEBUG == 1): ?>
<p class='infoMsg'><?php echo __('Debug mode is on!', 'ajax-search-pro'); ?></p>
<?php endif; ?>
<?php if (wd_asp()->o['asp_compatibility']['usecustomajaxhandler'] == 1): ?>
<p class='noticeMsgBox'>
<?php echo sprintf( __('NOTICE: The custom ajax handler is enabled. In case you experience issues, please <a href="%s">turn it off.</a>', 'ajax-search-pro'), get_admin_url() . "admin.php?page=asp_compatibility_settings" ); ?>
</p>
<?php endif; ?>
<?php if ( wd_asp()->updates->needsUpdate() ) { wd_asp()->updates->printUpdateMessage(); } ?>
<a class='back'
href='<?php echo get_admin_url() . "admin.php?page=asp_main_settings"; ?>'><?php echo __('Back to the search list', 'ajax-search-pro'); ?></a>
<a class='statistics'
href='<?php echo get_admin_url() . "admin.php?page=asp_statistics"; ?>'><?php echo __('Search Statistics', 'ajax-search-pro'); ?></a>
<a class='error'
href='<?php echo get_admin_url() . "admin.php?page=asp_compatibility_settings"; ?>'><?php echo __('Compatibility checking', 'ajax-search-pro'); ?></a>
<a class='cache'
href='<?php echo get_admin_url() . "admin.php?page=asp_cache_settings"; ?>'><?php echo __('Caching options', 'ajax-search-pro'); ?></a>
<?php ob_start(); ?>
<div class="wpdreams-box asp_b_shortcodes">
<?php if (defined('ASL_PATH')): ?>
<p class="errorMsg">
<?php echo __('Warning: <strong>Ajax Search Lite</strong> is still activated, please deactivate it to assure every PRO feature works properly.', 'ajax-search-pro'); ?>
</p>
<?php endif; ?>
<div class="asp_b_shortcodes_menu">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="18px" height="24px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<polygon transform = "rotate(90 256 256)" points="142.332,104.886 197.48,50 402.5,256 197.48,462 142.332,407.113 292.727,256 "/>
</svg>
<span class="asp_b_shortcodes_title"><?php echo __('Toggle shortcodes for', 'ajax-search-pro'); ?> <strong><?php echo esc_html( $search['name'] ); ?></strong></span>
<button id="shortcode_generator"><?php echo __('Shortcode generator', 'ajax-search-pro'); ?></button>
</div>
<fieldset>
<legend><?php echo __('Simple shortcodes', 'ajax-search-pro'); ?></legend>
<label class="shortcode"><?php echo __('Search shortcode:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode" value="[wpdreams_ajaxsearchpro id=<?php echo $search['id']; ?>]"
readonly="readonly"/>
<label class="shortcode"><?php echo __('Search shortcode for templates:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="&lt;?php echo do_shortcode('[wpdreams_ajaxsearchpro id=<?php echo $search['id']; ?>]'); ?&gt;"
readonly="readonly"/>
</fieldset>
<fieldset>
<legend><?php echo __('Result shortcodes', 'ajax-search-pro'); ?></legend>
<p style='margin:19px 10px 9px;'>
<?php echo __('Shortcodes for placing the result box elsewhere. (only works if the result layout position is <b>block</b> - see in layout options tab)', 'ajax-search-pro'); ?>
</p>
<label class="shortcode"><?php echo __('Result box shortcode:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="[wpdreams_ajaxsearchpro_results id=<?php echo $search['id']; ?> element='div']"
readonly="readonly"/>
<label class="shortcode"><?php echo __('Result shortcode for templates:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="&lt;?php echo do_shortcode('[wpdreams_ajaxsearchpro_results id=<?php echo $search['id']; ?> element=&quot;div&quot;]'); ?&gt;"
readonly="readonly"/>
</fieldset>
<fieldset>
<legend><?php echo __('Settings shortcodes', 'ajax-search-pro'); ?></legend>
<p style='margin:19px 10px 9px;'>
<?php echo __('Shortcodes for placing the settings box elsewhere.', 'ajax-search-pro'); ?>
</p>
<label class="shortcode"><?php echo __('Settings box shortcode:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="[wpdreams_asp_settings id=<?php echo $search['id']; ?> element='div']"
readonly="readonly"/>
<label class="shortcode"><?php echo __('Shortcode for templates:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="&lt;?php echo do_shortcode('[wpdreams_asp_settings id=<?php echo $search['id']; ?> element=&quot;div&quot;]'); ?&gt;"
readonly="readonly"/>
</fieldset>
<fieldset>
<legend><?php echo __('Two Column Shortcode', 'ajax-search-pro'); ?></legend>
<p style='margin:19px 10px 9px;'>
<?php echo __('Will place a search box (left) and a result box (right) next to each other, like the one on the demo front page.', 'ajax-search-pro'); ?>
</p>
<label class="shortcode"><?php echo __('TC shortcode:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="[wpdreams_ajaxsearchpro_two_column id=<?php echo $search['id']; ?> search_width=50 results_width=50 invert=0 element='div']"
readonly="readonly"/>
<label class="shortcode"><?php echo __('TC shortcode for templates:', 'ajax-search-pro'); ?></label>
<input type="text" class="shortcode"
value="&lt;?php echo do_shortcode('[wpdreams_ajaxsearchpro_two_column id=<?php echo $search['id']; ?> search_width=50 results_width=50 invert=0 element=&quot;div&quot;]'); ?&gt;"
readonly="readonly"/>
<p style='margin:19px 10px 9px;'><strong><?php echo __('Extra Parameters', 'ajax-search-pro'); ?></strong></p>
<ul style='margin:19px 10px 9px;'>
<li><?php echo __('search_width - {integer} the search bar width (in %, not px)', 'ajax-search-pro'); ?></li>
<li><?php echo __('results_width - {integer} the results box width (in %, not px)', 'ajax-search-pro'); ?></li>
<li><?php echo __('invert - {0 or 1} inverts the search and results box position from left to right', 'ajax-search-pro'); ?></li>
</ul>
</fieldset>
<fieldset>
<legend><?php echo __('Elementor Posts Widget Live Filter', 'ajax-search-pro'); ?></legend>
<div class="item">
<label>
<?php echo __('Add to Elementor Posts Widget class name to enable live filtering on that widget', 'ajax-search-pro'); ?>
<input type="text" value="asp_es_<?php echo $search['id']; ?>" readonly="readonly">
</label>
<div class="descMsg">
<?php echo sprintf(
__('Please check the <a href="%s">Elementor Posts Live Loader documentation</a> for more details', 'ajax-search-pro'),
'https://documentation.ajaxsearchpro.com/elementor-integration'); ?>
</div>
</div>
</fieldset>
</div>
<div style="width:100%; height: 1px; background:transparent; border: 0;"></div>
<div class="wpdreams-box" style="float:left;">
<?php echo $action_msg; ?>
<?php if ( ini_get('max_input_vars') < 1000 ): ?>
<form action='' style="display:none;" method='POST' name='asp_data_serialized'>
<input type="hidden" id='asp_options_serialized' name='asp_options_serialized' value = "">
<input type="submit"
id='asp_submit_serialized_<?php echo $search['id'] ?>'
name='asp_submit_serialized_<?php echo $search['id'] ?>'
style="display: none;">
</form>
<?php endif; ?>
<form action='' method='POST' name='asp_data' autocomplete="off">
<ul id="tabs" class='tabs'>
<li><a tabid="1" class='current general'><?php echo __('Search Sources', 'ajax-search-pro'); ?></a></li>
<li><a tabid="2" class='search_options'><?php echo __('Search Behavior', 'ajax-search-pro'); ?></a></li>
<li><a tabid="3" class='frontend'><?php echo __('Frontend Search Settings', 'ajax-search-pro'); ?></a></li>
<li><a tabid="4" class='layout'><?php echo __('Layout options', 'ajax-search-pro'); ?></a></li>
<li><a tabid="5" class='autocomplete'><?php echo __('Autocomplete & Suggestions', 'ajax-search-pro'); ?></a></li>
<li><a tabid="6" class='theme'><?php echo __('Theme & Styling', 'ajax-search-pro'); ?></a></li>
<li><a tabid="8" class='multisite<?php echo is_multisite() || ASP_DEMO ? '' : ' tab_disabled'; ?>'><?php echo __('Multisite Options', 'ajax-search-pro'); ?></a></li>
<li><a tabid="7" class='advanced'><?php echo __('Advanced options', 'ajax-search-pro'); ?></a></li>
</ul>
<div class='tabscontent'>
<div tabid="1">
<fieldset>
<legend><?php echo __('Search Sources', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/general_options.php"); ?>
</fieldset>
</div>
<div tabid="2">
<fieldset>
<legend><?php echo __('Search Behavior Options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/search_options.php"); ?>
</fieldset>
</div>
<div tabid="3">
<fieldset>
<legend><?php echo __('Frontend Search Settings options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/frontend_options.php"); ?>
</fieldset>
</div>
<div tabid="4">
<fieldset>
<legend><?php echo __('Layout Options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/layout_options.php"); ?>
</fieldset>
</div>
<div tabid="5">
<fieldset>
<legend><?php echo __('Autocomplete & Suggestions', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/autocomplete_options.php"); ?>
</fieldset>
</div>
<div tabid="6">
<fieldset>
<legend><?php echo __('Theme & Styling Options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/theme_options.php"); ?>
</fieldset>
</div>
<div tabid="8">
<fieldset>
<legend><?php echo __('Multisite Options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/multisite_options.php"); ?>
</fieldset>
</div>
<div tabid="7">
<fieldset>
<legend><?php echo __('Advanced Options', 'ajax-search-pro'); ?></legend>
<?php include(ASP_PATH . "backend/tabs/instance/advanced_options.php"); ?>
</fieldset>
</div>
<div tabid="loader">
<p><?php echo __('Loading...', 'ajax-search-pro'); ?></p>
</div>
</div>
<input type="hidden" name="sett_tabid" id="sett_tabid" value="1" />
<input type="hidden" name="asp_sett_nonce" id="asp_sett_nonce" value="<?php echo wp_create_nonce( "asp_sett_nonce" ); ?>">
</form>
</div>
<?php include(ASP_PATH . "backend/sidebar.php"); ?>
<?php
$output = ob_get_clean();
echo $output;
?>
<div class="clear"></div>
</div>
<?php
$media_query = ASP_DEBUG == 1 ? asp_gen_rnd_str() : get_site_option("asp_media_query", "defn");
// This needs to be enqueued first, so the node actions are attached, otherwise they will not work
// @TODO 4.10.5
/*wp_enqueue_script('wpd-backend-instant', plugin_dir_url(__FILE__) . 'settings/assets/instant_actions.js', array(
'jquery'
), $media_query, true);
wp_enqueue_script('wpd-backend-instance', plugin_dir_url(__FILE__) . 'settings/assets/search_instance.js', array(
'wpd-backend-instant'
), $media_query, true);
*/
// TODO 4.10.5 remove this, and use the one above
wp_enqueue_script('wpd-backend-instance', plugin_dir_url(__FILE__) . 'settings/assets/search_instance.js', array(
'jquery'
), $media_query, true);
wp_set_script_translations( 'wpd-backend-instance', 'ajax-search-pro' );
wp_enqueue_script('wpd-backend-options-search', plugin_dir_url(__FILE__) . 'settings/assets/option_search.js', array(
'jquery', 'wp-i18n'
), $media_query, true);
$metadata = require_once ASP_PATH . 'build/js/search-instance.asset.php';
wp_enqueue_script(
'wpd-asp-search-instance',
ASP_URL_NP . 'build/js/search-instance.js',
$metadata['dependencies'],
$metadata['version'],
array( 'in_footer' =>true ),
);

View File

@@ -0,0 +1,93 @@
#wpdreams .ac-container{
width: 720px;
margin: 10px auto 30px auto;
text-align: left;
}
#wpdreams .ac-container>div>label{
padding: 5px 20px;
position: relative;
z-index: 20;
display: block;
height: 30px;
cursor: pointer;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
line-height: 33px;
font-size: 14px;
background: #fcfcfc; /* Old browsers */
background: -moz-linear-gradient(top, #fcfcfc 0%, #fcfcfc 50%, #f9f9f9 54%, #fafafa 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfcfc), color-stop(50%,#fcfcfc), color-stop(54%,#f9f9f9), color-stop(100%,#fafafa)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fcfcfc 0%,#fcfcfc 50%,#f9f9f9 54%,#fafafa 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fcfcfc 0%,#fcfcfc 50%,#f9f9f9 54%,#fafafa 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #fcfcfc 0%,#fcfcfc 50%,#f9f9f9 54%,#fafafa 100%); /* IE10+ */
background: linear-gradient(to bottom, #fcfcfc 0%,#fcfcfc 50%,#f9f9f9 54%,#fafafa 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#fafafa',GradientType=0 ); /* IE6-9 */
box-shadow:
0px 0px 0px 1px rgba(155,155,155,0.3),
1px 0px 0px 0px rgba(255,255,255,0.9) inset,
0px 2px 2px rgba(0,0,0,0.1);
}
#wpdreams .ac-container>label:hover{
background: #fff;
}
#wpdreams .ac-container>div>input:checked + label,
#wpdreams .ac-container>div>input:checked + label:hover{
background: #c6e1ec;
color: #3d7489;
text-shadow: 0px 1px 1px rgba(255,255,255, 0.6);
box-shadow:
0px 0px 0px 1px rgba(155,155,155,0.3),
0px 2px 2px rgba(0,0,0,0.1);
}
#wpdreams .ac-container>div>label:hover:after,
#wpdreams .ac-container>div>input:checked + label:hover:after{
content: '';
position: absolute;
width: 24px;
height: 24px;
right: 13px;
top: 7px;
background: transparent url(../images/arrow_down.png) no-repeat center center;
}
#wpdreams .ac-container>div>input:checked + label:hover:after{
background-image: url(../images/arrow_up.png);
}
#wpdreams .ac-container>div>input{
display: none;
}
#wpdreams .ac-container>div article{
background: rgba(255, 255, 255, 0.5);
margin-top: -1px;
overflow: hidden;
height: 0px;
position: relative;
z-index: 10;
-webkit-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
-moz-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
-o-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
-ms-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
}
#wpdreams .ac-container input:checked ~ article{
-webkit-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
-moz-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
-o-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
-ms-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.3);
width: 690px;
}
#wpdreams .ac-container div>input:checked ~ article.ac-auto {
height: auto;
}
#wpdreams .ac-container div>input:checked ~ article.ac-small{
height: 140px;
}
#wpdreams .ac-container div>input:checked ~ article.ac-medium{
height: 180px;
}
#wpdreams .ac-container div>input:checked ~ article.ac-large{
height: 230px;
}

View File

@@ -0,0 +1,31 @@
jQuery(function($){
$('select[name=analytics]').on('change', function(){
var v = $(this).val();
if ( v == '0' ) {
$('.asp_al_pageview').addClass('hiddend');
$('.asp_al_event').addClass('hiddend');
$('.asp_al_both').addClass('hiddend');
} else if ( v == 'pageview' ) {
$('.asp_al_pageview').removeClass('hiddend');
$('.asp_al_event').addClass('hiddend');
$('.asp_al_both').removeClass('hiddend');
} else if ( v == 'event' ) {
$('.asp_al_pageview').addClass('hiddend');
$('.asp_al_event').removeClass('hiddend');
$('.asp_al_both').removeClass('hiddend');
}
}).trigger('change');
$('.asp_gtag_switch input[isparam]').on('change', function(){
if ( $(this).val() == 1 ) {
$(this).closest('fieldset').find('.asp_gtag_inputs').removeClass('disabled');
} else {
$(this).closest('fieldset').find('.asp_gtag_inputs').addClass('disabled');
}
}).trigger('change');
$('.asp_submit_reset').on('click', function(){
if(confirm('Do you really want to reset the options to defaults?')) {
return true;
}
return false;
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
// Simulate a click on the first element to initialize the tabs
jQuery(function ($) {
// Remove the # from the hash, as different browsers may or may not include it
var hash = location.hash.replace('#','');
if(hash != ''){
hash = parseInt(hash);
$('.tabs a[tabid=' + Math.floor( hash / 100 ) + ']').trigger('click');
$('.tabs a[tabid=' + hash + ']').trigger('click');
} else {
$('.tabs a[tabid=1]').trigger('click');
}
$('.tabs a').on('click', function(){
location.hash = $(this).attr('tabid');
});
$('input[name=selective_enabled]').on('change', function(){
if ( $(this).val() == 0 ) {
$(this).closest('fieldset').find('.item_selective_load').addClass('disabled');
} else {
$(this).closest('fieldset').find('.item_selective_load').removeClass('disabled');
}
}).trigger('change');
$('select[name=js_source]').on('change', function(){
if ( $(this).val().indexOf('jqueryless') < 0 ) {
$('select[name=script_loading_method]').closest('.item').addClass('disabled');
} else {
$('select[name=script_loading_method]').closest('.item').removeClass('disabled');
}
}).trigger('change');
});

View File

@@ -0,0 +1,53 @@
jQuery(function($){
$('#asp_export_textarea').on('click', function(){
var $this = $(this);
$this.select();
// Work around Chrome's little problem
$this.mouseup(function() {
// Prevent further mouseup intervention
$this.unbind("mouseup");
return false;
});
});
$('#asp_export_button').on('click', function(){
if ($('#asp_export :selected').length < 1) return false;
$(this).next().removeClass('hiddend');
$(this).prop('disabled', true);
var $this = $(this);
setTimeout(function(){
var searches = [];
$('#asp_export :selected').each(function(i, selected){
searches.push( $(this).val() );
});
if (searches.length > 0)
$('#asp_export_textarea').val(JSON.stringify(searches));
$this.prop('disabled', false);
$this.next().addClass('hiddend');
}, 1000);
});
$('#asp_export_button_sett').on('click', function(){
if ($('#asp_export_sett :selected').length < 1) return false;
$(this).next().removeClass('hiddend');
$(this).prop('disabled', true);
var $this = $(this);
setTimeout(function(){
$('#asp_export_textarea_sett').val($('#asp_export_sett').val());
$this.prop('disabled', false);
$this.next().addClass('hiddend');
}, 1000);
});
$('#asp_import_button_sett').on('click', function(e){
return confirm(msg('suc_msg'));
});
$('.tabs a[tabid=1]').trigger('click');
// ------------------------------------------- ETC -----------------------------------------------------------------
function msg(k) {
return typeof ASP_EI_LOC[k] != 'undefined' ? ASP_EI_LOC[k] : '';
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,85 @@
var webFontLoaded = [];
function loadFonts(family) {
WebFontConfig = {
google: { families: [family+":400,700"] }
};
if ( webFontLoaded.indexOf(family) < 0 ) {
if ( typeof WebFont !== 'undefined' ) {
WebFont.load(WebFontConfig);
webFontLoaded.push(family);
}
}
}
jQuery(function($){
$('.wpdreamsFontComplete input[type=text], .wpdreamsFontComplete select').on('keyup change', function() {
var p = $(this).closest('.wpdreamsFontComplete');
var family, fonts;
if ( p.find('select.wd_fonts_select').val() != 'custom' ) {
var realFamilyName = p.find('select.wd_fonts_select').val().replace('--g--', '');
loadFonts(realFamilyName);
fonts = p.find('select.wd_fonts_select').val().replace(/'|"/gi, '');
family = "font-family:" + fonts + ";";
} else {
if ( p.find('input.wd_fonts_custom').val() != '' ) {
fonts = p.find('input.wd_fonts_custom').val().replace(/'|"/gi, '');
family = "font-family:" + fonts + ";";
} else {
family = "font-family: Open Sans;";
}
}
var weight = "font-weight:"+p.find('select.wd_font_weight').val()+";";
var color = "color:"+p.find('.wd_fonts_type input.color').val()+";";
var size = "font-size:"+p.find('input.wd_fonts_size').val()+";";
var lh = "line-height:"+p.find('input.wd_fonts_line').val()+";";
var tShadow = p.find('input._xx_hlength_xx_').val() + "px " + p.find('input._xx_vlength_xx_').val() + "px ";
tShadow += p.find('input._xx_blurradius_xx_').val() + "px " + p.find('.wpd_font_shadow input.color').val();
var textShadow = "text-shadow:" + tShadow + ";";
p.find("input[isparam=1]").val(weight+family+color+size+lh+textShadow).trigger('change');
});
$('.wpdreamsFontComplete select.wd_fonts_select').on('change', function(){
var cf = $(this).closest('.wpdreamsFontComplete').find('label.wd_fonts_custom');
if ( $(this).val() == 'custom' ) {
cf.removeClass('hiddend');
} else {
cf.addClass('hiddend');
}
});
$('.wpdreamsFontComplete select.wd_fonts_select').trigger('change');
$(".wpdreamsFontComplete>.triggerer").on('click', function() {
var p = $(this).closest('.wpdreamsFontComplete');
var val = p.find("input[isparam=1]").val().replace(/(\r\n|\n|\r)/gm,"");
var font = $.trim(val.match(/family:(.*?);/)[1]).replace('--g--', '');
font = font.replace(/'|"/gi, '');
if ( $("select.wd_fonts_select option[value='"+font+"']").length > 0 ) {
p.find('select.wd_fonts_select').val( font );
} else {
p.find('select.wd_fonts_select').val('custom');
p.find('input.wd_fonts_custom').val(font);
}
p.find('select.wd_font_weight').val( $.trim(val.match(/font-weight:(.*?);/)[1]) );
p.find('input.wd_fonts_size').val( $.trim(val.match(/size:(.*?);/)[1]) );
p.find('input.wd_fonts_line').val( $.trim(val.match(/height:(.*?);/)[1]) );
p.find('.wd_fonts_type input.color').val( $.trim(val.match(/color:(.*?);/)[1]) );
p.find('.wd_fonts_type input.color').spectrum('set', $.trim(val.match(/color:(.*?);/)[1]));
var ts = val.match(/text-shadow:(.*?)px (.*?)px (.*?)px (.*?);/);
if (ts != null && ts.length > 0) {
p.find('input._xx_hlength_xx_').val( $.trim(ts[1]) );
p.find('input._xx_vlength_xx_').val( $.trim(ts[2]) );
p.find('input._xx_blurradius_xx_').val( $.trim(ts[3]) );
p.find('.wpd_font_shadow input.color').val( $.trim(ts[4]) );
p.find('.wpd_font_shadow input.color').spectrum('set', $.trim(ts[4]));
}
p.find('select.wd_fonts_select').trigger('change');
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Some files were not shown because too many files have changed in this diff Show More