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


PHP classXML::fetchItem方法代码示例

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


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

示例1: fetchXmlAppInformation

 /**
  * Fetch Apps XML Information File
  *
  * @access	public
  * @param	string		Application Directory
  * @param	string		Character set (used for ACP)
  * @return	array 		..of data
  */
 public static function fetchXmlAppInformation($app, $charset = '')
 {
     /* INIT */
     $info = array();
     /* Fetch core writeable files */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML($charset ? $charset : IPSSetUp::charSet);
     try {
         if (is_file(IPSLib::getAppDir($app) . '/xml/information.xml')) {
             $xml->load(IPSLib::getAppDir($app) . '/xml/information.xml');
             /* Fetch general information */
             foreach ($xml->fetchElements('data') as $xmlelement) {
                 //TERANOTE: remove this code below after making sure it doesn't cause issues the new way
                 /*$data = $xml->fetchElementsFromRecord( $xmlelement );
                          		
                          		$info['name']				= $data['name'];
                 		$info['title']				= $data['name'];
                 		$info['author']				= $data['author'];
                 		$info['description']		= $data['description'];
                 		$info['public_name']		= $data['public_name'];
                 		$info['disabledatinstall']	= ( $data['disabledatinstall'] ) ? 1 : 0;
                 		$info['key']				= $app;
                 		$info['ipskey']				= $data['ipskey'];
                 		$info['hide_tab']			= $data['hide_tab'];*/
                 $info = $xml->fetchElementsFromRecord($xmlelement);
                 /* Sort some things */
                 $info['title'] = $info['name'];
                 $info['disabledatinstall'] = intval($info['disabledatinstall']);
                 $info['hide_tab'] = intval($info['hide_tab']);
                 $info['key'] = $app;
             }
             /* Fetch template information */
             foreach ($xml->fetchElements('template') as $template) {
                 $name = $xml->fetchItem($template);
                 $match = $xml->fetchAttribute($template, 'match');
                 if ($name) {
                     $info['templates'][$name] = $match;
                 }
             }
         }
         return $info;
     } catch (Exception $error) {
         $this->registry->output->addError(IPS_ROOT_PATH . 'applications/' . $app . '/xml/information.xml');
         return FALSE;
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:55,代码来源:setup.php

示例2: importTemplateAppXML

 /**
  * Import a single app
  *
  * @access	public
  * @param	string		App
  * @param	string		Skin key to import
  * @param	int			Set ID
  * @param	boolean		Set the edited / added flags to 0 (from install, upgrade)
  * @return	mixed		bool, or array of info
  */
 public function importTemplateAppXML($app, $skinKey, $setID = 0, $ignoreAddedEditedFlag = false)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $templateGroups = array();
     $templates = array();
     $fileXML = IPSLib::getAppDir($app) . '/xml/' . $app . '_' . $skinKey . '_templates.xml';
     $infoXML = IPSLib::getAppDir($app) . '/xml/information.xml';
     $return = array('updateCount' => 0, 'insertCount' => 0, 'updateBits' => array(), 'insertBits' => array());
     if (!file_exists($fileXML)) {
         return $return;
     }
     if (!$setID and $skinKey != 'root') {
         /* Figure out correct set ID based on key */
         $skinSetData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => "set_key='" . $skinKey . "'"));
         $setID = $skinSetData['set_id'];
     }
     /* Set ignore flag correctly */
     if (!empty($skinKey) and in_array($skinKey, array('root', 'lofi', 'xmlskin'))) {
         $ignoreAddedEditedFlag = true;
     }
     //-----------------------------------------
     // XML
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPS_DOC_CHAR_SET);
     //-----------------------------------------
     // Get information file
     //-----------------------------------------
     $xml->load($infoXML);
     foreach ($xml->fetchElements('template') as $template) {
         $name = $xml->fetchItem($template);
         $match = $xml->fetchAttribute($template, 'match');
         if ($name) {
             $templateGroups[$name] = $match;
         }
     }
     if (!is_array($templateGroups) or !count($templateGroups)) {
         $this->_addMessage("Nothing to export for " . $app);
         return FALSE;
     }
     //-----------------------------------------
     // Fetch templates
     //-----------------------------------------
     $_templates = $this->fetchTemplates($setID, 'allNoContent');
     $_MASTER = $this->fetchTemplates(0, 'allNoContent');
     //-----------------------------------------
     // Loop through...
     //-----------------------------------------
     foreach ($_templates as $group => $data) {
         $_okToGo = FALSE;
         foreach ($templateGroups as $name => $match) {
             if ($match == 'contains') {
                 if (stristr($group, $name)) {
                     $_okToGo = TRUE;
                     break;
                 }
             } else {
                 if ($group == $name) {
                     $_okToGo = TRUE;
                 }
             }
         }
         if ($_okToGo === TRUE) {
             foreach ($data as $name => $templateData) {
                 $templates[$group][$name] = $templateData;
             }
         }
     }
     //-----------------------------------------
     // Wipe the master skins
     //-----------------------------------------
     if ($setID == 0) {
         $this->DB->delete('skin_templates', "template_set_id=0 AND template_group IN ('" . implode("','", array_keys($templates)) . "') AND template_user_added=0 AND template_added_to=0");
         /* Now wipe the array so we enforce creation */
         unset($templates);
     }
     //-----------------------------------------
     // Now grab the actual XML files
     //-----------------------------------------
     $xml->load($fileXML);
     foreach ($xml->fetchElements('template') as $templatexml) {
         $data = $xml->fetchElementsFromRecord($templatexml);
         /* Figure out if this is added by a user or not */
         if ($ignoreAddedEditedFlag === TRUE) {
             $isAdded = 0;
             $isEdited = 0;
         } else {
             $isAdded = (is_array($_MASTER[$data['template_group']][strtolower($data['template_name'])]) and !$_MASTER[$data['template_group']][strtolower($data['template_name'])]['template_user_added']) ? 0 : 1;
//.........这里部分代码省略.........
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:101,代码来源:skinImportExport.php

示例3: applicationRemove


//.........这里部分代码省略.........
                 }
                 /* Delete hook file entries */
                 $this->DB->delete('core_hooks_files', "hook_hook_id={$hook['hook_id']}");
             }
             $this->cache->rebuildCache('hooks', 'global');
         }
     }
     //-----------------------------------------
     // Remove Files
     //-----------------------------------------
     /* Languages */
     try {
         foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/lang_cache/') as $dir) {
             if (!$dir->isDot() && intval($dir->getFileName())) {
                 foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'cache/lang_cache/' . $dir->getFileName() . '/') as $file) {
                     if (!$file->isDot()) {
                         if (preg_match("/^({$application['app_directory']}_)/", $file->getFileName())) {
                             unlink($file->getPathName());
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
     }
     /* Remove Skins */
     if (is_file(IPSLib::getAppDir($application['app_directory']) . '/xml/information.xml')) {
         require_once IPS_KERNEL_PATH . 'classXML.php';
         /*noLibHook*/
         $xml = new classXML($this->settings['gb_char_set']);
         $xml->load(IPSLib::getAppDir($application['app_directory']) . '/xml/information.xml');
         if (is_object($xml->fetchElements('template'))) {
             foreach ($xml->fetchElements('template') as $template) {
                 $name = $xml->fetchItem($template);
                 $match = $xml->fetchAttribute($template, 'match');
                 if ($name) {
                     $templateGroups[$name] = $match;
                 }
             }
         }
         if (is_array($templateGroups) and count($templateGroups)) {
             /* Loop through skin directories */
             try {
                 foreach (new DirectoryIterator(IPS_CACHE_PATH . 'cache/skin_cache/') as $dir) {
                     if (preg_match("/^(cacheid_)/", $dir->getFileName())) {
                         foreach (new DirectoryIterator(IPS_CACHE_PATH . 'cache/skin_cache/' . $dir->getFileName() . '/') as $file) {
                             if (!$file->isDot()) {
                                 foreach ($templateGroups as $name => $match) {
                                     if ($match == 'contains') {
                                         if (stristr($file->getFileName(), $name)) {
                                             unlink($file->getPathName());
                                         }
                                     } else {
                                         if ($file->getFileName() == $name . '.php') {
                                             unlink($file->getPathName());
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             } catch (Exception $e) {
             }
             /* Delete from database */
             foreach ($templateGroups as $name => $match) {
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:67,代码来源:applications.php

示例4: fetchXmlAppInformation

 /**
  * Fetch Apps XML Information File
  *
  * @access	public
  * @param	string		Application Directory
  * @return	array 		..of data
  */
 public static function fetchXmlAppInformation($app)
 {
     /* INIT */
     $info = array();
     /* Fetch core writeable files */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPSSetUp::charSet);
     try {
         $xml->load(IPSLib::getAppDir($app) . '/xml/information.xml');
         /* Fetch general information */
         foreach ($xml->fetchElements('data') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             $info['name'] = $data['name'];
             $info['title'] = $data['name'];
             $info['author'] = $data['author'];
             $info['description'] = $data['description'];
             $info['public_name'] = $data['public_name'];
             $info['disabledatinstall'] = $data['disabledatinstall'] ? 1 : 0;
             $info['key'] = $app;
             $info['ipskey'] = $data['ipskey'];
             $info['hide_tab'] = $data['hide_tab'];
         }
         /* Fetch template information */
         foreach ($xml->fetchElements('template') as $template) {
             $name = $xml->fetchItem($template);
             $match = $xml->fetchAttribute($template, 'match');
             if ($name) {
                 $info['templates'][$name] = $match;
             }
         }
         return $info;
     } catch (Exception $error) {
         $this->registry->output->addError(IPS_ROOT_PATH . 'applications/' . $app . '/xml/information.xml');
         return FALSE;
     }
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:43,代码来源:setup.php


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