當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DOMElement::setProperty方法代碼示例

本文整理匯總了PHP中DOMElement::setProperty方法的典型用法代碼示例。如果您正苦於以下問題:PHP DOMElement::setProperty方法的具體用法?PHP DOMElement::setProperty怎麽用?PHP DOMElement::setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DOMElement的用法示例。


在下文中一共展示了DOMElement::setProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: filterElement

 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'orderedlist');
     $types = array('a' => 'loweralpha', 'A' => 'upperalpha', 'i' => 'lowerroman', 'I' => 'upperroman');
     if ($element->hasAttribute('type') && isset($types[$type = $element->getAttribute('type')])) {
         $element->setProperty('attributes', array('numeration' => $types[$type]));
     }
 }
開發者ID:jackalope,項目名稱:jr_cr_demo,代碼行數:14,代碼來源:enumerated.php

示例2: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $parent = $element->parentNode;
     if ($parent->namespaceURI === ezcDocumentOdt::NS_ODT_TEXT && $parent->localName === 'p') {
         $element->setProperty('type', 'inlinemediaobject');
     } else {
         $element->setProperty('type', 'mediaobject');
     }
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:15,代碼來源:frame.php

示例3: filterElement

 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     if ($element->tagName === 'p') {
         $element->setProperty('type', 'literallayout');
         $element->setProperty('attributes', array('class' => 'normal'));
     } else {
         $element->appendChild(new DOMText("\n"));
         $element->setProperty('whitespace', 'significant');
     }
 }
開發者ID:axelmdev,項目名稱:ecommerce,代碼行數:16,代碼來源:lineblock.php

示例4: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'ulink');
     $attrs = $element->getProperty('attributes');
     if (!is_array($attrs)) {
         $attrs = array();
     }
     // @todo: Can we convert more attributes here? Maybe <ulink type="…"/>?
     $attrs['url'] = $element->getAttributeNS(ezcDocumentOdt::NS_XLINK, 'href');
     $element->setProperty('attributes', $attrs);
 }
開發者ID:axelmdev,項目名稱:ecommerce,代碼行數:17,代碼來源:link.php

示例5: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'footnote');
     $citations = $element->getElementsByTagNameNS(ezcDocumentOdt::NS_ODT_TEXT, 'note-citation');
     // Should be only 1, foreach to remove all
     foreach ($citations as $cite) {
         $attrs = $element->getProperty('attributes');
         if ($attrs === false) {
             $attrs = array();
         }
         $attrs['label'] = $cite->nodeValue;
         $element->setProperty('attributes', $attrs);
         $element->removeChild($cite);
     }
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:21,代碼來源:footnote.php

示例6: filterElement

 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     // Only decorate non-empty paragraphs
     if (trim($element->textContent) && $element->getProperty('type') === false) {
         $element->setProperty('type', 'para');
     }
 }
開發者ID:jackalope,項目名稱:jr_cr_demo,代碼行數:13,代碼來源:paragraph.php

示例7: filterElement

 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     if ($element->hasAttribute('rowspan') && $element->getAttribute('rowspan') > 1) {
         $attributes = $element->getProperty('attributes');
         $attributes['morerows'] = $element->getAttribute('rowspan') - 1;
         $element->setProperty('attributes', $attributes);
     }
     // @todo: Handle colspan, too - even it is quite complex to express in
     // docbook.
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:16,代碼來源:tablecell.php

示例8: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $frame = $element->parentNode;
     $element->setProperty('type', 'imageobject');
     $imageData = new ezcDocumentPropertyContainerDomElement('imagedata', null, ezcDocumentOdt::NS_EZC);
     $this->insertImageData($element, $imageData);
     $imageData->setProperty('type', 'imagedata');
     $attributes = array('fileref' => $element->getAttributeNS(ezcDocumentOdt::NS_XLINK, 'href'));
     if ($frame->hasAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'width')) {
         $attributes['width'] = $frame->getAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'width');
     }
     if ($frame->hasAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'height')) {
         $attributes['depth'] = $frame->getAttributeNS(ezcDocumentOdt::NS_ODT_SVG, 'height');
     }
     $imageData->setProperty('attributes', $attributes);
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:22,代碼來源:image.php

示例9: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $spaces = '';
     switch ($element->localName) {
         case 's':
             $count = $element->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'c');
             $spaces = str_repeat(' ', $count !== '' ? (int) $count : 1);
             break;
         case 'tab':
             $spaces = "\t";
             break;
         case 'line-break':
             $spaces = "\n";
             break;
     }
     $element->setProperty('spaces', $spaces);
 }
開發者ID:axelmdev,項目名稱:ecommerce,代碼行數:23,代碼來源:whitespace.php

示例10: filterMetaData

 /**
  * Filter meta data
  *
  * Filter meta elements in HTML header for relevant metadata.
  * 
  * @param DOMElement $element
  * @return void
  */
 protected function filterMetaData(DOMElement $element)
 {
     if ($element->hasAttribute('name') && $element->hasAttribute('content') && ($name = strtolower($element->getAttribute('name'))) && isset($this->mapping[$name])) {
         // Set type of element
         $element->setProperty('type', $this->mapping[$name]);
         // Apply special parsing and conversion to some of the given
         // elements
         switch ($this->mapping[$name]) {
             case 'abstract':
                 $textNode = $element->ownerDocument->createElement('span');
                 $textNode->setProperty('type', 'para');
                 $element->appendChild($textNode);
                 break;
             default:
                 $textNode = $element;
         }
         // Set conents as child text node.
         $text = new DOMText($element->getAttribute('content'));
         $textNode->appendChild($text);
     }
 }
開發者ID:jackalope,項目名稱:jr_cr_demo,代碼行數:29,代碼來源:metadata.php

示例11: filterElement

 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', $this->nameMapping[$element->tagName]);
 }
開發者ID:jackalope,項目名稱:jr_cr_demo,代碼行數:10,代碼來源:mapping.php

示例12: setItemListProperties

 /**
  * Sets properties of itemized lists based on $listLevelProps.
  * 
  * @param DOMElement $itemList 
  * @param ezcDocumentOdtListLevelStyleBullet $listLevelProps 
  */
 protected function setItemListProperties(DOMElement $itemList, ezcDocumentOdtListLevelStyleBullet $listLevelProps)
 {
     $itemList->setProperty('type', 'itemizedlist');
 }
開發者ID:axelmdev,項目名稱:ecommerce,代碼行數:10,代碼來源:list_level.php

示例13: filterElement

 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('whitespace', 'significant');
     $element->setProperty('type', $this->isInline($element) ? 'literal' : 'literallayout');
 }
開發者ID:axelmdev,項目名稱:ecommerce,代碼行數:11,代碼來源:literal.php

示例14: filterElement

 /**
  * Filter a single element
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'emphasis');
     $element->setProperty('attributes', array('Role' => 'strong'));
 }
開發者ID:bmdevel,項目名稱:ezc,代碼行數:11,代碼來源:strong.php

示例15: filterElement

 /**
  * Filter a single element
  * 
  * @param DOMElement $element 
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'literallayout');
     $element->setProperty('attributes', array('class' => 'normal'));
 }
開發者ID:jackalope,項目名稱:jr_cr_demo,代碼行數:11,代碼來源:lineblock.php


注:本文中的DOMElement::setProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。