BaseHandler.php
11 years ago
EmptyTrashHandler.php
11 years ago
GetTaxonomiesHandler.php
11 years ago
ListingSortHandler.php
11 years ago
NestToggleHandler.php
11 years ago
NewChildHandler.php
11 years ago
NewLinkHandler.php
11 years ago
QuickEditHandler.php
11 years ago
QuickEditLinkHandler.php
11 years ago
SearchHandler.php
11 years ago
SortHandler.php
11 years ago
SyncMenuHandler.php
11 years ago
SyncMenuHandler.php
32 lines
| 1 | <?php namespace NestedPages\Form\Handlers; |
| 2 | |
| 3 | /** |
| 4 | * Turn on/off menu sync |
| 5 | * @return json response |
| 6 | */ |
| 7 | class SyncMenuHandler extends BaseHandler { |
| 8 | |
| 9 | public function __construct() |
| 10 | { |
| 11 | parent::__construct(); |
| 12 | $this->updateSync(); |
| 13 | $this->sendResponse(); |
| 14 | } |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * Update the sync setting |
| 19 | */ |
| 20 | private function updateSync() |
| 21 | { |
| 22 | if ( $this->data['syncmenu'] == 'sync' ){ |
| 23 | update_option('nestedpages_menusync', 'sync'); |
| 24 | $this->syncMenu(); |
| 25 | $this->response = array('status'=>'success', 'message'=> __('Menu sync enabled.')); |
| 26 | } else { |
| 27 | update_option('nestedpages_menusync', 'nosync'); |
| 28 | $this->response = array('status'=>'success', 'message'=> __('Menu sync disabled.')); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | } |