当前位置: 首页>>代码示例>>PHP>>正文


PHP Text::render方法代码示例

本文整理汇总了PHP中Text::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::render方法的具体用法?PHP Text::render怎么用?PHP Text::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Text的用法示例。


在下文中一共展示了Text::render方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRender

 /**
  * @covers Xoops\Form\Text::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertTrue(false !== strpos($value, '<input'));
     $this->assertTrue(false !== strpos($value, 'type="text"'));
     $this->assertTrue(false !== strpos($value, 'name="name"'));
     $this->assertTrue(false !== strpos($value, 'size="10"'));
     $this->assertTrue(false !== strpos($value, 'maxlength="20"'));
     $this->assertTrue(false !== strpos($value, 'placeholder="placeholder"'));
     $this->assertTrue(false !== strpos($value, 'title="Caption"'));
     $this->assertTrue(false !== strpos($value, 'id="name"'));
     $this->assertTrue(false !== strpos($value, 'value="value"'));
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:17,代码来源:TextTest.php

示例2: render

 public function render()
 {
     $this->setValue(null);
     // ensure the value is not displayed
     $this->set('type', 'password');
     return parent::render();
 }
开发者ID:irfanevrens,项目名称:html,代码行数:7,代码来源:Password.php

示例3: testPlacementAppend

 public function testPlacementAppend()
 {
     $decorator = new Text('foo');
     $decorator->setOption('placement', 'append');
     $expected = 'barfoo';
     $actual = $decorator->render('bar');
     $this->assertSame($expected, $actual);
 }
开发者ID:urbanetter,项目名称:muentschi,代码行数:8,代码来源:TextTest.php

示例4: render

 public function render(array $attributes = [], array $viewData = [])
 {
     $this->options = array_merge($this->getOptions(), $attributes);
     $value = request($this->name, $this->getOption('value'));
     if ($this->isChecked($value)) {
         $this->options['checked'] = 'checked';
     }
     return parent::render($attributes, $viewData);
 }
开发者ID:administrcms,项目名称:form,代码行数:9,代码来源:Checkbox.php

示例5: render

 public function render(array $attributes = [], array $viewData = [])
 {
     $this->options = array_merge($this->options, $attributes);
     // Since the hidden type does not have a label,
     // we can use its value to pass the value of the hidden
     if (strlen($this->getOption('value')) === 0) {
         $this->options['value'] = $this->getLabel();
         $this->value = $this->getLabel();
     }
     return parent::render($attributes, $viewData);
 }
开发者ID:administrcms,项目名称:form,代码行数:11,代码来源:Hidden.php

示例6: render

 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     $xoops = \Xoops::getInstance();
     if ($xoops->theme()) {
         $xoops->theme()->addScript('include/color-picker.js');
     } else {
         echo '<script type="text/javascript" src="' . \XoopsBaseConfig::get('url') . '/include/color-picker.js"></script>';
     }
     $this->setExtra(' style="background-color:' . $this->getValue() . ';"');
     return parent::render() . "<button class='btn' type='button' onclick=\"return TCP.popup('" . \XoopsBaseConfig::get('url') . "/include/',document.getElementById('" . $this->getName() . "'));\"> ... </button>";
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:16,代码来源:ColorPicker.php

示例7: render

 /**
  * render
  *
  * @return string
  */
 public function render()
 {
     $xoops = \Xoops::getInstance();
     if ($xoops->theme()) {
         $xoops->theme()->addScript('include/color-picker.js');
     } else {
         echo '<script type="text/javascript" src="' . $xoops->url('/include/color-picker.js') . '"></script>';
     }
     $temp = $this->get('value', '');
     if (!empty($temp)) {
         $this->set('style', 'background-color:' . $temp . ';');
     }
     return parent::render() . "<button class='btn' type='button' onclick=\"return TCP.popup('" . $xoops->url('/include/') . "',document.getElementById('" . $this->getName() . "'));\"> ... </button>";
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:19,代码来源:ColorPicker.php

示例8: valid

 public static function valid($rules, $data)
 {
     static::$errors = [];
     static::triggerOnce('init');
     self::$data = $data = (array) $data;
     foreach ((array) $rules as $field_name => $rule) {
         $current = isset($data[$field_name]) ? $data[$field_name] : null;
         if (is_callable($rule)) {
             static::$errors[$field_name] = call_user_func($rule, $current);
             continue;
         } elseif (is_string($rule)) {
             $current_rules = array_flip(preg_split('/\\s*\\|\\s*/', $rule));
         } else {
             $current_rules = (array) $rule;
         }
         static::$errors[$field_name] = true;
         foreach ($current_rules as $method => $message) {
             $meth_name = strtok($method, ':');
             $opts = strtok(':') ?: '';
             $opts = $opts ? json_decode("[{$opts}]") : [];
             $meth_opts = $opts ? array_merge([$current], $opts) : [$current];
             if (static::$errors[$field_name] !== true) {
                 continue 2;
             }
             if (empty(static::$methods[$meth_name])) {
                 static::$errors[$field_name] = true;
             } else {
                 if (call_user_func_array(static::$methods[$meth_name]->validate, $meth_opts)) {
                     static::$errors[$field_name] = true;
                 } else {
                     $arg = [];
                     foreach ($meth_opts as $key => $value) {
                         $arg["arg_{$key}"] = $value;
                     }
                     static::$errors[$field_name] = Text::render(static::$methods[$meth_name]->message, $arg);
                 }
             }
         }
     }
     self::$data = [];
     // Clean non-errors
     static::$errors = array_filter(static::$errors, function ($v) {
         return $v !== true;
     });
     return empty(static::$errors);
 }
开发者ID:caffeina-core,项目名称:core,代码行数:46,代码来源:Check.php

示例9: testInput

 public function testInput()
 {
     $text = new Text(['value' => "Valor", 'id' => 'id']);
     $text->setPlaceholder("Placeholder");
     $this->assertEquals($text->render(), '<div><input value="Valor" id="id" type="text" placeholder="Placeholder" /></div>');
 }
开发者ID:LeandroSenni,项目名称:Code.Education.DesignPatterns,代码行数:6,代码来源:TextTest.php

示例10: testWords

 /**
  * @dataProvider dataProviderTestWords
  */
 public function testWords($in, $out)
 {
     $this->assertSame($out, $this->me->render(new \Inml\Text($in)));
 }
开发者ID:ptrofimov,项目名称:inml,代码行数:7,代码来源:TextTest.php

示例11: translate

 public static function translate($text, $params = null)
 {
     $result = static::get(static::$current_lang . '.' . strtolower($text), $text);
     return $params ? Text::render($result) : $result;
 }
开发者ID:caffeina-core,项目名称:translation,代码行数:5,代码来源:Language.php


注:本文中的Text::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。