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


PHP StringUtil::escapeCDATA方法代码示例

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


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

示例1: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // send content type
     header('Content-Type: text/' . $this->fileType . '; charset=' . CHARSET);
     header('Content-Disposition: attachment; filename="export.' . $this->fileType . '"');
     if ($this->fileType == 'xml') {
         echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<addresses>\n";
     }
     // get users
     $sql = "SELECT\t\temail\n\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\tWHERE\t\tuserID IN (" . $this->userIDs . ")\n\t\t\tORDER BY\temail";
     $result = WCF::getDB()->sendQuery($sql);
     $i = 0;
     $j = WCF::getDB()->countRows($result) - 1;
     while ($row = WCF::getDB()->fetchArray($result)) {
         if ($this->fileType == 'xml') {
             echo "<address><![CDATA[" . StringUtil::escapeCDATA($row['email']) . "]]></address>\n";
         } else {
             echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $j ? $this->separator : '');
         }
         $i++;
     }
     if ($this->fileType == 'xml') {
         echo "</addresses>";
     }
     UserEditor::unmarkAll();
     $this->saved();
     exit;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:32,代码来源:UserEmailAddressExportForm.class.php

示例2: execute

 /**
  * @see Action::execute();
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     WCF::getUser()->checkPermission('admin.system.canEditOption');
     // header
     @header('Content-type: text/xml');
     // file name
     @header('Content-disposition: attachment; filename="options.xml"');
     // no cache headers
     @header('Pragma: no-cache');
     @header('Expires: 0');
     // content
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<options>\n";
     $options = Options::getOptions();
     foreach ($options as $option) {
         echo "\t<option>\n";
         echo "\t\t<name><![CDATA[" . StringUtil::escapeCDATA($option['optionName']) . "]]></name>\n";
         echo "\t\t<value><![CDATA[" . StringUtil::escapeCDATA($option['optionValue']) . "]]></value>\n";
         echo "\t</option>\n";
     }
     echo '</options>';
     $this->executed();
     exit;
 }
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:28,代码来源:OptionExportAction.class.php

示例3: getFormattedMessage

 /**
  * @see ViewablePost::getFormattedMessage()
  */
 public function getFormattedMessage()
 {
     $text = '';
     if ($this->post) {
         $text = $this->post->getFormattedMessage();
     }
     // replace relative urls
     $text = preg_replace('~(?<=href="|src=")(?![a-z0-9]+://)(?!mailto:)~i', PAGE_URL . '/', $text);
     return StringUtil::escapeCDATA($text);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:13,代码来源:FeedThread.class.php

示例4: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     parent::show();
     header('Content-type: text/xml');
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<suggestions>\n";
     if (!empty($this->query)) {
         // get users
         $sql = "SELECT\t\tDISTINCT name\n\t\t\t\tFROM\t\twcf" . WCF_N . "_tag\n\t\t\t\tWHERE\t\t" . ($this->languageID ? "languageID = " . $this->languageID . " AND" : '') . "\n\t\t\t\t\t\tname LIKE '" . escapeString($this->query) . "%'\n\t\t\t\tORDER BY\tname";
         $result = WCF::getDB()->sendQuery($sql, 10);
         while ($row = WCF::getDB()->fetchArray($result)) {
             echo "<tag><![CDATA[" . StringUtil::escapeCDATA($row['name']) . "]]></tag>\n";
         }
     }
     echo '</suggestions>';
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:TagSuggestPage.class.php

示例5: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     AbstractPage::show();
     header('Content-type: text/xml');
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<suggestions>\n";
     if (!empty($this->query)) {
         // get suggestions
         $sql = "(SELECT\t\tusername AS name, 'user' AS type\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\t\tWHERE\t\tusername LIKE '" . escapeString($this->query) . "%')\n\t\t\t\tUNION ALL\n\t\t\t\t(SELECT\t\tgroupName AS name, 'group' AS type\n\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\tWHERE\t\tgroupName LIKE '" . escapeString($this->query) . "%')\n\t\t\t\tORDER BY\tname";
         $result = WCF::getDB()->sendQuery($sql, 10);
         while ($row = WCF::getDB()->fetchArray($result)) {
             echo "<" . $row['type'] . "><![CDATA[" . StringUtil::escapeCDATA($row['name']) . "]]></" . $row['type'] . ">\n";
         }
     }
     echo '</suggestions>';
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:19,代码来源:BoardPermissionsObjectsSuggestPage.class.php

示例6: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     parent::show();
     // get smileys
     $smileys = WCF::getCache()->get('smileys', 'smileys');
     if (isset($smileys[$this->smileyCategoryID])) {
         header('Content-type: text/xml');
         echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<smileys>\n";
         foreach ($smileys[$this->smileyCategoryID] as $smiley) {
             echo "\t<smiley>\n";
             echo "\t\t<path><![CDATA[" . StringUtil::escapeCDATA($smiley->smileyPath) . "]]></path>\n";
             echo "\t\t<title><![CDATA[" . StringUtil::escapeCDATA(WCF::getLanguage()->get($smiley->smileyTitle)) . "]]></title>\n";
             echo "\t\t<code><![CDATA[" . StringUtil::escapeCDATA($smiley->smileyCode) . "]]></code>\n";
             echo "\t</smiley>\n";
         }
         echo '</smileys>';
     }
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:22,代码来源:SmileyXMLListPage.class.php

示例7: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     parent::show();
     $photos = $this->photoList->getObjects();
     // get photos
     if (count($photos)) {
         header('Content-type: text/xml');
         echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<photos>\n";
         foreach ($photos as $photo) {
             echo "\t<photo>\n";
             echo "\t\t<path><![CDATA[" . StringUtil::escapeCDATA(PAGE_URL . '/' . $photo->getPhoto(self::convertSize(INLINE_IMAGE_MAX_WIDTH))) . "]]></path>\n";
             echo "\t\t<title><![CDATA[" . StringUtil::escapeCDATA($photo->title) . "]]></title>\n";
             echo "\t\t<link><![CDATA[" . PAGE_URL . "/index.php?page=UserGalleryPhoto&photoID=" . $photo->photoID . "]]></link>\n";
             echo "\t\t<thumbnail><![CDATA[" . StringUtil::escapeCDATA(PAGE_URL . '/' . $photo->getPhoto('quadratic')) . "]]></thumbnail>\n";
             echo "\t</photo>\n";
         }
         echo '</photos>';
     }
     exit;
 }
开发者ID:NetzwergX,项目名称:WCF-Small-Plugins,代码行数:23,代码来源:UserGalleryPhotosXMLListPage.class.php

示例8: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     parent::show();
     header('Content-type: text/xml');
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<objects>";
     if (count($this->query)) {
         // get users
         $names = implode("','", array_map('escapeString', $this->query));
         $sql = "(SELECT\t\tusername AS name, userID AS id, 'user' AS type \n\t\t\t\tFROM\t\twcf" . WCF_N . "_user\n\t\t\t\tWHERE\t\tusername IN ('" . $names . "'))\n\t\t\t\tUNION\n\t\t\t\t(SELECT\t\tgroupName AS name, groupID AS id, 'group' AS type \n\t\t\t\tFROM\t\twcf" . WCF_N . "_group\n\t\t\t\tWHERE\t\tgroupName IN ('" . $names . "'))\n\t\t\t\tORDER BY \tname";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             echo "<object>";
             echo "<name><![CDATA[" . StringUtil::escapeCDATA($row['name']) . "]]></name>";
             echo "<type>" . $row['type'] . "</type>";
             echo "<id>" . $row['id'] . "</id>";
             echo "</object>";
         }
     }
     echo '</objects>';
     exit;
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:24,代码来源:BoardPermissionsObjectsPage.class.php

示例9: show

 /**
  * @see Page::show()
  */
 public function show()
 {
     if (!MODULE_CHEAT_DATABASE) {
         exit;
     }
     try {
         parent::show();
     } catch (Exception $e) {
         exit;
     }
     header('Content-type: text/xml');
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<suggestions>\n";
     if (!empty($this->query)) {
         $sql = "SELECT\t\tDISTINCT languageItem, languageItemValue\n\t\t\t\tFROM\t\twcf" . WCF_N . "_language_item\n\t\t\t\tWHERE\t\t" . ($this->languageID ? "languageID = " . $this->languageID . " AND" : '') . "\n\t\t\t\t\t\tlanguageItem LIKE 'wcf.cheatDatabase.entry." . escapeString($this->type) . "%' AND\n\t\t\t\t\t\tlanguageItemValue LIKE '" . escapeString($this->query) . "%'\n\t\t\t\tORDER BY\tlanguageItemValue";
         $result = WCF::getDB()->sendQuery($sql, 10);
         while ($row = WCF::getDB()->fetchArray($result)) {
             echo "\t<suggestion>\n\t\t<languageItem><![CDATA[" . StringUtil::escapeCDATA($row['languageItem']) . "]]></languageItem>\n\t\t<value><![CDATA[" . StringUtil::escapeCDATA($row['languageItemValue']) . "]]></value>\n\t</suggestion>\n";
         }
     }
     echo '</suggestions>';
     exit;
 }
