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


PHP G::xmlParser方法代码示例

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


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

示例1: streamCSSBigFile

 /**
  * streaming a big JS file with small js files
  *
  * @author Fernando Ontiveros Lira <fernando@colosa.com>
  * @access public
  * @param string $file
  * @return string
  */
 public function streamCSSBigFile($filename)
 {
     header('Content-Type: text/css');
     //First get Skin info
     $filenameParts = explode("-", $filename);
     $skinName = $filenameParts[0];
     $skinVariant = "skin";
     if (isset($filenameParts[1])) {
         $skinVariant = strtolower($filenameParts[1]);
     }
     $configurationFile = '';
     if ($skinName == "jscolors") {
         $skinName = "classic";
     }
     if ($skinName == "xmlcolors") {
         $skinName = "classic";
     }
     if ($skinName == "classic") {
         $configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
     } else {
         $configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
         if (!is_file($configurationFile)) {
             $configurationFile = G::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml';
         }
     }
     //Read Configuration File
     $xmlConfiguration = file_get_contents($configurationFile);
     $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
     $baseSkinDirectory = dirname($configurationFile);
     $directorySize = G::getDirectorySize($baseSkinDirectory);
     $mtime = $directorySize['maxmtime'];
     $outputHeader = "/* Autogenerated CSS file by gulliver framework \n";
     $outputHeader .= "   Skin: {$filename}\n";
     $outputHeader .= "   Configuration: {$configurationFile}\n";
     $mtimeNow = date('U');
     $gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT";
     $outputHeader .= "   Date: {$gmt_mtimeNow}*/\n";
     $output = "";
     //Base files
     switch (strtolower($skinVariant)) {
         case "extjs":
             //Base
             $baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP;
             $output .= file_get_contents($baseCSSPath . 'ext-all-notheme.css');
             //Classic Skin
             $extJsSkin = 'xtheme-gray';
             break;
         default:
             break;
     }
     //Get Browser Info
     $infoBrowser = G::browser_detection('full_assoc');
     $browserName = $infoBrowser['browser_working'];
     if (isset($infoBrowser[$browserName . '_data'])) {
         if ($infoBrowser[$browserName . '_data'][0] != "") {
             $browserName = $infoBrowser[$browserName . '_data'][0];
         }
     }
     //Read Configuration File
     $xmlConfiguration = file_get_contents($configurationFile);
     $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
     $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['cssFiles']['__CONTENT__'][$skinVariant]['__CONTENT__']['cssFile'];
     foreach ($skinFilesArray as $keyFile => $cssFileInfo) {
         $enabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['enabledBrowsers']);
         $disabledBrowsers = explode(",", $cssFileInfo['__ATTRIBUTES__']['disabledBrowsers']);
         if ((in_array($browserName, $enabledBrowsers) || in_array('ALL', $enabledBrowsers)) && !in_array($browserName, $disabledBrowsers)) {
             if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
                 G::LoadClass('serverConfiguration');
                 $oServerConf =& serverConf::getSingleton();
                 if (!defined('SYS_LANG')) {
                     if (isset($_SERVER['HTTP_REFERER'])) {
                         $syss = explode('://', $_SERVER['HTTP_REFERER']);
                         $sysObjets = explode('/', $syss['1']);
                         $sysLang = $sysObjets['2'];
                     } else {
                         $sysLang = 'en';
                     }
                 } else {
                     $sysLang = SYS_LANG;
                 }
                 if ($oServerConf->isRtl($sysLang)) {
                     $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']);
                 }
             } else {
                 $output .= file_get_contents($baseSkinDirectory . PATH_SEP . 'css' . PATH_SEP . $cssFileInfo['__ATTRIBUTES__']['file']);
             }
         }
     }
     //Remove comments..
     $regex = array("`^([\t\\s]+)`ism" => '', "`^\\/\\*(.+?)\\*\\/`ism" => "", "`([\n\\A;]+)\\/\\*(.+?)\\*\\/`ism" => "\$1", "`([\n\\A;\\s]+)//(.+?)[\n\r]`ism" => "\$1\n", "`(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+`ism" => "\n");
     $output = preg_replace(array_keys($regex), $regex, $output);
     $output = $outputHeader . $output;
//.........这里部分代码省略.........
开发者ID:nhenderson,项目名称:processmaker,代码行数:101,代码来源:class.g.php

示例2: importSkin

function importSkin()
{
    try {
        if (!isset($_FILES['uploadedFile'])) {
            throw new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED'));
        }
        $uploadedInstances = count($_FILES['uploadedFile']['name']);
        $sw_error = false;
        $sw_error_exists = isset($_FILES['uploadedFile']['error']);
        $emptyInstances = 0;
        $quequeUpload = array();
        // upload files & check for errors
        $tmp = $_FILES['uploadedFile']['tmp_name'];
        $items = stripslashes($_FILES['uploadedFile']['name']);
        if ($sw_error_exists) {
            $up_err = $_FILES['uploadedFile']['error'];
        } else {
            $up_err = file_exists($tmp) ? 0 : 4;
        }
        if ($items == "" || $up_err == 4) {
            throw new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED'));
        }
        if ($up_err == 1 || $up_err == 2) {
            throw new Exception(G::LoadTranslation('ID_FILE_TOO_BIG'));
            //$errors[$i]='miscfilesize';
        }
        if ($up_err == 3) {
            throw new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR'));
            //$errors[$i]='miscfilepart';
        }
        if (!@is_uploaded_file($tmp)) {
            throw new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR'));
            //$errors[$i]='uploadfile';
        }
        $fileInfo = pathinfo($items);
        $validType = array('tar', 'gz');
        if (!in_array($fileInfo['extension'], $validType)) {
            throw new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION'));
            //$errors[$i]='wrongtype';
        }
        $filename = $items;
        $tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
        G::verifyPath($tempPath, true);
        $tempName = $tmp;
        G::uploadFile($tempName, $tempPath, $filename);
        G::LoadThirdParty('pear/Archive', 'Tar');
        $tar = new Archive_Tar($tempPath . $filename);
        $aFiles = $tar->listContent();
        $swConfigFile = false;
        foreach ($aFiles as $key => $val) {
            if (basename($val['filename']) == 'config.xml') {
                $skinName = dirname($val['filename']);
                $skinArray = explode("/", $skinName);
                if (count($skinArray) == 1) {
                    $swConfigFile = true;
                }
            }
        }
        if (!$swConfigFile) {
            @unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
            throw new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING'));
        }
        if (is_dir(PATH_CUSTOM_SKINS . $skinName)) {
            if (isset($_REQUEST['overwrite_files']) && $_REQUEST['overwrite_files'] == 'on') {
                G::rm_dir(PATH_CUSTOM_SKINS . $skinName, false);
            } else {
                throw new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS'));
            }
        }
        $res = $tar->extract(PATH_CUSTOM_SKINS);
        if (!$res) {
            throw new Exception(G::LoadTranslation('ID_SKIN_ERROR_EXTRACTING'));
        }
        $configFileOriginal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
        $configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
        $xmlConfiguration = file_get_contents($configFileOriginal);
        $workspace = $_REQUEST['workspace'] == 'global' ? '' : SYS_SYS;
        $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
        $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];
        if (isset($skinInformationArray["workspace"]["__VALUE__"])) {
            $workspace = $workspace != "" && !empty($skinInformationArray["workspace"]["__VALUE__"]) ? $skinInformationArray["workspace"]["__VALUE__"] . "|" . $workspace : $workspace;
            $xmlConfiguration = preg_replace("/(<workspace>)(.*)(<\\/workspace>)/i", "<workspace>" . $workspace . "</workspace><!-- \$2 -->", $xmlConfiguration);
        } else {
            $xmlConfiguration = preg_replace("/(<name>)(.*)(<\\/name>)/i", "<name>" . $skinName . "</name><!-- \$2 -->\n<workspace>" . $workspace . "</workspace>", $xmlConfiguration);
        }
        file_put_contents($configFileFinal, $xmlConfiguration);
        //Delete Temporal
        @unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
        $response['success'] = true;
        $response['message'] = G::LoadTranslation('ID_SKIN_SUCCESSFUL_IMPORTED');
        G::auditLog("ImportSkin", "Skin Name: " . $skinName);
        print_r(G::json_encode($response));
    } catch (Exception $e) {
        $response['success'] = false;
        $response['message'] = $e->getMessage();
        $response['error'] = $e->getMessage();
        print_r(G::json_encode($response));
    }
}
开发者ID:emildev35,项目名称:processmaker,代码行数:99,代码来源:skin_Ajax.php

