Commit e2129363 authored by Andrius Mickus's avatar Andrius Mickus

darbo rusys

parent 58f89e67
...@@ -97,7 +97,7 @@ http { ...@@ -97,7 +97,7 @@ http {
include h5bp/web_performance/compression-brotli.conf; include h5bp/web_performance/compression-brotli.conf;
# Specify file cache expiration. # Specify file cache expiration.
include h5bp/web_performance/cache_expiration.conf; #include h5bp/web_performance/cache_expiration.conf;
# Add X-XSS-Protection for HTML documents. # Add X-XSS-Protection for HTML documents.
# h5bp/security/x-xss-protection.conf # h5bp/security/x-xss-protection.conf
......
...@@ -12,7 +12,7 @@ class JsonDataCollector ...@@ -12,7 +12,7 @@ class JsonDataCollector
'title' => 'pareigos', 'title' => 'pareigos',
'post_content' => 'aprasymas', 'post_content' => 'aprasymas',
'slug' => 'seo_url', 'slug' => 'seo_url',
'contact' => 'kontaktai', 'contact' => 'contacts',
'salary_from' => 'atlygis_nuo', 'salary_from' => 'atlygis_nuo',
'salary_to' => 'atlygis_iki', 'salary_to' => 'atlygis_iki',
// 'email' => 'email', // 'email' => 'email',
...@@ -32,14 +32,21 @@ class JsonDataCollector ...@@ -32,14 +32,21 @@ class JsonDataCollector
], ],
'field' => [ 'field' => [
'slug' => 'kategorija', 'slug' => 'kategorija',
'name' => 'sritis' 'name' => 'sritis',
'__primary' => true,
'additionalCategories' => [
'slug' => 'category_id',
'name' => 'category_name',
]
], ],
'company' => [ 'company' => [
'name' => 'imone' 'name' => 'imone'
], ],
'type' => [ 'type' => [
'slug' => 'type', 'types' => [
'name' => 'type' 'slug' => 'type_id',
'name' => 'type_name'
]
], ],
// 'tag' // 'tag'
// 'position', // 'position',
...@@ -53,17 +60,6 @@ class JsonDataCollector ...@@ -53,17 +60,6 @@ class JsonDataCollector
], ],
]; ];
protected $collections = [
'city' => [
'name' => 'additionalCities',
'map' => [
'slug' => 'city_id',
'name' => 'city',
],
'append' => 'terms:city'
]
];
// Language map // Language map
protected $lang = 'kalba'; protected $lang = 'kalba';
...@@ -139,25 +135,6 @@ class JsonDataCollector ...@@ -139,25 +135,6 @@ class JsonDataCollector
$item['posts'] = $this->getPosts($ad); $item['posts'] = $this->getPosts($ad);
$item['relations'] = $this->relationsMap; $item['relations'] = $this->relationsMap;
// foreach ($this->dataMap as $mapKey => $dataKey) {
// $dataValue = $ad->{$dataKey};
// $itemValue = $this->getValue($dataValue);
// $postValue = $this->getValue($dataValue);
// $item[$mapKey] = $itemValue;
//
//// if (array_key_exists($mapKey, $this->relationsMap)) {
//// $item['related_items'][$mapKey] = $this->relationsMap[$mapKey];
//// }
// }
//
// foreach ($this->relationsMap as $keyItem => $valueItem) {
// if (array_key_exists($keyItem, $item) && array_key_exists($valueItem, $item)) {
// $item[$valueItem] = [$valueItem . '_' . $item[$keyItem] => $item[$valueItem]];
// unset($item[$keyItem]);
// }
// }
$result[] = $item; $result[] = $item;
}; };
...@@ -184,11 +161,18 @@ class JsonDataCollector ...@@ -184,11 +161,18 @@ class JsonDataCollector
foreach ($this->terms as $termKey => $termProperties) { foreach ($this->terms as $termKey => $termProperties) {
$result[$termKey][] = $this->getEntity($ad, $termProperties); $entity = $this->getEntity($ad, $termProperties);
if ( ! empty($entity)) {
$result[$termKey][] = $entity;
}
$appends = array_filter($termProperties, function($item) { $appends = array_filter($termProperties, function($item) {
return is_array($item); return is_array($item);
}); });
foreach ($appends as $propertyKey => $propertyValues) { foreach ($appends as $propertyKey => $propertyValues) {
if (isset($ad->{$propertyKey})) { if (isset($ad->{$propertyKey})) {
...@@ -238,29 +222,6 @@ class JsonDataCollector ...@@ -238,29 +222,6 @@ class JsonDataCollector
return $result; return $result;
} }
private function getCollection($ad, $collectionMap)
{
$result = [];
foreach ($this->collections as $collection) {
if (isset($ad->{$collection['name']})) {
$data = $ad->{$collection['name']};
}
$entity = [];
foreach ($collection['map'] as $propertyKey => $propertyValue) {
if (preg_match('/^\_\_/', $propertyKey)) {
$entity[$propertyKey] = $propertyValue;
}
elseif (isset($data[$propertyValue])) {
$dataValue = $data[$propertyValue];
$entity[$propertyKey] = $this->getValue($dataValue);
}
}
}
}
private function getValue($value) private function getValue($value)
{ {
return (is_array($value)) ? $value : html_entity_decode($value); return (is_array($value)) ? $value : html_entity_decode($value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment