예제 #1
0
 public static function saveSettings()
 {
     $error = '';
     foreach ($_REQUEST as $key => $value) {
         if ($key[0] != '_' && $key != 'action' && $key != 'submit') {
             if (is_array($value)) {
                 $value = implode('~', $value);
             }
             if ($key == 'wpeditor_logging' && $value == '1') {
                 try {
                     WPEditorLog::createLogFile();
                 } catch (WPEditorException $e) {
                     $error = $e->getMessage();
                     WPEditorLog::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Caught WPEditor exception: " . $e->getMessage());
                 }
             }
             WPEditorSetting::setValue($key, trim(stripslashes($value)));
         }
     }
     if (isset($_REQUEST['_tab'])) {
         WPEditorSetting::setValue('settings_tab', $_REQUEST['_tab']);
     }
     if ($error) {
         $result[0] = 'WPEditorAjaxError';
         $result[1] = '<h3>' . __('Warning', 'wpeditor') . "</h3><p>{$error}</p>";
     } else {
         $result[0] = 'WPEditorAjaxSuccess';
         $result[1] = '<h3>' . __('Success', 'wpeditor') . '</h3><p>' . $_REQUEST['_success'] . '</p>';
     }
     $out = json_encode($result);
     echo $out;
     die;
 }