null, 'labels' => [ 'name' => 'Вариации поиска', 'singular_name' => 'Вариации поиска', 'add_new' => 'Добавить', 'add_new_item' => 'Добавить', 'edit_item' => 'Редактировать', 'new_item' => 'Вариации поиска', 'view_item' => 'Просмотреть', 'search_items' => 'Поиск', 'not_found' => 'Не найдено', 'not_found_in_trash' => 'Не найдено', 'parent_item_colon' => '', 'menu_name' => 'Вариации поиска', ], 'description' => '', 'menu_icon' => 'dashicons-media-document', 'publicly_queryable' => false, 'public' => true, 'exclude_from_search' => null, 'show_ui' => true, 'show_in_nav_menus' => false, 'show_in_menu' => true, 'rest_base' => null, 'menu_position' => 49, 'hierarchical' => true, 'supports' => ['title'], 'show_in_rest' => true, 'taxonomies' => [], 'has_archive' => true, 'rewrite' => true, 'query_var' => true ]); register_post_type('currencies', [ 'label' => null, 'labels' => [ 'name' => 'Валюты', 'singular_name' => 'Валюты', 'add_new' => 'Добавить', 'add_new_item' => 'Добавить', 'edit_item' => 'Редактировать', 'new_item' => 'Валюты', 'view_item' => 'Просмотреть', 'search_items' => 'Поиск', 'not_found' => 'Не найдено', 'not_found_in_trash' => 'Не найдено', 'parent_item_colon' => '', 'menu_name' => 'Валюты', ], 'description' => '', 'menu_icon' => 'dashicons-money-alt', 'publicly_queryable' => false, 'public' => true, 'exclude_from_search' => null, 'show_ui' => true, 'show_in_nav_menus' => false, 'show_in_menu' => true, 'rest_base' => null, 'menu_position' => 49, 'hierarchical' => true, 'supports' => ['title'], 'show_in_rest' => true, 'taxonomies' => [], 'has_archive' => true, 'rewrite' => true, 'query_var' => true ]); } public function enqueueScripts() { $directory = plugins_url().'/ajax-search/'; wp_enqueue_style("AjaxSearch-style", "{$directory}assets/style.css"); wp_enqueue_script("AjaxSearch-cookie", "{$directory}assets/cookie.js", ['jquery'], null, true); wp_enqueue_script("AjaxSearch-script", "{$directory}assets/script.js", ['AjaxSearch-cookie'], null, true); global $wpdb; $ress = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}postmeta WHERE meta_key = 'estate-price-object' AND meta_value != ''"); $curs = $arr = []; $currencies = get_posts([ 'numberposts' => -1, 'post_status' => 'publish', 'post_type' => 'currencies' ]); foreach( $currencies as $cur ){ $curs[$cur->ID] = get_post_meta($cur->ID, '_currencies_course', true)*1; } foreach( $ress as $res ){ $prc = $res->meta_value*1; $arr[$res->post_id] = [0 => $prc]; foreach( $curs as $id => $cur ){ $arr[$res->post_id][$id] = $cur * $prc; } } wp_localize_script("AjaxSearch-script", 'currencies', $arr); } public function addMetaBox() { add_meta_box("AjaxSearch-box", 'AjaxSearch', [$this, 'metaBox'], 'search-variations', 'normal', 'high'); add_meta_box("AjaxSearch-box", 'AjaxSearch', [$this, 'metaBoxСurrencies'], 'currencies', 'normal', 'high'); } public function savePost( $ID = null, $post = null, $update = null ) { if( isset($_POST['AjaxSearch']) && is_array($_POST['AjaxSearch']) && $post ){ foreach( $_POST['AjaxSearch'] as $key => $val ){ update_post_meta($post->ID, $key, $val); } } } public function metaBox() { $postID = $_GET['post']; include __DIR__ . '/meta-box.php'; } public function metaBoxСurrencies() { $postID = $_GET['post']; include __DIR__ . '/currencies.php'; } public function ajaxSearchVariations() { echo '
'.static::getVariations().'
'; } public function ajaxSearchVariationActive() { echo '
'; } public function editCurrencies() { $ul = ''; $posts = get_posts([ 'numberposts' => -1, 'post_status' => 'publish', 'post_type' => 'currencies' ]); foreach( $posts as $post ){ $ul .= '
  • '.$post->post_title.'
  • '; } echo '

    USD / $

    '; } static function getVariations() { require_once __DIR__ . '/vendor/phpExcelReader/Excel/reader.php'; $variations = []; $html = ''; $upload = wp_upload_dir(); $posts = get_posts([ 'numberposts' => -1, 'post_status' => 'publish', 'post_type' => 'search-variations' ]); if( is_array($posts) ){ foreach( $posts as $post ){ $variations[$post->ID] = [ 'name' => get_post_meta($post->ID, '_variation_meta', true), 'icon' => get_post_meta($post->ID, '_variation_svg', true), 'title' => $post->post_title, 'vars' => [] ]; $sht = get_post_meta($post->ID, '_variation_sht', true); $fileID = get_post_meta($post->ID, '_variation_file', true); $attached = get_post_meta($fileID, '_wp_attached_file', true); $_key = get_post_meta($post->ID, '_variation_key', true); $_val = get_post_meta($post->ID, '_variation_val', true); if( is_readable($upload['basedir'].'/'.$attached) && isset($sht) && $sht*1 > -1 && isset($fileID) && $fileID*1 > -1 ){ $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('UTF-8'); $data->read($upload['basedir'].'/'.$attached); $sheet = $data->sheets[$sht]['cells']; $key = 0; foreach( $sheet as $cols ){ if( $key > 0 ){ $variations[$post->ID]['vars'][$cols[$_key]][] = $cols[$_val]; } $key++; } } } } foreach( $variations as $item ){ $ul = "

    {$item['icon']}{$item['title']}

    "; if( count($item['vars']) > 0 ){ $i = 0; foreach( $item['vars'] as $val => $vars ){ $vars[] = $val; $ul .= "
  • $val
  • "; $i++; } } $html .= ""; } return "
    $html
    "; } static function getSelectUl( $acfID ) { global $wpdb; $postID = $wpdb->get_var("SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = '_variation_acf' AND meta_value = '$acfID'"); $post = get_post($postID); $html = $active = ''; if( $postID && !empty($postID) && $post ){ require_once __DIR__ . '/vendor/phpExcelReader/Excel/reader.php'; $vars = []; $upload = wp_upload_dir(); $sht = get_post_meta($post->ID, '_variation_sht', true); $_key = get_post_meta($post->ID, '_variation_key', true); $_val = get_post_meta($post->ID, '_variation_val', true); $name = get_post_meta($post->ID, '_variation_meta', true); $fileID = get_post_meta($post->ID, '_variation_file', true); $attached = get_post_meta($fileID, '_wp_attached_file', true); if( is_readable($upload['basedir'].'/'.$attached) && isset($sht) && $sht*1 > -1 && isset($fileID) && $fileID*1 > -1 ){ $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('UTF-8'); $data->read($upload['basedir'].'/'.$attached); $sheet = $data->sheets[$sht]['cells']; $key = 0; foreach( $sheet as $cols ){ if( $key > 0 ){ $vars[$cols[$_key]][] = $cols[$_val]; } $key++; } if( count($vars) > 0 ){ $k = 0; foreach( $vars as $val => $arr ){ $arr[] = $val; $check = ''; if( $k == 0 ){ $check = ' checked'; $active = $val; } $html .= '
  • '.$val.'
  • '; $k++; } } } } if( !empty($html) ){ $html = '

    '.$active.'

    '; } return $html; } } new AjaxSearch(); MEGARIELTOR https://megarieltor.com Mon, 25 Dec 2023 08:05:01 +0000 ru-RU hourly 1 https://wordpress.org/?v=6.5.2 Продаётся квартира в престижном районе. (Кукча) 3/3/4 в элитной новостройке. Застройщик Мурадбилдинг https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d0%bf%d1%80%d0%b5%d1%81%d1%82%d0%b8%d0%b6%d0%bd%d0%be%d0%bc-%d1%80%d0%b0%d0%b9%d0%be/ Mon, 25 Dec 2023 08:05:01 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d0%bf%d1%80%d0%b5%d1%81%d1%82%d0%b8%d0%b6%d0%bd%d0%be%d0%bc-%d1%80%d0%b0%d0%b9%d0%be/ Продаётся коттедж https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6-2/ Fri, 22 Dec 2023 06:50:54 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6-2/ Продаётся коттедж на Сергелийском районе https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6-%d0%bd%d0%b0-%d1%81%d0%b5%d1%80%d0%b3%d0%b5%d0%bb%d0%b8%d0%b9%d1%81%d0%ba%d0%be%d0%bc-%d1%80%d0%b0/ Fri, 22 Dec 2023 06:41:15 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6-%d0%bd%d0%b0-%d1%81%d0%b5%d1%80%d0%b3%d0%b5%d0%bb%d0%b8%d0%b9%d1%81%d0%ba%d0%be%d0%bc-%d1%80%d0%b0/ Продаётся коттедж https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6/ Fri, 22 Dec 2023 06:33:26 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%be%d1%82%d1%82%d0%b5%d0%b4%d0%b6/ Продам квартиру на Юнусобаде4 с ремонтом и мебелью в новостройке 3/7/9 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%bd%d0%b0-%d1%8e%d0%bd%d1%83%d1%81%d0%be%d0%b1%d0%b0%d0%b4%d0%b54-%d1%81-%d1%80%d0%b5%d0%bc%d0%be%d0%bd%d1%82/ Mon, 18 Dec 2023 11:33:59 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%bd%d0%b0-%d1%8e%d0%bd%d1%83%d1%81%d0%be%d0%b1%d0%b0%d0%b4%d0%b54-%d1%81-%d1%80%d0%b5%d0%bc%d0%be%d0%bd%d1%82/ Квартира в центре по цене окраины 3/3/9 Ц13 https://megarieltor.com/%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d1%86%d0%b5%d0%bd%d1%82%d1%80%d0%b5-%d0%bf%d0%be-%d1%86%d0%b5%d0%bd%d0%b5-%d0%be%d0%ba%d1%80%d0%b0%d0%b8%d0%bd%d1%8b-3-3-9-%d1%8613/ Fri, 15 Dec 2023 13:52:06 +0000 https://megarieltor.com/%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d1%86%d0%b5%d0%bd%d1%82%d1%80%d0%b5-%d0%bf%d0%be-%d1%86%d0%b5%d0%bd%d0%b5-%d0%be%d0%ba%d1%80%d0%b0%d0%b8%d0%bd%d1%8b-3-3-9-%d1%8613/ Продам квартиру очень дёшево срочно 2/1/2 за корзинкой ТТЗ https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%be%d1%87%d0%b5%d0%bd%d1%8c-%d0%b4%d1%91%d1%88%d0%b5%d0%b2%d0%be-%d1%81%d1%80%d0%be%d1%87%d0%bd%d0%be-2-1-2/ Fri, 15 Dec 2023 13:26:23 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%be%d1%87%d0%b5%d0%bd%d1%8c-%d0%b4%d1%91%d1%88%d0%b5%d0%b2%d0%be-%d1%81%d1%80%d0%be%d1%87%d0%bd%d0%be-2-1-2/ Продам не дорого квартиру в дорогом районе, Яккасарай 3/2/2 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%bd%d0%b5-%d0%b4%d0%be%d1%80%d0%be%d0%b3%d0%be-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%b2-%d0%b4%d0%be%d1%80%d0%be%d0%b3%d0%be%d0%bc-%d1%80%d0%b0/ Fri, 15 Dec 2023 13:00:21 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d0%bc-%d0%bd%d0%b5-%d0%b4%d0%be%d1%80%d0%be%d0%b3%d0%be-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d1%83-%d0%b2-%d0%b4%d0%be%d1%80%d0%be%d0%b3%d0%be%d0%bc-%d1%80%d0%b0/ Квартира в новой много этажке не дорого и с прекрасным видом из окна на город https://megarieltor.com/%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d0%bd%d0%be%d0%b2%d0%be%d0%b9-%d0%bc%d0%bd%d0%be%d0%b3%d0%be-%d1%8d%d1%82%d0%b0%d0%b6%d0%ba%d0%b5-%d0%bd%d0%b5-%d0%b4%d0%be%d1%80%d0%be%d0%b3/ Fri, 15 Dec 2023 11:39:43 +0000 https://megarieltor.com/%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-%d0%b2-%d0%bd%d0%be%d0%b2%d0%be%d0%b9-%d0%bc%d0%bd%d0%be%d0%b3%d0%be-%d1%8d%d1%82%d0%b0%d0%b6%d0%ba%d0%b5-%d0%bd%d0%b5-%d0%b4%d0%be%d1%80%d0%be%d0%b3/ ПРОДАЁТСЯ КВАРТИРА! https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-15/ Fri, 15 Dec 2023 10:18:14 +0000 https://megarieltor.com/%d0%bf%d1%80%d0%be%d0%b4%d0%b0%d1%91%d1%82%d1%81%d1%8f-%d0%ba%d0%b2%d0%b0%d1%80%d1%82%d0%b8%d1%80%d0%b0-15/