本文整理汇总了PHP中e107::getXml方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getXml方法的具体用法?PHP e107::getXml怎么用?PHP e107::getXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getXml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupQuery
function setupQuery($task, $blank_user = FALSE)
{
$mes = e107::getMessage();
$this->arrayData = array();
$xml = e107::getXml();
$file = $this->feedUrl;
$mes->addDebug("rss_import::setupQuery - \$task: " . $task);
$mes->addDebug("rss_import::setupQuery - \$file: " . $file);
switch ($task) {
case 'news':
case 'page':
case 'links':
// $rawData = $xml->getRemoteFile($file);
// print_a($rawData);
$array = $xml->loadXMLfile($file, 'advanced');
// $mes->addDebug("rss - setupQuery - RSS array: ".print_a($array,true));
if ($array === FALSE || $file === FALSE) {
$mes->addError("No data returned from : " . $file);
return FALSE;
}
foreach ($array['channel']['item'] as $val) {
$this->arrayData[] = $val;
}
$this->arrayData = array_reverse($this->arrayData);
// most recent last.
reset($this->arrayData);
break;
default:
return FALSE;
}
$this->copyUserInfo = !$blank_user;
$this->currentTask = $task;
return TRUE;
}
示例2: setupQuery
function setupQuery($task, $blank_user = FALSE)
{
$this->arrayData = array();
$xml = e107::getXml();
$file = $this->feedUrl;
switch ($task) {
case 'news':
case 'page':
case 'links':
// $rawData = $xml->getRemoteFile($file);
// print_a($rawData);
$array = $xml->loadXMLfile($file, 'advanced');
if ($array === FALSE || $file === FALSE) {
return FALSE;
}
foreach ($array['channel']['item'] as $val) {
$this->arrayData[] = $val;
}
$this->arrayData = array_reverse($this->arrayData);
// most recent last.
reset($this->arrayData);
break;
default:
return FALSE;
}
$this->copyUserInfo = !$blank_user;
$this->currentTask = $task;
return TRUE;
}
示例3: releaseCheck
public function releaseCheck($mode = 'plugin', $cache = TRUE)
{
global $e107cache;
if (!$this->getOption('releaseUrl')) {
return;
}
$cacheString = $mode . 'UpdateCheck';
$e107cache->CachePageMD5 = md5($cacheString . $this->getOption('curFolder') . $this->getOption('curVersion', 1.0));
if ($cache == TRUE && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE))) {
require_once e_HANDLER . "message_handler.php";
$emessage =& eMessage::getInstance();
$emessage->add($cacheData);
$e107cache->CachePageMD5 = "";
return;
}
$xml = e107::getXml();
$feed = $this->getOption('releaseUrl');
if (substr($feed, -4) == ".php") {
$feed .= "?folder=" . $this->getOption('curFolder') . "&version=" . $this->getOption('curVersion');
}
if ($rawData = $xml->loadXMLfile($feed, TRUE)) {
if (!$rawData[$mode][1]) {
$rawData[$mode] = $rawData;
}
$txt = "";
$lan_text = $mode == "theme" ? ADLAN_162 : ADLAN_163;
foreach ($rawData[$mode] as $val) {
$name = $val['@attributes']['name'];
$folder = $val['@attributes']['folder'];
$version = $val['@attributes']['version'];
$url = $val['@attributes']['url'];
if ($folder == $this->getOption('curFolder') && version_compare($version, $this->getOption('curVersion')) == 1) {
$txt .= $lan_text . " <a href='" . $url . "'>" . $name . " v" . $version . "</a><br />";
break;
}
}
if ($txt) {
require_once e_HANDLER . "message_handler.php";
$emessage =& eMessage::getInstance();
$emessage->add($txt);
if ($cache == TRUE) {
$e107cache->set($cacheString, $txt, TRUE);
}
$e107cache->CachePageMD5 = "";
}
}
}
示例4: pluginOnline
function pluginOnline()
{
global $plugin;
$tp = e107::getParser();
$frm = e107::getForm();
$caption = "Search Online";
$e107 = e107::getInstance();
$xml = e107::getXml();
$mes = e107::getMessage();
$mes->addWarning("This area is experimental and may produce unpredictable results.");
$from = intval($_GET['frm']);
// $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing
$file = "http://e107.org/feed?frm=" . $from;
$xml->setOptArrayTags('plugin');
// make sure 'plugin' tag always returns an array
$xdata = $xml->loadXMLfile($file, 'advanced');
$total = $xdata['@attributes']['total'];
//TODO use admin_ui including filter capabilities by sending search queries back to the xml script.
// XML data array.
$c = 1;
foreach ($xdata['plugin'] as $r) {
$row = $r['@attributes'];
$data[] = array('plugin_id' => $c, 'plugin_icon' => vartrue($row['icon'], e_IMAGE . "admin_images/plugins_32.png"), 'plugin_name' => $row['name'], 'plugin_folder' => $row['folder'], 'plugin_date' => vartrue($row['date']), 'plugin_category' => vartrue($r['category'][0]), 'plugin_author' => vartrue($row['author']), 'plugin_version' => $row['version'], 'plugin_description' => $tp->text_truncate(vartrue($r['description'][0]), 200), 'plugin_website' => vartrue($row['authorUrl']), 'plugin_url' => $row['url'], 'plugin_notes' => '');
$c++;
}
// print_a($data);
$fieldList = $this->fields;
unset($fieldList['plugin_checkboxes']);
$text = "\n\t\t\t<form action='" . e_SELF . "?" . e_QUERY . "' id='core-plugin-list-form' method='post'>\n\t\t\t\t<fieldset id='core-plugin-list'>\n\t\t\t\t\t<legend class='e-hideme'>" . $caption . "</legend>\n\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t" . $frm->colGroup($fieldList, $this->fieldpref) . $frm->thead($fieldList, $this->fieldpref) . "\n\t\t\t\t\t\t<tbody>\n\t\t";
foreach ($data as $key => $val) {
// print_a($val);
$text .= "<tr>";
foreach ($this->fields as $v => $foo) {
if (!in_array($v, $this->fieldpref) || $v == 'plugin_checkboxes') {
continue;
}
// echo '<br />v='.$v;
$text .= "<td class='" . vartrue($this->fields[$v]['class'], 'left') . "'>" . $frm->renderValue($v, $val[$v], $this->fields[$v]) . "</td>\n";
}
$text .= "<td class='center'>" . $this->options($val) . "</td>";
$text .= "</tr>";
}
$text .= "\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>";
$text .= "\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t";
$amount = 30;
if ($total > $amount) {
$parms = $total . "," . $amount . "," . $from . "," . e_SELF . '?mode=' . $_GET['mode'] . '&frm=[FROM]';
$text .= "<div style='text-align:center;margin-top:10px'>" . $tp->parseTemplate("{NEXTPREV={$parms}}", TRUE) . "</div>";
}
e107::getRender()->tablerender(ADLAN_98 . " :: " . $caption, $mes->render() . $text);
}
示例5: import_configuration
public function import_configuration()
{
$this->logLine('Starting configuration import');
// PRE-CONFIG start - create and register blank config instances - do not load!
$config_aliases = array('core', 'core_backup', 'emote', 'menu', 'search', 'notify');
foreach ($config_aliases as $alias) {
e107::getConfig($alias, false)->clearPrefCache();
}
// PRE-CONFIG end
// Basic stuff to get the handlers/classes to work.
// $udirs = "admin/|plugins/|temp";
// $e_SELF = $_SERVER['PHP_SELF'];
// $e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
//define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? true : false));
// define('CHARSET', 'utf-8');
// define("e_LANGUAGE", $this->previous_steps['language']);
// define('e_SELF', 'http://'.$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']);
$themeImportFile = array();
$themeImportFile[0] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install.xml";
$themeImportFile[1] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install/install.xml";
$themeImportFile[3] = $this->e107->e107_dirs['CORE_DIRECTORY'] . "xml/default_install.xml";
if (vartrue($this->previous_steps['generate_content'])) {
foreach ($themeImportFile as $file) {
if (is_readable($file)) {
$XMLImportfile = $file;
break;
}
}
} else {
$XMLImportfile = $this->e107->e107_dirs['CORE_DIRECTORY'] . "xml/default_install.xml";
}
$tp = e107::getParser();
define('PREVIEWTHEMENAME', "");
// Notice Removal.
include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/lan_prefs.php");
include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/admin/lan_theme.php");
//should be 'add' not 'replace' - but 'add' doesn't insert arrays correctly.
// [SecretR] should work now - fixed log errors (argument noLogs = true) change to false to enable log
e107::getXml()->e107Import($XMLImportfile, 'add', true, false);
// Add missing core pref values
$this->logLine('Core prefs written');
//Create default plugin-table entries.
// e107::getConfig('core')->clearPrefCache();
e107::getPlugin()->update_plugins_table();
$this->logLine('Plugins table updated');
// Install Theme-required plugins
if (vartrue($this->previous_steps['install_plugins'])) {
if ($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme'])) {
if (isset($themeInfo['plugins']['plugin'])) {
foreach ($themeInfo['plugins']['plugin'] as $k => $plug) {
$this->install_plugin($plug['@attributes']['name']);
$this->logLine('Theme-related plugin installed: ' . $plug['@attributes']['name']);
}
}
}
}
// Media import
/*
e107::getMedia()->import('news',e_IMAGE.'newspost_images/') //TODO remove when news are pluginized
->import('page',e_IMAGE.'custom/') //TODO remove when pages are pluginized
// ->importIcons(e_PLUGIN) - icons for plugins are imported on install
->importIcons(e_IMAGE."icons/")
->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/images/")
->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/icons/");
$this->logLine('Media imported to media manager');
*/
e107::getSingleton('e107plugin')->save_addon_prefs();
// save plugin addon pref-lists. eg. e_latest_list.
$this->logLine('Addon prefs saved');
$tm = e107::getSingleton('themeHandler');
$tm->noLog = true;
// false to enable log
$tm->setTheme($this->previous_steps['prefs']['sitetheme']);
// Admin log fix - don't allow logs to be called inside pref handler
e107::getConfig('core')->setParam('nologs', false);
// change to true to enable log
$pref = e107::getConfig('core')->getPref();
// Set Preferences defined during install - overwriting those that may exist in the XML.
$this->previous_steps['prefs']['sitelanguage'] = $this->previous_steps['language'];
$this->previous_steps['prefs']['sitelang_init'] = $this->previous_steps['language'];
$this->previous_steps['prefs']['siteadmin'] = $this->previous_steps['admin']['display'];
$this->previous_steps['prefs']['siteadminemail'] = $this->previous_steps['admin']['email'];
$this->previous_steps['prefs']['install_date'] = time();
$this->previous_steps['prefs']['siteurl'] = e_HTTP;
$this->previous_steps['prefs']['sitetag'] = LAN_PREF_2;
$this->previous_steps['prefs']['sitedisclaimer'] = LAN_PREF_3;
$this->previous_steps['prefs']['replyto_name'] = $this->previous_steps['admin']['display'];
$this->previous_steps['prefs']['replyto_email'] = $this->previous_steps['admin']['email'];
// Cookie name fix, ended up with 406 error when non-latin words used
$cookiename = preg_replace('/[^a-z0-9]/i', '', trim($this->previous_steps['prefs']['sitename']));
$this->previous_steps['prefs']['cookie_name'] = ($cookiename ? substr($cookiename, 0, 4) . '_' : 'e_') . 'cookie';
### URL related prefs
// set all prefs so that they are available, required for adminReadModules() - it checks which plugins are installed
e107::getConfig('core')->setPref($this->previous_steps['prefs']);
$url_modules = eRouter::adminReadModules();
$url_locations = eRouter::adminBuildLocations($url_modules);
$url_config = eRouter::adminBuildConfig(array(), $url_modules);
$this->previous_steps['prefs']['url_aliases'] = array();
$this->previous_steps['prefs']['url_config'] = $url_config;
$this->previous_steps['prefs']['url_modules'] = $url_modules;
//.........这里部分代码省略.........
示例6: get_XML_filetypes
/**
* Get array of file types (file extensions) which are permitted - reads an XML-formatted definition file.
* (Similar to @See{get_allowed_filetypes()}, but expects an XML file)
*
* @param string $def_file - name of an XML-formatted file, which is sought in the E_ADMIN directory
* @param string $file_mask - comma-separated list of allowed file types - only those specified in both $file_mask and $def_file are returned
*
* @return array - where key is the file type (extension); value is max upload size
*/
function get_XML_filetypes($def_file = FALSE, $file_mask = '')
{
$ret = array();
if ($def_file === FALSE) {
return $ret;
}
if ($file_mask) {
$file_array = explode(',', $file_mask);
foreach ($file_array as $k => $f) {
$file_array[$k] = trim($f);
}
}
if ($def_file && is_readable(e_SYSTEM . $def_file)) {
$xml = e107::getXml();
// class tag should be always array
$xml->setOptArrayTags('class');
$temp_vars = $xml->loadXMLfile(e_SYSTEM . $def_file, 'filetypes', false);
if ($temp_vars === FALSE) {
echo "Error reading XML file: {$def_file}<br />";
return $ret;
}
foreach ($temp_vars['class'] as $v1) {
$v = $v1['@attributes'];
if (check_class($v['name'])) {
$current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']);
$a_filetypes = explode(',', $v['type']);
foreach ($a_filetypes as $ftype) {
$ftype = strtolower(trim(str_replace('.', '', $ftype)));
// File extension
if (!$file_mask || in_array($ftype, $file_array)) {
// We can load this extension
if (isset($ret[$ftype])) {
$ret[$ftype] = file_size_decode($v['maxupload'], $ret[$ftype], 'gt');
// Use largest value
} else {
$ret[$ftype] = file_size_decode($v['maxupload']);
}
}
}
}
}
}
return $ret;
}
示例7: parse_plugin_xml
function parse_plugin_xml($plugName, $where = null)
{
$tp = e107::getParser();
// loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths
$xml = e107::getXml();
$mes = e107::getMessage();
// $xml->setOptArrayTags('extendedField,userclass,menuLink,commentID'); // always arrays for these tags.
// $xml->setOptStringTags('install,uninstall,upgrade');
if (null === $where) {
$where = 'plugin.xml';
}
$this->plug_vars = $xml->loadXMLfile(e_PLUGIN . $plugName . '/' . $where, 'advanced');
if ($this->plug_vars === FALSE) {
$mes->addError("Error reading {$plugName}/plugin.xml");
return FALSE;
}
$this->plug_vars['category'] = isset($this->plug_vars['category']) ? $this->manage_category($this->plug_vars['category']) : "misc";
$this->plug_vars['folder'] = $plugName;
// remove the need for <folder> tag in plugin.xml.
if (varset($this->plug_vars['description'])) {
if (is_array($this->plug_vars['description'])) {
if (isset($this->plug_vars['description']['@attributes']['lan']) && defined($this->plug_vars['description']['@attributes']['lan'])) {
// Pick up the language-specific description if it exists.
$this->plug_vars['description']['@value'] = constant($this->plug_vars['description']['@attributes']['lan']);
}
} else {
$diz = $this->plug_vars['description'];
unset($this->plug_vars['description']);
$this->plug_vars['description']['@value'] = $diz;
}
}
// Very useful debug code.to compare plugin.php vs plugin.xml
/*
$testplug = 'forum';
if($plugName == $testplug)
{
$plug_vars1 = $this->plug_vars;
$this->parse_plugin_php($testplug);
$plug_vars2 = $this->plug_vars;
ksort($plug_vars2);
ksort($plug_vars1);
echo "<table>
<tr><td><h1>PHP</h1></td><td><h1>XML</h1></td></tr>
<tr><td style='border-right:1px solid black'>";
print_a($plug_vars2);
echo "</td><td>";
print_a($plug_vars1);
echo "</table>";
}
*/
// TODO search for $this->plug_vars['adminLinks']['link'][0]['@attributes']['primary']==true.
$this->plug_vars['administration']['icon'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['icon']);
$this->plug_vars['administration']['caption'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['description']);
$this->plug_vars['administration']['iconSmall'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['iconSmall']);
$this->plug_vars['administration']['configFile'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['url']);
return TRUE;
}
示例8: available_langpacks
function available_langpacks()
{
$xml = e107::getXml();
$feed = e107::getPref('xmlfeed_languagepacks');
$text = '';
if ($rawData = $xml->loadXMLfile($feed, TRUE)) {
if (!varset($rawData['language'])) {
return FALSE;
}
$text .= "<div class='block-text'>" . LANG_LAN_35 . "</div>";
$text .= "<table class='table adminlist'>";
foreach ($rawData['language'] as $val) {
$att = $val['@attributes'];
$name = $att['folder'];
$languages[$name] = array('name' => $att['name'], 'author' => $att['author'], 'authorURL' => $att['authorURL'], 'folder' => $att['folder'], 'version' => $att['version'], 'date' => $att['date'], 'compatibility' => $att['compatibility'], 'url' => $att['url']);
}
ksort($languages);
$text .= "<thead>\n\t\t<tr>\n\t\t<th>" . LANG_LAN_108 . "</th>\n\t\t<th>" . LANG_LAN_109 . "</th>\n\t\t<th>" . LANG_LAN_110 . "</th>\n\t\t<th>" . LANG_LAN_111 . "</th>\n\t\t<th>" . LANG_LAN_112 . "</th>\n\t\t<th>" . LANG_LAN_113 . "</th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>";
foreach ($languages as $value) {
$text .= "<tr>\n\t\t\t\t<td>" . $value['name'] . "</td>\n\t\t\t\t<td>" . $value['version'] . "</td>\n\t\t\t\t<td><a href='" . $value['authorURL'] . "'>" . $value['author'] . "</a></td>\n\t\t\t\t<td>" . $value['date'] . "</td>\n\t\t\t\t<td>" . $value['compatibility'] . "</td>\n\t\t\t\t\n\t\t\t\t<td><a href='" . $value['url'] . "'>" . LANG_LAN_114 . "</a></td>\n\t\t\t\t</tr>";
}
$text .= "</tbody></table>";
return $text;
}
}
示例9: pluginXml
function pluginXml()
{
//TODO Plugin.xml Form Fields. .
$data = array('main' => array('name', 'lang', 'version', 'date', 'compatibility'), 'author' => array('name', 'url'), 'summary' => array('summary'), 'description' => array('description'), 'keywords' => array('one', 'two'), 'category' => array('category'), 'copyright' => array('copyright'));
// Load old plugin.php file if it exists;
$legacyFile = e_PLUGIN . $this->pluginName . "/plugin.php";
if (file_exists($legacyFile)) {
$eplug_name = $eplug_author = $eplug_url = $eplug_description = "";
$eplug_tables = array();
require_once $legacyFile;
$mes = e107::getMessage();
$mes->addInfo("Loading plugin.php file");
$defaults = array("main-name" => $eplug_name, "author-name" => $eplug_author, "author-url" => $eplug_url, "description-description" => $eplug_description, "summary-summary" => $eplug_description);
if (count($eplug_tables) && !file_exists(e_PLUGIN . $this->pluginName . "/" . $this->pluginName . "_sql.php")) {
$cont = '';
foreach ($eplug_tables as $tab) {
if (strpos($tab, "INSERT INTO") !== FALSE) {
continue;
}
$cont .= "\n" . str_replace("\t", " ", $tab);
}
if (file_put_contents(e_PLUGIN . $this->pluginName . "/" . $this->pluginName . "_sql.php", $cont)) {
$info = str_replace('[x]', $this->pluginName . "_sql.php", EPL_ADLAN_132);
$mes->addInfo($info, 'default', true);
$red = e107::getRedirect();
$red->redirect(e_REQUEST_URL, true);
// $red->redirect(e_SELF."?mode=create&newplugin=".$this->pluginName."&createFiles=1&step=2",true);
} else {
$msg = str_replace('[x]', $this->pluginName . "_sql.php", EPL_ADLAN_133) . "<br />";
$msg .= str_replace(array('[x]', '[y]'), array($this->pluginName . "_sql.php", $cont), EPL_ADLAN_134);
$mes->addWarning($msg);
}
}
}
$existingXml = e_PLUGIN . $this->pluginName . "/plugin.xml";
if (file_exists($existingXml)) {
$p = e107::getXml()->loadXMLfile($existingXml, true);
// print_a($p);
$defaults = array("main-name" => varset($p['@attributes']['name']), "author-name" => varset($p['author']['@attributes']['name']), "author-url" => varset($p['author']['@attributes']['url']), "description-description" => varset($p['description']), "summary-summary" => varset($p['summary'], $p['description']), "category-category" => varset($p['category']), "keywords-one" => varset($p['keywords']['word'][0]), "keywords-two" => varset($p['keywords']['word'][1]));
unset($p);
}
$text = "<table class='table adminform'>";
foreach ($data as $key => $val) {
$text .= "<tr><td>{$key}</td><td>\n\t\t\t\t<div class='controls'>";
foreach ($val as $type) {
$nm = $key . '-' . $type;
$name = "xml[{$nm}]";
$size = count($val) == 1 ? 'span7 col-md-7' : 'span2 col-md-2';
$text .= "<div class='{$size}'>" . $this->xmlInput($name, $key . "-" . $type, vartrue($defaults[$nm])) . "</div>";
}
$text .= "</div></td></tr>";
}
$text .= "</table>";
return $text;
}
示例10: foreach
exit;
}
if (ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons') {
$type = $_GET['type'] == 'plugin' ? 'plugin' : 'theme';
$tag = 'infopanel_' . $type;
$cache = e107::getCache();
$cache->setMD5('_');
if ($text = $cache->retrieve($tag, 180, true)) {
echo $text;
if (e_DEBUG === true) {
echo "<span class='label label-warning'>Cached</span>";
}
exit;
}
if ($data = e107::getXml()->getRemoteFile('http://e107.org/feed/?limit=3&type=' . $type, 3)) {
$rows = e107::getXml()->parseXml($data, 'advanced');
// print_a($rows);
// exit;
$link = $type == 'plugin' ? e_ADMIN . "plugin.php?mode=online" : e_ADMIN . "theme.php?mode=online";
$text = "<div style='margin-top:10px'>";
foreach ($rows[$type] as $val) {
$meta = $val['@attributes'];
$img = $type == 'theme' ? $meta['thumbnail'] : $meta['icon'];
$text .= '<div class="media">';
$text .= '<div class="media-left">
<a href="' . $link . '">
<img class="media-object img-rounded" src="' . $img . '" style="width:100px">
</a>
</div>
<div class="media-body">
<h4 class="media-heading"><a href="' . $link . '">' . $meta['name'] . ' v' . $meta['version'] . '</a> <small>— ' . $meta['author'] . '</small></h4>
示例11: checkCoreUpdate
/**
* Burnsy - This is just a test
*
*/
function checkCoreUpdate()
{
// Check if there's a core e107 update available
// Get site version
if (is_readable(e_ADMIN . "ver.php")) {
include e_ADMIN . "ver.php";
// $e107info['e107_version'];
} else {
// Find alternate way to get local site version or throw an error
}
// Check for updates for currently installed version
$localVersion = (int) $e107info['e107_version'];
switch ($localVersion) {
case 0:
// Local version is <= 0.7
// Run update routine for 0.x
break;
case 1:
// Local version is == 1.x
// Run update routine for 1.x
break;
case 2:
// Local version is == 2.x
// Run update routine for 2.x
// Get newest available release version
$xml = e107::getXml();
$file = "http://e107.org/releases.php?mode=2";
$xdata = $xml->loadXMLfile($file, true, false);
// Check for update
if ($e107info['e107_version'] < $xdata['core']['@attributes']['version']) {
// If there is a new version of e107 available, notify Site Admin by email, make a log entry, and notify Admin in Admin Area, $versionTest = false
$pref = e107::getPref();
require_once e_HANDLER . 'mail.php';
$message = "There is a new version of e107 available. Please visit http://www.e107.org for further details.";
sendemail($pref['siteadminemail'], "e107 - Update(s) Available For " . $pref['sitename'], $message, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']);
// Add entry to the log
e107::getAdminLog()->add("Update(s) Available", "There is a new version of e107 available. Please visit http://www.e107.org for further details.", 3);
$versionTest = $xdata['core']['@attributes']['version'];
} else {
// If there is not a new version of e107 available, $versionTest = false
$versionTest = false;
}
break;
}
//$versionTest = "{CHECK THE VERSION}"; // If out of date, return some text, if up-to-date , return false;
$che = e107::getCache();
$che->setMD5(e_LANGUAGE);
if ($versionTest) {
$che->set("releasecheck", $versionTest, TRUE);
return $versionTest;
// e107::getMessage()=>addInfo($versionTest);
} else {
$che->set("releasecheck", 'false', TRUE);
return false;
}
}
示例12: preview
function preview()
{
$file = $this->feedUrl;
$array = e107::getXml()->loadXMLfile($file, 'advanced');
// print_a($array); // raw xml data;
foreach ($array['channel']['item'] as $src) {
// $data = $this->process('description', $src);
// $this->process('sef',$src);
$data = $this->copyNewsData($target, $src);
print_a($data);
}
}
示例13: parse_theme_xml
function parse_theme_xml($path)
{
$tp = e107::getParser();
$xml = e107::getXml();
// loadLanFiles($path, 'admin'); // Look for LAN files on default paths
// layout should always be an array.
$xml->setOptArrayTags('layout');
$xml->setOptStringTags('menuPresets,customPages');
$vars = $xml->loadXMLfile(e_THEME . $path . '/theme.xml', true, true);
$vars['name'] = varset($vars['@attributes']['name']);
$vars['version'] = varset($vars['@attributes']['version']);
$vars['date'] = varset($vars['@attributes']['date']);
$vars['compatibility'] = varset($vars['@attributes']['compatibility']);
$vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']);
$vars['email'] = varset($vars['author']['@attributes']['email']);
$vars['website'] = varset($vars['author']['@attributes']['url']);
$vars['author'] = varset($vars['author']['@attributes']['name']);
$vars['info'] = varset($vars['description']);
$vars['category'] = $this->getThemeCategory(varset($vars['category']));
$vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']);
$vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']);
$vars['path'] = $path;
$vars['@attributes']['default'] = varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true' ? 1 : 0;
unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description']);
// Compile layout information into a more usable format.
$custom = array();
foreach ($vars['layouts'] as $layout) {
foreach ($layout as $key => $val) {
$name = $val['@attributes']['name'];
unset($val['@attributes']['name']);
$lays[$name] = $val;
if (isset($val['customPages'])) {
$custom[$name] = array_filter(explode(" ", $val['customPages']));
}
}
}
$vars['layouts'] = $lays;
$vars['path'] = $path;
$vars['custompages'] = $custom;
/*
$mes = e107::getMessage();
if($path == "bootstrap")
{
$mes->addDebug("<h2>".$path."</h2>");
$mes->addDebug(print_a($vars,true));
$mes->addDebug("<hr />");
}
*/
return $vars;
}
示例14: vartrue
// echo "Key: {$k} Class: {$c} Delete: {$_POST['file_line_delete'][$k]} List: {$_POST['file_type_list'][$k]} Size: {$_POST['file_maxupload'][$k]}<br />";
$file_text .= " <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='" . vartrue($_POST['file_maxupload'][$k], ini_get('upload_max_filesize')) . "' />\n";
}
}
$file_text .= "</e107Filetypes>\n";
if (($handle = fopen(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, 'wt')) == FALSE || fwrite($handle, $file_text) == FALSE || fclose($handle) == FALSE) {
$text = UPLLAN_61 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES;
} else {
$text = '';
$text .= '<br />' . UPLLAN_59 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES . '. ' . UPLLAN_60 . e_ADMIN . e_READ_FILETYPES . '<br />';
}
$ns->tablerender(LAN_FILETYPES, $text);
}
$current_perms = array();
if ($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES) || !$edit_upload_list && is_readable(e_ADMIN . e_READ_FILETYPES)) {
$xml = e107::getXml();
$source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES : e_ADMIN . e_READ_FILETYPES;
$temp_vars = $xml->loadXMLfile($source_file, true, false);
if ($temp_vars === FALSE) {
echo "Error parsing XML file!";
} else {
foreach ($temp_vars['class'] as $v1) {
$v = $v1['@attributes'];
$current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']);
}
}
} elseif (is_readable(e_ADMIN . 'filetypes.php')) {
$source_file = 'filetypes.php';
$current_perms[e_UC_MEMBER] = array('type' => implode(',', array_keys(get_allowed_filetypes('filetypes.php', ''))), 'maxupload' => '2M');
if (is_readable(e_ADMIN . 'admin_filetypes.php')) {
$current_perms[e_UC_ADMIN] = array('type' => implode(',', array_keys(get_allowed_filetypes('admin_filetypes.php', ''))), 'maxupload' => '2M');
示例15: parse_theme_xml
function parse_theme_xml($path)
{
$tp = e107::getParser();
$xml = e107::getXml();
// loadLanFiles($path, 'admin'); // Look for LAN files on default paths
// layout should always be an array.
$xml->setOptArrayTags('layout,screenshots/image');
$xml->setOptStringTags('menuPresets,customPages,custompages');
// $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true);
// $oldvars =
$vars = $xml->loadXMLfile(e_THEME . $path . '/theme.xml', 'advanced', true);
// must be 'advanced'
if ($path == "bootstrap3") {
// echo "<table class='table table-bordered'>
// <tr><th>old</th><th>new parser</th></tr>
// <tr><td>".print_a($oldvars,true)."</td><td>".print_a($vars,true)."</td></tr></table>";
}
$vars['name'] = varset($vars['@attributes']['name']);
$vars['version'] = varset($vars['@attributes']['version']);
$vars['date'] = varset($vars['@attributes']['date']);
$vars['compatibility'] = varset($vars['@attributes']['compatibility']);
$vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']);
$vars['email'] = varset($vars['author']['@attributes']['email']);
$vars['website'] = varset($vars['author']['@attributes']['url']);
$vars['author'] = varset($vars['author']['@attributes']['name']);
$vars['info'] = varset($vars['description']);
$vars['category'] = $this->getThemeCategory(varset($vars['category']));
$vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']);
$vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']);
$vars['path'] = $path;
$vars['@attributes']['default'] = varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true' ? 1 : 0;
$vars['preview'] = varset($vars['screenshots']['image']);
$vars['thumbnail'] = varset($vars['preview'][0]);
if (!empty($vars['themePrefs'])) {
foreach ($vars['themePrefs']['pref'] as $k => $val) {
$name = $val['@attributes']['name'];
$vars['preferences'][$name] = $val['@value'];
}
}
unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'], $vars['screenshots']);
// Compile layout information into a more usable format.
$custom = array();
/*
foreach ($vars['layouts'] as $layout)
{
foreach ($layout as $key=>$val)
{
$name = $val['@attributes']['name'];
unset($val['@attributes']['name']);
$lays[$name] = $val;
if(isset($val['customPages']))
{
$cusArray = explode(" ", $val['customPages']);
$custom[$name] = array_filter($cusArray);
}
if(isset($val['custompages']))
{
$cusArray = explode(" ", $val['custompages']);
$custom[$name] = array_filter(explode(" ", $val['custompages']));
}
}
}
*/
foreach ($vars['layouts']['layout'] as $k => $val) {
$name = $val['@attributes']['name'];
unset($val['@attributes']['name']);
$lays[$name] = $val;
if (isset($val['custompages'])) {
if (is_string($val['custompages'])) {
$custom[$name] = array_filter(explode(" ", $val['custompages']));
} elseif (is_array($val['custompages'])) {
$custom[$name] = $val['custompages'];
}
}
}
$vars['layouts'] = $lays;
$vars['path'] = $path;
$vars['custompages'] = $custom;
if (vartrue($vars['stylesheets']['css'])) {
$vars['css'] = array();
foreach ($vars['stylesheets']['css'] as $val) {
$notadmin = vartrue($val['@attributes']['admin']) ? false : true;
$vars['css'][] = array("name" => $val['@attributes']['file'], "info" => $val['@attributes']['name'], "nonadmin" => $notadmin, 'scope' => $val['@attributes']['scope']);
}
unset($vars['stylesheets']);
}
//
$mes = e107::getMessage();
// DEBUG
if ($path == "leasure") {
// $mes->addDebug("<h2>".$path."</h2>");
// $mes->addDebug(print_a($vars,true));
// $mes->addDebug("<hr />");
}
if ($path == "bootstrap3") {
// print_a($vars);
// echo "<table class='table'><tr><td>".print_a($vars,true)."</td><td>".print_a($adv,true)."</td></tr></table>";
}
//.........这里部分代码省略.........