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


PHP utility::xml2arr方法代码示例

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


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

示例1: getAvailablePackages

 /**
  * Get all available update packages
  *  
  * @access public      
  * @return array
  */
 public static function getAvailablePackages()
 {
     global $lC_Api;
     $result = array('entries' => array());
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $request_type = getRequestType();
     $versions = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
     $versions_array = utility::xml2arr($versions);
     $counter = 0;
     foreach ($versions_array['data'] as $l => $v) {
         if (version_compare(utility::getVersion(), $v['version'], '<')) {
             $result['entries'][] = array('key' => $counter, 'version' => $v['version'], 'date' => lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(lC_DateTime::getTimestamp($v['dateCreated'], 'Ymd'))), 'announcement' => $v['newsLink'], 'update_package' => isset($v['pharLink']) ? $v['pharLink'] . '?ref=' . urlencode($_SERVER['SCRIPT_FILENAME']) : null);
             $counter++;
         }
     }
     @usort($result['entries'], function ($a, $b) {
         return version_compare($a['version'], $b['version'], '>');
     });
     $result['total'] = count($result['entries']);
     return $result;
 }
开发者ID:rajeshb001,项目名称:loaded7,代码行数:27,代码来源:updates.php

示例2: apiCheck

 public static function apiCheck()
 {
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $request_type = getRequestType();
     $apiCheck = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
     $versions = utility::xml2arr($apiCheck);
     $error = false;
     if (count($versions) == 0) {
         // there was an error with the api
         $error = true;
         $errorMsg = preg_match("'<title[^>]*?>.*?</title>'si", $versions, $regs);
         $errorMsg = is_array($regs) ? strip_tags(end($regs)) : NULL;
         if ($errorMsg == '') {
             $errorMsg = 'Resource Unavailable at ' . $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'];
         }
         $error = true;
         // log the error
         self::log('Error: ' . $errorMsg);
     }
     if ($versions == null || $error) {
         // set the error flag
         return -1;
     }
     return 1;
 }
开发者ID:rajeshb001,项目名称:itpl_loaded7,代码行数:25,代码来源:login.php

示例3: getAvailbleAddons

 public static function getAvailbleAddons()
 {
     $installed = self::getInstalledAddons();
     $request = array('storeName' => STORE_NAME, 'storeWWW' => HTTP_SERVER . DIR_WS_HTTP_CATALOG, 'storeSSL' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG);
     $checksum = hash('sha256', json_encode($request));
     $request['checksum'] = $checksum;
     $request['instID'] = INSTALLATION_ID;
     $request_type = getRequestType();
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/store/addons/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'post', 'parameters' => $request, 'timeout' => 10));
     $available = utility::xml2arr($resultXML);
     $addons = array();
     $codeArr = array();
     foreach ($installed as $key => $val) {
         $codeArr[$val['code']] = true;
         $addons[] = array('name' => $val['name'], 'code' => $val['code'], 'type' => $val['type'], 'title' => $val['title'], 'description' => $val['description'], 'rating' => $val['rating'], 'author' => $val['author'], 'authorWWW' => $val['authorWWW'], 'thumbnail' => $val['thumbnail'], 'version' => $val['version'], 'compatibility' => $val['compatibility'], 'installed' => $val['installed'], 'mobile' => $val['mobile'], 'enabled' => $val['enabled'], 'from_store' => false, 'featured' => false, 'featured_in_group' => false);
     }
     foreach ($available['data'] as $key => $val) {
         if (array_key_exists($val['code'], $codeArr)) {
             continue;
         }
         $addons[] = array('name' => $val['code'] . '/controller.php', 'code' => $val['code'], 'type' => $val['type'], 'title' => self::_decodeText($val['title']), 'description' => self::_decodeText($val['description']), 'rating' => $val['rating'], 'author' => $val['author'], 'authorWWW' => $val['authorWWW'], 'thumbnail' => $val['thumbnail'], 'version' => $val['version'], 'compatibility' => $val['compatibility'], 'installed' => $val['installed'], 'mobile' => $val['mobile'], 'enabled' => $val['enabled'], 'from_store' => true, 'featured' => $val['featured'], 'featured_in_group' => $val['featured_in_group']);
     }
     return $addons;
 }
开发者ID:abhiesa-tolexo,项目名称:loaded7,代码行数:25,代码来源:store.php


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