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
1ac291c6
Commit
1ac291c6
authored
Apr 17, 2019
by
Andrius Mickus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
importer LV/EE
parent
2d58587b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
18 deletions
+47
-18
jobs-importer.php
wp-content/plugins/jobs-importer/jobs-importer.php
+47
-18
No files found.
wp-content/plugins/jobs-importer/jobs-importer.php
View file @
1ac291c6
...
@@ -38,24 +38,8 @@ function importer_admin_menu()
...
@@ -38,24 +38,8 @@ function importer_admin_menu()
*/
*/
function
do_import
()
function
do_import
()
{
{
// Set environment type
$env
=
getEnvironment
();
$env
=
'prod'
;
$inputFile
=
getSource
(
$env
);
//Set dev env. only on dev subdomain
$subDomain
=
strstr
(
$_SERVER
[
'SERVER_NAME'
],
'.biuro.lt'
,
true
);
if
(
$subDomain
==
'dev'
)
{
$env
=
'dev'
;
}
// Set data source path by environment type
if
(
$env
===
'dev'
)
{
// $inputFile = plugin_dir_path(__FILE__) . "source_data/wp_biuro.php.xml";
// $inputFile = "https://base.biuro.lt/_export/wp_biuro.php";
$inputFile
=
"https://base.biuro.lt/_export/new_wp.php"
;
}
elseif
(
$env
===
'prod'
)
{
// $inputFile = "http://export.biuro.lt/wp_biuro.php";
$inputFile
=
"http://export.biuro.lt/new_wp.php"
;
}
print_r
(
"<div style='background: lightgrey;'>
print_r
(
"<div style='background: lightgrey;'>
<small style='float: right;'>Working in <strong>
$env
</strong> mode</small>
<small style='float: right;'>Working in <strong>
$env
</strong> mode</small>
...
@@ -107,6 +91,51 @@ function do_import()
...
@@ -107,6 +91,51 @@ function do_import()
}
}
function
getSource
(
$env
)
{
$url
=
parse_url
(
site_url
());
$exploded
=
explode
(
'.'
,
$url
[
'host'
]);
$site
=
strtoupper
(
end
(
$exploded
));
switch
(
$site
)
{
case
'LT'
:
$script
=
'new_wp.php'
;
break
;
case
'LV'
:
$script
=
'new_wp_lv.php'
;
break
;
case
'EE'
:
$script
=
'new_wp_ee.php'
;
break
;
}
// Set data source path by environment type
if
(
$env
===
'dev'
)
{
// $inputFile = plugin_dir_path(__FILE__) . "source_data/wp_biuro.php.xml";
// $inputFile = "https://base.biuro.lt/_export/wp_biuro.php";
$inputFile
=
"https://base.biuro.lt/_export/
{
$script
}
"
;
}
elseif
(
$env
===
'prod'
)
{
// $inputFile = "http://export.biuro.lt/wp_biuro.php";
$inputFile
=
"http://export.biuro.lt/
{
$script
}
"
;
}
return
$inputFile
;
}
function
getEnvironment
()
{
// Set environment type
$env
=
'prod'
;
//Set dev env. only on dev subdomain
$subDomain
=
strstr
(
$_SERVER
[
'SERVER_NAME'
],
'.biuro.lt'
,
true
);
if
(
$subDomain
==
'dev'
)
{
$env
=
'dev'
;
}
return
$env
;
}
function
current_location
()
function
current_location
()
{
{
if
(
isset
(
$_SERVER
[
'HTTPS'
])
&&
if
(
isset
(
$_SERVER
[
'HTTPS'
])
&&
...
...
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