public function buildFromString($data) { if ($data['l_deal_type']) { $text = $data['l_assettype'] . " на продажу "; } else { $text = $data['l_assettype'] . " в аренду "; } $text .= "в " . rus_city_pad($data['l_geo_city']); $this->setHeadline($text); $text .= "Более {$data['cnt']} объявлений!"; $tmp = mb_split(" ", $text); $l = count($tmp); $i = 0; while (mb_strlen($new, 'utf-8') < 26 && $i < $l) { $old = $new; $new .= " " . $tmp[$i]; // echo $new."<br>"; $i++; } //echo "<br>"; $this->ga_headline = $old; $new = $tmp[$i - 1]; $old = ''; while (mb_strlen($new, 'utf-8') < 36) { $old = $new; $new .= " " . $tmp[$i]; //echo $new."<br>"; $i++; } //echo "!<br>"; $this->ga_description1 = trim($old); $new = $tmp[$i - 1]; $old = ''; while (mb_strlen($new, 'utf-8') < 36) { $old = $new; $new .= " " . $tmp[$i]; //echo $new."<br>"; $i++; } $this->ga_description2 = trim($old); $old = ''; if (!$this->ga_description2) { $this->ga_description2 = ' и дешевле...'; } //echo $this->ga_description1."<br>!".$this->ga_description2; //die(); }
public function build($data) { $this->y_region = $data['l_geo_city']; if ($data['l_deal_type']) { $text .= $data['l_assettype']; } else { $text .= $data['l_assettype']; } $text = "Аренда без посредников"; $text .= " в " . rus_city_pad($data['l_geo_city']) . "."; $num = $data['cnt'][0] . str_repeat("0", strlen($data['cnt']) - 1); if ($num > 10) { $text .= " Более"; } $text .= " {$num} объявлений"; $text .= $data['l_deal_type'] ? " о продаже " : " об аренде "; $text .= round($data['l_rooms']) ? round($data['l_rooms']) . "-комн. квартир " : ""; $text .= "в " . rus_city_pad($data['l_geo_city']); $tmp = mb_split(" ", $text); $l = count($tmp); $i = 0; while (mb_strlen($new, 'utf-8') < 34 && $i < $l) { $old = $new; $new .= " " . $tmp[$i]; $i++; } $this->buildHeader($old); $new = $tmp[$i - 1]; $old = ''; while (mb_strlen($new, 'utf-8') < 76 && $i < $l) { $old = $new; $new .= (mb_strlen($new, 'utf-8') + mb_strlen($tmp[$i], 'utf-8') < 35 || mb_strlen($new, 'utf-8') > 35 ? " " : "|") . $tmp[$i]; $i++; } $this->buildDescription($i < $l ? $old : $new); $this->buildUrl($data); $this->item_data['l_geo_city'] = "в " . rus_city_pad($data['l_geo_city']); $this->buildKeywords($data); }
protected function buildHeadline($data, $params = '') { $this->setHeadline("{KEYWORD:" . $data['l_assettype'] . " в " . rus_city_pad($data['l_geo_city']) . "}"); }
public function buildRealestateKeywordsRU($val) { $multipiers = array(); //$this->mainDB->executeSQL("SELECT * FROM $this->m_sMainTable WHERE l_id=$this->gag_l_id", $resultArry, $rowsAffected); $this->m_aItemData = $val; $this->m_aItemData['l_geo_city'] = "в " . rus_city_pad($this->m_aItemData['l_geo_city']); if ($data['l_geo_city']) { switch ($data['l_geo_city']) { case 'Санкт-Петербург': $this->m_aItemData['l_geo_city'] = " Питер"; break; default: } } $words = array($this->m_aItemData['l_assettype'], $this->m_aItemData['l_deal_type'] ? 'на продажу' : 'в аренду', $this->m_aItemData['l_geo_city']); require_once '../classes/KeywordForger.php'; //$this->m_aKeywords = KeywordForger::forgeKeywords($words, array(0,2)); $this->m_aKeywords[] = $this->m_aItemData['l_assettype'] . " " . ($this->m_aItemData['l_deal_type'] ? 'на продажу' : 'в аренду') . " " . $this->m_aItemData['l_geo_city']; $this->m_aKeywords[] = ($this->m_aItemData['l_deal_type'] ? 'на продажу' : 'в аренду') . " " . $this->m_aItemData['l_geo_city']; $this->m_aKeywords[] = $this->m_aItemData['l_assettype'] . " " . $this->m_aItemData['l_geo_city']; foreach ($this->m_aKeywords as $key => $kw) { $url = "http://realestate.pingola.ru.msn.com/search/" . str_replace(" ", "+", $val['l_geo_city']); if ($val['l_deal_type'] == 1) { $url .= '-sale'; } else { $url .= "-rent"; } $url .= "&asset=" . str_replace(" ", "%20", $val['l_assettype']); $url .= "&share&refGoogle=Network=_{network}_&Keyword=_{keyword}_&MatchType=_{matchtype}_&Ad=_{creative}_&AdPos=_{adposition}_"; $this->m_aKeywords[$key] = array(); $this->m_aKeywords[$key]['url'] = $url; $this->m_aKeywords[$key]['keyword'] = $kw; //echo $this->m_aKeywords[$key]['keyword'] ." added\r\n"; } return true; foreach ($this->m_aKeywords as $keyword) { $kw = new Keyword($this->db); $this->addKeyword($kw->keyword_id); } }
protected function buildHeadline($data, $params = '') { $this->setHeadline("Быстрый поиск {KEYWORD:в " . rus_city_pad($data['l_geo_city']) . "}"); }
protected function buildDescription1($data) { $this->setDescription1("аренде квартир в " . rus_city_pad($data['l_geo_city'])); }