當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLDAO::parseStruct方法代碼示例

本文整理匯總了PHP中XMLDAO::parseStruct方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDAO::parseStruct方法的具體用法?PHP XMLDAO::parseStruct怎麽用?PHP XMLDAO::parseStruct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLDAO的用法示例。


在下文中一共展示了XMLDAO::parseStruct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

 /**
  * Handle a cache miss
  * @param $cache GenericCache
  * @param $id mixed ID that wasn't found in the cache
  * @return null
  */
 function _cacheMiss($cache, $id)
 {
     $allCodelistItems =& Registry::get('all' . $this->getName() . 'CodelistItems', true, null);
     if ($allCodelistItems === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getFilename($locale);
         $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $nodeName = $this->getName();
         // i.e., subject
         $data = $xmlDao->parseStruct($filename, array($nodeName));
         // Build array with ($charKey => array(stuff))
         if (isset($data[$nodeName])) {
             foreach ($data[$nodeName] as $codelistData) {
                 $allCodelistItems[$codelistData['attributes']['code']] = array($codelistData['attributes']['text']);
             }
         }
         if (is_array($allCodelistItems)) {
             asort($allCodelistItems);
         }
         $cache->setEntireCache($allCodelistItems);
     }
     return null;
 }
開發者ID:PublishingWithoutWalls,項目名稱:omp,代碼行數:36,代碼來源:CodelistItemDAO.inc.php

示例2: array

 function _cacheMiss($cache, $id)
 {
     $allLanguages =& Registry::get('allLanguages-' . $cache->cacheId, true, null);
     if ($allLanguages === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getLanguageFilename($locale);
         $notes[] = array('debug.notes.languageListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($filename, array('language'));
         // Build array with ($charKey => array(stuff))
         if (isset($data['language'])) {
             foreach ($data['language'] as $languageData) {
                 $allLanguages[$languageData['attributes']['code']] = array($languageData['attributes']['name']);
             }
         }
         if (is_array($allLanguages)) {
             asort($allLanguages);
         }
         $cache->setEntireCache($allLanguages);
     }
     if (isset($allLanguages[$id])) {
         return $allLanguages[$id];
     } else {
         return null;
     }
 }
開發者ID:jprk,項目名稱:pkp-lib,代碼行數:32,代碼來源:LanguageDAO.inc.php

示例3: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array();
     if (isset($data['application'][0]['value'])) {
         $versionInfo['application'] = $data['application'][0]['value'];
     }
     if (isset($data['type'][0]['value'])) {
         $versionInfo['type'] = $data['type'][0]['value'];
     }
     if (isset($data['release'][0]['value'])) {
         $versionInfo['release'] = $data['release'][0]['value'];
     }
     if (isset($data['tag'][0]['value'])) {
         $versionInfo['tag'] = $data['tag'][0]['value'];
     }
     if (isset($data['date'][0]['value'])) {
         $versionInfo['date'] = $data['date'][0]['value'];
     }
     if (isset($data['info'][0]['value'])) {
         $versionInfo['info'] = $data['info'][0]['value'];
     }
     if (isset($data['package'][0]['value'])) {
         $versionInfo['package'] = $data['package'][0]['value'];
     }
     if (isset($data['patch'][0]['value'])) {
         $versionInfo['patch'] = array();
         foreach ($data['patch'] as $patch) {
             $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
         }
     }
     if (isset($data['class'][0]['value'])) {
         $versionInfo['class'] = (string) $data['class'][0]['value'];
     }
     $versionInfo['lazy-load'] = isset($data['lazy-load'][0]['value']) ? (int) $data['lazy-load'][0]['value'] : 0;
     $versionInfo['sitewide'] = isset($data['sitewide'][0]['value']) ? (int) $data['sitewide'][0]['value'] : 0;
     if (isset($data['release'][0]['value']) && isset($data['application'][0]['value'])) {
         $version =& Version::fromString($data['release'][0]['value'], isset($data['type'][0]['value']) ? $data['type'][0]['value'] : null, $data['application'][0]['value'], isset($data['class'][0]['value']) ? $data['class'][0]['value'] : '', $versionInfo['lazy-load'], $versionInfo['sitewide']);
         $versionInfo['version'] =& $version;
     }
     return $versionInfo;
 }
開發者ID:farhanabbas1983,項目名稱:ojs-1,代碼行數:52,代碼來源:VersionCheck.inc.php

示例4: XMLDAO

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getPluginPath() . '/' . LANGUAGE_MAP_FILE, array('mapping'));
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
開發者ID:ramonsodoma,項目名稱:harvester,代碼行數:22,代碼來源:LanguageMapPreprocessorPlugin.inc.php

