Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __construct($string)
 {
     if (!is_string($string)) {
         throw new Textpattern_Filter_Exception(gTxt('assert_string'));
     }
     parent::__construct($string);
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param string $string The string
  */
 public function __construct($string)
 {
     $this->string = (string) $string;
     if (self::$mbString === null) {
         self::$mbString = function_exists('mb_strlen');
     }
     if (self::$encode === null) {
         self::$encode = function_exists('utf8_decode');
     }
 }
Example #3
0
/**
 * Calls a core or custom function to render a preference input widget.
 *
 * @param  string $func Callable in a string presentation
 * @param  string $name HTML name/id of the input control
 * @param  string $val  Initial (or current) value of the input control
 * @param  int    $size Size of the input control (width or depth, dependent on control)
 * @return string HTML
 */
function pref_func($func, $name, $val, $size = '')
{
    if ($func != 'func' && is_callable('pref_' . $func)) {
        $func = 'pref_' . $func;
    } else {
        $string = new Textpattern_Type_String($func);
        $func = $string->toCallback();
        if (!is_callable($func)) {
            $func = 'text_input';
        }
    }
    return call_user_func($func, $name, $val, $size);
}