You are here

function ARC_api_helper::arg in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 5.2 arc/ARC_api_helper.php \ARC_api_helper::arg()
  2. 5 arc/ARC_api_helper.php \ARC_api_helper::arg()
  3. 6 arc/ARC_api_helper.php \ARC_api_helper::arg()

File

arc/ARC_api_helper.php, line 311

Class

ARC_api_helper

Code

function arg($name = "", $multi = false, $mthd = false) {
  $mthd = strtolower($mthd);
  if ($multi) {
    $qs = "";
    if (!$mthd || $mthd == "post") {
      $qs = @file_get_contents('php://input');
    }
    if (!$qs) {
      $qs = "&" . @$_SERVER["QUERY_STRING"] . "&";
    }
    if (preg_match_all("/\\&" . $name . "=([^\\&]*)/", $qs, $matches)) {
      foreach ($matches[1] as $i => $val) {
        $matches[1][$i] = stripslashes($val);
      }
      return $matches[1];
    }
    return array();
  }
  if ($mthd == "post") {
    return isset($_POST[$name]) ? stripslashes($_POST[$name]) : false;
  }
  if ($mthd == "get") {
    return isset($_GET[$name]) ? stripslashes($_GET[$name]) : false;
  }
  return isset($_POST[$name]) ? stripslashes($_POST[$name]) : (isset($_GET[$name]) ? stripslashes($_GET[$name]) : false);
}