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


PHP JFactory::getXML方法代码示例

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


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

示例1: display

 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     JToolbarHelper::title(JText::_('jUpgradePro'), 'jupgrade');
     JToolbarHelper::custom('cpanel', 'back.png', 'back_f2.png', 'Back', false, false);
     JToolbarHelper::preferences('com_jupgradepro', '500');
     JToolbarHelper::spacer();
     JToolbarHelper::custom('help', 'help.png', 'help_f2.png', 'Help', false, false);
     JToolbarHelper::spacer();
     // get params
     $params = JComponentHelper::getParams('com_jupgradepro');
     //
     // Joomla bug: JInstaller not save the defaults params reading config.xml
     //
     $db = JFactory::getDBO();
     if (!$params->get('method')) {
         $default_params = '{"method":"rest","rest_hostname":"http:\\/\\/www.example.org\\/","rest_username":"","rest_password":"","rest_key":"","path":"","driver":"mysql","hostname":"localhost","username":"","password":"","database":"","prefix":"jos_","skip_checks":"0","skip_files":"1","skip_templates":"1","skip_extensions":"1","skip_core_users":"0","skip_core_categories":"0","skip_core_sections":"0","skip_core_contents":"0","skip_core_contents_frontpage":"0","skip_core_menus":"0","skip_core_menus_types":"0","skip_core_modules":"0","skip_core_modules_menu":"0","skip_core_banners":"0","skip_core_banners_clients":"0","skip_core_banners_tracks":"0","skip_core_contacts":"0","skip_core_newsfeeds":"0","skip_core_weblinks":"0","positions":"0","debug":"0"}';
         $query = "UPDATE #__extensions SET `params` = '{$default_params}' WHERE `element` = 'com_jupgradepro'";
         $db->setQuery($query);
         $db->query();
         // get params.. again
         $params = JComponentHelper::getParams('com_jupgradepro');
     }
     // Load mooTools
     //JHTML::_('behavior.mootools'); // 2.5
     JHtml::_('behavior.framework', true);
     $xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/jupgradepro.xml';
     $xml = JFactory::getXML($xmlfile);
     $this->params = $params;
     $this->version = $xml->version[0];
     parent::display($tpl);
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:38,代码来源:view.html.php

示例2: display

 /**
  * fieldsattachs view display method
  * @return void
  */
 function display($tpl = null)
 {
     // Get data from the model
     $items = $this->get('Items');
     $pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Assign data to the view
     $this->items = $items;
     $this->pagination = $pagination;
     //Version
     $this->version = "";
     $xml = JFactory::getXML(JPATH_COMPONENT . DS . 'fieldsattach.xml');
     $this->version = (string) $xml->version;
     // Set the toolbar
     $this->addToolBar();
     //Add script
     $this->jqueryscript();
     // Display the template
     parent::display($tpl);
     // Set the document
     //$this->setDocument();
 }
开发者ID:Bitcoinsulting,项目名称:website-ads,代码行数:30,代码来源:view.html.php

