function save_site_css($response, $data) { $css = $data['store']; $global_settings = pl_settings(); $global_settings['settings']['site_css'] = $css; pl_settings_update($global_settings); return $response; }
function save_draft($pageID, $typeID, $pageData) { if (isset($pageData['global'])) { pl_settings_update(stripslashes_deep($pageData['global']), 'draft'); } if (isset($pageData['local'])) { pl_settings_update($pageData['local'], 'draft', $pageID); } if (isset($pageData['type']) && $pageID != $typeID) { pl_settings_update($pageData['type'], 'draft', $typeID); } }
function save_form($response, $data) { $form = $data['store']; $scope = $data['scope']; $key = isset($data['key']) ? $data['key'] : false; $uid = isset($data['uid']) && $data['uid'] != 'false' ? $data['uid'] : false; if (!empty($uid)) { global $sections_data_handler; $response['result'] = $sections_data_handler->update_or_insert(array('uid' => $uid, 'draft' => $form[$uid])); } if ($scope == 'global' || isset($form['settings']) && is_array($form['settings'])) { $global_settings = pl_settings(); // First parse sub settings field if (isset($form['settings'])) { $form['settings'] = wp_parse_args($form['settings'], $global_settings['settings']); } $response['form'] = $form; $global_settings = wp_parse_args($form, $global_settings); pl_settings_update($global_settings); } if ($scope == 'type' || $scope == 'local') { $metaID = $scope == 'type' ? $data['typeID'] : $data['pageID']; $meta_settings = pl_settings('draft', $metaID); $meta_settings = wp_parse_args($form, $meta_settings); pl_settings_update($meta_settings, 'draft', $metaID); } if ($scope == 'template') { $handler = new PLCustomTemplates(); $old_settings = $handler->retrieve_field($key, 'settings'); $settings = wp_parse_args($form, $old_settings); $handler->update($key, array('settings' => $settings)); } if ($scope == 'section') { $handler = new PLCustomSections(); $old_settings = $handler->retrieve_field($key, 'settings'); $settings = wp_parse_args($form, $old_settings); $handler->update($key, array('settings' => $settings)); $response['settings'] = $settings; $response['new'] = $handler->retrieve($key); } $response['scope'] = $scope; return $response; }