本文整理汇总了PHP中e107::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getFile方法的具体用法?PHP e107::getFile怎么用?PHP e107::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
$fl = e107::getFile();
$importClassList = $fl->get_files(e_PLUGIN . 'import/providers', "^.+?_import_class\\.php\$", "standard", 1);
foreach ($importClassList as $file) {
$tag = str_replace('_class.php', '', $file['fname']);
$key = str_replace("_import_class.php", "", $file['fname']);
include_once $file['path'] . $file['fname'];
// This will set up the variables
$this->providers[$key] = $this->getMeta($tag);
if (vartrue($_GET['type'])) {
$this->importClass = $_GET['type'] . "_import";
}
}
}
示例2: init
function init()
{
$fl = e107::getFile();
$helplist_all = $fl->get_files(DOC_PATH_ALT);
if (!is_dir(DOC_PATH) || DOC_PATH == DOC_PATH_ALT) {
$helplist = $helplist_all;
} else {
$helplist = $fl->get_files(DOC_PATH);
}
sort($helplist);
self::$helpList = $helplist;
foreach ($helplist as $key => $helpdata) {
$id = 'doc-' . $key;
$k = 'main/' . $id;
$this->adminMenu[$k] = array('caption' => str_replace("_", " ", $helpdata['fname']), 'perm' => false, 'uri' => "#" . $id);
}
}
示例3: libraries_update_addon_list
/**
* Update addon list.
*/
function libraries_update_addon_list()
{
$fl = e107::getFile();
$plugList = $fl->get_files(e_PLUGIN, "^plugin\\.(php|xml)\$", "standard", 1);
$pluginList = array();
$themeList = array();
$addonsList = array('plugin' => array(), 'theme' => array());
$siteTheme = e107::getPref('sitetheme');
$adminTheme = e107::getPref('admintheme');
// Remove Duplicates caused by having both plugin.php AND plugin.xml.
foreach ($plugList as $num => $val) {
$key = basename($val['path']);
$pluginList[$key] = $val;
}
$themes = $fl->get_dirs(e_THEME);
foreach ($themes as $theme) {
if (!in_array($theme, $themeList)) {
$themeList[] = $theme;
}
}
// Addon list.
foreach ($pluginList as $p) {
$p['path'] = substr(str_replace(e_PLUGIN, '', $p['path']), 0, -1);
$plugin = $p['path'];
if (is_readable(e_PLUGIN . $plugin . '/e_libraries.php')) {
if (e107::isInstalled($plugin)) {
$addonsList['plugin'][] = $plugin;
}
}
}
// Addon list.
foreach ($themeList as $theme) {
if (is_readable(e_THEME . $theme . '/e_libraries.php')) {
if ($theme == $siteTheme || $theme == $adminTheme) {
$addonsList['theme'][] = $theme;
}
}
}
e107::getPlugConfig('libraries')->set('addon_list', $addonsList)->save();
return $addonsList;
}
示例4: installed
/**
* Return a list of Installed Language Packs
*
* @return array
*/
function installed()
{
if (null == $this->lanlist) {
$fl = e107::getFile();
$dirArray = $fl->get_dirs(e_LANGUAGEDIR);
// $handle = opendir(e_LANGUAGEDIR);
$lanlist = array();
// while ($file = readdir($handle))
foreach ($dirArray as $file) {
if ($file != '.' && $file != '..' && is_readable(e_LANGUAGEDIR . $file . '/' . $file . '.php')) {
$lanlist[] = $file;
}
}
// closedir($handle);
$this->lanlist = array_intersect($lanlist, $this->list);
}
return $this->lanlist;
}
示例5: installCheck
function installCheck($do_one = FALSE)
{
global $e107;
$sql = e107::getDb();
$fl = e107::getFile();
$ns = e107::getRender();
$mes = e107::getMessage();
// Pick up a list of emote packs from the database
$pack_local = array();
if ($sql->db_Select("core", "*", "`e107_name` LIKE 'emote_%'")) {
while ($row = $sql->db_Fetch()) {
$pack_local[substr($row['e107_name'], 6)] = TRUE;
}
}
foreach ($this->packArray as $value) {
if (strpos($value, ' ') !== FALSE) {
// Highlight any directory names containing spaces - not allowed
$msg = "\r\n\t\t\t\t\t<strong>" . EMOLAN_17 . "</strong> " . EMOLAN_18 . ":\r\n\t\t\t\t\t<div>" . LAN_NAME . ": {$value}</div>\r\n\t\t\t\t\t<div>" . EMOLAN_20 . ": " . e_IMAGE_ABS . "emotes/</div>\r\n\t\t\t\t";
$mes->addError($msg);
$ns->tablerender(EMOLAN_PAGE_TITLE . ' - ' . EMOLAN_21, $mes->render());
return FALSE;
}
if (array_key_exists($value, $pack_local)) {
unset($pack_local[$value]);
}
if ($do_one == $value || !$do_one && !$sql->db_Select("core", "*", "e107_name='emote_" . $value . "' ")) {
// Pack info not in DB, or to be re-scanned
$no_error = TRUE;
$File_type = EMOLAN_32 . ":";
// Array of all files in the directory of the selected emote pack
$fileArray = $fl->get_files(e_IMAGE . "emotes/" . $value);
// We actually want all the files in the directory
$confFile = '';
foreach ($fileArray as $k => $file) {
if (strstr($file['fname'], ".xml")) {
$confFile = array('file' => $file['fname'], 'type' => "xml");
} else {
if (strstr($file['fname'], ".pak")) {
$confFile = array('file' => $file['fname'], 'type' => "pak");
} else {
if (strstr($file['fname'], ".php")) {
$confFile = array('file' => $file['fname'], 'type' => "php");
}
}
}
if ($confFile) {
unset($fileArray[$k]);
break;
}
}
/* .pak file */
if ($confFile['type'] == "pak") {
$filename = e_IMAGE . "emotes/" . $value . "/" . $confFile['file'];
$pakconf = file($filename);
$contentArray = array();
foreach ($pakconf as $line) {
if (trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) {
$contentArray[] = $line;
}
}
$confArray = array();
foreach ($contentArray as $pakline) {
$tmp = explode("=+:", $pakline);
$confIC = str_replace(".", "!", $tmp[0]);
$confArray[$confIC] = trim($tmp[2]);
}
// $tmp = addslashes(serialize($confArray));
$tmp = e107::getArrayStorage()->WriteArray($confArray);
$File_type = EMOLAN_22 . ":";
}
/* end */
/* .xml file */
if ($confFile['type'] == "xml") {
$filename = e_IMAGE . "emotes/" . $value . "/" . $confFile['file'];
$contents = file_get_contents($filename);
$confArray = array();
$xml_type = 0;
if (strpos($contents, "<icon>") !== FALSE && strpos($contents, "<icondef>") !== FALSE) {
// xep-0038 format
/* Example:
<icon>
<text>:-)</text>
<text>:)</text>
<object mime="image/png">happy.png</object>
<object mime="audio/x-wav">choir.wav</object>
</icon>*/
preg_match_all("#\\<icon>(.*?)\\<\\/icon\\>#si", $contents, $match);
$xml_type = 1;
// $match[0] - complete emoticon entry
// $match[1] - match string and object specification
$item_index = 1;
} elseif (strpos($contents, "<emoticon") !== FALSE) {
// "Original" E107 format (as used on KDE, although they may be changing to XEP-0038)
//echo "Decoding standard XML file<br />";
preg_match_all("#\\<emoticon file=\"(.*?)\"\\>(.*?)\\<\\/emoticon\\>#si", $contents, $match);
$xml_type = 2;
// $match[0] - complete emoticon entry
// $match[1] - filename (may or may not not have file extension/suffix)
// $match[2] - match string(s) representing emote
$item_index = 2;
//.........这里部分代码省略.........
示例6: update_706_to_800
//.........这里部分代码省略.........
}
require_once e_HANDLER . 'plugin_class.php';
$ep = new e107plugin();
$ep->update_plugins_table('update');
// $_pdateMessages[] = LAN_UPDATE_XX24;
// catch_error($sql);
}
//-- Media-manger import --------------------------------------------------
// Autogenerate filetypes.xml if not found.
if (!is_readable(e_SYSTEM . "filetypes.xml")) {
$data = '<?xml version="1.0" encoding="utf-8"?>
<e107Filetypes>
<class name="253" type="zip,gz,jpg,jpeg,png,gif,xml" maxupload="2M" />
</e107Filetypes>';
file_put_contents(e_SYSTEM . "filetypes.xml", $data);
}
$root_media = str_replace(basename(e_MEDIA) . "/", "", e_MEDIA);
$user_media_dirs = array("images", "avatars", "avatars/default", "avatars/upload", "files", "temp", "videos", "icons");
// check for old paths and rename.
if (is_dir($root_media . "images") || is_dir($root_media . "temp")) {
foreach ($user_media_dirs as $md) {
@rename($root_media . $md, e_MEDIA . $md);
}
}
// create sub-directories if they do not exist.
if (!is_dir(e_MEDIA . "images") || !is_dir(e_MEDIA . "temp") || !is_dir(e_AVATAR_UPLOAD) || !is_dir(e_AVATAR_DEFAULT)) {
foreach ($user_media_dirs as $md) {
if (!is_dir(e_MEDIA . $md)) {
mkdir(e_MEDIA . $md);
}
}
}
// Move Avatars to new location
$av1 = e107::getFile()->get_files(e_FILE . 'public/avatars', '.jpg|.gif|.png|.GIF|.jpeg|.JPG|.PNG');
$av2 = e107::getFile()->get_files(e_IMAGE . 'avatars', '.jpg|.gif|.png|.GIF|.jpeg|.JPG|.PNG');
$avatar_images = array_merge($av1, $av2);
if (count($avatar_images)) {
if ($just_check) {
return update_needed('Avatar paths require updating.');
}
foreach ($avatar_images as $av) {
$apath = strstr($av['path'], 'public/') ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
@rename($av['path'] . $av['fname'], $apath . $av['fname']);
}
}
// -------------------------------
if (!e107::isInstalled('download') && $sql->gen("SELECT * FROM #links WHERE link_url LIKE 'download.php%' AND link_class != '" . e_UC_NOBODY . "' LIMIT 1")) {
if ($just_check) {
return update_needed('Download Plugin needs to be installed.');
}
// e107::getSingleton('e107plugin')->install('download',array('nolinks'=>true));
e107::getSingleton('e107plugin')->refresh('download');
}
if (!e107::isInstalled('banner') && $sql->isTable('banner')) {
if ($just_check) {
return update_needed('Banner Table found, but plugin not installed. Needs to be refreshed.');
}
e107::getSingleton('e107plugin')->refresh('banner');
}
// ---------------------------------
$med = e107::getMedia();
// Media Category Update
if ($sql->db_Field("core_media_cat", "media_cat_nick")) {
$count = $sql->gen("SELECT * FROM `#core_media_cat` WHERE media_cat_nick = '_common' ");
if ($count == 1) {
if ($just_check) {
示例7: getAddons
function getAddons($plugin_path, $debug = FALSE)
{
$fl = e107::getFile();
$mes = e107::getMessage();
$p_addons = array();
foreach ($this->plugin_addons as $addon) {
// if(preg_match("#^(e_.*)\.php$#", $f['fname'], $matches))
$addonPHP = $addon . ".php";
if (is_readable(e_PLUGIN . $plugin_path . "/" . $addonPHP)) {
if ($debug === 'check') {
$passfail = '';
$file_text = file_get_contents(e_PLUGIN . $plugin_path . "/" . $addonPHP);
if (substr($file_text, 0, 5) != '<' . '?php' || substr($file_text, -2, 2) != '?' . '>' && strrpos($file_text, '?' . '>') !== FALSE) {
$passfail = '<b>fail</b>';
} else {
$passfail = 'pass';
}
echo $plugin_path . "/" . $addon . ".php - " . $passfail . "<br />";
}
// $mes->add('Detected addon: <b>'.$addon.'</b>', E_MESSAGE_DEBUG);
$p_addons[] = $addon;
}
}
// Grab List of Shortcodes & BBcodes
$shortcodeLegacyList = $fl->get_files(e_PLUGIN . $plugin_path, '\\.sc$', "standard", 1);
$shortcodeList = $fl->get_files(e_PLUGIN . $plugin_path . '/shortcodes/single', '\\.php$', "standard", 1);
$bbcodeList = $fl->get_files(e_PLUGIN . $plugin_path, '\\.bb$', "standard", 1);
$bbcodeClassList = $fl->get_files(e_PLUGIN . $plugin_path, '^bb_(.*)\\.php$', "standard", 1);
$bbcodeList = array_merge($bbcodeList, $bbcodeClassList);
$sqlList = $fl->get_files(e_PLUGIN . $plugin_path, '_sql\\.php$', "standard", 1);
// Search Shortcodes
foreach ($shortcodeLegacyList as $sc) {
if (is_readable(e_PLUGIN . $plugin_path . "/" . $sc['fname'])) {
$p_addons[] = $sc['fname'];
}
}
foreach ($shortcodeList as $sc) {
if (is_readable(e_PLUGIN . $plugin_path . "/shortcodes/single/" . $sc['fname'])) {
$p_addons[] = 'sc_' . $sc['fname'];
}
}
// Search Bbcodes.
foreach ($bbcodeList as $bb) {
if (is_readable(e_PLUGIN . $plugin_path . "/" . $bb['fname'])) {
$p_addons[] = $bb['fname'];
}
}
// Search _sql files.
foreach ($sqlList as $esql) {
if (is_readable(e_PLUGIN . $plugin_path . "/" . $esql['fname'])) {
$fname = str_replace(".php", "", $esql['fname']);
if (!in_array($fname, $p_addons)) {
$p_addons[] = $fname;
}
// Probably already found - avoid duplication
}
}
if ($debug == true) {
echo $plugin_path . " = " . implode(",", $p_addons) . "<br />";
}
return implode(",", $p_addons);
}
示例8: clearAll
/**
* Clear Full Cache
* @param string $type: content | system| browser | db | image
* @example clearAll('db');
*/
function clearAll($type, $mask = null)
{
$path = null;
if ($type == 'content') {
$this->clear();
return;
}
if ($type == 'system') {
$this->clear_sys();
return;
}
if ($type == 'browser') {
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
return;
}
if ($type == 'db') {
$path = e_CACHE_DB;
$mask = $mask == null ? '.*\\.php' : $mask;
}
if ($type == 'image') {
$path = e_CACHE_IMAGE;
$mask = $mask == null ? '.*\\.cache\\.bin' : $mask;
}
if (null == $path || null == $mask) {
return;
}
$fl = e107::getFile(false);
$fl->mode = 'fname';
$files = $fl->get_files($path, $mask);
if ($files) {
foreach ($files as $file) {
unlink($path . $file);
}
}
}
示例9: xmlInput
function xmlInput($name, $info, $default = '')
{
$frm = e107::getForm();
list($cat, $type) = explode("-", $info);
$size = 30;
$help = '';
switch ($info) {
case 'main-name':
$help = "The name of your theme. (Must be written in English)";
$required = true;
$pattern = "[A-Za-z ]*";
break;
case 'main-lang':
$help = "If you have a language file, enter the LAN_XXX value for the theme's name";
$required = false;
$placeholder = " ";
$pattern = "[A-Z0-9_]*";
break;
case 'main-date':
$help = "Creation date of your theme";
$required = true;
break;
case 'main-version':
$default = '1.0';
$required = true;
$help = "The version of your theme. Format: x.x";
$pattern = "^[\\d]{1,2}\\.[\\d]{1,2}\$";
break;
case 'main-compatibility':
$default = '2.0';
$required = true;
$help = "Compatible with this version of e107";
$pattern = "^[\\d]{1,2}\\.[\\d]{1,2}\$";
break;
case 'author-name':
$default = vartrue($default) ? $default : USERNAME;
$required = true;
$help = "Author Name";
$pattern = "[A-Za-z \\.0-9]*";
break;
case 'author-url':
$required = true;
$help = "Author Website Url";
// $pattern = "https?://.+";
break;
//case 'main-installRequired':
// return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO);
//break;
//case 'main-installRequired':
// return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO);
//break;
case 'summary-summary':
$help = "A short one-line description of the plugin. (!@#\$%^&* characters not permitted) <br />(Must be written in English)";
$required = true;
$size = 100;
$placeholder = " ";
$pattern = "[A-Za-z,() \\.0-9]*";
break;
case 'keywords-one':
case 'keywords-two':
$help = "Keyword/Tag for this theme<br />(Must be written in English)";
$required = true;
$size = 20;
$placeholder = " ";
$pattern = '^[a-z]*$';
break;
case 'description-description':
$help = "A full description of the theme<br />(Must be written in English)";
$required = true;
$size = 100;
$placeholder = " ";
$pattern = "[A-Za-z \\.0-9]*";
break;
case 'category-category':
$help = "What category of theme is this?";
$required = true;
$size = 20;
break;
default:
break;
}
$req = $required == true ? "&required=1" : "";
$placeholder = varset($placeholder) ? $placeholder : $type;
$pat = $pattern ? "&pattern=" . $pattern : "";
switch ($type) {
case 'stylesheets':
$fl = e107::getFile();
$fl->setMode('full');
$stylesheets = $fl->get_files(e_THEME . $this->themeName . "/", "\\.css", $reject, 1);
foreach ($stylesheets as $key => $path) {
$file = str_replace(e_THEME . $this->themeName . "/", '', $path);
$text .= "<div class='row-fluid'>";
$text .= "<div class='controls'>";
$text .= "<div class='span3'>" . $frm->checkbox($name . '[' . $key . '][file]', $file, false, array('label' => $file)) . "\n\t\t\t\t\t\t<div class='field-help'>Enable this stylesheet as a selectable option in the Theme Manager.</div></div>";
$text .= "<div class='span3'>" . $frm->text($name . '[' . $key . '][name]', $default, $size, 'placeholder=' . $file . $req . $pat) . "\n\t\t\t\t\t\t<div class='field-help'>Give this stylesheet a name</div></div>";
// $text .= "<div class='span2'>".$frm->checkbox('css['.$key.'][file]',$file, false, array('label'=>$file))."</div>";
// $text .= "<div class='span2'>".$frm->text('css['.$key.'][name]', $default, $size, 'placeholder='.$placeholder . $req. $pat)."</div>";
$text .= "</div>";
$text .= "</div>";
}
//.........这里部分代码省略.........
示例10: getRemoteFile
/**
* Get Remote XML file contents
* use setOptArrayTags above if you require a consistent array result by in 1 item or many.
* @param string $address
* @param integer $timeout [optional] seconds
* @return string
*/
function getRemoteFile($address, $timeout = 10, $postData = null)
{
$_file = e107::getFile();
$this->xmlFileContents = $_file->getRemoteContent($address, array('timeout' => $timeout, 'post' => $postData));
$this->error = $_file->error;
return $this->xmlFileContents;
// ------ MOVED TO FILE HANDLER ------ //
// Could do something like: if ($timeout <= 0) $timeout = $pref['get_remote_timeout']; here
$timeout = min($timeout, 120);
$timeout = max($timeout, 3);
$this->xmlFileContents = '';
$mes = e107::getMessage();
if ($this->_feedUrl) {
$mes->addDebug("getting Remote File: " . $this->_feedUrl);
} else {
$address = str_replace(array("\r", "\n", "\t"), '', $address);
// May be paranoia, but streaky thought it might be a good idea
// ... and there shouldn't be unprintable characters in the URL anyway
}
if ($this->urlPrefix !== false) {
$address = $this->urlPrefix . $address;
}
// ... and there shouldn't be unprintable characters in the URL anyway
// Keep this in first position.
if (function_exists("curl_init")) {
$cu = curl_init();
curl_setopt($cu, CURLOPT_URL, $address);
curl_setopt($cu, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cu, CURLOPT_HEADER, 0);
curl_setopt($cu, CURLOPT_TIMEOUT, $timeout);
curl_setopt($cu, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($cu, CURLOPT_REFERER, e_REQUEST_HTTP);
curl_setopt($cu, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($cu, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($cu, CURLOPT_COOKIEFILE, e_SYSTEM . 'cookies.txt');
curl_setopt($cu, CURLOPT_COOKIEJAR, e_SYSTEM . 'cookies.txt');
if (!file_exists(e_SYSTEM . 'cookies.txt')) {
file_put_contents(e_SYSTEM . 'cookies.txt', '');
}
$this->xmlFileContents = curl_exec($cu);
if (curl_error($cu)) {
$this->error = "Curl error: " . curl_errno($cu) . ", " . curl_error($cu);
return FALSE;
}
curl_close($cu);
return $this->xmlFileContents;
}
if (function_exists('file_get_contents') && ini_get('allow_url_fopen')) {
$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
$address = $this->_feedUrl ? $this->_feedUrl : urldecode($address);
$data = file_get_contents($address);
// $data = file_get_contents(htmlspecialchars($address)); // buggy - sometimes fails.
if ($old_timeout !== FALSE) {
e107_ini_set('default_socket_timeout', $old_timeout);
}
if ($data !== FALSE) {
$this->xmlFileContents = $data;
return $data;
}
$this->error = "File_get_contents(XML) error";
// Fill in more info later
return FALSE;
}
if (ini_get("allow_url_fopen")) {
$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
$remote = @fopen($address, "r");
if (!$remote) {
$this->error = "fopen: Unable to open remote XML file: " . $address;
return FALSE;
}
} else {
$old_timeout = $timeout;
$tmp = parse_url($address);
if (!($remote = fsockopen($tmp['host'], 80, $errno, $errstr, $timeout))) {
$this->error = "Sockets: Unable to open remote XML file: " . $address;
return FALSE;
} else {
socket_set_timeout($remote, $timeout);
fputs($remote, "GET " . urlencode($address) . " HTTP/1.0\r\n\r\n");
}
}
$this->xmlFileContents = "";
while (!feof($remote)) {
$this->xmlFileContents .= fgets($remote, 4096);
}
fclose($remote);
if ($old_timeout != $timeout) {
if ($old_timeout !== FALSE) {
e107_ini_set('default_socket_timeout', $old_timeout);
}
}
return $this->xmlFileContents;
}
示例11: get_comp_lan_phrases
function get_comp_lan_phrases($comp_dir, $lang, $depth = 0)
{
$fl = e107::getFile();
$ret = array();
if ($lang_array = $fl->get_files($comp_dir, '\\.php', 'standard', $depth)) {
sort($lang_array);
}
$regexp = strpos($comp_dir, e_LANGUAGEDIR) !== FALSE ? "#.php#" : "#" . $lang . "#";
foreach ($lang_array as $f) {
if (preg_match($regexp, $f['path'] . $f['fname'])) {
$data = file($f['path'] . $f['fname']);
$relpath = str_replace($comp_dir, "", $f['path']);
if (substr($data[0], 0, 5) != "<?php") {
$key = str_replace(".php", "", $relpath . $f['fname']);
$ret['bom'][$key] = $f['fname'];
}
if ($f['path'] . $f['fname'] == e_LANGUAGEDIR . $lang . "/" . $lang . ".php") {
$f['fname'] = "English.php";
// change the key for the main language file.
}
if ($f['path'] . $f['fname'] == e_LANGUAGEDIR . $lang . "/" . $lang . "_custom.php") {
$f['fname'] = "English_custom.php";
// change the key for the main language file.
}
$ret = $ret + $this->fill_phrases_array($data, $relpath . $f['fname']);
}
}
return $ret;
}
示例12: adminBuildLocations
/**
* Detect available config locations (readable check), based on available url_modules {@link eDispatcher::adminReadModules()} core preference arrays
* Used to rebuild url_locations core preference value
* @see eDispatcher::adminBuildConfig()
* @see eDispatcher::adminReadModules()
* @param array $available {@link eDispatcher::adminReadModules()} stored as url_modules core preference
* @return array available config locations, stored as url_locations core preference
*/
public static function adminBuildLocations($available = null)
{
$ret = array();
if (null === $available) {
$available = self::adminReadModules();
}
$fl = e107::getFile();
// Core
foreach ($available['core'] as $module) {
// Default module
$ret[$module] = array('core');
// read sub-locations
$path = eDispatcher::getConfigLocationPath($module, 'core');
//$sub = $fl->get_dirs($path);
$sub = eRouter::adminReadConfigs($path);
if ($sub) {
foreach ($sub as $moduleSub) {
// auto-override: override available (controller or url config), check for config
if (in_array($module, $available['override']) && is_readable(eDispatcher::getConfigPath($module, 'override/' . $moduleSub))) {
$ret[$module][] = 'override/' . $moduleSub;
} elseif (is_readable(eDispatcher::getConfigPath($module, 'core/' . $moduleSub))) {
$ret[$module][] = 'core/' . $moduleSub;
}
}
}
}
// Plugins
foreach ($available['plugin'] as $module) {
// Default module
$ret[$module] = array('plugin');
// read sub-locations
$path = eDispatcher::getConfigLocationPath($module, 'plugin');
//$sub = $fl->get_dirs($path);
$sub = eRouter::adminReadConfigs($path);
if ($sub) {
foreach ($sub as $moduleSub) {
// auto-override: override available (controller or url config), check for config
if (in_array($module, $available['override']) && is_readable(eDispatcher::getConfigPath($module, 'override/' . $moduleSub))) {
$ret[$module][] = 'override/' . $moduleSub;
} elseif (is_readable(eDispatcher::getConfigPath($module, 'plugin/' . $moduleSub))) {
$ret[$module][] = 'plugin/' . $moduleSub;
}
}
}
}
// Go through all overrides, register those who don't belong to core & plugins as standalone core modules
foreach ($available['override'] as $module) {
// either it is a core/plugin module or e_url.php is not readable - continue
if (in_array($module, $available['core']) || in_array($module, $available['plugin'])) {
continue;
}
// Default module
$ret[$module] = array('override');
// read sub-locations
$path = eDispatcher::getConfigLocationPath($module, 'override');
//$sub = $fl->get_dirs($path);
$sub = eRouter::adminReadConfigs($path);
if ($sub) {
foreach ($sub as $moduleSub) {
if (is_readable(eDispatcher::getConfigPath($module, 'override/' . $moduleSub))) {
$ret[$module][] = 'override/' . $moduleSub;
}
}
}
}
return $ret;
}
示例13: PreFile_Select
function PreFile_Select($formid = 'prefile_selector')
{
require_once e_HANDLER . "userclass_class.php";
global $IMAGES_DIRECTORY, $fl;
$sql = e107::getDb();
$fl = e107::getFile();
$filelist = array();
$downloadList = array();
/*$sql->db_Select('download', '*', 'download_class != '.e_UC_NOBODY);
while ($row = $sql->db_Fetch()) {
extract($row);
if($download_url)
{
$filelist[] = array('id' => $download_id, 'name' => $download_name, 'url' => $download_url, 'class' => $download_class);
$downloadList[] = $download_url;
}
}*/
$tmp = $fl->get_files(e_FILE . 'downloads/');
foreach ($tmp as $value) {
if (!in_array($value['fname'], $downloadList)) {
$filelist[] = array('id' => 0, 'name' => $value['fname'], 'url' => $value['fname']);
}
}
$text = "<!-- Start of PreFile selector -->\n\t<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
$text .= "<div style='position:absolute; bottom:30px; right:75px'>";
$text .= "<table class='fborder' style='background-color: #fff'>\n\t<tr><td class='forumheader3' style='white-space: nowrap'>";
if (!count($filelist)) {
$text .= LANHELP_40;
} else {
$text .= "<select class='tbox' name='prefileselect' onchange=\"addtext(this.value); expandit('{$formid}')\">\n\t\t\t\t<option value=''>" . LANHELP_43 . "</option>";
foreach ($filelist as $file) {
if (isset($file['class'])) {
$ucinfo = "^" . $file['class'];
$ucname = r_userclass_name($file['class']);
} else {
$ucinfo = "";
$ucname = r_userclass_name(0);
}
if ($file['id']) {
$text .= "<option value=\"[file={e_BASE}request.php?" . $file['id'] . "{$ucinfo}]" . htmlspecialchars($file['name']) . "[/file]\">" . htmlspecialchars($file['name']) . " - {$ucname}</option>\n";
} else {
$text .= "<option value=\"[file={e_BASE}request.php?" . htmlspecialchars($file['url']) . "{$ucinfo}]" . htmlspecialchars($file['name']) . "[/file]\">" . htmlspecialchars($file['name']) . " - {$ucname}</option>\n";
}
}
$text .= "</select>";
}
$text .= "</td></tr>\t\n </table></div>\n\t</div>\n<!-- End of PreFile selector -->\n";
return $text;
}
示例14: file_size_decode
/**
* Parse a file size string (e.g. 16M) and compute the simple numeric value.
* Proxy to e_file::file_size_decode().
*
* @see e_file::file_size_decode()
* @param string $source - input string which may include 'multiplier' characters such as 'M' or 'G'. Converted to 'decoded value'
* @param int $compare - a 'compare' value
* @param string $action - values (gt|lt)
*
* @return int file size value.
* If the decoded value evaluates to zero, returns the value of $compare
* If $action == 'gt', return the larger of the decoded value and $compare
* If $action == 'lt', return the smaller of the decoded value and $compare
*/
function file_size_decode($source, $compare = 0, $action = '')
{
return e107::getFile(true)->file_size_decode($source, $compare, $action);
}
示例15: init
public function init()
{
$tmp = e107::getFile()->get_files(e_IMAGE . 'ranks', '.*?\\.(png|gif|jpg)');
$mode = $this->getMode();
$action = $this->getAction();
$existing = e107::getDb()->gen("SELECT gen_id FROM #generic WHERE gen_type='user_rank_data' LIMIT 1 ");
if ($mode == 'ranks' && $action == 'list' && !$existing) {
$this->createDefaultRecords();
}
// $this->addTitle(LAN_USER_RANKS);
foreach ($tmp as $k => $v) {
$id = $v['fname'];
$this->fields['gen_chardata']['writeParms']['optArray'][$id] = $v['fname'];
}
unset($tmp);
natsort($imageList);
}