Recursively sanitize output.

@param $var
@return array
163867
public function scrub($var)
	{
		if (is_string($var)) {
			// Sanitize strings
			return $this->escape($var);

		} elseif (is_array($var)) {
			// Sanitize arrays
                        foreach($var as $key => $value){
				// casting key to string for the case of numeric indexed arrays
				// i.e. 0, 1, etc. b/c 0 == any string in php
				if (!in_array((string)$key, $this->unguarded)) {
					$var[$key] = $this->scrub($value);
				}
			}

			return $var;
		} elseif (is_object($var)) {
			// Sanitize objects
			$values = get_object_vars($var);

			foreach ($values as $key => $value) {
				$var->$key = $this->scrub($value);
			}
			return $var;

		} else {
			// Not sure what this is. null or bool? Just return it.
			return $var;
		}
	}
753563
public function raw($var = null)
    {
        if ($var !== null) {
            $this->raw = (string) $var;
            $this->content = null;
        }

        if (!\is_string($this->raw)) {
            $this->raw = $this->load();
        }

        return $this->raw;
    }
916057
private function sanitize($var) {
        $sanitized = strip_tags($var);
        $sanitized = str_replace('http://', '', $sanitized);
        $sanitized = str_replace('https://', '', $sanitized);
        $sanitized = str_replace('../', '', $sanitized);
        $sanitized = str_replace('./', '', $sanitized);
        return $sanitized;
    }
767603
public function dump_vars($vars)
    {
        $this->last_selector = null;
        $args = array();
        foreach (func_get_args() as $index => $func) {
            if ($func instanceof PheryResponse || $func instanceof PheryFunction) {
                $args[$index] = array($this->typecast($func, true, true));
            } elseif (is_object($func)) {
                $args[$index] = array(get_object_vars($func));
            } else {
                $args[$index] = array($func);
            }
        }

        return $this->cmd(6, $args);
    }
148696
function varIsArray($var)
		{
			$var_ser = serialize($var);
			array_push($this->arrHistory, $var_ser);

			$this->makeTableHeader("array","array");
			if(Arrays::isArray($var)) {
				foreach($var as $key => $value) {
					$this->makeTDHeader("array", $key);

					//check for recursion
					if(Arrays::isArray($value)) {
						$var_ser = serialize($value);
						if(Arrays::inArray($var_ser, $this->arrHistory, TRUE))
							$value = "*RECURSION*";
					}

					if(Arrays::inArray(gettype($value), $this->arrType)) {
						$this->checkType($value);
					} else {
						$value = (trim($value)=="") ? "[empty string]" : $value;
						echo $value;
					}
					echo $this->closeTDRow();
				}
			} else {
				echo "<tr><td>" . $this->error("array") . $this->closeTDRow();
			}
			array_pop($this->arrHistory);
			echo "</table><hr class=thinDebugHr />";
		}
1146717
public function getvar($var, $sanitize = true)
    {
        if(!isset($_GET[$var]) || $_GET[$var]=='') {
            $this->error('INVALID_VAR', [$var]);
        } else {
            if($sanitize) {
                $this->get[$var] = $this->sanitize($_GET[$var]);
            } else {
                $this->get[$var] = $_GET[$var];
            }
            return true;
        }
    }
81745
protected function sanitizeArray($array)
    {
        foreach($array as $key => $value){
            if(is_array($value)){
                $array[$key] = $this->sanitizeArray($value);
            } else {
                $array[$key] = $this->convertStaticPhpExcelConstantsFromStringsToConstants($value);
            }
        }

        return $array;
    }
1072435
public static function dump($var, $echo = true)
    {
        ob_start();
        var_dump($var);

        $output = ob_get_clean();
        $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);

        if (PHP_SAPI == "cli") {
            $output = PHP_EOL . PHP_EOL . $output . PHP_EOL;
        } else {
            $output = "<pre>" . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        }

        if ($echo) echo($output);

        return $output;
    }
215012
protected function _children($var)
    {
        $found = array();

        // Look for access of the form {ns:var}.
        if (strpos($var, ':') !== false) {
            list($ns, $elt) = explode(':', $var, 2);
            foreach ($this->_element->childNodes as $child) {
                if ($child->localName == $elt && $child->prefix == $ns) {
                    $found[] = $child;
                }
            }
        } else {
            foreach ($this->_element->childNodes as $child) {
                if ($child->localName == $var) {
                    $found[] = $child;
                }
            }
        }

        return $found;
    }
358015
protected function decode($var)
    {
        $lines = (array) preg_split('#(\r\n|\n|\r)#', $var);

        $results = array();
        foreach ($lines as $line) {
            preg_match('#^\[(.*)\] (.*)  @  (.*)  @@  (.*)$#', $line, $matches);
            if ($matches) {
                $results[] = ['date' => $matches[1], 'message' => $matches[2], 'url' => $matches[3], 'file' => $matches[4]];
            }
        }

        return $results;
    }
427547
protected function getDumpedHtml($var)
    {
        ob_start();

        dump($var);

        $content = ob_get_contents();

        ob_get_clean();

        return substr($content, strpos($content, '<pre '));
    }
521733
public static function _unset($var) {
        Session::init(true);
        if (!Session::check_checksum()) return false;
        unset($_SESSION[$var]);
        $_SESSION[__SESSION_checksum_var] = Session::make_checksum();
        return true;
    }
1236522
final protected function sanitize($data)
    {
        // Recursively loop through the data array and return the sanitized data
        $sanitized = [];
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $sanitized[$key] = $this->sanitize($value);
            }
        } else {
            $sanitized = trim(strip_tags($data));
        }
        return $sanitized;
    }
259773
static function dumpVariable( $var )
    {
        // If we have var_export (PHP >= 4.2.0) we use the instead
        // provides better output, doesn't require output buffering
        // and doesn't get mangled by Xdebug

        // dl: we should always use 'var_dump' since 'var_export' is
        // unable to handle recursion properly.
        //if ( function_exists( 'var_export' ) )
        //    return var_export( $var, true );

        ob_start();
        var_dump( $var );
        $variableContents = '';
        if ( extension_loaded( 'xdebug' ) )
           $variableContents = self::XDEBUG_SIGNATURE;
        $variableContents .= ob_get_contents();
        ob_end_clean();
        return $variableContents;
    }
918575
public static function sanitizeJsVarName($str)
    {
        $out = preg_replace("/ /", '_', trim($str));
        $out = preg_replace("/[^A-Za-z_]/", '', $out);

        return $out;
    }
321259
private function cleanVariable($input)
    {
        if (is_string($input)) {
            if ($this->shouldSanitizeInput) {
                return trim(strip_tags($input));
            } else {
                return trim($input);
            }
        } else {
            return $input;
        }
    }
591578
public static function remove($var)
    {
        $path = ($var instanceof Model)
            ? self::getPath($var)
            : $var;

        Utils\Utils::arrayPathUnset(self::$models, $path);
    }