From 31600eeb381d24a83267ad4d892df3692ed0faea Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 25 May 2015 22:24:31 -0400 Subject: [PATCH] Use filter_var() over base/filter.php, which is going away soon. --- data/profiling_pdo.php | 3 +-- views/template.php | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/data/profiling_pdo.php b/data/profiling_pdo.php index 4b1a9d2..cd055b8 100644 --- a/data/profiling_pdo.php +++ b/data/profiling_pdo.php @@ -18,7 +18,6 @@ namespace hoplite\data; use \hoplite\base\Profiling; -require_once HOPLITE_ROOT . '/base/filter.php'; require_once HOPLITE_ROOT . '/base/profiling.php'; /*! @@ -118,7 +117,7 @@ class ProfilingPDO extends \PDO $debug .= "\n\t\t\t$query[query]\n\n"; if (isset($query['params'])) { $debug .= "\t\t\t
    \n\t\t\t\t
  1. "; - $debug .= implode("
  2. \n\t\t\t\t
  3. ", \hoplite\base\filter\String($query['params'])); + $debug .= implode("
  4. \n\t\t\t\t
  5. ", filter_var_array($query['params'], FILTER_SANITIZE_SPECIAL_CHARS)); $debug .= "
  6. \n\t\t\t
\n"; } $debug .= "\n\t\t\t
(" . diff --git a/views/template.php b/views/template.php index 2aeb455..da6857d 100644 --- a/views/template.php +++ b/views/template.php @@ -18,7 +18,6 @@ namespace hoplite\views; use \hoplite\base\Profiling; -require_once HOPLITE_ROOT . '/base/filter.php'; require_once HOPLITE_ROOT . '/base/profiling.php'; /*! @@ -254,7 +253,7 @@ class Template // No specifier defaults to escaped string. if ($formatter_pos === FALSE) - return 'echo hoplite\\base\\filter\\String(' . $macro . ')'; + return 'echo filter_var(' . $macro . ', FILTER_SANITIZE_STRING)'; $expression = trim(substr($macro, 0, $formatter_pos)); @@ -264,7 +263,7 @@ class Template switch (strtolower($formatter)) { case 'int': return "echo intval($expression)"; case 'float': return "echo floatval($expression)"; - case 'str': return "echo hoplite\\base\\filter\\String($expression)"; + case 'str': return "echo filter_var($expression, FILTER_SANITIZE_STRING)"; case 'raw': return "echo $expression"; case 'json': return "echo json_encode($expression)"; default: -- 2.43.5