本文整理匯總了PHP中JApplicationHelper::parseXMLInstallFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP JApplicationHelper::parseXMLInstallFile方法的具體用法?PHP JApplicationHelper::parseXMLInstallFile怎麽用?PHP JApplicationHelper::parseXMLInstallFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JApplicationHelper
的用法示例。
在下文中一共展示了JApplicationHelper::parseXMLInstallFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetchElement
/**
* Method to get the element.
*
* @return string A message containing the installed version and,
* if necessary, information on a new version.
*
* @since 2.1
*/
function fetchElement($name, $value, &$node, $control_name)
{
// Check if cURL is loaded; if not, proceed no further
if (!extension_loaded('curl')) {
return JText::_('MOD_TWEETDISPLAYBACK_ERROR_NOCURL');
} else {
// Get the module's XML
$xmlfile = JPATH_SITE . '/modules/mod_tweetdisplayback/mod_tweetdisplayback.xml';
$data = JApplicationHelper::parseXMLInstallFile($xmlfile);
// The module's version
$version = $data['version'];
// The target to check against
$target = 'http://www.flbab.com/updates/TDB_version';
// Get the JSON data
$update = ModTweetDisplayBackHelper::getJSON($target);
// Message containing the version
$message = '<label style="max-width:100%">' . JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_INSTALLED', $version);
// If an update is available, notify the user
if (version_compare($update['version'], $version, 'gt')) {
$message .= ' <a href="' . $update['notice'] . '" target="_blank">' . JText::sprintf('MOD_TWEETDISPLAYBACK_VERSION_UPDATE', $update['version']) . '</a></label>';
} else {
$message .= ' ' . JText::_('MOD_TWEETDISPLAYBACK_VERSION_CURRENT') . '</label>';
}
return $message;
}
}
示例2: getLabel
/**
* Method to get the field label.
*
* @return string A message containing the installed version and,
* if necessary, information on a new version.
*
* @since 2.1
*/
protected function getLabel()
{
// Check if cURL is loaded; if not, proceed no further
if (!extension_loaded('curl')) {
return JText::_('TPL_CONSTRUCT5_ERROR_NOCURL');
} else {
// Get the module's XML
$xmlfile = JPATH_SITE . '/templates/construct5/templateDetails.xml';
$data = JApplicationHelper::parseXMLInstallFile($xmlfile);
// The module's version
$version = $data['version'];
$name = str_replace(array('construct', 'bootstruct'), array('Construct', 'Bootstruct'), $data['name']);
// The target to check against
$target = 'http://construct-framework.com/upgradecheck/' . $data['name'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $target);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$update = curl_exec($curl);
curl_close($curl);
// Message containing the version
$message = '<label style="max-width:100%">' . JText::sprintf('TPL_CONSTRUCT5_VERSION_INSTALLED', $name, $version);
// If an update is available, and compatible with the current Joomla! version, notify the user
if (version_compare($version, $update, 'lt')) {
$message .= ' <a href="http://construct-framework.com" target="_blank">' . JText::sprintf('TPL_CONSTRUCT5_VERSION_UPDATE', $update) . '</a></label>';
} else {
$message .= ' ' . JText::_('TPL_CONSTRUCT5_VERSION_CURRENT') . '</label>';
}
return $message;
}
}
示例3: versionXML
/**
* Retrieve Kunena version from manifest.xml
*
* @return string version
*/
function versionXML()
{
if ($data = JApplicationHelper::parseXMLInstallFile(KUNENA_FILE_INSTALL)) {
return $data['version'];
}
return 'ERROR';
}
示例4: _loadItems
function _loadItems()
{
global $mainframe, $option;
// Get a database connector
$db =& JFactory::getDBO();
$query = 'SELECT e.id as id, e.name as name, e.extension as extension, e.folder as folder, p.name as file, p.title as plugin' . ' FROM #__jce_extensions AS e' . ' INNER JOIN #__jce_plugins as p ON e.pid = p.id' . ' ORDER BY e.name';
$db->setQuery($query);
$rows = $db->loadObjectList();
$numRows = count($rows);
for ($i = 0; $i < $numRows; $i++) {
$row =& $rows[$i];
$plugin = $row->plugin;
$name = $row->name;
$folder = $row->folder;
// Get the plugin base path
$baseDir = JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins';
// Get the plugin xml file
$xmlfile = $baseDir . DS . $row->file . DS . 'extensions' . DS . $row->folder . DS . $row->extension . ".xml";
if (file_exists($xmlfile)) {
if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
foreach ($data as $key => $value) {
$row->{$key} = $value;
}
}
}
$row->name = $name;
$row->plugin = $plugin;
}
$this->setState('pagination.total', $numRows);
if ($this->_state->get('pagination.limit') > 0) {
$this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
} else {
$this->_items = $rows;
}
}
示例5: _getXMLInfos
function _getXMLInfos($info)
{
$folder = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jinc';
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
} else {
$folder = JPATH_SITE . DS . 'components' . DS . 'com_jinc';
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, 'com_jinc.xml');
} else {
$xmlFilesInDir = null;
}
}
$xml_items = '';
if (count($xmlFilesInDir)) {
foreach ($xmlFilesInDir as $xmlfile) {
if ($data = JApplicationHelper::parseXMLInstallFile($folder . DS . $xmlfile)) {
foreach ($data as $key => $value) {
$xml_items[$key] = $value;
}
}
}
}
if (isset($xml_items[$info]) && $xml_items[$info] != '') {
return $xml_items[$info];
} else {
return '';
}
}
示例6: display
function display($tpl = null)
{
global $option;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$client = JRequest::getWord('client', 'site');
$id = JRequest::getVar('id', '', '', 'int');
$lists = array();
$query = 'SELECT * FROM #__jomtube_plugins WHERE id = ' . $id;
$db->setQuery($query);
$row = $db->loadObject();
if ($id) {
$data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . $row->folder . DS . $row->element . '.xml');
} else {
$row->folder = '';
$row->ordering = 999;
$row->published = 1;
$row->description = '';
}
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
// get params definitions
$params = new JParameter($row->params, JPATH_SITE . DS . $row->folder . DS . $row->element . '.xml', 'plugin');
$this->assignRef('lists', $lists);
$this->assignRef('plugin', $row);
$this->assignRef('params', $params);
parent::display($tpl);
}
示例7: getVersions
/**
* Get extension versions
* @return Array
*/
function getVersions()
{
$db = JFactory::getDBO();
// Get Component xml
$com_xml = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce' . DS . 'jce.xml');
$mediabox_xml_file = WF_JOOMLA15 ? JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml' : JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox' . DS . 'jcemediabox.xml';
if (file_exists($mediabox_xml_file)) {
$mediabox_xml = JApplicationHelper::parseXMLInstallFile($mediabox_xml_file);
} else {
$mediabox_xml['version'] = 0;
// return 0 for false
}
$versions = array('joomla' => array('com_jce' => $com_xml['version'], 'plg_jcemediabox' => $mediabox_xml['version']), 'jce' => array());
$model = JModel::getInstance('plugins', 'WFModel');
// get all plugins
$plugins = $model->getPlugins();
// get all extensions
$extensions = $model->getExtensions();
foreach ($plugins as $plugin) {
if ($plugin->core == 0) {
$file = WF_EDITOR_PLUGINS . DS . $plugin->name . DS . $plugin->name . '.xml';
$xml = JApplicationHelper::parseXMLInstallFile($file);
$versions['jce']['jce_' . $plugin->name] = $xml['version'];
}
}
foreach ($extensions as $extension) {
if ($extension->core == 0) {
$file = WF_EDITOR_EXTENSIONS . DS . $extension->folder . DS . $extension->extension . '.xml';
$xml = JApplicationHelper::parseXMLInstallFile($file);
$versions['jce']['jce_' . $extension->folder . '_' . $extension->extension] = $xml['version'];
}
}
return $versions;
}
示例8: getExtensionVersion
public static function getExtensionVersion($c = 'phocadownload') {
$folder = JPATH_ADMINISTRATOR .DS. 'components'.DS.'com_'.$c;
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, '.xml$');
} else {
$folder = JPATH_SITE .DS. 'components'.DS.'com_'.$c;
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, '.xml$');
} else {
$xmlFilesInDir = null;
}
}
$xml_items = '';
if (count($xmlFilesInDir))
{
foreach ($xmlFilesInDir as $xmlfile)
{
if ($data = JApplicationHelper::parseXMLInstallFile($folder.DS.$xmlfile)) {
foreach($data as $key => $value) {
$xml_items[$key] = $value;
}
}
}
}
if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
return $xml_items['version'];
} else {
return '';
}
}
示例9: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$language = JFactory::getLanguage();
// create a unique id
$id = preg_replace('#([^a-z0-9_-]+)#i', '', $control_name . 'filesystem' . $name);
// add javascript if element has parameters
if ($node->attributes('parameters')) {
$document = JFactory::getDocument();
$document->addScriptDeclaration('$jce.Parameter.add("#' . $id . '", "filesystem");');
}
// path to directory
$path = WF_EDITOR_EXTENSIONS . DS . 'filesystem';
$filter = '\\.xml$';
$files = JFolder::files($path, $filter, false, true);
$options = array();
if (!$node->attributes('exclude_default')) {
$options[] = JHTML::_('select.option', '', WFText::_('WF_OPTION_NOT_SET'));
}
if (is_array($files)) {
foreach ($files as $file) {
// load language file
$language->load('com_jce_filesystem_' . basename($file, '.xml'), JPATH_SITE);
$xml = JApplicationHelper::parseXMLInstallFile($file);
$options[] = JHTML::_('select.option', basename($file, '.xml'), WFText::_($xml['name']));
}
}
return JHTML::_('select.genericlist', $options, '' . $control_name . '[filesystem][' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $id);
}
示例10: _loadItems
function _loadItems()
{
global $mainframe, $option;
// Get a database connector
$db =& JFactory::getDBO();
$where = null;
if ($search = $this->_state->get('filter.string')) {
$where .= ' AND title LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
}
$query = 'SELECT id, title, type, name' . ' FROM #__jce_plugins' . ' WHERE type="plugin"' . ' AND iscore=0' . $where . ' ORDER BY name';
$db->setQuery($query);
$rows = $db->loadObjectList();
// Get the plugin base path
$baseDir = JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins';
$numRows = count($rows);
for ($i = 0; $i < $numRows; $i++) {
$row =& $rows[$i];
// Get the plugin xml file
$xmlfile = $baseDir . DS . $row->name . DS . $row->name . ".xml";
if (file_exists($xmlfile)) {
if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) {
foreach ($data as $key => $value) {
$row->{$key} = $value;
}
}
}
}
$this->setState('pagination.total', $numRows);
if ($this->_state->get('pagination.limit') > 0) {
$this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
} else {
$this->_items = $rows;
}
}
示例11: display
/**
* Метод для отображения вида
*/
public function display($tpl = null)
{
$data = JApplicationHelper::parseXMLInstallFile(JPATH_COMPONENT . DS . 'smfaq.xml');
$this->assignRef('data', $data);
require_once JPATH_COMPONENT . '/helpers/smfaq.php';
SmFaqHelper::addSubmenu($this->_name);
parent::display($tpl);
}
示例12: isEnabled
public function isEnabled()
{
$path_to_xml = JPATH_ADMINISTRATOR . '/components/com_mtree/mtree.xml';
if (JFile::exists($path_to_xml) && ($data = JApplicationHelper::parseXMLInstallFile($path_to_xml))) {
return version_compare($data['version'], '2.1.3') >= 0;
}
return false;
}
示例13: isEnabled
/**
* If K2 is installed on the system
*
* @return boolean If K2 is installed on the system
*
* @since 2.0
*/
public function isEnabled()
{
$path_to_xml = JPATH_ADMINISTRATOR . '/components/com_k2/';
if (JFile::exists($path_to_xml . 'manifest.xml') and $data = JApplicationHelper::parseXMLInstallFile($path_to_xml . 'manifest.xml') or JFile::exists($path_to_xml . 'k2.xml') and $data = JApplicationHelper::parseXMLInstallFile($path_to_xml . 'k2.xml')) {
return version_compare($data['version'], '2.1') >= 0;
}
return false;
}
示例14: onAfterInitialise
public function onAfterInitialise()
{
if (!($app = @(include JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit-app.php') and file_exists($path = JPATH_ADMINISTRATOR . '/components/com_k2/k2.xml') and JComponentHelper::getComponent('com_k2', true)->enabled and $data = JApplicationHelper::parseXMLInstallFile(JPATH_ADMINISTRATOR . '/components/com_k2/k2.xml') and version_compare($data['version'], '2.1', '>='))) {
return;
}
$app['plugins']->addPath(__DIR__ . '/plugin/plugin.php');
$app['locator']->addPath('plugins/content/k2', __DIR__ . '/plugin');
}
示例15: display
function display($tpl = null)
{
global $option;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$client = JRequest::getWord('client', 'site');
$cid = JRequest::getVar('cid', array(0), '', 'array');
JArrayHelper::toInteger($cid, array(0));
$lists = array();
$row =& JTable::getInstance('plugin');
// load the row from the db table
$row->load($cid[0]);
// fail if checked out not by 'me'
if ($row->isCheckedOut($user->get('id'))) {
$msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The plugin'), $row->title);
$this->setRedirect('index.php?option=' . $option . '&client=' . $client, $msg, 'error');
return false;
}
if ($client == 'admin') {
$where = "client_id='1'";
} else {
$where = "client_id='0'";
}
// get list of groups
if ($row->access == 99 || $row->client_id == 1) {
$lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
} else {
// build the html select list for the group access
$lists['access'] = JHTML::_('list.accesslevel', $row);
}
if ($cid[0]) {
$row->checkout($user->get('id'));
if ($row->ordering > -10000 && $row->ordering < 10000) {
// build the html select list for ordering
$query = 'SELECT ordering AS value, name AS text' . ' FROM #__plugins' . ' WHERE folder = ' . $db->Quote($row->folder) . ' AND published > 0' . ' AND ' . $where . ' AND ordering > -10000' . ' AND ordering < 10000' . ' ORDER BY ordering';
$order = JHTML::_('list.genericordering', $query);
$lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
} else {
$lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />' . JText::_('This plugin cannot be reordered');
}
$lang =& JFactory::getLanguage();
$lang->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_ADMINISTRATOR);
$data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . 'plugins' . DS . $row->folder . DS . $row->element . '.xml');
$row->description = $data['description'];
} else {
$row->folder = '';
$row->ordering = 999;
$row->published = 1;
$row->description = '';
}
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
// get params definitions
$params = new JParameter($row->params, JApplicationHelper::getPath('plg_xml', $row->folder . DS . $row->element), 'plugin');
$this->assignRef('lists', $lists);
$this->assignRef('plugin', $row);
$this->assignRef('params', $params);
parent::display($tpl);
}