本文整理汇总了PHP中DOMElement::get_attribute方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::get_attribute方法的具体用法?PHP DOMElement::get_attribute怎么用?PHP DOMElement::get_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::get_attribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
/**
* Create a new checkbutton element using DOM tree element to initialize
* it.
*
* @param DOMElement $root the DOM 'input' element
*
* @return CheckBox new checkbox element
*
* @see CheckBox::CheckBox()
*/
function &create(&$root, &$pipeline)
{
$value = $root->get_attribute('value');
if (trim($value) == "") {
error_log("Checkbox with empty 'value' attribute");
$value = sprintf("___Value%s", md5(time() . rand()));
}
$box =& new CheckBox($root->has_attribute('checked'), $root->get_attribute('name'), $value);
return $box;
}
示例2: ButtonBox
/**
* Create a new button element from the DOM tree element
*
* @param DOMElement $root pointer to the DOM tree element corresponding to the button.
*
* @return ButtonBox new button element
*/
function &create(&$root, &$pipeline)
{
/**
* Button text is defined by its 'value' attrubute;
* if this attribute is not specified, we should provide some
* appropriate defaults depending on the exact button type:
* reset, submit or generic button.
*
* Default button text values are specified in config file config.inc.php.
*
* @see config.inc.php
* @see DEFAULT_SUBMIT_TEXT
* @see DEFAULT_RESET_TEXT
* @see DEFAULT_BUTTON_TEXT
*/
if ($root->has_attribute("value")) {
$text = $root->get_attribute("value");
} else {
$text = DEFAULT_BUTTON_TEXT;
}
$box =& new ButtonBox();
$box->readCSS($pipeline->getCurrentCSSState());
/**
* If button width is not constrained, then we'll add some space around the button text
*/
$text = " " . $text . " ";
$box->_setup($text, $pipeline);
return $box;
}
示例3: explode
/**
* Create a new checkbutton element using DOM tree element to initialize
* it.
*
* @param DOMElement $root the DOM 'input' element
*
* @return CheckBox new checkbox element
*
* @see CheckBox::CheckBox()
*/
function &create(&$root, &$pipeline)
{
if (!class_exists('G')) {
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode('/', $realdocuroot);
array_pop($docuroot);
$pathhome = implode('/', $docuroot) . '/';
array_pop($docuroot);
$pathTrunk = implode('/', $docuroot) . '/';
require_once $pathTrunk . 'gulliver/system/class.g.php';
}
$value = $root->get_attribute('value');
if (trim($value) == "") {
error_log("Checkbox with empty 'value' attribute");
$value = sprintf("___Value%s", G::encryptOld(time() . rand()));
}
$box =& new CheckBox($root->has_attribute('checked'), $root->get_attribute('name'), $value);
$box->readCSS($pipeline->getCurrentCSSState());
return $box;
}
示例4: ButtonBox
/**
* Create a new button element from the DOM tree element
*
* @param DOMElement $root pointer to the DOM tree element corresponding to the button.
*
* @return ButtonBox new button element
*/
function &create(&$root, &$pipeline)
{
/**
* Button text is defined by its 'value' attrubute;
* if this attribute is not specified, we should provide some
* appropriate defaults depending on the exact button type:
* reset, submit or generic button.
*
* Default button text values are specified in config file config.inc.php.
*
* @see config.inc.php
* @see DEFAULT_SUBMIT_TEXT
* @see DEFAULT_RESET_TEXT
* @see DEFAULT_BUTTON_TEXT
*/
if ($root->has_attribute("value")) {
$text = $root->get_attribute("value");
} else {
$text = DEFAULT_BUTTON_TEXT;
}
$box =& new ButtonBox($text);
return $box;
}