示例3: getSkingList

 public function getSkingList()
 {
     //Create Skins custom folder if it doesn't exists
     if (!is_dir(PATH_CUSTOM_SKINS)) {
         G::verifyPath(PATH_CUSTOM_SKINS, true);
     }
     //Get Skin Config files
     $skinListArray = array();
     $customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
     if (!is_array($customSkins)) {
         $customSkins = array();
     }
     // getting al base skins
     $baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml');
     // filtering no public skins (uxs, simplified)
     foreach ($baseSkins as $i => $skinName) {
         if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false || strpos($skinName, 'uxmodern') !== false) {
             unset($baseSkins[$i]);
         }
     }
     $customSkins = array_merge($baseSkins, $customSkins);
     $global = G::LoadTranslation('ID_GLOBAL');
     //Read and parse each Configuration File
     foreach ($customSkins as $key => $configInformation) {
         $folderId = basename(dirname($configInformation));
         if ($folderId == 'base') {
             $folderId = 'classic';
         }
         $partnerFlag = defined('PARTNER_FLAG') ? PARTNER_FLAG : false;
         if ($partnerFlag && $folderId == 'classic') {
             continue;
         }
         $xmlConfiguration = file_get_contents($configInformation);
         $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
         if (isset($xmlConfigurationObj->result['skinConfiguration'])) {
             $skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
             $res = array();
             $res['SKIN_FOLDER_ID'] = strtolower($folderId);
             foreach ($skinInformationArray as $keyInfo => $infoValue) {
                 $res['SKIN_' . strtoupper($keyInfo)] = isset($infoValue['__VALUE__']) ? $infoValue['__VALUE__'] : '';
             }
             $res['SKIN_CREATEDATE'] = isset($res['SKIN_CREATEDATE']) ? $res['SKIN_CREATEDATE'] : '';
             $res['SKIN_MODIFIEDDATE'] = isset($res['SKIN_MODIFIEDDATE']) ? $res['SKIN_MODIFIEDDATE'] : '';
             $res['SKIN_WORKSPACE'] = isset($res['SKIN_WORKSPACE']) ? $res['SKIN_WORKSPACE'] != '' ? $res['SKIN_WORKSPACE'] : $global : $global;
             $swWS = true;
             if ($res['SKIN_WORKSPACE'] != $global) {
                 $workspace = explode("|", $res['SKIN_WORKSPACE']);
                 $swWS = false;
                 foreach ($workspace as $key => $value) {
                     if ($value == SYS_SYS) {
                         $swWS = true;
                         break;
                     }
                 }
             }
             if ($swWS) {
                 $skinListArray['skins'][] = $res;
             }
         }
     }
     $skinListArray['currentSkin'] = SYS_SKIN;
     return $skinListArray;
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:63,代码来源:class.system.php

示例4: file_get_contents

?>
<html>
	<head>
		<link type="text/css" href="/js/jquery/css/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<link type="text/css" href="/skins/<?php 
echo SYS_SKIN;
?>
/style.css" rel="stylesheet" />
		<style> body{ background-color: #fff; }</style>
		<script type="text/javascript" src="/js/jquery/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="/js/jquery/jquery-ui-1.7.2.custom.min.js"></script>
		<script type="text/javascript" src="/jscore/dynaforms/dynaforms_fieldsHandler.js"></script>
	</head>
<?php 
$content = file_get_contents(PATH_DYNAFORM . $_SESSION['Current_Dynafom']['Parameters']['FILE'] . ".xml");
$oXxml = G::xmlParser($content);
if (!isset($oXxml->result['dynaForm']['__CONTENT__'])) {
    ?>
	<br/>
	<div class="ui-widget-header ui-corner-all" style="height:17px" align="center">
		<?php 
    echo G::loadTranslation('ID_NO_FIELD_FOUND');
    ?>
	</div>
	<script>
        parent.document.getElementById('light').style.display='none';
        parent.document.getElementById('fade').style.display='none';
	</script>
<?php 
    die;
}
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:31,代码来源:fieldsHandler.php

示例5: getSkingList

 function getSkingList()
 {
     //Create Skins custom folder if it doesn't exists
     if (!is_dir(PATH_CUSTOM_SKINS)) {
         G::verifyPath(PATH_CUSTOM_SKINS, true);
     }
     //Get Skin Config files
     $skinListArray = array();
     $customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml");
     // getting al base skins
     $baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml');
     // filtering no public skins (uxs, simplified)
     foreach ($baseSkins as $i => $skinName) {
         if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false) {
             unset($baseSkins[$i]);
         }
     }
     $customSkins = array_merge($baseSkins, $customSkins);
     //Read and parse each Configuration File
     foreach ($customSkins as $key => $configInformation) {
         $folderId = basename(dirname($configInformation));
         if ($folderId == 'base') {
             $folderId = 'classic';
         }
         $xmlConfiguration = file_get_contents($configInformation);
         $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
         if (isset($xmlConfigurationObj->result['skinConfiguration'])) {
             $skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__'];
             $res = array();
             $res['SKIN_FOLDER_ID'] = strtolower($folderId);
             foreach ($skinInformationArray as $keyInfo => $infoValue) {
                 $res['SKIN_' . strtoupper($keyInfo)] = $infoValue['__VALUE__'];
             }
             $skinListArray['skins'][] = $res;
         }
     }
     $skinListArray['currentSkin'] = SYS_SKIN;
     return $skinListArray;
 }