示例5: array

 function _countryCacheMiss($cache, $id)
 {
     $countries =& Registry::get('allCountriesData', true, array());
     if (!isset($countries[$id])) {
         // Reload country registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getFilename(), array('countries', 'country'));
         if (isset($data['countries'])) {
             foreach ($data['country'] as $countryData) {
                 $countries[$id][$countryData['attributes']['code']] = $countryData['attributes']['name'];
             }
         }
         asort($countries[$id]);
         $cache->setEntireCache($countries[$id]);
     }
     return null;
 }
開發者ID:doana,項目名稱:pkp-lib,代碼行數:17,代碼來源:CountryDAO.inc.php

示例6: array

 function _cacheMiss(&$cache, $id)
 {
     $mappings = array();
     // Add a debug note indicating an XML load.
     $notes =& Registry::get('system.debug.notes');
     $notes[] = array('debug.notes.helpMappingLoad', array('id' => $id, 'filename' => $this->filename));
     // Reload help XML file
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($this->filename, array('topic'));
     // Build associative array of page keys and ids
     if (isset($data['topic'])) {
         foreach ($data['topic'] as $helpData) {
             $mappings[$helpData['attributes']['key']] = $helpData['attributes']['id'];
         }
     }
     $cache->setEntireCache($mappings);
     return isset($mappings[$id]) ? $mappings[$id] : null;
 }
開發者ID:farhanabbas1983,項目名稱:ojs-1,代碼行數:18,代碼來源:HelpMappingFile.inc.php

示例7: XMLDAO

 function _timeZoneCacheMiss($cache, $id)
 {
     $timeZones =& Registry::get('allTimeZonesData', true, null);
     if ($timeZones === null) {
         // Reload time zone registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getFilename(), array('timezones', 'entry'));
         $timeZones = array();
         if (isset($data['timezones'])) {
             foreach ($data['entry'] as $timeZoneData) {
                 $timeZones[$timeZoneData['attributes']['key']] = $timeZoneData['attributes']['name'];
             }
         }
         asort($timeZones);
         $cache->setEntireCache($timeZones);
     }
     return null;
 }
開發者ID:doana,項目名稱:pkp-lib,代碼行數:18,代碼來源:TimeZoneDAO.inc.php

示例8: XMLDAO

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         // $cache->cacheId has the same value as the archive ID (but ask Alec to verify this is always
         // true in this context)
         $typemap_file = "typemap-" . $cache->cacheId . ".xml";
         $data = $xmlDao->parseStruct($this->getPluginPath() . '/' . $typemap_file, array('mapping'));
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
開發者ID:jalperin,項目名稱:harvester,代碼行數:25,代碼來源:TypeMapPreprocessorPlugin.inc.php

示例9: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array();
     if (isset($data['application'][0]['value'])) {
         $versionInfo['application'] = $data['application'][0]['value'];
     }
     if (isset($data['type'][0]['value'])) {
         $versionInfo['type'] = $data['type'][0]['value'];
     }
     if (isset($data['release'][0]['value'])) {
         $versionInfo['release'] = $data['release'][0]['value'];
     }
     if (isset($data['tag'][0]['value'])) {
         $versionInfo['tag'] = $data['tag'][0]['value'];
     }
     if (isset($data['date'][0]['value'])) {
         $versionInfo['date'] = $data['date'][0]['value'];
     }
     if (isset($data['info'][0]['value'])) {
         $versionInfo['info'] = $data['info'][0]['value'];
     }
     if (isset($data['package'][0]['value'])) {
         $versionInfo['package'] = $data['package'][0]['value'];
     }
     if (isset($data['patch'][0]['value'])) {
         $versionInfo['patch'] = array();
         foreach ($data['patch'] as $patch) {
             $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
         }
     }
     if (isset($data['version'][0]['value'])) {
         $versionInfo['version'] = Version::fromString($data['release'][0]['value'], $data['application'][0]['value'], isset($data['type'][0]['value']) ? $data['type'][0]['value'] : null);
     }
     return $versionInfo;
 }
開發者ID:anorton,項目名稱:pkp-lib,代碼行數:46,代碼來源:VersionCheck.inc.php

示例10: XMLDAO

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         $typemapFile = $this->getPluginPath() . '/typemap-' . (int) $cache->cacheId . '.xml';
         if (file_exists($typemapFile)) {
             $data = $xmlDao->parseStruct($typemapFile, array('mapping'));
         } else {
             $data = array();
         }
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
開發者ID:Rygbee,項目名稱:harvester,代碼行數:27,代碼來源:TypeMapPreprocessorPlugin.inc.php