开发者ID:0xLeon,项目名称:com.leon.pokemon.cheatdatabase.core,代码行数:25,代码来源:CheatDatabaseSuggestPage.class.php

示例10: getFormattedMessage

 /**
  * @see ViewablePM::getFormattedMessage()
  */
 public function getFormattedMessage()
 {
     // replace relative urls
     $text = preg_replace('~(?<=href="|src=")(?![a-z0-9]+://)~i', PAGE_URL . '/', parent::getFormattedMessage());
     return StringUtil::escapeCDATA($text);
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:9,代码来源:FeedPM.class.php

示例11: export

 /**
  * Exports this style.
  * 
  * @param	boolean 	$templates
  * @param	boolean		$images
  * @param	boolean		$icons
  */
 public function export($templates = false, $images = false, $icons = false)
 {
     // create style tar
     require_once WCF_DIR . 'lib/system/io/TarWriter.class.php';
     $styleTarName = FileUtil::getTemporaryFilename('style_', '.tgz');
     $styleTar = new TarWriter($styleTarName, true);
     // append style preview image
     if ($this->image && @file_exists(WCF_DIR . $this->image)) {
         $styleTar->add(WCF_DIR . $this->image, '', FileUtil::addTrailingSlash(dirname(WCF_DIR . $this->image)));
     }
     // create style info file
     $string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE style SYSTEM \"http://www.woltlab.com/DTDs/SXF/style.dtd\">\n<style>\n";
     // general block
     $string .= "\t<general>\n";
     $string .= "\t\t<stylename><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->styleName) : $this->styleName) . "]]></stylename>\n";
     // style name
     if ($this->styleDescription) {
         $string .= "\t\t<description><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->styleDescription) : $this->styleDescription) . "]]></description>\n";
     }
     // style description
     if ($this->styleVersion) {
         $string .= "\t\t<version><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->styleVersion) : $this->styleVersion) . "]]></version>\n";
     }
     // style version
     if ($this->styleDate) {
         $string .= "\t\t<date><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->styleDate) : $this->styleDate) . "]]></date>\n";
     }
     // style date
     if ($this->image) {
         $string .= "\t\t<image><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', basename($this->image)) : basename($this->image)) . "]]></image>\n";
     }
     // style preview image
     if ($this->copyright) {
         $string .= "\t\t<copyright><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->copyright) : $this->copyright) . "]]></copyright>\n";
     }
     // copyright
     if ($this->license) {
         $string .= "\t\t<license><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->license) : $this->license) . "]]></license>\n";
     }
     // license
     $string .= "\t</general>\n";
     // author block
     $string .= "\t<author>\n";
     if ($this->authorName) {
         $string .= "\t\t<authorname><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->authorName) : $this->authorName) . "]]></authorname>\n";
     }
     // author name
     if ($this->authorURL) {
         $string .= "\t\t<authorurl><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $this->authorURL) : $this->authorURL) . "]]></authorurl>\n";
     }
     // author URL
     $string .= "\t</author>\n";
     // files block
     $string .= "\t<files>\n";
     $string .= "\t\t<variables>variables.xml</variables>\n";
     // variables
     if ($templates && $this->templatePackID) {
         $string .= "\t\t<templates>templates.tar</templates>\n";
     }
     // templates
     if ($images) {
         $string .= "\t\t<images>images.tar</images>\n";
     }
     // images
     if ($icons) {
         $string .= "\t\t<icons>icons.tar</icons>\n";
     }
     // icons
     $string .= "\t</files>\n";
     $string .= "</style>";
     // append style info file to style tar
     $styleTar->addString(self::INFO_FILE, $string);
     unset($string);
     // create variable list
     $string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE variables SYSTEM \"http://www.woltlab.com/DTDs/SXF/variables.dtd\">\n<variables>\n";
     // get variables
     $variables = $this->getVariables();
     $exportImages = array();
     foreach ($variables as $name => $value) {
         // search images
         if ($images && $value) {
             if (preg_match_all('~([^/\\s\\$]+\\.(?:gif|jpg|jpeg|png))~i', $value, $matches)) {
                 $exportImages = array_merge($exportImages, $matches[1]);
             }
         }
         $string .= "\t<variable name=\"" . StringUtil::encodeHTML($name) . "\"><![CDATA[" . StringUtil::escapeCDATA(CHARSET != 'UTF-8' ? StringUtil::convertEncoding(CHARSET, 'UTF-8', $value) : $value) . "]]></variable>\n";
     }
     $string .= "</variables>";
     // append variable list to style tar
     $styleTar->addString('variables.xml', $string);
     unset($string);
     if ($templates && $this->templatePackID) {
         require_once WCF_DIR . 'lib/data/template/TemplatePack.class.php';
//.........这里部分代码省略.........
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:101,代码来源:StyleEditor.class.php

示例12: save

 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // build conditions
     $this->conditions = new ConditionBuilder();
     // static fields
     if (!empty($this->username)) {
         $this->conditions->add("user.username LIKE '%" . addcslashes(escapeString($this->username), '_%') . "%'");
     }
     if (!empty($this->email)) {
         $this->conditions->add("user.email LIKE '%" . addcslashes(escapeString($this->email), '_%') . "%'");
     }
     if (count($this->groupIDArray) > 0) {
         $this->conditions->add("user.userID " . ($this->invertGroupIDs == 1 ? 'NOT ' : '') . "IN (SELECT userID FROM wcf" . WCF_N . "_user_to_groups WHERE groupID IN (" . implode(',', $this->groupIDArray) . "))");
     }
     if (count($this->languageIDArray) > 0) {
         $this->conditions->add("user.languageID IN (" . implode(',', $this->languageIDArray) . ")");
     }
     // dynamic fields
     foreach ($this->activeOptions as $name => $option) {
         $value = isset($this->values[$option['optionName']]) ? $this->values[$option['optionName']] : null;
         $condition = $this->getTypeObject($option['optionType'])->getCondition($option, $value, isset($this->matchExactly[$name]));
         if ($condition !== false) {
             $this->conditions->add($condition);
         }
     }
     // call buildConditions event
     EventHandler::fireAction($this, 'buildConditions');
     // execute action
     switch ($this->action) {
         case 'sendMail':
             WCF::getUser()->checkPermission('admin.user.canMailUser');
             // get user ids
             $userIDArray = array();
             $sql = "SELECT\t\tuser.userID\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value USING (userID)\n\t\t\t\t\t" . $this->conditions->get();
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 $userIDArray[] = $row['userID'];
                 $this->affectedUsers++;
             }
             // save config in session
             $userMailData = WCF::getSession()->getVar('userMailData');
             if ($userMailData === null) {
                 $userMailData = array();
             }
             $mailID = count($userMailData);
             $userMailData[$mailID] = array('action' => '', 'userIDs' => implode(',', $userIDArray), 'groupIDs' => '', 'subject' => $this->subject, 'text' => $this->text, 'from' => $this->from, 'enableHTML' => $this->enableHTML);
             WCF::getSession()->register('userMailData', $userMailData);
             $this->saved();
             // show worker template
             WCF::getTPL()->assign(array('pageTitle' => WCF::getLanguage()->get('wcf.acp.user.sendMail'), 'url' => 'index.php?action=UserMail&mailID=' . $mailID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED));
             WCF::getTPL()->display('worker');
             exit;
             break;
         case 'exportMailAddress':
             WCF::getUser()->checkPermission('admin.user.canMailUser');
             // send content type
             header('Content-Type: text/' . $this->fileType . '; charset=' . CHARSET);
             header('Content-Disposition: attachment; filename="export.' . $this->fileType . '"');
             if ($this->fileType == 'xml') {
                 echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<addresses>\n";
             }
             // get users
             $sql = "SELECT\t\tuser.email\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value USING (userID)\n\t\t\t\t\t" . $this->conditions->get() . "\n\t\t\t\t\tORDER BY\tuser.email";
             $result = WCF::getDB()->sendQuery($sql);
             $i = 0;
             $j = WCF::getDB()->countRows($result) - 1;
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if ($this->fileType == 'xml') {
                     echo "<address><![CDATA[" . StringUtil::escapeCDATA($row['email']) . "]]></address>\n";
                 } else {
                     echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $j ? $this->separator : '');
                 }
                 $i++;
                 $this->affectedUsers++;
             }
             if ($this->fileType == 'xml') {
                 echo "</addresses>";
             }
             $this->saved();
             exit;
             break;
         case 'assignToGroup':
             WCF::getUser()->checkPermission('admin.user.canEditUser');
             $userIDArray = array();
             $sql = "SELECT\t\tuser.*,\n\t\t\t\t\t\t\tGROUP_CONCAT(groupID SEPARATOR ',') AS groupIDs\n\t\t\t\t\tFROM\t\twcf" . WCF_N . "_user user\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_option_value option_value USING (userID)\n\t\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_to_groups groups\n\t\t\t\t\tON\t\t(groups.userID = user.userID)\n\t\t\t\t\t" . $this->conditions->get() . "\t\t\n\t\t\t\t\tGROUP BY\tuser.userID";
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!Group::isAccessibleGroup(explode(',', $row['groupIDs']))) {
                     throw new PermissionDeniedException();
                 }
                 $user = new UserEditor(null, $row);
                 $user->addToGroups($this->assignToGroupIDArray, false, false);
                 $userIDArray[] = $row['userID'];
                 $this->affectedUsers++;
             }
             Session::resetSessions($userIDArray);
