';
$spro_add_nonce_vars = 1;
}
if(!empty($spro_add_nonce_vars)){
echo '';
}
}
return '';
}
function softaculous_pro_get_option($option_name, $default_value = false, $site_id = null){
if($site_id !== null && is_multisite()){
return get_site_option($option_name, $default_value);
}
return get_option($option_name, $default_value);
}
/**
* Takes care of Slashes
*
* @param string $string The string that will be processed
* @return string A string that is safe to use for Database Queries, etc
* @since 1.0
*/
function softaculous_pro_inputsec($string){
//get_magic_quotes_gpc is deprecated in php 7.4
if(version_compare(PHP_VERSION, '7.4', '<')){
if(!get_magic_quotes_gpc()){
$string = addslashes($string);
}else{
$string = stripslashes($string);
$string = addslashes($string);
}
}else{
$string = addslashes($string);
}
// This is to replace ` which can cause the command to be executed in exec()
$string = str_replace('`', '\`', $string);
return $string;
}
/**
* Converts Special characters to html entities
*
* @param string $string The string containing special characters
* @return string A string containing special characters replaced by html entities of the format ASCIICODE;
* @since 1.0
*/
function softaculous_pro_htmlizer($string){
$string = htmlentities($string, ENT_QUOTES, 'UTF-8');
preg_match_all('/(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)/', $string, $matches);
foreach($matches[1] as $mk => $mv){
$tmp_m = softaculous_pro_entity_check($matches[2][$mk]);
$string = str_replace($matches[1][$mk], $tmp_m, $string);
}
return $string;
}
/**
* Used in function htmlizer()
*
* @param string $string
* @return string
* @since 1.0
*/
function softaculous_pro_entity_check($string){
//Convert Hexadecimal to Decimal
$num = ((substr($string, 0, 1) === 'x') ? hexdec(substr($string, 1)) : (int) $string);
//Squares and Spaces - return nothing
$string = (($num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num < 0x20) ? '' : ''.$num.';');
return $string;
}
/**
* OPTIONAL REQUEST of the given REQUEST Key
*
* @param string $name The key of the $_REQUEST array i.e. the name of the input / textarea text
* @param string $default The value to return if the $_REQUEST[$name] is NOT SET
* @return string Returns the string if the REQUEST is there otherwise the default value given.
* @since 1.0
*/
function softaculous_pro_optREQ($name, $default = ''){
global $softaculous_error;
//Check the POSTED NAME was posted
if(isset($_REQUEST[$name])){
return trim(sanitize_text_field($_REQUEST[$name]));
}else{
return $default;
}
}
/**
* OPTIONAL POST of the given POST Key
*
* @param string $name The key of the $_POST array i.e. the name of the input / textarea text
* @param string $default The value to return if the $_POST[$name] is NOT SET
* @return string Returns the string if the POST is there otherwise the default value given.
* @since 1.4.6
*/
function softaculous_pro_optPOST($name, $default = ''){
global $softaculous_error;
//Check the POSTED NAME was posted
if(isset($_POST[$name])){
if(is_array($_POST[$name])){
$values = array_map('trim', $_POST[$name]);
return array_map('sanitize_text_field', $values);
}
return trim(sanitize_text_field($_POST[$name]));
}else{
return $default;
}
}
/**
* OPTIONAL GET of the given GET Key i.e. dont throw a error if not there
*
* @param string $name The key of the $_GET array i.e. the name of the input / textarea text
* @param string $default The value to return if the $_GET[$name] is NOT SET
* @return string Returns the string if the GET is there otherwise the default value given.
* @since 1.0
*/
function softaculous_pro_optGET($name, $default = ''){
global $softaculous_error;
//Check the GETED NAME was GETed
if(isset($_GET[$name])){
return trim(sanitize_text_field($_GET[$name]));
}else{
return $default;
}
}
function softaculous_pro_sp_api_url($main_server = 0){
global $softaculous_pro;
return softaculous_pro_api_url($main_server, 'sitepad');
}
function softaculous_pro_pfx_api_url($main_server = 0){
global $softaculous_pro;
return softaculous_pro_api_url($main_server, 'popularfx');
}
function softaculous_pro_api_url($main_server = 0, $suffix = ''){
global $softaculous_pro;
$r = array(
'https://s0.softaculous.com/a/softwp/',
'https://s1.softaculous.com/a/softwp/',
'https://s2.softaculous.com/a/softwp/',
'https://s3.softaculous.com/a/softwp/',
'https://s4.softaculous.com/a/softwp/',
'https://s5.softaculous.com/a/softwp/',
'https://s7.softaculous.com/a/softwp/',
'https://s8.softaculous.com/a/softwp/'
);
$mirror = $r[array_rand($r)];
// If the license is newly issued, we need to fetch from API only
if(!empty($main_server) || empty($softaculous_pro['license']['last_edit']) ||
(!empty($softaculous_pro['license']['last_edit']) && (time() - 3600) < $softaculous_pro['license']['last_edit'])
){
$mirror = 'https://a.softaculous.com/softwp/';
}
// -1 indicates that we need to force the mirror server used for rendering static files e.g. screenshots
if(!empty($main_server) && $main_server == '-1'){
$mirror = $r[array_rand($r)];
}
if(!empty($suffix)){
$mirror = str_replace('/softwp', '/'.$suffix, $mirror);
}
return $mirror;
}
// Load license data
function softaculous_pro_load_license(){
global $softaculous_pro;
// Load license
$softaculous_pro['license'] = get_option('softaculous_pro_license', array());
if(empty($softaculous_pro['license'])){
return false;
}
$prods = apply_filters('softaculous_pro_products', []);
// Update license details as well
if(empty($softaculous_pro['license']['last_update']) ||
(!empty($softaculous_pro['license']['last_update']) && (time() - $softaculous_pro['license']['last_update']) >= 86400)
){
$resp = wp_remote_get(softaculous_pro_api_url(1).'license.php?license='.$softaculous_pro['license']['license'].'&prods='.implode(',', $prods).'&url='.rawurlencode(site_url()));
// Did we get a response ?
if(is_array($resp)){
$tosave = json_decode($resp['body'], true);
// Is it the license ?
if(!empty($tosave['license'])){
$softaculous_pro['license'] = $tosave;
}
}
// Save the old data only
if(empty($tosave['license'])){
$tosave = get_option('softaculous_pro_license', array());
}
$tosave['last_update'] = time();
update_option('softaculous_pro_license', $tosave);
}
return $softaculous_pro['license'];
}
add_filter('softaculous_pro_products', 'softaculous_softwp_pro_products', 10, 1);
function softaculous_softwp_pro_products($r = []){
$r['softwp'] = 'softwp';
return $r;
}
// Load Softaculous rebranding settings
function softaculous_pro_rebranding(){
global $softaculous_pro;
$softaculous_pro['branding']['sn'] = 'SoftWP';
$softaculous_pro['branding']['logo_url'] = SOFTACULOUS_PRO_PLUGIN_URL.'assets/images/logo-white.png';
$softaculous_pro['branding']['rebranded'] = 0;
//Getting info if Softaculous rebranding done or not?
$soft_rebranding = get_option('softaculous_pro_rebranding', '[]');
if(!empty($soft_rebranding['logo_url'])){
$softaculous_pro['branding']['logo_url'] = $soft_rebranding['logo_url'];
}
if(!empty($soft_rebranding['sn']) && $soft_rebranding['sn'] != 'Softaculous'){
$softaculous_pro['branding']['sn'] = $soft_rebranding['sn'];
$softaculous_pro['branding']['rebranded'] = 1;
}
if(!empty($soft_rebranding['default_hf_bg'])){
$softaculous_pro['branding']['default_hf_bg'] = $soft_rebranding['default_hf_bg'];
}
if(!empty($soft_rebranding['default_hf_text'])){
$softaculous_pro['branding']['default_hf_text'] = $soft_rebranding['default_hf_text'];
}
return true;
}
// Add our license key if ANY
function softaculous_pro_updater_filter_args($queryArgs) {
global $softaculous_pro;
if ( !empty($softaculous_pro['license']['license']) ) {
$queryArgs['license'] = $softaculous_pro['license']['license'];
}
return $queryArgs;
}
// Handle the Check for update link and ask to install license key
function softaculous_pro_updater_check_link($final_link){
global $softaculous_pro;
if(empty($softaculous_pro['license']['license'])){
return 'Enter Pro License Key';
}
return $final_link;
}
function softaculous_pro_report_error($error = array()) {
if(empty($error)){
return true;
}
$error_string = '' . esc_html__('Please fix the below error(s):', 'softaculous-pro') . ' ';
foreach($error as $ev){
$error_string .= '* ' . esc_html($ev) . ' ';
}
echo '