示例11: array

 function _cacheMiss($cache, $id)
 {
     $allCurrencies =& Registry::get('allCurrencies', true, null);
     if ($allCurrencies === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $filename = $this->getCurrencyFilename(AppLocale::getLocale());
         $notes[] = array('debug.notes.currencyListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($filename, array('currency'));
         // Build array with ($charKey => array(stuff))
         if (isset($data['currency'])) {
             foreach ($data['currency'] as $currencyData) {
                 $allCurrencies[$currencyData['attributes']['code_alpha']] = array($currencyData['attributes']['name'], $currencyData['attributes']['code_numeric']);
             }
         }
         asort($allCurrencies);
         $cache->setEntireCache($allCurrencies);
     }
     return null;
 }
開發者ID:mczirfusz,項目名稱:pkp-lib,代碼行數:22,代碼來源:CurrencyDAO.inc.php

示例12: XMLDAO

 /**
  * Load a locale list from a file.
  * @param $filename string
  * @return array
  */
 function &loadLocaleList($filename)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($filename, array('locale'));
     $allLocales = array();
     // Build array with ($localKey => $localeName)
     if (isset($data['locale'])) {
         foreach ($data['locale'] as $localeData) {
             $allLocales[$localeData['attributes']['key']] = $localeData['attributes'];
         }
     }
     return $allLocales;
 }
開發者ID:ingmarschuster,項目名稱:MindResearchRepository,代碼行數:18,代碼來源:PKPLocale.inc.php

示例13: installEmailTemplates

    /**
     * Install email templates from an XML file.
     * NOTE: Uses qstr instead of ? bindings so that SQL can be fetched
     * rather than executed.
     * @param $templatesFile string Filename to install
     * @param $returnSql boolean Whether or not to return SQL rather than
     * executing it
     * @param $emailKey string Optional name of single email key to install,
     * skipping others
     * @param $skipExisting boolean If true, do not install email templates
     * that already exist in the database
     * @param $emailKey string If specified, the key of the single template
     * to install (otherwise all are installed)
     * @return array
     */
    function installEmailTemplates($templatesFile, $returnSql = false, $emailKey = null, $skipExisting = false)
    {
        $xmlDao = new XMLDAO();
        $sql = array();
        $data = $xmlDao->parseStruct($templatesFile, array('email'));
        if (!isset($data['email'])) {
            return false;
        }
        foreach ($data['email'] as $entry) {
            $attrs = $entry['attributes'];
            if ($emailKey && $emailKey != $attrs['key']) {
                continue;
            }
            if ($skipExisting && $this->templateExistsByKey($attrs['key'])) {
                continue;
            }
            $sql[] = 'INSERT INTO email_templates_default
				(email_key, can_disable, can_edit, from_role_id, to_role_id)
				VALUES
				(' . $this->_dataSource->qstr($attrs['key']) . ', ' . ($attrs['can_disable'] ? 1 : 0) . ', ' . ($attrs['can_edit'] ? 1 : 0) . ', ' . (isset($attrs['from_role_id']) ? (int) $attrs['from_role_id'] : 'null') . ', ' . (isset($attrs['to_role_id']) ? (int) $attrs['to_role_id'] : 'null') . ")";
            if (!$returnSql) {
                $this->update(array_shift($sql));
            }
        }
        if ($returnSql) {
            return $sql;
        }
        return true;
    }
開發者ID:JovanyJeff,項目名稱:hrp,代碼行數:44,代碼來源:PKPEmailTemplateDAO.inc.php

示例14: installDefaultBase

    /**
     * Install genres from an XML file.
     * @param $pressId int
     * @return boolean
     */
    function installDefaultBase($pressId)
    {
        $xmlDao = new XMLDAO();
        $data = $xmlDao->parseStruct($this->getDefaultBaseFilename(), array('genre'));
        if (!isset($data['genre'])) {
            return false;
        }
        foreach ($data['genre'] as $entry) {
            $attrs = $entry['attributes'];
            $this->update('INSERT INTO genres
				(entry_key, sortable, press_id, category)
				VALUES
				(?, ?, ?, ?)', array($attrs['key'], $attrs['sortable'] ? 1 : 0, $pressId, $attrs['category']));
        }
        return true;
    }
開發者ID:jerico-dev,項目名稱:omp,代碼行數:21,代碼來源:GenreDAO.inc.php

示例15: array

 /**
  * Static method: Load a locale array from a file. Not cached!
  * @param $filename string Filename to locale XML to load
  * @param array
  */
 function &load($filename)
 {
     $localeData = array();
     // Reload localization XML file
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($filename, array('message'));
     // Build array with ($key => $string)
     if (isset($data['message'])) {
         foreach ($data['message'] as $messageData) {
             $localeData[$messageData['attributes']['key']] = $messageData['value'];
         }
     }
     return $localeData;
 }
開發者ID:yuricampos,項目名稱:ojs,代碼行數:19,代碼來源:LocaleFile.inc.php


注:本文中的XMLDAO::parseStruct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。