/** * @dataProvider escapeStrings */ public function testEscape($text, $expected) { $this->assertEquals(Advisor::escapePercent($text), $expected); }
/** * Wrapper function for translating. * * @param string $str the string * @param mixed $param the parameters * * @return string */ function translate($str, $param = null) { $string = _gettext(Advisor::escapePercent($str)); if (!is_null($param)) { $params = $this->ruleExprEvaluate('array(' . $param . ')'); } else { $params = array(); } return vsprintf($string, $params); }
/** * Wrapper function for translating. * * @param string $str * @param mixed $param * * @return string */ function translate($str, $param = null) { if (is_null($param)) { return sprintf(_gettext(Advisor::escapePercent($str))); } else { $printf = 'sprintf("' . _gettext(Advisor::escapePercent($str)) . '",'; return $this->ruleExprEvaluate($printf . $param . ')', strlen($printf)); } }
/** * Wrapper function for translating. * * @param string $str the string * @param mixed $param the parameters * * @return string */ function translate($str, $param = null) { $string = _gettext(Advisor::escapePercent($str)); if (!is_null($param)) { $param = $this->ruleExprEvaluate($param); } return sprintf($string, $param); }