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


PHP DOMElement::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Created a new HTML Element
  *
  * @param string $name         The tag name of the element
  * @param string $value        The value of the element.
  * @param string $namespaceURI A namespace URI to create the element within a specific namespace.
  * @param bool   $createDoc    Whether or not to create parent document and append to
  */
 public function __construct($name = 'div', $value = null, $namespaceURI = null, $createDoc = false)
 {
     parent::__construct($name, $value, $namespaceURI);
     if ($createDoc) {
         (new \DOMDocument())->appendChild($this);
     }
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:15,代码来源:html_el.php

示例2: __construct

 /**
  * @param null|DOMDocument $dom
  * @param $root
  * @param array $atts
  * @param string $tag
  */
 public function __construct($root = null, $atts = array(), $tag = 'param', $value = '')
 {
     //get ns
     if (HW_XML::getNS($tag)) {
         //namespace detect
         $ns = HW_WXR_Parser_SimpleXML::valid_namespaces(null, HW_XML::getNS($tag));
         parent::__construct($tag, null, $ns);
     } else {
         parent::__construct($tag);
     }
     if ($atts instanceof DOMElement) {
         $this->element = $atts;
     } else {
         $this->element = $this;
     }
     if (!$this->element->ownerDocument) {
         //make sure element not move from exists dom
         $this->dom = new DOMDocument(HW_Export::XML_VERSION, HW_Export::XML_ENCODING);
         //note: add to dom before do anything on DOMElement object
         $this->element = $this->dom->importNode($this->element, true);
         //convert
         $this->dom->appendChild($this->element);
     } else {
         $this->dom = $this->element->ownerDocument;
     }
     if (!empty($value) && is_string($value)) {
         $this->element->nodeValue = $value;
     }
     if (is_array($atts) && count($atts)) {
         foreach ($atts as $key => $value) {
             $this->element->setAttribute($key, $value);
         }
     }
     //$this->nodeValue = '';  //remove node value
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:41,代码来源:wxr-data-type.php

示例3: __construct

 public function __construct($name, $value = '', $namespaceURI = '')
 {
     list($ns, $name) = $this->splitns($name);
     $value = htmlspecialchars($value);
     if (!$namespaceURI && $ns) {
         $namespaceURI = $this->namespaces[$ns];
     }
     parent::__construct($name, $value, $namespaceURI);
 }
开发者ID:seblucas,项目名称:php-epub-meta,代码行数:9,代码来源:EPubDOMElement.php

示例4: __construct

 /**
  * Class constructor | Creates a new DOMElement
  *
  * @param string $name         [TagName for new element]
  * @param string $value        [nodeValue/textContent for new element]
  * @param string $namespaceURI [Namespace for new element]
  */
 public function __construct($name, $content = null, $namespaceURI = null)
 {
     if (is_string($content) or is_numeric($content)) {
         parent::__construct($name, "{$content}", $namespaceURI);
     } elseif (isset($content) and is_object($content) and in_array(get_class($content), ['DOMElement', 'DOMNode', 'core\\resources\\XML_Node'])) {
         parent::__construct($name, null, $namespaceURI);
         $this->append($content);
     } else {
         parent::__construct($name, null, $namespaceURI);
     }
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:18,代码来源:xml_node.php

示例5: __construct

 /**
  * Creates a new <script> element with options for src, async, defer, and type
  *
  * @param string $src   The source URL
  * @param bool   $async Whether or not the script is to be asynchronous
  * @param bool   $defer Whether or not to defer parsing of script
  * @param string $type  The type attribute, defaults to "application/javascript" without version
  */
 public function __construct($src, $async = false, $defer = false, $type = 'application/javascript')
 {
     parent::__construct('script');
     (new \DOMDocument('1.0', 'UTF-8'))->appendChild($this);
     $this->setAttribute('src', $src);
     $this->setAttribute('type', $type);
     if ($async) {
         $this->setAttribute('async', 'async');
     }
     if ($defer) {
         $this->setAttribute('defer', 'defer');
     }
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:21,代码来源:script.php

示例6: __construct

 /**
  * Creates a new <dialog> element, along with the delete/close button
  *
  * @param string $id      The id attribute, used to close/delete & show dialog
  * @param mixed  $content String or \DOMNode
  */
 public function __construct($id, $content = null)
 {
     $this->id = "#{$id}" . self::ID_SUFFIX;
     parent::__construct(self::TAG);
     (new \DOMDocument('1.0', 'UTF-8'))->appendChild($this);
     $this->setAttribute('id', $id . self::ID_SUFFIX);
     $this->appendChild(new \DOMElement('button'))->setAttribute('data-delete', $this->id);
     $fullscreen = $this->appendChild(new \DOMElement('button'));
     $fullscreen->setAttribute('data-fullscreen', $this->id);
     $fullscreen->setAttribute('title', 'View full-screen');
     $this->appendChild(new \DOMElement('br'));
     $svg = $fullscreen->appendChild(new \DOMElement('svg'));
     $svg->setAttribute('class', 'currentColor icon');
     $use = $svg->appendChild(new \DOMElement('use'));
     $use->setAttribute('xlink:href', 'images/icons/combined.svg#screen-full');
     if ($content instanceof \DOMNode) {
         $this->appendChild(isset($content->ownerDocument) ? $this->ownerDocument->importNode($content, true) : $content);
     } elseif (is_string($content)) {
         $this->importHTML($content);
     }
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:27,代码来源:dialog.php

示例7: __construct

 /**
  * Creates the table element, along with its head, foot, & body
  *
  * @param string $col ...    Any number of strings to create columns from
  */
 public function __construct()
 {
     parent::__construct('table');
     (new \DOMDocument('1.0', 'UTF-8'))->appendChild($this);
     $this->_headers = array_filter(func_get_args(), 'is_string');
     $this->_headers = array_map('strtolower', $this->_headers);
     $this->_getEmptyRow();
     $this->_thead = $this->appendChild(new THead());
     $this->_tfoot = $this->appendChild(new TFoot());
     $this->_tbody = $this->appendChild(new TBody());
     $this->_thead->build($this->_headers);
     $this->_tfoot->build($this->_headers);
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:18,代码来源:table.php

示例8: __construct

 public function __construct()
 {
     parent::__construct('testsuite');
 }
开发者ID:ryanaslett,项目名称:junit-xml,代码行数:4,代码来源:TestSuiteElement.php

示例9: __construct

 /**
  * Create a new instance of XDOMElement.
  *
  * @param string      $name         The tag name of the element.
  * @param string|null $value        The value of the element.
  * @param string|null $namespaceURI The namespace of the element.
  */
 public function __construct($name, $value = null, $namespaceURI = null)
 {
     parent::__construct($name, null, $namespaceURI);
 }
开发者ID:pazjacket,项目名称:j0k3r-_-f43.me,代码行数:11,代码来源:XDOMElement.php

示例10: __construct

 /**
  * @param string $name
  * @param string $value
  * @param string $namespaceURI
  */
 public function __construct($name = null, $value = null, $namespaceURI = null)
 {
     parent::__construct('testsuite', $value, $namespaceURI);
 }
开发者ID:piece,项目名称:stagehand-testrunner,代码行数:9,代码来源:TestsuiteDOMElement.php

示例11: __construct

 public function __construct($rows = 1, $cols = 1)
 {
     $this->rows = $rows;
     $this->cols = $cols;
     parent::__construct('table');
 }
开发者ID:BackupTheBerlios,项目名称:phtmlwidgets-svn,代码行数:6,代码来源:PHTMLTable.php

示例12: __construct

 /**
  * Create a new <thead> using DOMElement
  *
  * @param void
  */
 public function __construct()
 {
     parent::__construct('thead');
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:9,代码来源:thead.php

示例13: __construct

 /**
  * Create a new <tfoot> using DOMElement
  *
  * @param void
  */
 public function __construct()
 {
     parent::__construct('tfoot');
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:9,代码来源:tfoot.php

示例14: __construct

 /**
  * Create a new <tbody> using DOMElement
  *
  * @param void
  */
 public function __construct()
 {
     parent::__construct('tbody');
 }
开发者ID:shgysk8zer0,项目名称:core,代码行数:9,代码来源:tbody.php

示例15: __construct

 public function __construct($val)
 {
     parent::__construct('value', htmlspecialchars($val));
     $this->value = $val;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:5,代码来源:archimedes.class.php


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