本文整理汇总了PHP中Tag::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::__construct方法的具体用法?PHP Tag::__construct怎么用?PHP Tag::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($text, $value = '', $selected = false)
{
parent::__construct('option');
$this->_text = $this->add(new Text($text), true);
$this->_value = $this->attribute('value', $value, true);
$this->_selected = $this->attribute('selected', $selected ? 'selected' : '', true);
}
示例2: __construct
public function __construct($type = null)
{
parent::__construct('i');
if ($type) {
$this->setType($type);
}
}
示例3: __construct
/**
*
* @param string $href
*/
public function __construct($href = '')
{
parent::__construct('link');
$this->attribute('type', 'text/css');
$this->attribute('rel', 'stylesheet');
$this->href = $this->attribute('href', $href, true);
}
示例4: __construct
/**
*
* @param string $doctype
* @param string $xmlns
* @param string $charset
* @param string $title
* @param string $css
* @param string $jq
* @param string $jqm
*/
public function __construct($doctype = Container::DOCTYPE, $xmlns = Container::XMLNS, $charset = Container::CHARSET, $title = Container::TITLE, $css = Container::CSS, $jq = Container::JQUERY_PATH, $jqm = Container::JQUERY_MOBILE_PATH)
{
parent::__construct('html');
$this->_doctype = new Text($doctype);
$this->head = $this->add(new Head($xmlns, $charset, $title, $css, $jq, $jqm), true);
$this->body = $this->add(new Body(), true);
}
示例5: __construct
/**
* @param array $config Configuration options
* @param string[] $config['classes'] CSS class names to add
* @param string $config['id'] HTML id attribute
* @param string $config['text'] Text to insert
* @param array $config['content'] Content to append (after text), strings
* or Element objects. Strings will be HTML-escaped for output, use an
* HtmlSnippet instance to prevent that.
* @param mixed $config['data'] Element data
*/
public function __construct(array $config = array())
{
// Parent constructor
parent::__construct($this->getTagName());
// Initialization
if (isset($config['infusable']) && is_bool($config['infusable'])) {
$this->setInfusable($config['infusable']);
}
if (isset($config['data'])) {
$this->setData($config['data']);
}
if (isset($config['classes']) && is_array($config['classes'])) {
$this->ownClasses = $config['classes'];
$this->addClasses($this->ownClasses);
}
if (isset($config['id'])) {
$this->setAttributes(array('id' => $config['id']));
}
if (isset($config['text'])) {
// JS compatibility
$this->appendContent($config['text']);
}
if (isset($config['content'])) {
$this->appendContent($config['content']);
}
}
示例6: __construct
/**
*
* @staticvar array $default_ids Contains default ids for input to prevent repeats
* @param string $name Input name
* @param mixed $value Default value sent (radio, checkbox) or filled in (text)
* @param string $label Label associated with input
*/
public function __construct($name, $value = null, $label = null)
{
static $default_ids = array();
$this->label = new Label();
$this->setName($name);
if (!isset($default_ids[$this->tag_type])) {
$default_ids[$this->tag_type] = 1;
}
$id_name = preg_replace('|[\\W_]+|', '-', preg_replace('/\\[|\\]/', '', $this->name));
if (isset($default_ids[$id_name])) {
$default_ids[$id_name]++;
$id_name = $id_name . '-' . $default_ids[$id_name];
} else {
$default_ids[$id_name] = 1;
}
$this->setId($id_name);
$this->type = strtolower($this->popClass());
parent::__construct($this->tag_type, $value);
// this MUST come after the above construct
$this->addIgnoreVariables('has_label', 'label_location');
$this->label->addClass($this->getType() . '-label');
if ($label) {
$this->label->setText($label);
}
}
示例7: __construct
public function __construct($text = null, $for = null)
{
if (isset($for)) {
$this->setFor($for);
}
parent::__construct('label', $text);
}
示例8: __construct
/**
*
* @param string $id
* @param array $attributes
* @param array $items
* @param string $theme
* @param boolean $fullscreen
* @param boolean $nobackbtn
*/
public function __construct($id, array $attributes = array(), array $items = array(), $theme = '', $fullscreen = false, $nobackbtn = false)
{
parent::__construct('div', $id, $attributes, $items, $theme);
if (count($items) > 0) {
foreach ($items as $item) {
if ($item instanceof Header) {
$this->_header = $this->add($item, true);
} elseif ($item instanceof Content) {
$this->_content = $this->add($item, true);
} elseif ($item instanceof Footer) {
$this->_footer = $this->add($item, true);
}
}
}
if (!$this->_header) {
$this->_header = $this->add(new Header(), true);
}
if (!$this->_content) {
$this->_content = $this->add(new Content(), true);
}
if (!$this->_footer) {
$this->_footer = $this->add(new Footer(), true);
}
$this->_role = $this->addAttribute(new Attribute('data-role', 'page'), true);
$this->_fullscreen = $this->addAttribute(new Attribute('data-fullscreen', $fullscreen === true ? 'true' : ''), true);
$this->_nobackbtn = $this->addAttribute(new Attribute('data-nobackbtn', $nobackbtn === true ? 'true' : ''), true);
}
示例9: __construct
public function __construct($label, $href = null)
{
parent::__construct('a', $label);
$this->addIgnoreVariables('rel');
if ($href) {
$this->setHref($href);
}
}
示例10: __construct
/**
*
* @param string $id
* @param array $attributes
* @param array $items
* @param string $theme
*/
public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '')
{
parent::__construct('div', $id, $attributes, $items, $theme);
$this->_role = $this->attribute('data-role', 'navbar', true);
$this->items()->prefix('<ul><li>');
$this->items()->separator('</li><li>');
$this->items()->suffix('</li></ul>');
}
示例11: __construct
/**
* @param string $id
* @param array $attributes
* @param array $items
* @param string $theme
* @param string $title
* @param string $position
* @param bool $uiBar
*/
public function __construct($id = '', $attributes = array(), $items = array(), $theme = '', $title = '', $position = 'inline', $uiBar = false)
{
parent::__construct('div', $id, $attributes, $items, $theme);
$this->_role = $this->attribute('data-role', 'header', true);
$this->_position = $this->attribute('data-position', $position, true);
$this->_uiBar = $this->attribute('class', $uiBar ? 'ui-bar' : '', true);
$this->_title = $this->add(new Title($title), true);
}
示例12: __construct
/**
*
* @param string $id
* @param array $attributes
* @param array $items
* @param string $theme
* @param string $title
* @param boolean $collapsed
*/
public function __construct($id = '', array $attributes = array(), array $items = array(), $theme = '', $title = '', $collapsed = true)
{
parent::__construct('div', $id, $attributes, array(), $theme);
$this->_role = $this->attribute('data-role', 'collapsible', true);
$this->_collapsed = $this->attribute('data-collapsed', $collapsed ? 'true' : 'false', true);
$this->_title = $this->add(new Title($title), true);
$this->items()->addFromArray($items);
}
示例13: time
/**
* Return a script object
*
* @param string $source
* @param string $options
* @return LinkCss
* @author Justin Palmer
*/
function __construct($source, $options = '')
{
$app_path = Registry::get('pr-install-path');
if ($app_path != null) {
$source = $app_path . 'public/javascript/' . $source . '?' . time();
}
$this->options = "src:{$source},type:text/javascript";
parent::__construct($options);
}
示例14: __construct
/**
*
* @param string $id
* @param string $legend
* @param array $items
* @param string $theme
* @param string $dataType
* @param boolean $fieldContain
*/
public function __construct($id = '', $legend = '', array $items = array(), $theme = '', $dataType = 'vertical', $fieldContain = false)
{
parent::__construct('fieldset', $id, array(), array(), $theme);
$this->_legend = $this->add(new Tag('legend', '', array(), array($legend)), true);
$this->items()->addFromArray($items);
$this->_role = $this->addAttribute(new Attribute('data-role', 'controlgroup'), true);
$this->_dataType = $this->addAttribute(new Attribute('data-type', $dataType), true);
$this->_fieldContain = $fieldContain;
}
示例15: __construct
/**
*
* @staticvar int $default_id Helps in the creation of form ids if none is set
*/
public function __construct()
{
parent::__construct('form');
$this->action = \Server::getCurrentUrl();
static $default_id = 1;
$this->setId('form-' . $default_id);
$default_id++;
$this->addClass('phpws-form');
}