//.........这里部分代码省略.........
开发者ID:CaribeSoy,项目名称:contest-wcf,代码行数:101,代码来源:UsersMassProcessingForm.class.php

示例13: export

 /**
  * Exports this language.
  */
 public function export($packageIDArray = array(), $exportCustomValues = false)
 {
     // bom
     echo "";
     // header
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<language xmlns=\"http://www.woltlab.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.woltlab.com/XSD/language.xsd\" languagecode=\"" . $this->getLanguageCode() . "\">\n";
     // get items
     $items = array();
     if (count($packageIDArray)) {
         $sql = "SELECT\t\tlanguageItem, " . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ", languageCategory\n\t\t\t\tFROM\t\twcf" . WCF_N . "_language_item language_item\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_language_category language_category\n\t\t\t\tON\t\t(language_category.languageCategoryID = language_item.languageCategoryID)\n\t\t\t\tWHERE \t\tlanguage_item.packageID IN (" . implode(',', $packageIDArray) . ")\n\t\t\t\t\t\tAND language_item.languageID = " . $this->languageID;
     } else {
         $sql = "SELECT\t\tlanguageItem, " . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ", languageCategory\n\t\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency,\n\t\t\t\t\t\twcf" . WCF_N . "_language_item language_item\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_language_category language_category\n\t\t\t\tON\t\t(language_category.languageCategoryID = language_item.languageCategoryID)\n\t\t\t\tWHERE \t\tlanguage_item.packageID = package_dependency.dependency\n\t\t\t\t\t\tAND language_item.languageID = " . $this->languageID . "\n\t\t\t\t\t\tAND package_dependency.packageID = " . PACKAGE_ID . "\n\t\t\t\tORDER BY \tpackage_dependency.priority ASC";
     }
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $items[$row['languageCategory']][$row['languageItem']] = $row['languageItemValue'];
     }
     // sort categories
     ksort($items);
     foreach ($items as $category => $categoryItems) {
         // sort items
         ksort($categoryItems);
         // category header
         echo "\t<category name=\"" . $category . "\">\n";
         // items
         foreach ($categoryItems as $item => $value) {
             if (CHARSET != 'UTF-8') {
                 $value = StringUtil::convertEncoding(CHARSET, 'UTF-8', $value);
             }
             echo "\t\t<item name=\"" . $item . "\"><![CDATA[" . StringUtil::escapeCDATA($value) . "]]></item>\n";
         }
         // category footer
         echo "\t</category>\n";
     }
     // footer
     echo "</language>";
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:40,代码来源:LanguageEditor.class.php

