本文整理汇总了PHP中DomDocument::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::__construct方法的具体用法?PHP DomDocument::__construct怎么用?PHP DomDocument::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomDocument
的用法示例。
在下文中一共展示了DomDocument::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config
public function config($theUser, &$theElement)
{
ENTER("config::config", __LINE__);
parent::__construct();
$this->{$myUser} = $theUser;
$this->myFilename = "/home/{$theUser}/" . CONFIGNAME;
if (!is_file($this->myFilename)) {
$aSourceFilename = MAINDIR . "/" . CONFIGNAME;
if (copy($aSourceFilename, $this->myFilename) == false) {
$aError = sprintf("Error: can't copy file: %s to %s\n", $aSourceFilename, $this->myFilename);
ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.2 $');
return;
}
}
if (!is_readable($this->myFilename)) {
$aError = sprintf("Error: file unreadable: %s\n", $this->myFilename);
ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.2 $');
return;
}
$this->load($this->myFilename);
$this->myXpath = new domXPath($this);
$this->myXPathQuery = $this->myXpath->query($this->configPath . "/*");
$aNumberOfItems = $this->myXPathQuery->length;
for ($i = 0; $i < $aNumberOfItems; $i++) {
$aNode = $this->myXPathQuery->item($i);
unset($anElement);
$this->getElement($aNode, &$anElement);
$theElement[] = $anElement;
}
$this->my_object_is_build = true;
}
示例2: mailConfig
function mailConfig($theUser)
{
ENTER("mailConfig::mailConfig", __LINE__);
parent::__construct();
SHOW("theUser={$theUser}, this={$this}");
$this->_myUser = $theUser;
$this->_myFilename = sprintf($this->_myTemplateFilename, $theUser);
if (!is_file($this->_myFilename)) {
$fd = fopen($this->_myFilename, "w");
if ($fd == NULL) {
$aError = sprintf("Error: can't open file: %s\n", $this->_myFilename);
ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.8 $');
return;
}
fwrite($fd, $this->_myInitialFile);
fclose($fd);
}
if (!is_readable($this->_myFilename)) {
$aError = sprintf("Error: file unreadable: %s\n", $this->_myFilename);
ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.8 $');
return;
}
$this->load($this->_myFilename);
$this->_myXpath = new domxpath($this);
$this->_myMailconfigContext = $this->_myXpath->query($this->_mailconfigPath)->item(0);
$this->initMailSourceIndex();
$this->_my_object_is_build = true;
}
示例3: uniqid
function __construct()
{
$this->sessionid = uniqid();
parent::__construct('1.0', 'UTF-8');
$this->formatOutput = true;
//$this->standalone = false;
#$this->validateOnParse = true;
}
示例4: __construct
/**
* Constructs a new DOM document.
*
* \param string $version
* (optional) XML version to use.
*
* \param string $encoding
* (optional) Encoding for the document.
*/
public function __construct($version = null, $encoding = null)
{
$this->clearErrors();
if ($version === null && $encoding === null) {
parent::__construct();
} elseif ($encoding === null) {
parent::__construct($version);
} else {
parent::__construct($version, $encoding);
}
}
示例5: strtolower
function __construct($type)
{
parent::__construct('1.0', 'UTF-8');
$this->loadXML(self::TEMPLATE);
$type = strtolower($type);
if (!in_array($type, array('hello', 'greeting', 'command', 'response'))) {
trigger_error("Invalid argument value '{$type}' for \$type", E_USER_ERROR);
}
$this->epp = $this->firstChild;
$this->body = $this->createElement($type);
$this->epp->appendChild($this->body);
}
示例6: __construct
/**
* Constructor, duh
*
* Set up the DOM environment
*
* @param string $root The name of the root node
* @param string $nod_name The name numeric keys are called
*
*/
public function __construct($root = 'root', $node_name = 'node')
{
parent::__construct();
/*** set the encoding ***/
$this->encoding = "ISO-8859-1";
/*** format the output ***/
$this->formatOutput = true;
/*** set the node names ***/
$this->node_name = $node_name;
/*** create the root element ***/
$this->root = $this->appendChild($this->createElement($root));
$this->xpath = new DomXPath($this);
}
示例7: __construct
/**
* WsdlWriter Constructor
*
* @param string The Object File name
* @param string The Base Url for the Web Service
*/
public function __construct(WsdlDefinition $wsdlDefinition)
{
// Items before parent Constructor don't stick!
parent::__construct();
// DomDocument::$formatOutput Format the WSDL Doc
$this->formatOutput = true;
$this->encoding = "UTF-8";
// Set the WsdlWriter Properties
$this->wsdlMethods = array();
$this->wsdlDefinition = $wsdlDefinition;
// Create the Base WSDL Doc
$this->seedXML();
}
示例8: __construct
/**
* @constructor Sets up the DOM environment.
* @access public
* @param string $sTitle The site title
* @param string $sLink The link to the site
* @param string $sDescription The site description
* @return void
*/
public function __construct($sTitle, $sLink, $sDescription)
{
// Call the parent constructor (DomDocument)
parent::__construct();
// Craete the root element
$oRoot = $this->appendChild($this->createElement('rss'));
// Sets to RSS version 2
$oRoot->setAttribute('version', '2.0');
// Sets the channel node
$this->_oChannel = $oRoot->appendChild($this->createElement('channel'));
// Sets the title link and description elements
$this->_oChannel->appendChild($this->createElement('title', $sTitle));
$this->_oChannel->appendChild($this->createElement('link', $sLink));
$this->_oChannel->appendChild($this->createElement('description', $sDescription));
}
示例9: __construct
public function __construct($title, $link, $description)
{
// call the parent constructor
parent::__construct();
// format the created XML
$this->formatOutput = true;
// craete the root element
$root = $this->appendChild($this->createElement('rss'));
// set to rss2
$root->setAttribute('version', '2.0');
// set the channel node
$this->channel = $root->appendChild($this->createElement('channel'));
// set the title link and description elements
$this->channel->appendChild($this->createElement('title', $title));
$this->channel->appendChild($this->createElement('link', $link));
$this->channel->appendChild($this->createElement('description', $description));
}
示例10:
function __construct($elemWhitelist = null, $attrWhitelist = null)
{
global $tags_allowed_in_fields;
// defined in config.inc
Logger::log("Enter: creating new InputSanitizer class");
parent::__construct();
if ($elemWhitelist) {
$this->elemWhitelist = $elemWhitelist;
}
if ($attrWhitelist) {
$this->attrWhitelist = $attrWhitelist;
}
$this->tags_allowed_in_fields = $tags_allowed_in_fields;
// defined in config.inc
// note: this is still not really OO,
// but better than using a global in process()
Logger::log("Exit: creating new InputSanitizer class");
}
示例11: __construct
public function __construct($version = '1.0', $encoding = 'ISO-8859-1')
{
parent::__construct($version, $encoding);
$this->formatOutput = true;
}
示例12: __construct
/**
* Constructor.
* All it does is to call the parent constructor
*/
public function __construct()
{
parent::__construct();
}
示例13: __construct
public function __construct()
{
parent::__construct();
$this->formatOutput = true;
#$this->validateOnParse = true;
}
示例14: __construct
public function __construct($filepath)
{
parent::__construct();
$this->load($filepath);
}
示例15: __construct
public function __construct($root, $value = null, $attributes = null)
{
parent::__construct('1.0');
$this->root_element = $this->createElement($root);
$this->appendChild($this->root_element);
$this->formatOutput = true;
if ($attributes) {
foreach ($attributes as $key => $val) {
$this->root_element->setAttribute($key, $val);
}
}
}