예제 #1
0
 /**
  * @dataProvider escapeStrings
  */
 public function testEscape($text, $expected)
 {
     $this->assertEquals(Advisor::escapePercent($text), $expected);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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));
     }
 }
예제 #4
0
 /**
  * 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);
 }