Use filter_var() over base/filter.php, which is going away soon.
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 26 May 2015 02:24:31 +0000 (22:24 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 26 May 2015 02:24:31 +0000 (22:24 -0400)
data/profiling_pdo.php
views/template.php

index 4b1a9d2968916e186e2325167bce7f00e60b35ca..cd055b8aa5fe6c96d8c90535e4988888368dfc79 100644 (file)
@@ -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<ol>\n\t\t\t\t<li>";
-        $debug .= implode("</li>\n\t\t\t\t<li>", \hoplite\base\filter\String($query['params']));
+        $debug .= implode("</li>\n\t\t\t\t<li>", filter_var_array($query['params'], FILTER_SANITIZE_SPECIAL_CHARS));
         $debug .= "</li>\n\t\t\t</ol>\n";
       }
       $debug .= "\n\t\t\t<div style=\"font-size: 9px;\">(" .
index 2aeb4554e53b8cbd4b0e2c34bb65e77f0171cb32..da6857d69a514af2d800ec419d6a0c46c2ec3a35 100644 (file)
@@ -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: