本文整理汇总了PHP中JoomleagueHelper::stripInvalidXml方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomleagueHelper::stripInvalidXml方法的具体用法?PHP JoomleagueHelper::stripInvalidXml怎么用?PHP JoomleagueHelper::stripInvalidXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomleagueHelper
的用法示例。
在下文中一共展示了JoomleagueHelper::stripInvalidXml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
/**
* Method to export one or more events
*
* @access public
* @return boolean True on success
* @since 1.5.0a
*/
function export($cid = array(), $table, $record_name)
{
$result = false;
if (count($cid)) {
$mdlJLXExports = JModel::getInstance("jlxmlexports", 'JoomleagueModel');
JArrayHelper::toInteger($cid);
$cids = implode(',', $cid);
$query = "SELECT * FROM #__joomleague_eventtype WHERE id IN ({$cids})";
$this->_db->setQuery($query);
$exportData = $this->_db->loadObjectList();
$SportsTypeArray = array();
$x = 0;
foreach ($exportData as $event) {
$SportsTypeArray[$x] = $event->sports_type_id;
}
$st_cids = implode(',', $SportsTypeArray);
$query = "SELECT * FROM #__joomleague_sports_type WHERE id IN ({$st_cids})";
$this->_db->setQuery($query);
$exportDataSportsType = $this->_db->loadObjectList();
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
// open the events
$output .= "<events>\n";
$output .= $mdlJLXExports->_addToXml($mdlJLXExports->_getJoomLeagueVersion());
$record_name = 'SportsType';
//$tabVar=' ';
$tabVar = ' ';
foreach ($exportDataSportsType as $name => $value) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name) . "\">\n";
foreach ($value as $name2 => $value2) {
if ($name2 != 'checked_out' && $name2 != 'checked_out_time') {
$output .= $tabVar . '<' . $name2 . '><![CDATA[' . JoomleagueHelper::stripInvalidXml(trim($value2)) . ']]></' . $name2 . ">\n";
}
}
$output .= "</record>\n";
}
unset($name, $value);
$record_name = 'EventType';
foreach ($exportData as $name => $value) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name) . "\">\n";
foreach ($value as $name2 => $value2) {
if ($name2 != 'checked_out' && $name2 != 'checked_out_time') {
$output .= $tabVar . '<' . $name2 . '><![CDATA[' . JoomleagueHelper::stripInvalidXml(trim($value2)) . ']]></' . $name2 . ">\n";
}
}
$output .= "</record>\n";
}
unset($name, $value);
// close events
$output .= '</events>';
$mdlJLXExports = JModel::getInstance("jlxmlexports", 'JoomleagueModel');
$mdlJLXExports->downloadXml($output, $table);
// close the application
$app = JFactory::getApplication();
$app->close();
}
return true;
}
示例2: export
/**
* Method to export one or more leagues
*
* @access public
* @return boolean True on success
* @since 1.5.0a
*/
function export($cid = array(), $table, $record_name)
{
if (count($cid)) {
$mdlJLXExport = JModelLegacy::getInstance("jlxmlexport", 'JoomleagueModel');
JArrayHelper::toInteger($cid);
$cids = implode(',', $cid);
$query = "SELECT * FROM #__joomleague_" . $table . " WHERE id IN ({$cids})";
$this->_db->setQuery($query);
$exportData = $this->_db->loadObjectList();
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$output .= "<" . $table . "s>\n";
// get the version of JoomLeague
$output .= $mdlJLXExport->_addToXml($mdlJLXExport->_getJoomLeagueVersion());
$tabVar = ' ';
$record_name = $record_name;
foreach ($exportData as $name => $value) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name) . "\">\n";
foreach ($value as $name2 => $value2) {
if ($name2 != 'checked_out' && $name2 != 'checked_out_time') {
$output .= $tabVar . '<' . $name2 . '><![CDATA[' . JoomleagueHelper::stripInvalidXml(trim($value2)) . ']]></' . $name2 . ">\n";
}
}
$output .= "</record>\n";
}
unset($name, $value);
$output .= '</' . $table . 's>';
$mdlJLXExport->downloadXml($output, $table);
$app = JFactory::getApplication();
$app->close();
}
}
示例3: export
/**
* Method to export one or more positions
*
* @access public
* @return boolean True on success
*/
function export($cid = array(), $table, $record_name)
{
$result = false;
if (count($cid)) {
JArrayHelper::toInteger($cid);
$cids = implode(',', $cid);
$query = "SELECT * FROM #__joomleague_position WHERE id IN ({$cids})";
$this->_db->setQuery($query);
$exportData = $this->_db->loadObjectList();
$SportsTypeArray = array();
$x = 0;
foreach ($exportData as $position) {
$SportsTypeArray[$x] = $position->sports_type_id;
}
$st_cids = implode(',', $SportsTypeArray);
$query = "SELECT * FROM #__joomleague_sports_type WHERE id IN ({$st_cids})";
//echo $query;
$this->_db->setQuery($query);
$exportDataSportsType = $this->_db->loadObjectList();
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
// open the positions
$output .= "<positions>\n";
$record_name = 'SportsType';
//$tabVar=' ';
$tabVar = ' ';
foreach ($exportDataSportsType as $name => $value) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name) . "\">\n";
foreach ($value as $name2 => $value2) {
if ($name2 != 'checked_out' && $name2 != 'checked_out_time') {
$output .= $tabVar . '<' . $name2 . '><![CDATA[' . JoomleagueHelper::stripInvalidXml(trim($value2)) . ']]></' . $name2 . ">\n";
}
}
$output .= "</record>\n";
}
unset($name, $value);
$record_name_position = 'Position';
$record_name_parent_position = 'ParentPosition';
foreach ($exportData as $name => $value) {
if ($value->parent_id == 0) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name_parent_position) . "\">\n";
} else {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($record_name_position) . "\">\n";
}
foreach ($value as $name2 => $value2) {
if ($name2 != 'checked_out' && $name2 != 'checked_out_time') {
$output .= $tabVar . '<' . $name2 . '><![CDATA[' . JoomleagueHelper::stripInvalidXml(trim($value2)) . ']]></' . $name2 . ">\n";
//echo "<pre>".$name2."#".$value2."<br /></pre>";
}
}
$output .= "</record>\n";
}
unset($name, $value);
// close positions
$output .= '</positions>';
$mdlJLXExports = JModelLegacy::getInstance("jlxmlexport", 'JoomleagueModel');
$mdlJLXExports->downloadXml($output, $table, true);
// close the application
$app = JFactory::getApplication();
$app->close();
}
return true;
}
示例4: _addToXml
/**
* Add data to the xml
*
* @param array $data data what we want to add in the xml
*
* @access public
* @since 1.5.0a
*
* @return void
*/
public function _addToXml($data)
{
if (is_array($data) && count($data) > 0) {
$object = $data[0]['object'];
$output = '';
foreach ($data as $name => $value) {
$output .= "<record object=\"" . JoomleagueHelper::stripInvalidXml($object) . "\">\n";
foreach ($value as $key => $data) {
if (!is_null($data) && !(substr($key, 0, 1) == "_") && $key != "object") {
$output .= " <{$key}><![CDATA[" . JoomleagueHelper::stripInvalidXml(trim($data)) . "]]></{$key}>\n";
}
}
$output .= "</record>\n";
}
return $output;
}
return false;
}