本文整理匯總了PHP中XoopsLoad::loadFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP XoopsLoad::loadFile方法的具體用法?PHP XoopsLoad::loadFile怎麽用?PHP XoopsLoad::loadFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XoopsLoad
的用法示例。
在下文中一共展示了XoopsLoad::loadFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getHelper
/**
* @param string $dirname
*
* @return bool|Xoops\Module\Helper\HelperAbstract
*/
public static function getHelper($dirname = 'system')
{
static $modules = array();
$dirname = strtolower($dirname);
if (!isset($modules[$dirname])) {
$modules[$dirname] = false;
$xoops = \Xoops::getInstance();
if ($xoops->isActiveModule($dirname)) {
//Load Module helper if available
if (\XoopsLoad::loadFile($xoops->path("modules/{$dirname}/class/helper.php"))) {
$className = '\\' . ucfirst($dirname);
if (class_exists($className)) {
$class = new $className();
if ($class instanceof \Xoops\Module\Helper\HelperAbstract) {
$modules[$dirname] = $class::getInstance();
}
}
} else {
//Create Module Helper
$xoops->registry()->set('module_helper_id', $dirname);
$class = \Xoops\Module\Helper\Dummy::getInstance();
$class->setDirname($dirname);
$modules[$dirname] = $class;
}
}
}
return $modules[$dirname];
}
示例2: getPlugins
/**
* @param string $pluginName
* @param array|bool $inactiveModules
*
* @return mixed
*/
public static function getPlugins($pluginName = 'system', $inactiveModules = false)
{
static $plugins = array();
if (!isset($plugins[$pluginName])) {
$plugins[$pluginName] = array();
$xoops = \Xoops::getInstance();
//Load interface for this plugin
if (!\XoopsLoad::loadFile($xoops->path("modules/{$pluginName}/class/plugin/interface.php"))) {
return $plugins[$pluginName];
}
$dirnames = $xoops->getActiveModules();
if (is_array($inactiveModules)) {
$dirnames = array_merge($dirnames, $inactiveModules);
}
foreach ($dirnames as $dirname) {
if (\XoopsLoad::loadFile($xoops->path("modules/{$dirname}/class/plugin/{$pluginName}.php"))) {
$className = '\\' . ucfirst($dirname) . ucfirst($pluginName) . 'Plugin';
$interface = '\\' . ucfirst($pluginName) . 'PluginInterface';
$class = new $className($dirname);
if ($class instanceof \Xoops\Module\Plugin\PluginAbstract && $class instanceof $interface) {
$plugins[$pluginName][$dirname] = $class;
}
}
}
}
return $plugins[$pluginName];
}
示例3: loadLanguage
/**
* @param string $name
*/
public function loadLanguage($name)
{
$helper = Menus::getInstance();
$language = XoopsLocale::getLegacyLanguage();
$path = $helper->path("decorators/{$name}/language");
if (!($ret = XoopsLoad::loadFile("{$path}/{$language}/decorator.php"))) {
$ret = XoopsLoad::loadFile("{$path}/english/decorator.php");
}
return $ret;
}
示例4: xoops_module_pre_uninstall_notifications
function xoops_module_pre_uninstall_notifications(&$module)
{
$xoops = Xoops::getInstance();
XoopsLoad::loadFile($xoops->path('modules/notifications/class/helper.php'));
$helper = Notifications::getInstance();
$plugins = \Xoops\Module\Plugin::getPlugins('notifications');
foreach (array_keys($plugins) as $dirname) {
$helper->deleteModuleRelations($xoops->getModuleByDirname($dirname));
}
return true;
}
示例5: loadLanguage
/**
* @param string $name Name of language file to be loaded, without extension
* @param mixed $domain string: Module dirname; global language file will be loaded if $domain is set to 'global' or not specified
* array: example; array('Frameworks/moduleclasses/moduleadmin')
* @param string $language Language to be loaded, current language content will be loaded if not specified
*
* @return boolean
*/
public static function loadLanguage($name, $domain = '', $language = null)
{
if (empty($name)) {
return false;
}
$language = empty($language) ? XoopsLocale::getLegacyLanguage() : $language;
// expanded domain to multiple categories, e.g. module:system, framework:filter, etc.
if (empty($domain) || 'global' == $domain) {
$path = '';
} else {
$path = is_array($domain) ? array_shift($domain) : "modules/{$domain}";
}
$xoops = Xoops::getInstance();
$fullPath = $xoops->path("{$path}/language/{$language}/{$name}.php");
if (!($ret = XoopsLoad::loadFile($fullPath))) {
$fullPath2 = $xoops->path("{$path}/language/english/{$name}.php");
$ret = XoopsLoad::loadFile($fullPath2);
}
return $ret;
}
示例6: exit
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
use Xoops\Core\Kernel\Criteria;
use Xoops\Core\Kernel\CriteriaCompo;
use Xoops\Core\Request;
use Xoops\Core\FixedGroups;
$xoops = Xoops::getInstance();
// Check users rights
if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->userIsAdmin) {
exit(XoopsLocale::E_NO_ACCESS_PERMISSION);
}
XoopsLoad::loadFile($xoops->path('modules/system/admin/users/users.php'));
// Get Action type
$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string');
$member_handler = $xoops->getHandlerMember();
// Call Header
$xoops->header('admin:system/system_users.tpl');
$myts = MyTextSanitizer::getInstance();
// Define Stylesheet
$xoops->theme()->addStylesheet('modules/system/css/admin.css');
// Define scripts
$xoops->theme()->addScript('modules/system/js/admin.js');
// Define Breadcrumb and tips
$system_breadcrumb->addLink(SystemLocale::USERS_MANAGEMENT, system_adminVersion('users', 'adminpath'));
$uid = $system->cleanVars($_REQUEST, 'uid', 0);
switch ($op) {
// Edit user
示例7: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$xoops = \Xoops::getInstance();
\XoopsLoad::loadFile($xoops->path('class/template.php'));
$this->object = new XoopsTpl();
}
示例8: array
* @since 1.0
* @author Bandit-X
* @author trabis <lusopoemas@gmail.com>
* @author Xoops Modules Dev Team
* @version $Id$
*/
// ######################################################################
// # Original version:
// # [11-may-2001] Kenneth Lee - http://www.nexgear.com/
// ######################################################################
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$xoops->header('module:publisher/publisher_archive.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
$lastyear = 0;
$lastmonth = 0;
$months_arr = array(1 => XoopsLocale::L_MONTH_JANUARY, 2 => XoopsLocale::L_MONTH_FEBRUARY, 3 => XoopsLocale::L_MONTH_MARCH, 4 => XoopsLocale::L_MONTH_APRIL, 5 => XoopsLocale::L_MONTH_MAY, 6 => XoopsLocale::L_MONTH_JUNE, 7 => XoopsLocale::L_MONTH_JULY, 8 => XoopsLocale::L_MONTH_AUGUST, 9 => XoopsLocale::L_MONTH_SEPTEMBER, 10 => XoopsLocale::L_MONTH_OCTOBER, 11 => XoopsLocale::L_MONTH_NOVEMBER, 12 => XoopsLocale::L_MONTH_DECEMBER);
$fromyear = Request::getInt('year');
$frommonth = Request::getInt('month');
$pgtitle = '';
if ($fromyear && $frommonth) {
$pgtitle = sprintf(" - %d - %d", $fromyear, $frommonth);
}
$dateformat = $publisher->getConfig('format_date');
if ($dateformat == '') {
$dateformat = 'm';
}
$myts = MyTextSanitizer::getInstance();
$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars(_MD_PUBLISHER_ARCHIVES) . $pgtitle . ' - ' . $myts->htmlSpecialChars($xoopsModule->getVar('name')));
示例9: getCategories
function getCategories($respond = true)
{
global $xoopsDB;
if (!$this->_checkUser($this->params[1], $this->params[2])) {
$this->response->add(new XoopsXmlRpcFault(104));
} else {
if (!XoopsLoad::loadFile(\XoopsBaseConfig::get('root-path') . '/class/xoopstopic.php', true)) {
$this->response->add(new XoopsXmlRpcFault(103));
return;
}
//$this->db = xoopsDB;
$xt = new XoopsTopic($xoopsDB->prefix('topics'));
$ret = $xt->getTopicsList();
if (!$respond) {
return $ret;
} else {
if (count($ret) == 0) {
$this->response->add(new XoopsXmlRpcFault(106, 'Found 0 Entries'));
} else {
$arr = new XoopsXmlRpcArray();
foreach ($ret as $topic_id => $topic_vars) {
$struct = new XoopsXmlRpcStruct();
$struct->add('categoryId', new XoopsXmlRpcString($topic_id));
$struct->add('categoryName', new XoopsXmlRpcString($topic_vars['title']));
$struct->add('categoryPid', new XoopsXmlRpcString($topic_vars['pid']));
$arr->add($struct);
unset($struct);
}
$this->response->add($arr);
}
}
}
}
示例10: 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 The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @subpackage Action
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
include_once __DIR__ . '/include/common.php';
$publisher = Publisher::getInstance();
if ($publisher->getConfig('seo_url_rewrite') !== 'none') {
XoopsLoad::loadFile($publisher->path('include/seo.inc.php'));
}
示例11: array
$xoopsConfigSearch = $xoops->getConfigs();
if (empty($xoopsConfigSearch["enable_search"])) {
$xoops->redirect(PUBLISHER_URL . "/index.php", 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$groups = $xoops->getUserGroups();
$gperm_handler = $publisher->getGrouppermHandler();
$module_id = $publisher->getModule()->mid();
//Checking permissions
if (!$publisher->getConfig('perm_search') || !$gperm_handler->checkRight('global', _PUBLISHER_SEARCH, $groups, $module_id)) {
$xoops->redirect(PUBLISHER_URL, 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$xoops->disableModuleCache();
$xoops->header('module:publisher/publisher_search.tpl');
$xoopsTpl = $xoops->tpl();
$module_info_search = $publisher->getModule()->getInfo("search");
XoopsLoad::loadFile($publisher->path($module_info_search["file"]));
$limit = 10;
//$publisher->getConfig('idxcat_perpage');
$uid = 0;
$queries = array();
$andor = Request::getString('andor');
$start = Request::getInt('start');
$category = Request::getArray('category');
$username = Request::getString('uname');
$searchin = Request::getArray('searchin');
$sortby = Request::getString('sortby');
$term = Request::getString('term');
if (empty($category) || is_array($category) && in_array("all", $category)) {
$category = array();
} else {
$category = !is_array($category) ? explode(",", $category) : $category;
示例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 The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @author The SmartFactory <www.smartfactory.ca>
*/
include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$publisher->loadLanguage('modinfo');
XoopsLoad::loadFile($xoops->path(dirname(__DIR__) . '/include/common.php'));
XoopsLoad::loadFile($xoops->path(XOOPS_ROOT_PATH . '/include/cp_header.php'));
示例13: copyrighted
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.
*/
/**
* Publisher class
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
$xoops = \Xoops::getInstance();
define("PUBLISHER_DIRNAME", basename(dirname(__DIR__)));
define("PUBLISHER_URL", $xoops->url('modules/' . PUBLISHER_DIRNAME));
define("PUBLISHER_ADMIN_URL", PUBLISHER_URL . '/admin');
define("PUBLISHER_UPLOADS_URL", $xoops->url('uploads/' . PUBLISHER_DIRNAME));
define("PUBLISHER_ROOT_PATH", $xoops->path('modules/' . PUBLISHER_DIRNAME));
define("PUBLISHER_UPLOADS_PATH", $xoops->path('uploads/' . PUBLISHER_DIRNAME));
$path = dirname(__DIR__);
XoopsLoad::addMap(array('publishermetagen' => $path . '/class/metagen.php', 'publisher' => $path . '/class/helper.php', 'publisherutils' => $path . '/class/utils.php', 'publisherblockform' => $path . '/class/blockform.php'));
$publisher = Publisher::getInstance();
$publisher->loadLanguage('common');
XoopsLoad::loadFile($publisher->path('include/constants.php'));
示例14: dirname
*/
use Xoops\Core\Kernel\Criteria;
use Xoops\Core\Kernel\CriteriaCompo;
/**
* Publisher form class
*
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/include/common.php';
$publisher = Publisher::getInstance();
XoopsLoad::loadFile($publisher->path('class/formdatetime.php'));
class PublisherItemForm extends Xoops\Form\SimpleForm
{
private $_checkperm = true;
private $_tabs = array(_CO_PUBLISHER_TAB_MAIN => '_mainTab', _CO_PUBLISHER_TAB_IMAGES => '_imagesTab', _CO_PUBLISHER_TAB_FILES => '_filesTab', _CO_PUBLISHER_TAB_OTHERS => '_othersTab');
private $_mainTab = array(_PUBLISHER_SUBTITLE, _PUBLISHER_ITEM_SHORT_URL, _PUBLISHER_ITEM_TAG, _PUBLISHER_SUMMARY, _PUBLISHER_DOHTML, _PUBLISHER_DOSMILEY, _PUBLISHER_DOXCODE, _PUBLISHER_DOIMAGE, _PUBLISHER_DOLINEBREAK, _PUBLISHER_DATESUB, _PUBLISHER_STATUS, _PUBLISHER_AUTHOR_ALIAS, _PUBLISHER_NOTIFY, _PUBLISHER_AVAILABLE_PAGE_WRAP, _PUBLISHER_UID);
private $_imagesTab = array(_PUBLISHER_IMAGE_ITEM);
private $_filesTab = array(_PUBLISHER_ITEM_UPLOAD_FILE);
private $_othersTab = array(_PUBLISHER_ITEM_META_KEYWORDS, _PUBLISHER_ITEM_META_DESCRIPTION, _PUBLISHER_WEIGHT, _PUBLISHER_ALLOWCOMMENTS);
/**
* @param PublisherItem $obj
*/
public function __construct(PublisherItem $obj)
{
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
示例15: update
/**
* update
*
* @param string $mod module dirname
*
* @return mixed boolean false if failed, XoopsModule if success
*/
public function update($mod = '')
{
$xoops = Xoops::getInstance();
$module_handler = $xoops->getHandlerModule();
$module = $module_handler->getByDirname($mod);
$xoops->templateClearModuleCache($module->getVar('mid'));
// Save current version for use in the update function
$prev_version = $module->getVar('version');
// we dont want to change the module name set by admin
$temp_name = $module->getVar('name');
$module->loadInfoAsVar($module->getVar('dirname'));
$module->setVar('name', $temp_name);
$module->setVar('last_update', time());
if (!$module_handler->insertModule($module)) {
$this->error[] = sprintf(XoopsLocale::EF_NOT_UPDATED, "<strong>" . $module->getVar('name') . "</strong>");
return false;
} else {
// execute module specific preupdate script if any
$update_script = $module->getInfo('onUpdate');
if (false != $update_script && trim($update_script) != '') {
XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($update_script)));
$func = 'xoops_module_preupdate_' . $mod;
if (function_exists($func)) {
$result = $func($module, $prev_version);
if (!$result) {
$this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
$this->trace = array_merge($this->error, $module->getErrors());
} else {
$this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
$this->trace = array_merge($this->trace, $module->getMessages());
}
}
}
// update schema
$schema_file = $module->getInfo('schema');
if (!empty($schema_file)) {
$schema_file_path = \XoopsBaseConfig::get('root-path') . '/modules/' . $mod . '/' . $schema_file;
if (!XoopsLoad::fileExists($schema_file_path)) {
$this->error[] = sprintf(SystemLocale::EF_SQL_FILE_NOT_FOUND, "<strong>{$schema_file}</strong>");
return false;
}
$importer = new ImportSchema();
$importSchema = $importer->importSchemaArray(Yaml::read($schema_file_path));
$synchronizer = new SingleDatabaseSynchronizer($xoops->db());
$synchronizer->updateSchema($importSchema, true);
}
// delete templates
$this->deleteTemplates($module);
// install templates
$this->installTemplates($module);
// install blocks
$this->installBlocks($module);
// reset compile_id
$xoops->tpl()->setCompileId();
// first delete all config entries
$this->deleteConfigs($module);
// Install Configs
$this->installConfigs($module, 'update');
// execute module specific update script if any
$update_script = $module->getInfo('onUpdate');
if (false != $update_script && trim($update_script) != '') {
XoopsLoad::loadFile($xoops->path('modules/' . $mod . '/' . trim($update_script)));
$func = 'xoops_module_update_' . $mod;
if (function_exists($func)) {
$result = $func($module, $prev_version);
if (!$result) {
$this->trace[] = sprintf(XoopsLocale::EF_NOT_EXECUTED, $func);
$this->trace = array_merge($this->error, $module->getErrors());
} else {
$this->trace[] = sprintf(XoopsLocale::SF_EXECUTED, "<strong>{$func}</strong>");
$this->trace = array_merge($this->trace, $module->getMessages());
}
}
}
$this->trace[] = sprintf(XoopsLocale::SF_UPDATED, '<strong>' . $module->getVar('name', 's') . '</strong>');
return $module;
}
}