开发者ID:nshong,项目名称:processmaker,代码行数:39,代码来源:class.system.php

示例6: streamCSSBigFile

 /**
  * streaming a big JS file with small js files
  *
  * @author Fernando Ontiveros Lira <fernando@colosa.com>
  * @access public
  * @param  string $file
  * @return string
  */
 function streamCSSBigFile($filename)
 {
     header('Content-Type: text/css');
     //First get Skin info
     $filenameParts = explode("-", $filename);
     $skinName = $filenameParts[0];
     $skinVariant = "skin";
     if (isset($filenameParts[1])) {
         $skinVariant = strtolower($filenameParts[1]);
     }
     if ($skinName == "jscolors") {
         $skinName = "classic";
     }
     if ($skinName == "xmlcolors") {
         $skinName = "classic";
     }
     if ($skinName == "classic") {
         $configurationFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'config.xml';
     } else {
         $configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
         if (!is_file($configurationFile)) {
             $configurationFile = G::ExpandPath("skinEngine") . $skinName . PATH_SEP . 'config.xml';
         }
     }
     //Read Configuration File
     $xmlConfiguration = file_get_contents($configurationFile);
     $xmlConfigurationObj = G::xmlParser($xmlConfiguration);
     $baseSkinDirectory = dirname($configurationFile);
     $directorySize = G::getDirectorySize($baseSkinDirectory);
     $mtime = $directorySize['maxmtime'];
     //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
     //$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
     $gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
     header('Pragma: cache');
     header('ETag: "' . md5($mtime . $filename) . '"');
     header("Last-Modified: " . $gmt_mtime);
     header('Cache-Control: public');
     header("Expires: " . gmdate("D, d M Y H:i:s", time() + 30 * 60 * 60 * 24) . " GMT");
     //1 month
     //header("Expires: " . gmdate("D, d M Y H:i:s", time () + 60*60*24 ) . " GMT"); //1 day - tempor
     if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
         if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) {
             header('HTTP/1.1 304 Not Modified');
             exit;
         }
     }
     if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
         if (str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == md5($mtime . $filename)) {
             header("HTTP/1.1 304 Not Modified");
             exit;
         }
     }
     $outputHeader = "/* Autogenerated CSS file by gulliver framework \n";
     $outputHeader .= "   Skin: {$filename}\n";
     $outputHeader .= "   Configuration: {$configurationFile}\n";
     $mtimeNow = date('U');
     $gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow) . " GMT";
     $outputHeader .= "   Date: {$gmt_mtimeNow}*/\n";
     $output = "";
     //Base files
     switch (strtolower($skinVariant)) {
         case "extjs":
             //Base
             $baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP;
             $output .= file_get_contents($baseCSSPath . 'ext-all-notheme.css');
             //$output .= file_get_contents ( $publicExtPath . 'ext-all.css' );
             //Classic Skin
             $extJsSkin = 'xtheme-gray';
             /*$publicExtPath = PATH_SKIN_ENGINE."base". PATH_SEP."css". PATH_SEP;
               $output .= file_get_contents ( $publicExtPath . $extJsSkin . '.css' );
               $output .= file_get_contents ( $publicExtPath . 'pmos-' . $extJsSkin . '.css' );
               */
             //adding the extend css for extjs-pmos
             //TODO: move this files to pmos-xthem..
             //$cssThemeExtensions = glob(PATH_TPL . "*/css/extjs-extend/{$extJsSkin}.css");
             //foreach($cssThemeExtensions as $cssThemeExtensionFile)
             //$helper->addFile($cssThemeExtensionFile);
             //$output .= file_get_contents ( $cssThemeExtensionFile );
             //                $classicCSSPath=PATH_SKIN_ENGINE."base". PATH_SEP."css". PATH_SEP;
             //                $output .= file_get_contents ( $classicCSSPath . 'sprite.css' );
             //$output .= file_get_contents ( $classicCSSPath . 'sprite_ie.css' );
             break;
         default:
             break;
     }
     //Get Browser Info
     $infoBrowser = G::browser_detection('full_assoc');
     $browserName = $infoBrowser['browser_working'];
     if (isset($infoBrowser[$browserName . '_data'])) {
         if ($infoBrowser[$browserName . '_data'][0] != "") {
             $browserName = $infoBrowser[$browserName . '_data'][0];
         }
//.........这里部分代码省略.........
开发者ID:nshong,项目名称:processmaker,代码行数:101,代码来源:class.g.php


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