本文整理汇总了PHP中XoopsLists::getFileListAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLists::getFileListAsArray方法的具体用法?PHP XoopsLists::getFileListAsArray怎么用?PHP XoopsLists::getFileListAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLists
的用法示例。
在下文中一共展示了XoopsLists::getFileListAsArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_extra_preloads
public function load_extra_preloads($dir, $name)
{
$dir = rtrim($dir, '/');
$extra = array();
if (is_dir($dir . '/events')) {
$file_list = XoopsLists::getFileListAsArray($dir . '/events');
foreach ($file_list as $file) {
if (preg_match('/(\\.php)$/i', $file)) {
$file = substr($file, 0, -4);
$extra[] = $file;
}
}
}
foreach ($extra as $preload) {
include_once $dir . '/events/' . $preload . '.php';
$class_name = ucfirst($name) . ucfirst($preload) . 'Preload';
if (!class_exists($class_name)) {
continue;
}
$class_methods = get_class_methods($class_name);
foreach ($class_methods as $method) {
if (strpos($method, 'event') === 0) {
$event_name = strtolower(str_replace('event', '', $method));
$event = array('class_name' => $class_name, 'method' => $method);
$this->_events[$event_name][] = $event;
}
}
}
}
示例2: subMenus
/**
* expects an array of array containing:
* name, Name of the submenu
* url, Url of the submenu relative to the module
* ex: return array(0 => array(
* 'name' => _MI_PUBLISHER_SUB_SMNAME3;
* 'url' => "search.php";
* ));
*
* @return array
*/
public function subMenus()
{
$ret = array();
$files = XoopsLists::getFileListAsArray(dirname(dirname(__DIR__)));
$i = 0;
foreach ($files as $file) {
if (!in_array($file, array('xoops_version.php', 'index.php'))) {
$fileName = ucfirst(str_replace('.php', '', $file));
$ret[$i]['name'] = $fileName;
$ret[$i]['url'] = $file;
++$i;
}
}
return $ret;
}
示例3: getPluginsArray
function getPluginsArray()
{
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$aFiles = XoopsLists::getFileListAsArray(SMARTCLONE_ROOT_PATH . 'plugins/');
$ret = array();
foreach ($aFiles as $file) {
if (substr($file, strlen($file) - 4, 4) == '.php') {
$pluginName = str_replace('.php', '', $file);
$module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/{$pluginName}/xoops_version.php";
if (file_exists($module_xoops_version_file)) {
$ret[$pluginName] = $pluginName;
}
}
}
return $ret;
}
示例4: backend
/**
* Used to populate backend
*
* @param int $limit : Number of item for backend
*
* Expects an array containing:
* title : Title for the backend items
* link : Link for the backend items
* content : content for the backend items
* date : Date of the backend items
*
* @return array
*/
public function backend($limit)
{
$xoops = Xoops::getInstance();
$i = 0;
$ret = array();
$files = XoopsLists::getFileListAsArray($xoops->path('modules/codex/'));
foreach ($files as $file) {
if (!in_array($file, array('xoops_version.php', 'index.php'))) {
$ret[$i]['title'] = ucfirst(str_replace('.php', '', $file));
$ret[$i]['link'] = $xoops->url('modules/codex/' . $file);
$ret[$i]['content'] = 'Codex module : ' . ucfirst(str_replace('.php', '', $file));
$ret[$i]['date'] = filemtime($xoops->path('modules/codex/' . $file));
++$i;
}
}
return $ret;
}
示例5: search
public function search($queries, $andor, $limit, $start, $uid)
{
$queries = implode(' ', (array) $queries);
$files = XoopsLists::getFileListAsArray(dirname(dirname(__DIR__)));
$res = array();
$i = 0;
foreach ($files as $file) {
if (!in_array($file, array('xoops_version.php', 'index.php'))) {
$fileName = ucfirst(str_replace('.php', '', $file));
if (stripos($fileName, $queries) !== false) {
$res[$i]['link'] = $file;
$res[$i]['title'] = $fileName;
++$i;
}
}
}
return $res;
}
示例6: setPreloads
/**
* Get available preloads information and set them to go!
*
* @return void
*/
function setPreloads()
{
//$modules_list = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH . "/modules/");
if ($modules_list = XoopsCache::read('system_modules_active')) {
$i = 0;
foreach ($modules_list as $module) {
if (is_dir($dir = XOOPS_ROOT_PATH . "/modules/{$module}/preloads/")) {
$file_list = XoopsLists::getFileListAsArray($dir);
foreach ($file_list as $file) {
if (preg_match('/(\\.php)$/i', $file)) {
$file = substr($file, 0, -4);
$this->_preloads[$i]['module'] = $module;
$this->_preloads[$i]['file'] = $file;
$i++;
}
}
}
}
}
}
示例7: render
function render()
{
$files = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/modules/rmcommon/lang', '');
$langs = array();
$langs['en_US'] = 'en';
foreach ($files as $file => $v) {
if (substr($file, -3) != '.mo') {
continue;
}
$langs[substr($file, 0, -3)] = substr($file, 0, -3);
}
if ($this->type) {
$rtn = '<div class="' . ($this->multi ? 'checkbox' : 'radio') . '"><ul class="rmoptions_container">';
$i = 1;
foreach ($langs as $k) {
if ($this->multi) {
$rtn .= "<li><label><input type='checkbox' value='{$k}' name='" . $this->getName() . "[]' id='" . $this->id() . "[]'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " checked='checked'" : '' : '') . " /> {$k}</label></li>";
} else {
$rtn .= "<li><label><input type='radio' value='{$k}' name='" . $this->getName() . "' id='" . $this->id() . "'" . (!empty($this->selected) ? $k == $this->selected ? " checked='checked'" : '' : '') . " /> {$k}</label></li>";
}
$i++;
}
$rtn .= "</ul></div>";
} else {
if ($this->multi) {
$rtn = "<select name='" . $this->getName() . "[]' id='" . $this->id() . "[]' size='{$this->cols}' multiple='multiple' class=\"form-control " . $this->getClass() . "\">";
foreach ($langs as $k) {
$rtn .= "<option value='{$k}'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " selected='selected'" : '' : '') . ">{$k}</option>";
}
$rtn .= "</select>";
} else {
$rtn = "<select name='" . $this->getName() . "' id='" . $this->id() . "' class=\"form-control " . $this->getClass() . "\">";
foreach ($langs as $k) {
$rtn .= "<option value='{$k}'" . (!empty($this->selected) ? $k == $this->selected ? " selected='selected'" : '' : '') . ">{$k}</option>";
}
$rtn .= "</select>";
}
}
return $rtn;
}
示例8: getPluginsArray
function getPluginsArray()
{
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$module_handler = xoops_gethandler('module');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('isactive', 1));
$tempModulesObj = $module_handler->getObjects($criteria);
$modulesObj = array();
foreach ($tempModulesObj as $moduleObj) {
$modulesObj[$moduleObj->getVar('dirname')] = $moduleObj;
}
$aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/');
$ret = array();
foreach ($aFiles as $file) {
if (substr($file, strlen($file) - 4, 4) == '.php') {
$pluginName = str_replace('.php', '', $file);
$module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/{$pluginName}/xoops_version.php";
if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) {
$ret[$pluginName] = $modulesObj[$pluginName]->getVar('name');
}
}
}
return $ret;
}
示例9: cache_delete_expired
function cache_delete_expired()
{
global $xoopsSecurity;
if (!$xoopsSecurity->check()) {
redirectMsg('plugins.php?p=booster&action=view', __('Session token expired!', 'booster'), 1);
die;
}
$plugin = RMFunctions::get()->load_plugin('booster');
$items = XoopsLists::getFileListAsArray(XOOPS_CACHE_PATH . '/booster/files');
$files = array();
foreach ($items as $file) {
$tmp = explode('.', $file);
if ($tmp[1] != 'meta') {
continue;
}
$content = json_decode(file_get_contents(XOOPS_CACHE_PATH . '/booster/files/' . $file), true);
if (time() - $content['created'] >= $plugin->get_config('time')) {
@unlink(XOOPS_CACHE_PATH . '/booster/files/' . $file);
@unlink(XOOPS_CACHE_PATH . '/booster/files/' . $tmp[0] . '.html');
}
}
redirectMsg('plugins.php?p=booster&action=view', __('Expired pages deleted successfully', 'boost'), 0);
die;
}
示例10: getList
/**
* Get a list of extensions
*
* @param string $name name of captcha looking for
* @param string $extension extentions for captcha
*
* @return array|mixed
*/
public function getList($name, $extension = "")
{
if ($items = Xoops_Cache::read("captcha_captcha_{$name}")) {
return $items;
}
$file_path = $this->xoops_root_path . "/class/captcha/image/{$name}";
$files = XoopsLists::getFileListAsArray($file_path);
foreach ($files as $item) {
if (empty($extension) || preg_match("/(\\.{$extension})\$/i", $item)) {
$items[] = $item;
}
}
Xoops_Cache::write("captcha_captcha_{$name}", $items);
return $items;
}
示例11: array
$modversion['tables'][7] = 'rmc_blocks_positions';
$modversion['tables'][8] = 'rmc_bkmod';
// Templates
$modversion['templates'][1]['file'] = 'rmc_comments_display.html';
$modversion['templates'][1]['description'] = 'Comments list';
$modversion['templates'][2]['file'] = 'rmc_comments_form.html';
$modversion['templates'][2]['description'] = 'Shows the comments form';
/**
* Language
*/
$modversion['config'][1]['name'] = 'lang';
$modversion['config'][1]['title'] = '_MI_RMC_LANG';
$modversion['config'][1]['description'] = '';
$modversion['config'][1]['formtype'] = 'select';
$modversion['config'][1]['valuetype'] = 'text';
$files = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/modules/rmcommon/lang', '');
$options = array();
$options['en_US'] = 'en';
foreach ($files as $file => $v) {
if (substr($file, -3) != '.mo') {
continue;
}
$options[substr($file, 0, -3)] = substr($file, 0, -3);
}
$modversion['config'][1]['default'] = 'en';
$modversion['config'][1]['options'] = $options;
// Update config options
$fct = isset($_GET['fct']) ? $_GET['fct'] : '';
$mid = isset($_GET['mod']) ? $_GET['mod'] : '';
$mh = xoops_gethandler('module');
$mod = $mh->getByDirname('rmcommon');
示例12: copyrighted
<?php
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
$files = XoopsLists::getFileListAsArray(__DIR__);
foreach ($files as $file) {
if (!in_array($file, array('xoops_version.php', 'index.php'))) {
$fileName = ucfirst(str_replace('.php', '', $file));
echo "<a href={$file}>{$fileName}</a><br/>";
}
}
$xoops->footer();
示例13: setPreloads
/**
* Get list of all available preload files
*
* @return void
*/
protected function setPreloads()
{
$cache = \Xoops::getInstance()->cache();
$key = 'system/modules/preloads';
if (!($this->preloadList = $cache->read($key))) {
// get active modules from the xoops instance
$modules_list = \Xoops::getInstance()->getActiveModules();
if (empty($modules_list)) {
// this should only happen if an exception was thrown in setActiveModules()
$modules_list = array('system');
}
$this->preloadList = array();
$i = 0;
foreach ($modules_list as $module) {
if (is_dir($dir = \XoopsBaseConfig::get('root-path') . "/modules/{$module}/preloads/")) {
$file_list = \XoopsLists::getFileListAsArray($dir);
foreach ($file_list as $file) {
if (preg_match('/(\\.php)$/i', $file)) {
$file = substr($file, 0, -4);
$this->preloadList[$i]['module'] = $module;
$this->preloadList[$i]['file'] = $file;
++$i;
}
}
}
}
$cache->write($key, $this->preloadList);
}
}
示例14: array
$other_menu = RMEvents::get()->run_event('twop6.other.menu');
// Left Widgets
$left_widgets = array();
$left_widgets = RMEvents::get()->run_event('rmcommon.load.left.widgets', $left_widgets);
// Right widgets
$right_widgets = array();
$right_widgets = RMEvents::get()->run_event('rmcommon.load.right.widgets', $right_widgets);
$tp6Span = 12;
if ($left_widgets) {
$tp6Span -= 2;
}
if ($right_widgets) {
$tp6Span -= 3;
}
/* Load color schemes */
$files = XoopsLists::getFileListAsArray(TWOP6_PATH . '/css/schemes');
$color_schemes = array();
foreach ($files as $scheme) {
$content_color = file_get_contents(TWOP6_PATH . '/css/schemes/' . $scheme, null, null, null, 100);
$info_color = array();
preg_match("/^\\/\\*\\s(.*)\\s\\*\\//s", $content_color, $info_color);
if (isset($info_color[1]) && $info_color[1] != '') {
$color_schemes[$scheme] = $info_color[1];
}
}
unset($content_color, $info_color);
$this->add_style('bootstrap.min.css', 'rmcommon');
$this->add_style('general.min.css', 'rmcommon', array());
$this->add_style('2.6.css', 'twop6', array(), 'theme');
$color_scheme = isset($_COOKIE['color_scheme']) ? $_COOKIE['color_scheme'] : 'theme-default.css';
$this->add_style('schemes/' . $color_scheme, 'twop6', array('id' => 'color-scheme'), 'theme');
示例15: sprintf
if ($command == "delete") {
$xoopsTpl->assign('lid', $lid);
$xoopsTpl->assign('filename', $filename);
$xoopsTpl->assign('deleteok', sprintf(_MD_DELETEFILE, $filename));
}
if ($command == "deleteok") {
$fullpath = XOOPS_ROOT_PATH . UPLOADS . "/" . $filename;
if (extension_loaded('mbstring')) {
$fullpath = mb_convert_encoding($fullpath, $xoopsModuleConfig['filename_code'], mb_internal_encoding());
}
if (is_file($fullpath)) {
unlink($fullpath);
}
}
}
$file_array = XoopsLists::getFileListAsArray($dir_src);
$files = 0;
$per_page = $xoopsModuleConfig['perpage'];
$flist = array();
foreach ($file_array as $file) {
$d = new download($file);
if (!preg_match("/^\\./", $d->fnameToDwonload)) {
$info = array();
$info['name'] = $d->fnameToDwonload;
$info['size'] = filesize($dir_src . "/" . $file);
$info['type'] = $d->contentType;
$info['date'] = date("Y/m/d H:i", filemtime($dir_src . "/" . $file));
$flist[] = $info;
$files++;
}
}