function save_api_key($op) { $key = op_get_var($op, OptimizePress_Sl_Api::OPTION_API_KEY_PARAM); $status = op_sl_register($key); if (is_wp_error($status)) { op_tpl_error('op_sections_' . OptimizePress_Sl_Api::OPTION_API_KEY_PARAM, __('API key is invalid. Please re-check it.', OP_SN)); } else { op_sl_save_key($key); } }
function save_layout_columns($op) { if (isset($op['column_layout'])) { $op = op_get_var($op, 'column_layout', array()); $layouts = op_theme_config('layouts'); $cur_layout = op_default_option('column_layout', 'option'); $cur_layout = $cur_layout == '' ? key($layouts['layouts']) : $cur_layout; $new_layout = array('option' => op_get_var($op, 'option', $cur_layout), 'widths' => array()); if (isset($layouts['layouts'][$new_layout['option']])) { $def_widths = op_get_var($layouts['layouts'][$new_layout['option']], 'widths', array()); $new_widths = op_get_var($op, 'widths', array()); foreach ($def_widths as $name => $options) { $val = op_get_var($new_widths, $name, $options['width']); if (!($val >= $options['min'] && $val <= $options['max'])) { op_tpl_error('op_sections_column_layout_withs_' . $name, sprintf(__('The %1$s column must be between %2$s and %3$s.', 'optimizepress'), $options['title'], $options['min'], $options['max']), 'layout_column_layout'); } else { $new_layout['widths'][$name] = $val; } } } op_update_option('column_layout', $new_layout); } }
function save_flowplayer_license($op) { if (empty($op['flowplayer_license']['custom_logo']) && empty($op['flowplayer_license']['license_key']) && empty($op['flowplayer_license']['js_file']) && empty($op['flowplayer_license']['swf_file'])) { /* * If every param is empty, we aren't trying to license flowplayer */ op_delete_option('flowplayer_license'); return; } else { if (empty($op['flowplayer_license']['license_key']) || empty($op['flowplayer_license']['js_file']) || empty($op['flowplayer_license']['swf_file'])) { op_group_error('global_settings'); op_section_error('global_settings_flowplayer_license'); op_tpl_error('op_sections_flowplayer_license', __('To remove Flowplayer watermark and/or to use custom logo, license key, HTML5 and Flash commercial version files needs to be present.', OP_SN)); } } op_update_option('flowplayer_license', $op['flowplayer_license']); }