Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dev.biuro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biuro
dev.biuro
Commits
e2129363
Commit
e2129363
authored
Mar 28, 2019
by
Andrius Mickus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
darbo rusys
parent
58f89e67
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
59 deletions
+20
-59
nginx.conf
nginx/nginx.conf
+1
-1
JsonDataCollector.php
wp-content/plugins/jobs-importer/JsonDataCollector.php
+19
-58
No files found.
nginx/nginx.conf
View file @
e2129363
...
@@ -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
...
...
wp-content/plugins/jobs-importer/JsonDataCollector.php
View file @
e2129363
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment