/**
  * Loads the xml file into a string and returns this string.
  *  
  * @return 	XML		$xml
  */
 protected function getXML()
 {
     $instructions = $this->installation->getInstructions();
     if (!isset($instructions[$this->tagName]['cdata'])) {
         return false;
     }
     // Search the acpmenu xml-file in the package archive.
     // Abort installation in case no file was found.
     if (($fileIndex = $this->installation->getArchive()->getTar()->getIndexByFilename($instructions[$this->tagName]['cdata'])) === false) {
         throw new SystemException("xml file '" . $instructions[$this->tagName]['cdata'] . "' not found in '" . $this->installation->getArchive()->getArchive() . "'", 13008);
     }
     // Extract acpmenu file and parse with SimpleXML
     $xml = new XML();
     $tmpFile = FileUtil::getTemporaryFilename('xml_');
     try {
         $this->installation->getArchive()->getTar()->extract($fileIndex, $tmpFile);
         $xml->loadFile($tmpFile);
     } catch (Exception $e) {
         // bugfix to avoid file caching problems
         try {
             $this->installation->getArchive()->getTar()->extract($fileIndex, $tmpFile);
             $xml->loadFile($tmpFile);
         } catch (Exception $e) {
             $this->installation->getArchive()->getTar()->extract($fileIndex, $tmpFile);
             $xml->loadFile($tmpFile);
         }
     }
     @unlink($tmpFile);
     return $xml;
 }
Пример #2
0
 public static function unserialize($xml, $isnormal = false)
 {
     $xml_parser = new XML($isnormal);
     $data = $xml_parser->parse($xml);
     $xml_parser->destruct();
     return $data;
 }
Пример #3
0
function XML_unserialize($xml)
{
    $xml_parser = new XML();
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
 /**
  * Parse a rss feed.
  * 
  * @param	string		$sourceURL
  * @return	array
  */
 public static function parseFeed($sourceURL)
 {
     $newsItems = array();
     $filename = FileUtil::downloadFileFromHttp($sourceURL, 'feed');
     // open & parse file
     $xml = new XML($filename);
     $data = $xml->getElementTree('channel');
     $items = $data['children'][0]['children'];
     foreach ($items as $item) {
         if ($item['name'] != 'item') {
             continue;
         }
         $newsItem = array('title' => '', 'author' => '', 'link' => '', 'guid' => '', 'pubDate' => '', 'description' => '');
         foreach ($item['children'] as $child) {
             if (!isset($child['cdata'])) {
                 continue;
             }
             $newsItem[$child['name']] = $child['cdata'];
         }
         // convert encodings
         if (CHARSET != 'UTF-8') {
             $newsItem['title'] = StringUtil::convertEncoding('UTF-8', CHARSET, $newsItem['title']);
             $newsItem['author'] = StringUtil::convertEncoding('UTF-8', CHARSET, $newsItem['author']);
             $newsItem['link'] = StringUtil::convertEncoding('UTF-8', CHARSET, $newsItem['link']);
             $newsItem['guid'] = StringUtil::convertEncoding('UTF-8', CHARSET, $newsItem['guid']);
             $newsItem['description'] = StringUtil::convertEncoding('UTF-8', CHARSET, $newsItem['description']);
         }
         @($newsItem['pubDate'] = intval(strtotime($newsItem['pubDate'])));
         $newsItems[] = $newsItem;
     }
     // delete tmp file
     @unlink($filename);
     return $newsItems;
 }
Пример #5
0
function unapiExplainResponse($unapiID)
{
    global $contentTypeCharset;
    // these variables are specified in 'ini.inc.php'
    $unapiCollectionDoc = new XMLDocument();
    $unapiCollectionDoc->setEncoding($contentTypeCharset);
    $unapiCollection = new XML("formats");
    if (!empty($unapiID)) {
        $unapiCollection->setTagAttribute("id", $unapiID);
    }
    // Recommended format names are given at <http://unapi.stikipad.com/unapi/show/existing+formats>
    // TODO: add 'ISI', 'ODF XML' and 'Word XML'
    addNewBranch($unapiCollection, "format", array("name" => "bibtex", "type" => "text/plain", "docs" => "http://en.wikipedia.org/wiki/BibTeX"), "");
    // function 'addNewBranch()' is defined in 'webservice.inc.php'
    addNewBranch($unapiCollection, "format", array("name" => "endnote", "type" => "text/plain", "docs" => "http://www.ecst.csuchico.edu/~jacobsd/bib/formats/endnote.html"), "");
    addNewBranch($unapiCollection, "format", array("name" => "ris", "type" => "text/plain", "docs" => "http://www.adeptscience.co.uk/kb/article/A626"), "");
    addNewBranch($unapiCollection, "format", array("name" => "atom", "type" => "application/atom+xml", "docs" => "http://www.atomenabled.org/developers/syndication/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/mods/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "oai_dc", "type" => "application/xml", "docs" => "http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore"), "");
    addNewBranch($unapiCollection, "format", array("name" => "srw_dc", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "srw_mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "html", "type" => "text/html", "docs" => "http://www.w3.org/MarkUp/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "rtf", "type" => "application/rtf", "docs" => "http://en.wikipedia.org/wiki/Rich_Text_Format"), "");
    addNewBranch($unapiCollection, "format", array("name" => "pdf", "type" => "application/pdf", "docs" => "http://partners.adobe.com/public/developer/pdf/index_reference.html"), "");
    addNewBranch($unapiCollection, "format", array("name" => "latex", "type" => "application/x-latex", "docs" => "http://en.wikipedia.org/wiki/LaTeX"), "");
    addNewBranch($unapiCollection, "format", array("name" => "markdown", "type" => "text/plain", "docs" => "http://daringfireball.net/projects/markdown/"), "");
    addNewBranch($unapiCollection, "format", array("name" => "text", "type" => "text/plain"), "");
    $unapiCollectionDoc->setXML($unapiCollection);
    $unapiCollectionString = $unapiCollectionDoc->getXMLString();
    return $unapiCollectionString;
}
Пример #6
0
 public function lCV3($id = -1, $returnCollector = true)
 {
     if ($this->Adapter == null) {
         $this->loadAdapter();
     }
     if ($this->xml == null and $this->collection != null) {
         if (is_object($this->collection)) {
             $this->collection->lCV3();
             $XML = new XML();
             $XML->setCollection($this->collection);
             $this->xml = $XML->getXML();
         } elseif (is_string($this->collection)) {
             $handle = @fopen($this->collection, "r");
             if ($handle) {
                 while (!feof($handle)) {
                     $this->xml .= fgets($handle, 4096);
                 }
                 fclose($handle);
             } else {
                 die('error');
             }
         }
     }
     $this->Adapter->setXML($this->xml);
     if ($returnCollector) {
         $this->collector = $this->Adapter->lCV4();
     } else {
         return $this->Adapter->lCV4();
     }
 }
 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // upload
     if ($this->optionImport && $this->optionImport['error'] != 4) {
         if ($this->optionImport['error'] != 0) {
             throw new UserInputException('optionImport', 'uploadFailed');
         }
         try {
             $xml = new XML($this->optionImport['tmp_name']);
             $optionsXML = $xml->getElementTree('options');
             foreach ($optionsXML['children'] as $option) {
                 $name = $value = '';
                 foreach ($option['children'] as $optionData) {
                     switch ($optionData['name']) {
                         case 'name':
                             $name = $optionData['cdata'];
                             break;
                         case 'value':
                             $value = $optionData['cdata'];
                             break;
                     }
                 }
                 if (!empty($name)) {
                     $this->options[$name] = $value;
                 }
             }
         } catch (SystemException $e) {
             throw new UserInputException('optionImport', 'importFailed');
         }
     } else {
         throw new UserInputException('optionImport');
     }
 }
Пример #8
0
function xml_unserialize(&$xml, $isnormal = FALSE)
{
    $xml_parser = new XML($isnormal);
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
Пример #9
0
 private function set($url)
 {
     $contents = file_get_contents($url);
     if ($contents) {
         $xml = new XML($contents);
         $this->json = json_encode($xml->get());
     }
 }
Пример #10
0
function &XML_unserialize(&$xml)
{
    //$xml_parser = &new XML();
    $xml_parser = new XML();
    $data =& $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
Пример #11
0
function xml_unserialize(&$xml)
{
    $xml_parser = new XML();
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    $arr = xml_format_array($data);
    return $arr['root'];
}
Пример #12
0
 function leer($oc)
 {
     session_start();
     //$xml_file="./demo.xml";
     $xml_file = "./OC/Orden_" . $oc . ".xml";
     #$xml_data=implode("",file($xml_file)); //get XML data for alternative direct parsing
     $xml = new XML();
     $xml->file_read($xml_file);
     #$xml->parse($xml_data); //parse direct XML data
     $xml->parse();
     #$xml->debug();
     //Samples...
     //echo $xml->demo->tag1->_param["say"];
     //echo $xml->demo->tag4->item[1]->_value;
     $_SESSION["numoc"] = $oc;
     $fecha = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderDates->PromiseDate->_value;
     $fechaoc = explode("T", $fecha);
     $_SESSION["fechaoc"] = $fechaoc[0];
     $_SESSION["depto"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->BuyerParty->NameAddress->Name1->_value;
     $rut = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PartyID->Ident->_value;
     $r = explode(".", $rut);
     $rut2 = $r[0] . $r[1] . $r[2];
     $r2 = explode("-", $rut2);
     $_SESSION["rutp1"] = $r2[0];
     $_SESSION["rutp2"] = $r2[1];
     $_SESSION["namep"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->Name1->_value;
     $_SESSION["direccionp"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->District->_value;
     $_SESSION["ciudadp"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->City->_value;
     $_SESSION["contactop"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PrimaryContact->ContactName->_value;
     $_SESSION["telefonop"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PrimaryContact->ListOfContactNumber->ContactNumber[1]->ContactNumberValue->_value;
     $_SESSION["solicitante"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->BuyerParty->PrimaryContact->ContactName->_value;
     $_SESSION["Total"] = $xml->OrdersResults->OrdersList->Order->OrderSummary->OrderTotal->MonetaryAmount->_value;
     $_SESSION["neto"] = $xml->OrdersResults->OrdersList->Order->OrderSummary->OrderSubTotal->MonetaryAmount->_value;
     $size = $xml->OrdersResults->OrdersList->Order->OrderSummary->NumberOfLines->_value;
     $_SESSION["size"] = $size;
     $list = array();
     if ($size == 1) {
         $name = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->BaseItemDetail->ItemIdentifiers->ItemDescription->_value;
         $cantidad = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->BaseItemDetail->TotalQuantity->QuantityValue->_value;
         $preciou = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->PricingDetail->ListOfPrice->Price->UnitPrice->UnitPriceValue->_value;
         $preciot = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->PricingDetail->LineItemTotal->MonetaryAmount->_value;
         $list[0] = array($name, $cantidad, $preciou, $preciot);
     } else {
         for ($i = 0; $i < $size; $i++) {
             $name = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->BaseItemDetail->ItemIdentifiers->ItemDescription->_value;
             $cantidad = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->BaseItemDetail->TotalQuantity->QuantityValue->_value;
             $preciou = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->PricingDetail->ListOfPrice->Price->UnitPrice->UnitPriceValue->_value;
             $preciot = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->PricingDetail->LineItemTotal->MonetaryAmount->_value;
             $list[$i] = array($name, $cantidad, $preciou, $preciot);
         }
     }
     $_SESSION["list"] = $list;
     /*echo "<hr />";
     foreach($xml->demo->tag2->text as $key=>$value){
     	echo "$key = $value->_value<br />";
     }*/
 }
Пример #13
0
 function apply(&$value, &$component)
 {
     $xml = new XML();
     $xml->parseXML($value);
     $rootNode = $xml->firstChild;
     $result = '';
     $this->__toString($rootNode, $result);
     $value = preg_replace('/^<root>/i', '', $result);
 }
Пример #14
0
 public static function ls($url, array $loginDetails = array(), array $options = array())
 {
     $options['asXML'] = true;
     $output = self::executeCommand('list', $url, $loginDetails, $options);
     $output = implode($output, '');
     $xml = new XML();
     $xml->loadString($output);
     return $xml->getElementTree('');
 }
Пример #15
0
 function testSerialization()
 {
     $input = array(array('Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial')), array('Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education')));
     $expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project><project id="2" title="" client_id="2" show="1" is_spotlight="" style_id="0" job_type_id="2" industry_id="2" modified="2007-11-26 14:48:36" created=""><style id="" name="" /><job_type id="2" name="Awareness Campaign" /><industry id="2" name="Education" /></project>';
     $xml = new XML($input);
     $result = $xml->compose(false);
     $result = preg_replace("/\n/", '', $result);
     $this->assertEqual($expected, $result);
 }
Пример #16
0
 public function setBody(\SimpleXMLElement $body)
 {
     $this->data = null;
     $parser = new XML();
     $data = $parser->toArray($body);
     if (!isset($data['@attributes']['type']) || !isset($data['@attributes']['msg'])) {
         return;
     }
     $this->data = $data;
 }
Пример #17
0
 /**
  * Process XML Response
  *
  * Process the XML response from Twitter.com
  *
  * @param string $response
  */
 function __process_xml($response)
 {
     $xml = new XML($response);
     $result = $xml->toArray();
     $xml->__killParent();
     $xml->__destruct();
     $xml = null;
     unset($xml);
     return $result;
 }
 /**
  * Creates a new instance of type Configuration
  */
 public function __construct()
 {
     if (!file_exists(SDIR . 'config/config.xml')) {
         throw new Exception("Startup error: config.xml not found in " . SDIR . "config/! Aborted start!");
     }
     // load xml
     $xml = new XML(SDIR . 'config/config.xml');
     // get element array
     $data = $xml->getElementTree('config');
     // call loop
     $this->readConfiguration($this->configuration, $data);
 }
Пример #19
0
 /**
  * undocumented function
  *
  * @param string $options 
  * @return void
  * @access public
  */
 function process($options = array())
 {
     $defaults = array('type' => 'redirect', 'tId' => false);
     $options = am($defaults, $options);
     if ($options['type'] == 'redirect') {
         $myXml = $this->inquiry($options['tId']);
         App::import('Core', 'Xml');
         $xml = new XML($myXml);
         $data = $xml->toArray();
         return array('order_id' => $data['PaymentService']['Reply']['OrderStatus']['orderCode'], 'url' => $data['PaymentService']['Reply']['OrderStatus']['reference']['value']);
     }
     return false;
 }
Пример #20
0
 /**
  * Crea la parte de las camisetas en XML
  * @param XML $xml_cat XML de la categoría correspondiente
  * @param Int $idCat ID de la categoría correspondiente
  */
 protected function XMLAddCamisetas($xml_cat, $idCat)
 {
     $lista_camisetas = $this->Mdl_xml->getCamisetas($idCat);
     $xml_camisetas = $xml_cat->addChild('camisetas');
     //Crea etiqueta <camisetas> dentro de <categoria>
     foreach ($lista_camisetas as $camiseta) {
         $xml_camiseta = $xml_camisetas->addChild('camiseta');
         //Crea etiqueta <camiseta> dentro de <camisetas>
         foreach ($camiseta as $idx => $valor) {
             $xml_camiseta->addChild($idx, utf8_encode($valor));
             //Añade a la etiqueta <camiseta>
         }
     }
 }
Пример #21
0
 /**
  *	Returns HTML-formatted RSS items
  *	@method		getHTMLTitlesFormatted
  *	@returns	string HTML-formatted RSS items
  */
 function getHTMLTitlesFormatted()
 {
     $itemBranchesXML = new XML("ul");
     reset($this->itemBranches);
     foreach ($this->itemBranches as $newsItem) {
         $itemXML = new XMLBranch("li");
         $itemLinkXML = new XMLBranch("a");
         $itemLinkXML->setTagContent($newsItem->getTagContent("item/title"));
         $itemLinkXML->setTagAttribute("href", $newsItem->getTagContent("item/link"));
         $itemXML->addXMLBranch($itemLinkXML);
         $itemBranchesXML->addXMLBranch($itemXML);
     }
     return $itemBranchesXML->getXMLString();
 }
Пример #22
0
	public function render($formatted = FALSE)
	{

		$this->add_info('time', time());
		
		return parent::render($formatted);
	}
 /**
  * This method actually generates the output
  * @param ms method actually generates the outpuixed $params Comes from base class definition. Not used in this implementation.
  * @return string HTML output
  */
 public function execute($params = false)
 {
     $aOut[] = '<div class="bs-statebar-body-item" id="sbb-' . $this->sKey . '">';
     $aOut[] = '<h4 class="bs-statebar-body-itemheading" id="sbb-' . $this->sKey . '-heading">' . wfMessage('bs-review-review')->plain() . '</h4>';
     $aOut[] = '<div class="bs-statebar-body-itembody" id="sbb-' . $this->sKey . '-text">';
     $aOut[] = $this->sStatusText;
     $aOut[] = $this->sStatusReasonText;
     if (!empty($this->aComments)) {
         $aOut[] = '<br /><br /><u>' . wfMessage('bs-review-comments')->plain() . "</u><br />";
         foreach ($this->aComments as $sComment) {
             $aOut[] = $sComment . '<br />';
         }
     }
     $aOut[] = '</div>';
     if ($this->bVotable) {
         $aOut[] = '<h4 class="bs-statebar-body-itemheading" id="sbb-DoReview-heading">' . wfMessage('bs-review-statebar-body-do-review')->plain() . '</h4>';
         $aOut[] = '<div class="bs-statebar-body-itembody" id="sbb-DoReview-text">';
         $aOut[] = '<div class="bs-statebar-body-reviewvotesection">';
         if (!empty($this->sComment)) {
             $aOut[] = $this->sComment . '<br />';
         }
         $aOut[] = '<label for="bs-review-voteresponse-comment">';
         $aOut[] = wfMessage('bs-review-commentinputlabel')->plain();
         $aOut[] = '</label>';
         $aOut[] = XML::input('bs-review-voteresponse-comment', false, '', array('id' => 'bs-review-voteresponse-comment'));
         foreach ($this->aButtons as $aButton) {
             $aOut[] = sprintf('<a id="%s" href="#" class="%s" title="%s">%s</a>', $aButton['id'], $aButton['class'], $aButton['title'], $aButton['text']);
         }
         $aOut[] = '</div>';
         $aOut[] = '<div>';
     }
     $aOut[] = '</div>';
     return implode("\n", $aOut);
 }
Пример #24
0
 /**
  * Instantiates an RSS Encoder.
  * 
  * @param array 	$channelElements 	An assosiative array of channel elements. Per RSS
  *                                	 	specification: title, link, and description are
  *                                	 	required. "element" => "value"
  * @param array 	$itemElements    	An array of elements to include in each data item;
  *                                 		for example, title, link, author, etc...
  * @param array 	$data            	An array of items in the feed
  * @param array  	$dataMap         	An associative array mapping fields in the items
  *                                  	passed $data array to RSS-specific fields.
  *                                  	"UserField" => "RSSField"
  *                                  	For example:
  *                                  	$dataMap = array(
  *                                  		"published" => "pubDate",
  *                                  		"body" => "description"
  *                                  	);
  */
 public function __construct($channelElements, $itemElements, $data, $dataMap = array())
 {
     parent::__construct($data);
     $this->channelElements = $channelElements;
     $this->itemElements = $itemElements;
     $this->dataMap = $dataMap;
     $this->setupFeed();
 }
 /**
  * Main function for special page. At the current time only produces html for the blacklist.
  * Should support updating the blacklist.
  * 
  * @global $wgOut object
  * @global $wgRequest object
  * @param $par
  */
 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     //$this->outputHeader();
     $wgOut->addWikiMsg('archivelinks-modify-blacklist-desc');
     $wgOut->addHTML(HTML::openElement('form', array('method' => 'post', 'action' => SpecialPage::getTitleFor('ModifyBlacklist')->getLocalUrl())) . HTML::openElement('fieldset') . HTML::element('legend', null, wfMsg('ModifyArchiveBlacklist')) . HTML::openElement('table') . HTML::openElement('tr') . HTML::openElement('td') . wfMsg('archivelinks-modify-blacklist-blacklist-or-whitelist-field-label') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_blacklist-whitelist', 'type' => 'radio', 'value' => 'blacklist')) . '&#160;' . wfMsg('archivelinks-modify-blacklist-blacklist-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_blacklist-whitelist', 'type' => 'radio', 'value' => 'whitelist')) . '&#160;' . wfMsg('archivelinks-modify-blacklist-whitelist-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . wfMsg('archivelinks-modify-blacklist-add-or-remove-field-label') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_add-remove', 'type' => 'radio', 'value' => 'add')) . '&#160;' . wfMsg('archivelinks-modify-blacklist-add-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_add-remove', 'type' => 'radio', 'value' => 'remove')) . '&#160;' . wfMsg('archivelinks-modify-blacklist-remove-field-label') . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_url'), wfMsg('archivelinks-modify-blacklist-url-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_url', 'type' => 'text', 'size' => '110')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_duration'), wfMsg('archivelinks-modify-blacklist-duration-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_duration', 'type' => 'text', 'size' => '60')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::openElement('tr') . HTML::openElement('td') . HTML::element('label', array('for' => 'bl_reason'), wfMsg('archivelinks-modify-blacklist-reason-field-label')) . HTML::closeElement('td') . HTML::openElement('td') . HTML::element('input', array('name' => 'bl_reason', 'type' => 'text', 'size' => '60')) . HTML::closeElement('td') . HTML::closeElement('tr') . HTML::closeElement('table') . XML::submitButton('Blacklist URL') . HTML::closeElement('fieldset') . HTML::closeElement('form'));
 }
Пример #26
0
 /**
  * Loads the compiled language file.
  * Compiles the language file before if necessary.
  */
 public function loadLanguage()
 {
     $this->languageLoaded = true;
     $filename = TMP_DIR . TMP_FILE_PREFIX . $this->data['languageCode'] . '_' . $this->data['languageEncoding'] . '_wcf.setup.php';
     if (!file_exists($filename)) {
         $xml = new XML(TMP_DIR . TMP_FILE_PREFIX . 'setup_' . $this->data['languageCode'] . '.xml');
         // compile an array with XML::getElementTree
         $languageXML = $xml->getElementTree('language');
         // extract attributes (language code, language name)
         //$languageXML = array_merge($languageXML, $languageXML['attrs']);
         // get language items
         $categoriesToCache = array();
         foreach ($languageXML['children'] as $key => $languageCategory) {
             // language category does not exist yet, create it
             if (isset($languageCategory['children'])) {
                 foreach ($languageCategory['children'] as $key2 => $languageitem) {
                     $categoriesToCache[] = array('name' => $languageitem['attrs']['name'], 'cdata' => $languageitem['cdata']);
                 }
             }
         }
         // update language files here
         if (count($categoriesToCache) > 0) {
             $file = new File($filename);
             $file->write("<?php\n/**\n* WoltLab Community Framework\n* language: " . $this->data['languageCode'] . "\n* encoding: " . $this->data['languageEncoding'] . "\n* category: WCF Setup\n* generated at " . gmdate("r") . "\n* \n* DO NOT EDIT THIS FILE\n*/\n");
             foreach ($categoriesToCache as $value => $name) {
                 // simple_xml returns values always UTF-8 encoded
                 // manual decoding to charset necessary
                 if ($this->data['languageEncoding'] != 'UTF-8') {
                     $name['cdata'] = StringUtil::convertEncoding('UTF-8', $this->data['languageEncoding'], $name['cdata']);
                 }
                 $file->write("\$this->items[\$this->languageID]['" . $name['name'] . "'] = '" . str_replace("'", "\\'", $name['cdata']) . "';\n");
                 // compile dynamic language variables
                 if (strpos($name['cdata'], '{') !== false) {
                     $file->write("\$this->dynamicItems[\$this->languageID]['" . $name['name'] . "'] = '" . str_replace("'", "\\'", self::getScriptingCompiler()->compileString($name['name'], $name['cdata'])) . "';\n");
                 }
             }
             $file->write("?>");
             $file->close();
         }
     }
     include_once $filename;
     $this->setLocale();
 }
Пример #27
0
 public function __construct($name, $url, $title, $img, $author)
 {
     $this->url = $url;
     $this->title = $title;
     $this->img = $img;
     $this->author = $author;
     $date = new \DateTime();
     $this->date = $date->format('Y-m-d\\TH:i:s\\Z');
     $this->initEntries();
     parent::__construct($name, 'xml version="1.0" encoding="utf-8"');
 }
Пример #28
0
 /**
  * @param string $request
  * @param array  $args
  */
 public function fix_xml($request, $args)
 {
     $request_dom = XML::Loader()->load($request);
     $xpath = new DOMXPath($request_dom);
     $arguments_dom_node = $xpath->query("//*[local-name()='Envelope']/*[local-name()='Body']/*")->item(0);
     $this->fix_xml_node($arguments_dom_node, $args[0], $xpath);
     if (version_compare(PHP_VERSION, '5.2.3', '<')) {
         $this->remove_empty_header_elements($xpath);
     }
     return $request_dom->saveXML();
 }
    /**
     * Updates the language items of a language category.
     * 
     * @param	array		$items
     * @param	integer		$categoryID
     * @param	integer		$packageID
     * @param 	array		$useCustom
     */
    public function easyUpdateItems($categoryString, $items, $packageID = null)
    {
        $packageID = $packageID === null ? WCF::getPackageID('de.easy-coding.wcf.contest') : $packageID;
        $language = new LanguageEditor($this->languageID);
        $xmlString = '<?xml version="1.0" encoding="' . CHARSET . '"?>
		<language languagecode="' . $this->getLanguageCode() . '">
			<category name="' . $categoryString . '">';
        foreach ($items as $key => $val) {
            if ($val === null) {
                continue;
            }
            $xmlString .= '<item name="' . $key . '"><![CDATA[' . $val . ']]></item>';
        }
        $xmlString .= '
			</category>
		</language>';
        $xml = new XML();
        $xml->loadString($xmlString);
        $language->updateFromXML($xml, $packageID);
    }
Пример #30
0
/**
 * @file
 * @ingroup SpecialPage
 */
function wfSpecialCategories($par = null)
{
    global $wgOut, $wgRequest;
    if ($par == '') {
        $from = $wgRequest->getText('from');
    } else {
        $from = $par;
    }
    $cap = new CategoryPager($from);
    $wgOut->addHTML(XML::openElement('div', array('class' => 'mw-spcontent')) . wfMsgExt('categoriespagetext', array('parse')) . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . XML::closeElement('div'));
}