Пример #1
0
 /**
  * Redirect function to current admin page with errors and messages specified
  *
  * @param array   $params
  * @param array   $errors
  * @param array   $notes
  * @param bool    $check_referrer
  * @return void
  */
 public static function redirect_with_custom_messages($params, $errors = null, $notes = null, $check_referrer = false)
 {
     if (empty($errors) && Util_Admin::single_system_item($notes)) {
         Util_Admin::redirect(array_merge($params, array('w3tc_note' => $notes[0])), $check_referrer);
         return;
     }
     if (Util_Admin::single_system_item($errors) && empty($notes)) {
         Util_Admin::redirect(array_merge($params, array('w3tc_error' => $errors[0])), $check_referrer);
         return;
     }
     $message_id = uniqid();
     set_transient('w3tc_message', array($message_id => array('errors' => $errors, 'notes' => $notes)), 600);
     Util_Admin::redirect(array_merge($params, array('w3tc_message' => $message_id)), $check_referrer);
 }