Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Danny Froberg
Polylang Cli
Commits
c5f0414a
Commit
c5f0414a
authored
Aug 09, 2017
by
Peter J. Herrel
Committed by
GitHub
Aug 09, 2017
Browse files
Merge pull request #86 from diggy/fix-wp-pll-option-sync/unsync
fix wp pll option sync/unsync
parents
d32d8ce1
a97e6944
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Commands/Option.php
View file @
c5f0414a
...
...
@@ -255,7 +255,7 @@ class OptionCommand extends BaseCommand
if
(
$args
[
0
]
===
'all'
)
{
$this
->
pll
->
model
->
options
[
'sync'
]
=
array_fill_keys
(
array_keys
(
$this
->
options_sync
),
1
);
$this
->
pll
->
model
->
options
[
'sync'
]
=
array_keys
(
$this
->
options_sync
);
# update options, default category and nav menu locations
$this
->
pll
->
model
->
update_default_lang
(
$this
->
api
->
default_language
()
);
...
...
@@ -277,7 +277,7 @@ class OptionCommand extends BaseCommand
$settings
=
(
array
)
$this
->
pll
->
model
->
options
[
'sync'
];
# update current settings
$settings
=
array_merge
(
$settings
,
array_fill_keys
(
$args
,
1
)
);
$settings
=
array_merge
(
$settings
,
$args
);
$this
->
pll
->
model
->
options
[
'sync'
]
=
$settings
;
...
...
@@ -332,9 +332,10 @@ class OptionCommand extends BaseCommand
$args
=
explode
(
','
,
$args
[
0
]
);
# validate args
foreach
(
$args
as
$key
)
{
foreach
(
$args
as
$i
=>
$key
)
{
if
(
!
in_array
(
$key
,
array_keys
(
$this
->
options_sync
)
)
)
{
return
$this
->
cli
->
error
(
sprintf
(
'Invalid key: %s'
,
$key
)
);
unset
(
$args
[
$i
]
);
$this
->
cli
->
warning
(
sprintf
(
'Invalid key: %s'
,
$key
)
);
}
}
...
...
@@ -342,9 +343,9 @@ class OptionCommand extends BaseCommand
$settings
=
(
array
)
$this
->
pll
->
model
->
options
[
'sync'
];
# update current settings
$settings
=
array_diff
_key
(
$settings
,
array_fill_keys
(
$args
,
1
)
);
$settings
=
array_diff
(
$settings
,
$args
);
$this
->
pll
->
model
->
options
[
'sync'
]
=
$settings
;
$this
->
pll
->
model
->
options
[
'sync'
]
=
array_values
(
$settings
)
;
# update options, default category and nav menu locations
$this
->
pll
->
model
->
update_default_lang
(
$this
->
api
->
default_language
()
);
...
...
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