示例3: find

 /**
  * Reads a file and searches for the license
  *
  * @param   string  $file  - The path to the file
  *
  * @return boolean True if the license was found, otherwise False.
  */
 protected function find($file)
 {
     $xml = JFactory::getXML($file);
     // Failed to parse the xml file.
     // Assume that this is not a extension manifest
     if (!$xml) {
         return true;
     }
     // Check if this is an extension manifest
     // 1.5 uses 'install', 1.6 uses 'extension'
     if ($xml->getName() != 'install' && $xml->getName() != 'extension') {
         return true;
     }
     // Check if there's a license tag
     if (!isset($xml->license)) {
         $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_FOUND'));
         return false;
     }
     // Check if the license is gpl
     if (stripos($xml->license, 'gpl') === false && stripos($xml->license, 'general public license') === false) {
         $this->report->addCompat($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_GPL'));
         return false;
     }
     // All checks passed. Return true
     return true;
 }
开发者ID:angelexevior,项目名称:jedchecker,代码行数:33,代码来源:xmllicense.php

示例4: importYtb

 public static function importYtb($ytbLink, $folder, &$errorMsg = '')
 {
     $ytbCode = str_replace("&feature=related", "", PhocaGalleryYoutube::getCode(strip_tags($ytbLink)));
     $ytb = array();
     $ytb['title'] = '';
     $ytb['desc'] = '';
     $ytb['filename'] = '';
     $ytb['link'] = strip_tags($ytbLink);
     if (!function_exists("curl_init")) {
         $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_NOT_LOADED_CURL');
         return false;
     } else {
         if ($ytbCode == '') {
             $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_URL_NOT_CORRECT');
             return false;
         } else {
             // Data
             $cUrl = curl_init("http://gdata.youtube.com/feeds/api/videos/" . strip_tags($ytbCode));
             curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
             $xml = curl_exec($cUrl);
             curl_close($cUrl);
             $xml = str_replace('<media:', '<phcmedia', $xml);
             $xml = str_replace('</media:', '</phcmedia', $xml);
             $data = JFactory::getXML($xml, false);
             //Title
             if (isset($data->title)) {
                 $ytb['title'] = (string) $data->title;
             }
             if ($ytb['title'] == '' && isset($data->phcmediagroup->phcmediatitle)) {
                 $ytb['title'] = (string) $data->phcmediagroup->phcmediatitle;
             }
             if (isset($data->phcmediagroup->phcmediadescription)) {
                 $ytb['desc'] = (string) $data->phcmediagroup->phcmediadescription;
             }
             // Thumbnail
             if (isset($data->phcmediagroup->phcmediathumbnail[0]['url'])) {
                 $cUrl = curl_init(strip_tags((string) $data->phcmediagroup->phcmediathumbnail[0]['url']));
                 curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
                 $img = curl_exec($cUrl);
                 curl_close($cUrl);
             }
             if ($img != '') {
                 $cUrl = curl_init("http://img.youtube.com/vi/" . strip_tags($ytbCode) . "/0.jpg");
                 curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
                 $img = curl_exec($cUrl);
                 curl_close($cUrl);
             }
             $ytb['filename'] = $folder . strip_tags($ytbCode) . '.jpg';
             if (JFile::exists(JPATH_ROOT . DS . 'images' . DS . 'phocagallery' . DS . $ytb['filename'], $img)) {
                 $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_ERROR_VIDEO_EXISTS');
                 return false;
             }
             if (!JFile::write(JPATH_ROOT . DS . 'images' . DS . 'phocagallery' . DS . $ytb['filename'], $img)) {
                 $errorMsg = JText::_('COM_PHOCAGALLERY_YTB_ERROR_WRITE_IMAGE');
                 return false;
             }
         }
     }
     return $ytb;
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:60,代码来源:youtube.php

示例5: getInput

 protected function getInput()
 {
     JHtml::_('behavior.modal', 'a.modal');
     $catalog_path = JPATH_SITE . DS . 'modules' . DS . 'mod_image_show_gk4' . DS . 'styles';
     $folders = JFolder::folders($catalog_path);
     $options = array();
     $final_output = '';
     if (count($folders) > 0) {
         foreach ($folders as $folder) {
             $output = '';
             // read XML file
             $xml = JFactory::getXML($catalog_path . DS . $folder . DS . 'info.xml');
             //
             foreach ($xml->config[0]->field as $field) {
                 $type = $field->attributes()->type;
                 $output .= '<li>' . $this->generateField($type, $field, $folder) . '</li>';
             }
             //
             $final_output .= '<div id="module_style_' . $folder . '" class="module_style"><ul class="adminformlist">' . $output . '</ul></div>';
         }
     } else {
         $final_output = 'Module have no styles. Please install some style package.';
     }
     $final_output .= '<textarea name="' . $this->name . '" id="' . $this->id . '" rows="20" cols="50">' . $this->value . '</textarea>';
     return $final_output;
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:26,代码来源:config.php

示例6: display

 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     // Get params
     JLoader::import('helpers.redmigrator', JPATH_COMPONENT_ADMINISTRATOR);
     $params = redMigratorHelper::getParams();
     //
     // Joomla bug: JInstaller not save the defaults params reading config.xml
     //
     $db = JFactory::getDBO();
     if (!$params->method) {
         $default_params = '{"method":"rest","rest_hostname":"http:\\/\\/www.example.org\\/","rest_username":"","rest_password":"","rest_key":"","path":"","driver":"mysql","hostname":"localhost","username":"","password":"","database":"","prefix":"jos_","skip_checks":"0","skip_files":"1","skip_templates":"1","skip_extensions":"1","skip_core_users":"0","skip_core_categories":"0","skip_core_sections":"0","skip_core_contents":"0","skip_core_contents_frontpage":"0","skip_core_menus":"0","skip_core_menus_types":"0","skip_core_modules":"0","skip_core_modules_menu":"0","skip_core_banners":"0","skip_core_banners_clients":"0","skip_core_banners_tracks":"0","skip_core_contacts":"0","skip_core_newsfeeds":"0","skip_core_weblinks":"0","positions":"0","debug":"0"}';
         $query = "UPDATE #__extensions SET `params` = '{$default_params}' WHERE `element` = 'com_redmigrator'";
         $db->setQuery($query);
         $db->query();
         // Get params.. again
         $params = redMigratorHelper::getParams();
     }
     // Load mooTools
     JHtml::_('behavior.framework', true);
     $xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/redmigrator.xml';
     $xml = JFactory::getXML($xmlfile);
     $this->params = $params;
     $this->version = $xml->version[0];
     parent::display($tpl);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:32,代码来源:view.html.php

示例7: loadManifestFromXML

 /**
  * Load a manifest from an XML file
  *
  * @param	string	$xmlpath	Path to XML manifest file
  *
  * @return	boolean	Result of load
  * @since	1.6
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->packagename = (string) $xml->packagename;
         $this->update = (string) $xml->update;
         $this->authorurl = (string) $xml->authorUrl;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->description = (string) $xml->description;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->version = (string) $xml->version;
         if (isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 // NOTE: JExtension doesn't expect a string.
                 // DO NOT CAST $file
                 $this->filelist[] = new JExtension($file);
             }
         }
         return true;
     }
 }
开发者ID:akksi,项目名称:jcg,代码行数:36,代码来源:packagemanifest.php

示例8: uninstall

 function uninstall($parent)
 {
     // Post Install Log
     self::_postInstallMessage('uninstall', $parent);
     $db = JFactory::getDbo();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "package" AND element = "pkg_cck"');
     $eid = $db->loadResult();
     $db->setQuery('SELECT extension_id FROM #__extensions WHERE type = "plugin" AND element = "cck" AND folder="system"');
     $cck = $db->loadResult();
     // Uninstall FULL PACKAGE only if package exists && system plugin exists..
     if ($eid && $cck) {
         $manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml';
         if (JFile::exists($manifest)) {
             $xml = JFactory::getXML($manifest);
             // Keep it this way until platform 13.x
         }
         if (isset($xml->files)) {
             unset($xml->files->file[3]);
             $xml->asXML($manifest);
         }
         jimport('joomla.installer.installer');
         $installer = JInstaller::getInstance();
         $installer->uninstall('package', $eid);
     }
 }
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:25,代码来源:script.php

示例9: doExecute

 /**
  * Overrides the parent doExecute method to run the web application.
  *
  * This method should include your custom code that runs the application.
  *
  * @return  void
  *
  * @since   11.3
  */
 protected function doExecute()
 {
     // Create a stream context.
     $context = stream_context_create(array('http' => array('method' => 'GET')));
     // Open Flickr Feed as a Stream.
     $feed = @file_get_contents('http://api.flickr.com/services/feeds/photos_public.gne', false, $context);
     // Check if the feed could be opened.
     if (!$feed) {
         // Push the output into the document buffer.
         $this->document->setBuffer('Error: Failed to open stream.', array('type' => 'component', 'name' => 'main'));
         return false;
     }
     // Parse the XML feed.
     $reader = JFactory::getXML($feed, false);
     // Start an output buffer.
     ob_start();
     // Iterate through the elements in the stream.
     foreach ($reader->entry as $entry) {
         echo '<div class="cell">';
         echo $entry->content->data();
         echo '</div>';
     }
     // Get the buffer output.
     $output = ob_get_clean();
     // Push the output into the document buffer.
     $this->document->setBuffer($output, array('type' => 'component', 'name' => 'main'));
 }
开发者ID:robschley,项目名称:joomla-platform-examples,代码行数:36,代码来源:index.php

示例10: installPricingPack

 function installPricingPack($sourcepath)
 {
     if (!self::isPackXML($sourcepath . DS . "manifest.xml")) {
         JError::raiseWarning(500, JText::_("FACTORY_FILE_IS_NOT_A_VALID_PRICING_MANIFEST") . $sourcepath . DS . "manifest.xml");
         return null;
     }
     $xml = JFactory::getXML($sourcepath . DS . "manifest.xml");
     $destfolder = (string) $xml->attributes()->folder;
     $destination = JPATH_COMPONENT_ADMINISTRATOR . DS . 'pricing' . DS . $destfolder;
     jimport("joomla.filesystem.folder");
     JFolder::copy($sourcepath, $destination);
     $db = JFactory::getDbo();
     $db->setQuery("select max(`ordering`)+1 from #__" . APP_PREFIX . "_pricing");
     $maxordering = $db->loadResult();
     $paytable = JTable::getInstance('PricingTable', 'JTheFactory');
     $paytable->itemname = (string) $xml->attributes()->folder;
     $paytable->pricetype = (string) $xml->pricetype;
     $paytable->name = (string) $xml->name;
     $paytable->price = (string) $xml->price;
     $paytable->currency = (string) $xml->currency;
     $paytable->enabled = 0;
     $paytable->params = null;
     $paytable->ordering = $maxordering;
     $paytable->store();
     self::parseQueries($xml->queries);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:26,代码来源:pricing.php

示例11: loadManifestFromXML

 /**
  * Load the manifest file
  *
  * @param   string  $xmlFile  XML File path
  *
  * @return   bool              True if successful, or False otherwise.
  */
 private function loadManifestFromXML($xmlFile = '')
 {
     $xml = null;
     if (version_compare(JVERSION, '1.6', '<')) {
         $xml = simplexml_load_file($xmlFile);
     } else {
         $xml = JFactory::getXML($xmlFile);
     }
     if (!$xml) {
         $this->_errors[] = JText::sprintf('File not found: %s', $xmlFile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->template = (string) $xml->template;
         $this->creationDate = (string) $xml->creationDate;
         $this->author = (string) $xml->author;
         $this->copyright = (string) $xml->copyright;
         $this->authorEmail = (string) $xml->authorEmail;
         $this->authorUrl = (string) $xml->authorUrl;
         $this->version = (string) $xml->version;
         $this->description = (string) $xml->description;
         // It is not just an Array, for compatibility with current extensions version,
         // that expect $manifest->positions->position as the array.
         $this->positions = new stdClass();
         $this->positions->position = array();
         foreach ($xml->positions->position as $position) {
             $this->positions->position[] = (string) $position;
         }
         return true;
     }
 }
开发者ID:Rikisha,项目名称:proj,代码行数:38,代码来源:manifest.php

示例12: load

 public function load($path)
 {
     // Locate for the manifest file in the folder.
     $files = FD::get('Folders')->files($path, '.xml', self::RECURSIVE_SEARCH, self::RETRIEVE_FULL_PATH);
     $this->source = $path;
     if (!count($files)) {
         // Throw errors
         FD::get('Errors')->set('installer.xml', self::XML_NOT_FOUND);
         return false;
     }
     // Load through the list of manifest files to perform the installation.
     foreach ($files as $file) {
         $xml = JFactory::getXML($file);
         if (!$xml) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($xml);
             continue;
         }
         $this->type = (string) $xml->attributes()->type;
         if ($xml->getName() != 'social' || !in_array($this->type, $this->allowed)) {
             FD::get('Errors')->set('installer', self::XML_NOT_VALID);
             unset($parser);
             continue;
         }
         $this->parser = JFactory::getXMLParser('Simple');
         $this->parser->loadFile($file);
         // Set the path of the current xml file.
         $this->path = $file;
         // Retrieves the element
         $this->element = $this->parser->document->getElementByPath('element')->data();
         unset($xml);
         return true;
     }
     return false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:joomla17.php

示例13: _validateEasyDiscussVersion

 public function _validateEasyDiscussVersion()
 {
     $valid = true;
     $parser = null;
     $version = '';
     $xmlFile = JPATH_ROOT . '/administrator/components/com_easydiscuss/easydiscuss.xml';
     if (JFile::exists($xmlFile)) {
         $jVerArr = explode('.', JVERSION);
         $joomlaVersion = $jVerArr[0] . '.' . $jVerArr[1];
         $contents = JFile::read($xmlFile);
         if ($joomlaVersion >= '3.0') {
             $parser = JFactory::getXML($contents, false);
             $version = $parser->xpath('version');
         } else {
             $parser = JFactory::getXMLParser('Simple');
             $parser->loadString($contents);
             $element = $parser->document->getElementByPath('version');
             $version = $element->data();
         }
         if ($version < '3.0.0') {
             $valid = false;
         }
         // If the current installed version is lower than attachment bug patch 3.0.8598
         if ($version < '3.0.8597') {
             $valid = 'warning';
         }
     }
     return $valid;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:29,代码来源:script.php

示例14: loadManifestFromXML

 /**
  * Load a manifest from a file
  * @param string $xmlfile Path to file to load
  */
 function loadManifestFromXML($xmlfile)
 {
     $this->manifest_file = JFile::stripExt(basename($xmlfile));
     $xml = JFactory::getXML($xmlfile);
     if (!$xml) {
         $this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
         return false;
     } else {
         $this->name = (string) $xml->name;
         $this->libraryname = (string) $xml->libraryname;
         $this->version = (string) $xml->version;
         $this->description = (string) $xml->description;
         $this->creationdate = (string) $xml->creationdate;
         $this->author = (string) $xml->author;
         $this->authoremail = (string) $xml->authorEmail;
         $this->authorurl = (string) $xml->authorUrl;
         $this->packager = (string) $xml->packager;
         $this->packagerurl = (string) $xml->packagerurl;
         $this->update = (string) $xml->update;
         if (isset($xml->files) && isset($xml->files->file) && count($xml->files->file)) {
             foreach ($xml->files->file as $file) {
                 $this->filelist[] = (string) $file;
             }
         }
         return true;
     }
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:31,代码来源:librarymanifest.php

示例15: helpsite

 public static function helpsite($value)
 {
     if (empty($value)) {
         return self::value($value);
     } else {
         $version = new JVersion();
         $jver = explode('.', $version->getShortVersion());
         $pathToXml = JPATH_ADMINISTRATOR . '/help/helpsites.xml';
         $text = $value;
         if (!empty($pathToXml) && ($xml = JFactory::getXML($pathToXml))) {
             foreach ($xml->sites->site as $site) {
                 if ((string) $site->attributes()->url == $value) {
                     $text = (string) $site;
                     break;
                 }
             }
         }
         $value = htmlspecialchars($value);
         if (substr($value, 0, 4) == "http") {
             return '<a href="' . $value . '">' . $text . '</a>';
         } else {
             return '<a href="http://' . $value . '">' . $text . '</a>';
         }
     }
 }
开发者ID:khangcodt,项目名称:nvssehcweb,代码行数:25,代码来源:users.php


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