Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../clone/wp-conte.../plugins/themify-.../themify
File: themify-wpajax.php
<?php
[0] Fix | Delete
/***************************************************************************
[1] Fix | Delete
*
[2] Fix | Delete
* ----------------------------------------------------------------------
[3] Fix | Delete
* DO NOT EDIT THIS FILE
[4] Fix | Delete
* ----------------------------------------------------------------------
[5] Fix | Delete
*
[6] Fix | Delete
* Copyright (C) Themify
[7] Fix | Delete
*
[8] Fix | Delete
* ----------------------------------------------------------------------
[9] Fix | Delete
*
[10] Fix | Delete
***************************************************************************/
[11] Fix | Delete
[12] Fix | Delete
defined( 'ABSPATH' ) || exit;
[13] Fix | Delete
[14] Fix | Delete
// Initialize actions
[15] Fix | Delete
[16] Fix | Delete
$themify_ajax_actions = array(
[17] Fix | Delete
'import_settings',
[18] Fix | Delete
'plupload',
[19] Fix | Delete
'get_404_pages',
[20] Fix | Delete
'save',
[21] Fix | Delete
'reset_settings',
[22] Fix | Delete
'add_link_field',
[23] Fix | Delete
'media_lib_browse',
[24] Fix | Delete
'clear_all_webp',
[25] Fix | Delete
'clear_all_menu',
[26] Fix | Delete
'clear_all_concate',
[27] Fix | Delete
'clear_all_html',
[28] Fix | Delete
'clear_gfonts',
[29] Fix | Delete
'search_autocomplete',
[30] Fix | Delete
'ajax_load_more',
[31] Fix | Delete
'required_plugins_modal',
[32] Fix | Delete
'news_widget',
[33] Fix | Delete
'activate_plugin',
[34] Fix | Delete
'update_license',
[35] Fix | Delete
'upload_json'
[36] Fix | Delete
);
[37] Fix | Delete
foreach($themify_ajax_actions as $action){
[38] Fix | Delete
add_action('wp_ajax_themify_' . $action, 'themify_' . $action);
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
//Show 404 page in autocomplete
[42] Fix | Delete
function themify_get_404_pages(){
[43] Fix | Delete
if ( ! empty( $_POST['term'] ) && current_user_can( 'manage_options' ) ) {
[44] Fix | Delete
$args = array(
[45] Fix | Delete
'sort_order' => 'asc',
[46] Fix | Delete
'sort_column' => 'post_title',
[47] Fix | Delete
'post_type' => 'page',
[48] Fix | Delete
's'=> sanitize_text_field($_POST['term']),
[49] Fix | Delete
'no_found_rows'=>true,
[50] Fix | Delete
'ignore_sticky_posts'=>true,
[51] Fix | Delete
'cache_results'=>false,
[52] Fix | Delete
'update_post_term_cache'=>false,
[53] Fix | Delete
'update_post_meta_cache'=>false,
[54] Fix | Delete
'post_status' => 'publish',
[55] Fix | Delete
'posts_per_page' => 15
[56] Fix | Delete
);
[57] Fix | Delete
add_filter( 'posts_search', 'themify_posts_where', 10, 2 );
[58] Fix | Delete
$terms = new WP_Query($args);
[59] Fix | Delete
$items = array();
[60] Fix | Delete
if($terms->have_posts()){
[61] Fix | Delete
while ($terms->have_posts()){
[62] Fix | Delete
$terms->the_post();
[63] Fix | Delete
$items[] = array('value'=> get_the_ID(),'label'=> get_the_title());
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
echo wp_json_encode($items);
[67] Fix | Delete
}
[68] Fix | Delete
wp_die();
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
//Search only by post title
[72] Fix | Delete
function themify_posts_where($search,$wp_query ){
[73] Fix | Delete
if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) {
[74] Fix | Delete
global $wpdb;
[75] Fix | Delete
[76] Fix | Delete
$q = $wp_query->query_vars;
[77] Fix | Delete
$n = ! empty( $q['exact'] ) ? '' : '%';
[78] Fix | Delete
[79] Fix | Delete
$search = array();
[80] Fix | Delete
$search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $wpdb->esc_like( implode(' ',$q['search_terms']) ) . $n );
[81] Fix | Delete
[82] Fix | Delete
if ( ! is_user_logged_in() )
[83] Fix | Delete
$search[] = "$wpdb->posts.post_password = ''";
[84] Fix | Delete
[85] Fix | Delete
$search = ' AND ' . implode( ' AND ', $search );
[86] Fix | Delete
}
[87] Fix | Delete
return $search;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Handles theme settings import via file
[92] Fix | Delete
*/
[93] Fix | Delete
function themify_import_settings() {
[94] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[95] Fix | Delete
die;
[96] Fix | Delete
}
[97] Fix | Delete
check_ajax_referer( 'themify_import_settings' );
[98] Fix | Delete
[99] Fix | Delete
if ( ! empty( $_POST['data'] ) ) {
[100] Fix | Delete
$data = stripslashes( $_POST['data'] );
[101] Fix | Delete
$data = is_serialized( $data ) ? unserialize( $data, [ 'allowed_classes' => false ] ) : json_decode( $data, true );
[102] Fix | Delete
if ( ! empty( $data ) ) {
[103] Fix | Delete
themify_set_data( $data );
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
wp_send_json_success();
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
/**
[111] Fix | Delete
* AJAX - Plupload execution routines
[112] Fix | Delete
* @since 1.2.2
[113] Fix | Delete
* @package themify
[114] Fix | Delete
*/
[115] Fix | Delete
function themify_plupload() {
[116] Fix | Delete
if( ! current_user_can( 'upload_files' ) ) {
[117] Fix | Delete
die;
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
$imgid = $_POST['imgid'];
[121] Fix | Delete
check_ajax_referer( $imgid . 'themify-plupload' );
[122] Fix | Delete
/** Decide whether to send this image to Media. @var String */
[123] Fix | Delete
$add_to_media_library = isset( $_POST['tomedia'] ) ? $_POST['tomedia'] : false;
[124] Fix | Delete
/** If post ID is set, uploaded image will be attached to it. @var String */
[125] Fix | Delete
$postid = isset( $_POST['topost'] )? $_POST['topost'] : '';
[126] Fix | Delete
[127] Fix | Delete
/** Handle file upload storing file|url|type. @var Array */
[128] Fix | Delete
$file = wp_handle_upload($_FILES[$imgid . 'async-upload'], array('test_form' => true, 'action' => 'themify_plupload'));
[129] Fix | Delete
[130] Fix | Delete
// if $file returns error, return it and exit the function
[131] Fix | Delete
if ( isset( $file['error'] ) && ! empty( $file['error'] ) ) {
[132] Fix | Delete
wp_send_json_error( $file['error'] );
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
$type = $_POST['type'];
[136] Fix | Delete
$allowed_extensions = [
[137] Fix | Delete
'image' => [ 'jpg', 'jpeg', 'gif', 'png', 'ico', 'svg' ],
[138] Fix | Delete
'audio' => [ 'mp3', 'm4a', 'ogg', 'wav', 'wma' ],
[139] Fix | Delete
'video' => [ 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ],
[140] Fix | Delete
'font' => [ 'woff', 'woff2', 'ttf', 'otf', 'svg', 'eot' ]
[141] Fix | Delete
];
[142] Fix | Delete
[143] Fix | Delete
// let's see if it's a valid file type
[144] Fix | Delete
$extension = pathinfo( $file['file'], PATHINFO_EXTENSION );
[145] Fix | Delete
if ( ! in_array( $extension, $allowed_extensions[ $type ], true ) ) {
[146] Fix | Delete
Themify_Filesystem::delete( $file['file'], 'f' );
[147] Fix | Delete
wp_send_json_error( __( 'Invalid file type.', 'themify' ) );
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
//Image Upload routines
[151] Fix | Delete
if( 'tomedia' === $add_to_media_library ){
[152] Fix | Delete
[153] Fix | Delete
// Insert into Media Library
[154] Fix | Delete
// Set up options array to add this file as an attachment
[155] Fix | Delete
$attachment = array(
[156] Fix | Delete
'post_mime_type' => sanitize_mime_type($file['type']),
[157] Fix | Delete
'post_title' => str_replace('-', ' ', sanitize_file_name(pathinfo($file['file'], PATHINFO_FILENAME))),
[158] Fix | Delete
'post_status' => 'inherit'
[159] Fix | Delete
);
[160] Fix | Delete
[161] Fix | Delete
if( $postid ){
[162] Fix | Delete
$attach_id = wp_insert_attachment( $attachment, $file['file'], $postid );
[163] Fix | Delete
} else {
[164] Fix | Delete
$attach_id = wp_insert_attachment( $attachment, $file['file'] );
[165] Fix | Delete
}
[166] Fix | Delete
$file['id'] = $attach_id;
[167] Fix | Delete
[168] Fix | Delete
// Common attachment procedures
[169] Fix | Delete
require_once(ABSPATH . 'wp-admin/includes/image.php');
[170] Fix | Delete
$attach_data = wp_generate_attachment_metadata( $attach_id, $file['file'] );
[171] Fix | Delete
wp_update_attachment_metadata($attach_id, $attach_data);
[172] Fix | Delete
[173] Fix | Delete
if( $postid ) {
[174] Fix | Delete
[175] Fix | Delete
$full = wp_get_attachment_image_src( $attach_id, 'full' );
[176] Fix | Delete
[177] Fix | Delete
update_post_meta($postid, $_POST['fields'], $full[0]);
[178] Fix | Delete
update_post_meta($postid, '_'.$_POST['fields'] . '_attach_id', $attach_id);
[179] Fix | Delete
}
[180] Fix | Delete
[181] Fix | Delete
/* Return URL for the image field in meta box */
[182] Fix | Delete
if ( $type === 'image' ) {
[183] Fix | Delete
$thumb = wp_get_attachment_image_src( $attach_id, 'thumbnail' );
[184] Fix | Delete
$file['thumb'] = $thumb[0];
[185] Fix | Delete
}
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
$file['type'] = $extension;
[189] Fix | Delete
wp_send_json_success( $file );
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
/**
[193] Fix | Delete
* AJAX - Save user settings
[194] Fix | Delete
* @since 1.1.3
[195] Fix | Delete
* @package themify
[196] Fix | Delete
*/
[197] Fix | Delete
function themify_save(){
[198] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[199] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[200] Fix | Delete
die;
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
$previous_data = themify_get_data();
[204] Fix | Delete
$temp = themify_normalize_save_data( $_POST['data'] );
[205] Fix | Delete
unset($temp['tmp_cache_network'],$temp['tmp_cache_concte_network'],$temp['tmp_regenerate_all_css']);
[206] Fix | Delete
themify_set_data( $temp );
[207] Fix | Delete
_e('Your settings were saved', 'themify');
[208] Fix | Delete
[209] Fix | Delete
if (
[210] Fix | Delete
Themify_Enqueue_Assets::$mobileMenuActive !== intval( $temp['setting-mobile_menu_trigger_point'] )
[211] Fix | Delete
|| ( isset( $previous_data['skin'] ) && $previous_data['skin'] !== $temp['skin'])
[212] Fix | Delete
|| ( isset( $previous_data['setting-header_design'] ) && $previous_data['setting-header_design'] !== $temp['setting-header_design'])
[213] Fix | Delete
|| ( isset( $previous_data['setting-exclude_menu_navigation'] ) && $previous_data['setting-exclude_menu_navigation'] !== $temp['setting-exclude_menu_navigation'])
[214] Fix | Delete
) {
[215] Fix | Delete
Themify_Enqueue_Assets::clearConcateCss();
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/* clear webP image cache when changing image quality */
[219] Fix | Delete
if ( (empty( $previous_data['setting-gf'] ) && !empty($temp['setting-gf'])) || (!empty( $previous_data['setting-gf'] ) && empty($temp['setting-gf']))) {
[220] Fix | Delete
Themify_Storage::deleteByPrefix('tf_fg_css_');
[221] Fix | Delete
}
[222] Fix | Delete
/* clear google fonts cache*/
[223] Fix | Delete
[224] Fix | Delete
if ( class_exists( 'Themify_Builder_Stylesheet',false ) ) {
[225] Fix | Delete
$breakpoints=themify_get_breakpoints('all',true);
[226] Fix | Delete
foreach ( $breakpoints as $bp=>$v ) {
[227] Fix | Delete
if ( isset( $previous_data["setting-customizer_responsive_design_{$bp}"] ) && $previous_data["setting-customizer_responsive_design_{$bp}"] !== $temp["setting-customizer_responsive_design_{$bp}"] ) {
[228] Fix | Delete
Themify_Builder_Stylesheet::regenerate_css_files();
[229] Fix | Delete
break;
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
}
[233] Fix | Delete
unset($previous_data);
[234] Fix | Delete
if(themify_get_server()==='nginx'){
[235] Fix | Delete
if(empty($temp['setting-webp'])){
[236] Fix | Delete
Themify_Enqueue_Assets::removeWebp();
[237] Fix | Delete
}
[238] Fix | Delete
}
[239] Fix | Delete
else{
[240] Fix | Delete
$isDev=!empty($temp['setting-dev-mode']);
[241] Fix | Delete
$gzip=$isDev?true:empty($temp['setting-cache_gzip']);
[242] Fix | Delete
$browser=$isDev?true:empty($temp['setting-cache_browser']);
[243] Fix | Delete
Themify_Enqueue_Assets::rewrite_htaccess($gzip,empty($temp['setting-webp']),$browser);
[244] Fix | Delete
}
[245] Fix | Delete
TFCache::remove_cache();
[246] Fix | Delete
if(empty($temp['setting-dev-mode'])){
[247] Fix | Delete
TFCache::create_config($temp);
[248] Fix | Delete
}
[249] Fix | Delete
else{
[250] Fix | Delete
TFCache::disable_cache();
[251] Fix | Delete
}
[252] Fix | Delete
TFCache::clear_3rd_plugins_cache();
[253] Fix | Delete
[254] Fix | Delete
do_action( 'themify_settings_save' );
[255] Fix | Delete
[256] Fix | Delete
wp_die();
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
function themify_normalize_save_data($data){
[260] Fix | Delete
$data = explode('&', $data);
[261] Fix | Delete
$temp = array();
[262] Fix | Delete
foreach($data as $a){
[263] Fix | Delete
$v = explode('=', $a);
[264] Fix | Delete
$temp[$v[0]] = urldecode( str_replace('+',' ',preg_replace_callback('/%([0-9a-f]{2})/i', 'themify_save_replace_cb', urlencode($v[1]))) );
[265] Fix | Delete
}
[266] Fix | Delete
[267] Fix | Delete
/* cleanup Hook Content data, remove empty hooks */
[268] Fix | Delete
if ( ! empty( $temp['setting-hooks_field_ids'] ) ) {
[269] Fix | Delete
$ids = json_decode( $temp['setting-hooks_field_ids'] );
[270] Fix | Delete
if ( ! empty( $ids ) ) {
[271] Fix | Delete
$new_ids = [];
[272] Fix | Delete
foreach ( $ids as $id ) {
[273] Fix | Delete
if ( empty( $temp["setting-hooks-{$id}-code"] ) ) {
[274] Fix | Delete
unset( $temp["setting-hooks-{$id}-code"], $temp["setting-hooks-{$id}-location"], $temp["setting-hooks-{$id}-r"], $temp["setting-hooks-{$id}-visibility"] );
[275] Fix | Delete
} else {
[276] Fix | Delete
$new_ids[] = $id;
[277] Fix | Delete
}
[278] Fix | Delete
}
[279] Fix | Delete
$temp['setting-hooks_field_ids'] = json_encode( $new_ids );
[280] Fix | Delete
}
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
return $temp;
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
/**
[287] Fix | Delete
* Replace callback for preg_replace_callback used in themify_save().
[288] Fix | Delete
*
[289] Fix | Delete
* @since 2.2.5
[290] Fix | Delete
*
[291] Fix | Delete
* @param array $matches 0 complete match 1 first match enclosed in (...)
[292] Fix | Delete
*
[293] Fix | Delete
* @return string One character specified by ascii.
[294] Fix | Delete
*/
[295] Fix | Delete
function themify_save_replace_cb( $matches ) {
[296] Fix | Delete
// "chr(hexdec('\\1'))"
[297] Fix | Delete
return chr( hexdec( $matches[1] ) );
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
/**
[301] Fix | Delete
* AJAX - Reset Settings
[302] Fix | Delete
* @since 1.1.3
[303] Fix | Delete
* @package themify
[304] Fix | Delete
*/
[305] Fix | Delete
function themify_reset_settings(){
[306] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[307] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[308] Fix | Delete
die;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
$temp_data = themify_normalize_save_data($_POST['data']);
[312] Fix | Delete
$temp = array();
[313] Fix | Delete
foreach($temp_data as $key => $val){
[314] Fix | Delete
// Don't reset if it's not a setting or the # of social links or a social link or the Hook Contents
[315] Fix | Delete
if(strpos($key, 'setting') === false || strpos($key, 'hooks') || strpos($key, 'link_field_ids') || strpos($key, 'themify-link') || strpos($key, 'custom_css')){
[316] Fix | Delete
$temp[$key] = $val;
[317] Fix | Delete
}
[318] Fix | Delete
}
[319] Fix | Delete
$temp['setting-script_minification'] = 'disable';
[320] Fix | Delete
print_r(themify_set_data($temp));
[321] Fix | Delete
die();
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
function themify_add_link_field(){
[325] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[326] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[327] Fix | Delete
die;
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
if( isset($_POST['fid']) ) {
[331] Fix | Delete
$hash = $_POST['fid'];
[332] Fix | Delete
$type = isset( $_POST['type'] )? $_POST['type'] : 'image-icon';
[333] Fix | Delete
echo themify_add_link_template( 'themify-link-'.$hash, array(), true, $type);
[334] Fix | Delete
wp_die();
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
/**
[339] Fix | Delete
* Set image from wp library
[340] Fix | Delete
* @since 1.2.9
[341] Fix | Delete
* @package themify
[342] Fix | Delete
*/
[343] Fix | Delete
function themify_media_lib_browse() {
[344] Fix | Delete
if ( ! wp_verify_nonce( $_POST['media_lib_nonce'], 'media_lib_nonce' ) ) die(-1);
[345] Fix | Delete
if ( ! current_user_can( 'upload_files' ) ) {
[346] Fix | Delete
die;
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
$file = array();
[350] Fix | Delete
$postid = $_POST['post_id'];
[351] Fix | Delete
$attach_id = $_POST['attach_id'];
[352] Fix | Delete
[353] Fix | Delete
$full = wp_get_attachment_image_src( $attach_id, 'full' );
[354] Fix | Delete
if( $_POST['featured'] ){
[355] Fix | Delete
//Set the featured image for the post
[356] Fix | Delete
set_post_thumbnail($postid, $attach_id);
[357] Fix | Delete
}
[358] Fix | Delete
update_post_meta($postid, $_POST['field_name'], $full[0]);
[359] Fix | Delete
update_post_meta($postid, '_'.$_POST['field_name'] . '_attach_id', $attach_id);
[360] Fix | Delete
[361] Fix | Delete
$thumb = wp_get_attachment_image_src( $attach_id, 'thumbnail' );
[362] Fix | Delete
[363] Fix | Delete
//Return URL for the image field in meta box
[364] Fix | Delete
$file['thumb'] = $thumb[0];
[365] Fix | Delete
[366] Fix | Delete
echo json_encode($file);
[367] Fix | Delete
[368] Fix | Delete
exit();
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
[372] Fix | Delete
function themify_clear_all_webp(){
[373] Fix | Delete
check_ajax_referer('tf_nonce', 'nonce');
[374] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[375] Fix | Delete
die;
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
wp_send_json_success(Themify_Enqueue_Assets::removeWebp());
[379] Fix | Delete
}
[380] Fix | Delete
[381] Fix | Delete
function themify_clear_all_concate(){
[382] Fix | Delete
check_ajax_referer('tf_nonce', 'nonce');
[383] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[384] Fix | Delete
die;
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
$type=false;
[388] Fix | Delete
if(is_multisite()){
[389] Fix | Delete
if(!empty($_POST['all'])){
[390] Fix | Delete
$type='all';
[391] Fix | Delete
}
[392] Fix | Delete
else{
[393] Fix | Delete
$data = themify_normalize_save_data($_POST['data']);
[394] Fix | Delete
if(!empty($data['tmp_cache_concte_network'])){
[395] Fix | Delete
$type='all';
[396] Fix | Delete
}
[397] Fix | Delete
$data=null;
[398] Fix | Delete
}
[399] Fix | Delete
}
[400] Fix | Delete
Themify_Enqueue_Assets::clearConcateCss($type);
[401] Fix | Delete
wp_send_json_success();
[402] Fix | Delete
}
[403] Fix | Delete
[404] Fix | Delete
function themify_clear_all_menu(){
[405] Fix | Delete
check_ajax_referer('tf_nonce', 'nonce');
[406] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[407] Fix | Delete
die;
[408] Fix | Delete
}
[409] Fix | Delete
[410] Fix | Delete
TFCache::remove_cache();
[411] Fix | Delete
TFCache::clear_3rd_plugins_cache();
[412] Fix | Delete
themify_clear_menu_cache();
[413] Fix | Delete
die('1');
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
function themify_clear_all_html(){
[417] Fix | Delete
check_ajax_referer('tf_nonce', 'nonce');
[418] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[419] Fix | Delete
die;
[420] Fix | Delete
}
[421] Fix | Delete
$type='blog';
[422] Fix | Delete
if(is_multisite()){
[423] Fix | Delete
$data = themify_normalize_save_data($_POST['data']);
[424] Fix | Delete
if(!empty($data['tmp_cache_network'])){
[425] Fix | Delete
$type='all';
[426] Fix | Delete
}
[427] Fix | Delete
$data=null;
[428] Fix | Delete
}
[429] Fix | Delete
TFCache::remove_cache($type);
[430] Fix | Delete
die('1');
[431] Fix | Delete
}
[432] Fix | Delete
function themify_clear_gfonts(){
[433] Fix | Delete
check_ajax_referer('tf_nonce', 'nonce');
[434] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[435] Fix | Delete
die;
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
Themify_Storage::deleteByPrefix('tf_fg_css_');
[439] Fix | Delete
wp_send_json_success();
[440] Fix | Delete
}
[441] Fix | Delete
add_action('wp_ajax_nopriv_themify_search_autocomplete','themify_search_autocomplete');
[442] Fix | Delete
function themify_search_autocomplete(){
[443] Fix | Delete
if(!empty($_POST['s'])){
[444] Fix | Delete
$s = sanitize_text_field($_POST['s']);
[445] Fix | Delete
if(!empty($s)){
[446] Fix | Delete
global $query,$found_types;
[447] Fix | Delete
if(!empty($_POST['post_type'])){
[448] Fix | Delete
$post_types = array(sanitize_text_field($_POST['post_type']));
[449] Fix | Delete
}else{
[450] Fix | Delete
if(true===themify_is_woocommerce_active() && 'product' === themify_get( 'setting-search_post_type','all',true )){
[451] Fix | Delete
$post_types = array('product');
[452] Fix | Delete
}else{
[453] Fix | Delete
$post_types = Themify_Builder_Model::get_post_types();
[454] Fix | Delete
unset($post_types['attachment']);
[455] Fix | Delete
$post_types=array_keys($post_types);
[456] Fix | Delete
}
[457] Fix | Delete
}
[458] Fix | Delete
$query_args = array(
[459] Fix | Delete
'post_type'=>$post_types,
[460] Fix | Delete
'post_status'=>'publish',
[461] Fix | Delete
'posts_per_page'=>22,
[462] Fix | Delete
's'=>$s
[463] Fix | Delete
);
[464] Fix | Delete
[465] Fix | Delete
$query_args = apply_filters('themify_search_args',$query_args);
[466] Fix | Delete
wp_reset_postdata();
[467] Fix | Delete
$query = new WP_Query( $query_args );
[468] Fix | Delete
$found_types=array();
[469] Fix | Delete
while ( $query->have_posts() ){
[470] Fix | Delete
$query->the_post();
[471] Fix | Delete
$post_type = get_post_type();
[472] Fix | Delete
if (($key = array_search($post_type, $query_args['post_type'])) !== false) {
[473] Fix | Delete
unset($query_args['post_type'][$key]);
[474] Fix | Delete
$found_types[]=$post_type;
[475] Fix | Delete
}
[476] Fix | Delete
if(empty($query_args['post_type'])){
[477] Fix | Delete
break;
[478] Fix | Delete
}
[479] Fix | Delete
}
[480] Fix | Delete
$query->rewind_posts();
[481] Fix | Delete
[482] Fix | Delete
ob_start();
[483] Fix | Delete
include( THEMIFY_DIR.'/includes/search-box-result.php' );
[484] Fix | Delete
ob_end_flush();
[485] Fix | Delete
}
[486] Fix | Delete
}
[487] Fix | Delete
wp_die();
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
/*Load More Ajax - Used for module ajax load more*/
[491] Fix | Delete
if(!function_exists('themify_ajax_load_more')){
[492] Fix | Delete
function themify_ajax_load_more(){
[493] Fix | Delete
if(!empty($_POST['module']) && !empty($_POST['id'])){
[494] Fix | Delete
$builder_id=(int)($_POST['id']);
[495] Fix | Delete
$mod_id=str_replace('tb_','',$_POST['module']);
[496] Fix | Delete
$data = Themify_Builder::get_builder_modules_list( (int)$_POST['id'] );
[497] Fix | Delete
if ( ! empty( $data ) ) {
[498] Fix | Delete
foreach ( $data as $module ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function