示例14: execute

 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // header
     $buffer = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
     $buffer .= "<systeminfo xmlns=\"http://www.woltlab.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.woltlab.com/XSD/systeminfo.xsd\">\n";
     // system block
     $buffer .= "\t<system>\n";
     // os block
     $buffer .= "\t\t<os>\n";
     // os type
     $buffer .= "\t\t\t<type><![CDATA[" . StringUtil::escapeCDATA(StringUtil::toLowerCase(PHP_OS)) . "]]></type>\n";
     // try to get os version
     $osVersion = @exec('cat /proc/version');
     // Linux
     if (empty($osVersion)) {
         $osVersion = @exec('uname -a');
     }
     // FreeBSD / Darwin
     if (empty($osVersion)) {
         $osVersion = @exec('ver');
     }
     // Windows
     $buffer .= "\t\t\t<version><![CDATA[" . StringUtil::escapeCDATA($osVersion) . "]]></version>\n";
     $buffer .= "\t\t</os>\n";
     // webserver block
     $buffer .= "\t\t<webserver>\n";
     // webserver type
     $webserver = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '';
     $webserverType = 'other';
     if (stripos($webserver, 'apache') !== false) {
         $webserverType = 'apache';
     } else {
         if (stripos($webserver, 'iis') !== false) {
             $webserverType = 'iis';
         } else {
             if (stripos($webserver, 'lighttpd') !== false) {
                 $webserverType = 'lighttpd';
             } else {
                 if (stripos($webserver, 'zeus') !== false) {
                     $webserverType = 'zeus';
                 }
             }
         }
     }
     $buffer .= "\t\t\t<type><![CDATA[" . $webserverType . "]]></type>\n";
     // webserver version
     $buffer .= "\t\t\t<version><![CDATA[" . StringUtil::escapeCDATA($webserver) . "]]></version>\n";
     // webserver modules
     $modules = '';
     if (function_exists('apache_get_modules')) {
         $modules = @implode(', ', apache_get_modules());
     }
     $buffer .= "\t\t\t<modules><![CDATA[" . StringUtil::escapeCDATA($modules) . "]]></modules>\n";
     $buffer .= "\t\t</webserver>\n";
     // php block
     $buffer .= "\t\t<php>\n";
     // version
     $buffer .= "\t\t\t<version><![CDATA[" . StringUtil::escapeCDATA(PHP_VERSION) . "]]></version>\n";
     // integration
     $buffer .= "\t\t\t<integration><![CDATA[" . StringUtil::escapeCDATA(php_sapi_name()) . "]]></integration>\n";
     // safe-mode?
     $buffer .= "\t\t\t<safemode><![CDATA[" . FileUtil::getSafeMode() . "]]></safemode>\n";
     // suhosin?
     $buffer .= "\t\t\t<suhosin><![CDATA[" . intval(extension_loaded('suhosin')) . "]]></suhosin>\n";
     // php modules
     $buffer .= "\t\t\t<modules><![CDATA[" . StringUtil::escapeCDATA(implode(', ', get_loaded_extensions())) . "]]></modules>\n";
     $buffer .= "\t\t</php>\n";
     // sql block
     $buffer .= "\t\t<sql>\n";
     // type
     $buffer .= "\t\t\t<type><![CDATA[" . StringUtil::escapeCDATA(str_replace('Database', '', WCF::getDB()->getDBType())) . "]]></type>\n";
     // version
     $buffer .= "\t\t\t<version><![CDATA[" . StringUtil::escapeCDATA(WCF::getDB()->getVersion()) . "]]></version>\n";
     $buffer .= "\t\t</sql>\n";
     $buffer .= "\t</system>\n\n";
     // wcf block
     $buffer .= "\t<wcf>\n";
     $buffer .= "\t\t<packages>\n";
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_package\n\t\t\tORDER BY\tpackage";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $buffer .= "\t\t\t<package>\n";
         $buffer .= "\t\t\t\t<name><![CDATA[" . StringUtil::escapeCDATA($row['package']) . "]]></name>\n";
         $buffer .= "\t\t\t\t<version><![CDATA[" . StringUtil::escapeCDATA($row['packageVersion']) . "]]></version>\n";
         $buffer .= "\t\t\t</package>\n";
     }
     $buffer .= "\t\t</packages>\n";
     $buffer .= "\t</wcf>\n";
     $buffer .= "</systeminfo>";
     // output
     header('Content-Type: application/xml; charset=' . CHARSET);
     header('Content-Disposition: attachment; filename="systeminfo.xml"');
     header('Content-Length: ' . strlen($buffer));
     print $buffer;
     $this->executed();
     exit;
//.........这里部分代码省略.........
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:101,代码来源:SystemInformationXMLExportAction.class.php


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