本文整理汇总了PHP中SPLoader::loadClass方法的典型用法代码示例。如果您正苦于以下问题:PHP SPLoader::loadClass方法的具体用法?PHP SPLoader::loadClass怎么用?PHP SPLoader::loadClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPLoader
的用法示例。
在下文中一共展示了SPLoader::loadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialise
private function initialise()
{
static $loaded = false;
if (!$loaded || true) {
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
require_once JPATH_SITE . '/components/com_sobipro/lib/sobi.php';
Sobi::Initialise();
if (SOBI_CMS == 'joomla3') {
SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jqnc', 'adm.sobipro', 'adm.jnmenu', 'jquery-base64'));
} else {
SPFactory::header()->initBase(true)->addJsFile(array('sobipro', 'jquery', 'adm.sobipro', 'adm.jnmenu', 'jquery-migrate', 'jquery-base64'))->addCSSCode('#toolbar-box { display: block }');
}
$loaded = true;
SPLoader::loadClass('mlo.input');
SPLoader::loadClass('models.datamodel');
SPLoader::loadClass('models.dbobject');
SPLoader::loadModel('section');
$model = JModelLegacy::getInstance('MenusModelItem')->getItem();
self::$mid = $model->id;
if (isset($model->params['SobiProSettings']) && strlen($model->params['SobiProSettings'])) {
$this->params = json_decode(base64_decode($model->params['SobiProSettings']));
}
$jsString = json_encode(array('component' => Sobi::Txt('SOBI_NATIVE_TASKS'), 'buttonLabel' => Sobi::Txt('SOBI_SELECT_FUNCTIONALITY')));
SPFactory::header()->addJsCode("SpStrings = {$jsString}; ");
}
}
示例2: __construct
public function __construct($component)
{
if (!defined('SOBIPRO')) {
define('SOBIPRO', true);
defined('SOBI_CMS') || version_compare(JVERSION, '1.6.0', 'ge') ? define('SOBI_CMS', 'joomla16') : define('SOBI_CMS', 'joomla15');
defined('SOBI_TASK') || define('SOBI_TASK', 'task');
defined('SOBI_DEFLANG') || define('SOBI_DEFLANG', JFactory::getConfig()->get('config.language'));
defined('SOBI_ACL') || define('SOBI_ACL', 'front');
defined('SOBI_ROOT') || define('SOBI_ROOT', JPATH_ROOT);
defined('SOBI_MEDIA') || define('SOBI_MEDIA', implode(DIRECTORY_SEPARATOR, array(JPATH_ROOT, 'media', 'sobipro')));
defined('SOBI_MEDIA_LIVE') || define('SOBI_MEDIA_LIVE', JURI::root() . '/media/sobipro');
defined('SOBI_PATH') || define('SOBI_PATH', SOBI_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_sobipro');
defined('SOBI_LIVE_PATH') || define('SOBI_LIVE_PATH', 'components/com_sobipro');
$this->addFile(SOBI_PATH . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'fs' . DIRECTORY_SEPARATOR . 'loader.php');
}
SPLoader::loadController('interface');
SPLoader::loadClass('base.filter');
SPLoader::loadClass('base.request');
SPLoader::loadClass('base.const');
SPLoader::loadClass('base.factory');
SPLoader::loadClass('base.object');
SPLoader::loadClass('base.filter');
SPLoader::loadClass('base.request');
SPLoader::loadClass('sobi');
SPLoader::loadClass('base.config');
SPLoader::loadClass('base.exception');
SPLoader::loadClass('cms.base.lang');
SPLoader::loadClass('mlo.input');
parent::__construct($component);
}
示例3: loadFunction
protected function loadFunction($function)
{
$xml = new DOMDocument();
$xml->load(SPLoader::path("menu.{$function}", 'adm.templates', true, 'xml'));
$xpath = new DOMXPath($xml);
$this->loadLanguage($xpath);
$calls = $xpath->query('/definition/config/calls/call');
$this->menu = SPFactory::db()->select('*', '#__menu', array('id' => SPRequest::int('mid')))->loadObject();
if (isset($this->menu->params)) {
$this->menu->params = json_decode($this->menu->params);
if (isset($this->menu->params->SobiProSettings)) {
$this->menu->params->SobiProSettings = json_decode(base64_decode($this->menu->params->SobiProSettings));
}
}
/** @var SPAdmView $view */
$view = SPFactory::View('joomla-menu', true);
$view->assign($this->menu, 'joomlaMenu');
$section = SPRequest::int('section');
if ($calls->length) {
foreach ($calls as $file) {
$method = $file->attributes->getNamedItem('method')->nodeValue;
if ($file->attributes->getNamedItem('static') && $file->attributes->getNamedItem('static')->nodeValue == 'true') {
$class = SPLoader::loadClass($file->attributes->getNamedItem('file')->nodeValue);
$class::$method($view, $this->menu);
} else {
$obj = SPFactory::Instance($file->attributes->getNamedItem('file')->nodeValue);
$obj->{$method}($view, $this->menu);
}
}
}
$view->assign($section, 'sectionId')->determineTemplate('menu', $function)->display();
}
示例4: edit
protected function edit()
{
SPLoader::loadClass('html.tooltip');
$this->_type = 'entry_form';
$id = $this->get('entry.id');
if ($id) {
$this->addHidden($id, 'entry.id');
}
if (Sobi::Cfg('legacy.sigsiutree', false)) {
/* load the SigsiuTree class */
$tree = SPLoader::loadClass('mlo.tree');
/* create new instance */
$tree = new $tree(Sobi::Cfg('list.categories_ordering'));
$link = "javascript:SP_selectCat( '{sid}' )";
$tree->setHref($link);
$tree->setTask('category.chooser');
$tree->disable(Sobi::Section());
$tree->init(Sobi::Section());
$head = SPFactory::header();
$params = array();
$params['URL'] = Sobi::Url(array('task' => 'category.parents', 'out' => 'json'), true, false, true);
$params['MAXCATS'] = Sobi::Cfg('legacy.maxCats', '5');
$params['SEPARATOR'] = Sobi::Cfg('string.path_separator', ' > ');
$head->addJsVarFile('edit', md5(Sobi::Section() . Sobi::Section(true) . serialize($params)), $params);
}
$type = $this->key('template_type', 'xslt');
if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
$type = 'php';
}
if ($type == 'xslt') {
$data = $this->entryData(false);
$fields = $this->get('fields');
$f = array();
if (count($fields)) {
foreach ($fields as $field) {
if ($field->enabled('form')) {
$pf = null;
$pfm = null;
if (!$field->get('isFree') && $field->get('fee') && !Sobi::Can('entry.payment.free')) {
$pf = SPLang::currency($field->get('fee'));
$pfm = Sobi::Txt('EN.FIELD_NOT_FREE_MSG', array('fee' => $pf, 'fieldname' => $field->get('name')));
}
$f[$field->get('nid')] = array('_complex' => 1, '_data' => array('label' => array('_complex' => 1, '_data' => $field->get('name'), '_attributes' => array('lang' => Sobi::Lang(false), 'show' => $field->__get('showEditLabel'))), 'data' => array('_complex' => 1, '_xml' => 1, '_data' => $field->field(true)), 'description' => array('_complex' => 1, '_xml' => 1, '_data' => $field->get('description')), 'fee' => $pf, 'fee_msg' => $pfm), '_attributes' => array('id' => $field->get('id'), 'type' => $field->get('type'), 'suffix' => $field->get('suffix'), 'position' => $field->get('position'), 'required' => $field->get('required'), 'css_edit' => $field->get('cssClassEdit'), 'width' => $field->get('bsWidth'), 'css_class' => strlen($field->get('cssClass')) ? $field->get('cssClass') : 'spField'));
}
}
}
$f['save_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::submit('save', Sobi::Txt('EN.SAVE_ENTRY_BT')))));
$f['cancel_button'] = array('_complex' => 1, '_data' => array('data' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::button('cancel', Sobi::Txt('EN.CANCEL_BT'), array('onclick' => 'SPcancelEdit();')))));
if (Sobi::Cfg('legacy.sigsiutree', false)) {
$data['entry']['_data']['category_chooser'] = array('path' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::textarea('parent_path', $this->get('parent_path'), false, 500, 60, array('id' => 'entry.path', 'class' => 'inputbox required', 'readonly' => 'readonly'))), 'selected' => array('_complex' => 1, '_xml' => 1, '_data' => SPHtml_Input::text('entry.parent', $this->get('parents'), array('id' => 'entry.parent', 'size' => 15, 'maxlength' => 50, 'class' => 'inputbox required', 'readonly' => 'readonly', 'style' => 'text-align:center;'))));
}
$data['entry']['_data']['fields'] = array('_complex' => 1, '_data' => $f, '_attributes' => array('lang' => Sobi::Lang(false)));
if (Sobi::Cfg('legacy.sigsiutree', false)) {
$data['tree'] = array('_complex' => 1, '_xml' => 1, '_data' => SPLang::entities($tree->display(true), true));
}
$this->_attr = $data;
Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
}
}
示例5: __construct
/**
*/
public function __construct()
{
SPLoader::loadClass('mlo.input');
SPFactory::header()->addJsFile('adm.tooltips');
// @todo: legacy - has to be removed later
SPLoader::loadClass('helpers.adm.lists');
Sobi::Trigger('Create', $this->name(), array(&$this));
}
示例6: __construct
/**
* @param int $limit
* @param int $count
* @param int $current
* @param string $func
* @param array $limits
* @deprecated
*/
public function __construct($limit, $count, $current, $func, $box, $boxFunc, $limits = array(5, 10, 15, 25, 50))
{
$this->limit = $limit;
$this->count = $count;
$this->current = $current ? $current : 1;
$this->limits = is_array($limits) && count($limits) ? $limits : $this->limits;
$this->func = $func;
$this->boxFunc = $boxFunc;
$this->box = $box;
SPLoader::loadClass('mlo.input');
}
示例7: _display
/**
*
*/
public function _display()
{
SPLoader::loadClass('html.tooltip');
switch ($this->get('task')) {
case 'edit':
$this->assign($this->languages(), 'languages-list');
case 'add':
$this->edit();
break;
}
parent::display();
}
示例8: getObjectInfo
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
$db = JFactory::getDBO();
$query = "SELECT o.id, o.name, o.owner, o.parent, fd.baseData" . " FROM #__sobipro_object as o" . " LEFT JOIN #__sobipro_field_data AS fd ON o.id = fd.sid" . " JOIN #__sobipro_field AS f ON fd.fid = f.fid AND f.nid = 'field_name'" . " WHERE o.id = " . $id . " AND o.oType = 'entry'";
$db->setQuery($query);
$row = $db->loadObject();
if (!empty($row)) {
$sobiCore = JPATH_SITE . '/components/com_sobipro/lib/base/fs/loader.php';
if (is_file($sobiCore)) {
if (!defined('SOBIPRO')) {
$ver = new JVersion();
$ver = str_replace('.', null, $ver->RELEASE);
if ($ver > '15') {
$ver = '16';
}
define('SOBI_CMS', 'joomla' . $ver);
define('SOBIPRO', true);
define('SOBI_TASK', 'task');
define('SOBI_DEFLANG', JFactory::getLanguage()->getDefault());
define('SOBI_ACL', 'front');
define('SOBI_ROOT', JPATH_ROOT);
define('SOBI_MEDIA', implode(DS, array(JPATH_ROOT, 'media', 'sobipro')));
define('SOBI_MEDIA_LIVE', JURI::root() . '/media/sobipro');
define('SOBI_PATH', JPATH_ROOT . '/components/com_sobipro');
define('SOBI_LIVE_PATH', 'components/com_sobipro');
require_once JPATH_ROOT . '/components/com_sobipro/lib/base/fs/loader.php';
}
SPLoader::loadClass('sobi');
SPLoader::loadClass('base.request');
SPLoader::loadClass('base.object');
SPLoader::loadClass('base.factory');
SPLoader::loadClass('base.mainframe');
SPLoader::loadClass('base.const');
SPLoader::loadClass('cms.base.mainframe');
SPLoader::loadClass('cms.base.lang');
$info->title = empty($row->name) ? isset($row->baseData) ? $row->baseData : '' : $row->name;
$info->access = NULL;
$info->userid = $row->owner;
$info->link = Sobi::Url(array('title' => $row->name, 'pid' => $row->parent, 'sid' => $row->id));
}
}
}
return $info;
}
示例9: getSections
/**
*/
private function getSections()
{
$order = $this->parseOrdering();
try {
$sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), $order)->loadObjectList();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
}
if (count($sections)) {
SPLoader::loadClass('models.datamodel');
SPLoader::loadClass('models.dbobject');
SPLoader::loadModel('section');
foreach ($sections as $section) {
if (Sobi::Can('section', 'access', 'any', $section->id)) {
$s = new SPSection();
$s->extend($section);
$this->_sections[] = $s;
}
}
}
}
示例10: execute
public function execute()
{
SPRequest::set('task', $this->_type . '.' . $this->_task);
if (strstr($this->_task, '.')) {
$task = explode('.', $this->_task);
$class = SPLoader::loadClass('opt.listing.' . $task[0], false, null, true);
} else {
$class = SPLoader::loadClass('opt.listing.' . $this->_task, false, null, true);
}
if ($class) {
$imp = class_implements($class);
if (is_array($imp) && in_array('SPListing', $imp)) {
/** @noinspection PhpIncludeInspection $compatibility */
$listing = new $class();
if (!isset($class::$compatibility)) {
define('SOBI_LEGACY_LISTING', true);
if (strstr($this->_task, '.')) {
$t = explode('.', $this->_task);
$listing->setTask($t[0]);
} else {
$listing->setTask($this->_task);
}
} else {
$listing->setTask($this->_task);
}
return $listing->execute();
} else {
Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND Wrong class definition', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
}
} else {
/* case parent didn't registered this task, it was an error */
if (!parent::execute() && $this->name() == __CLASS__) {
Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
}
}
}
示例11: Init
/**
* @deprecated since 1.1 replaced by {@link #Initialise()}
* @param int $sid - section id
* @param null $root - root of Joomla!
* @param null $lang - language
* @return null
*/
public static function Init($root = null, $lang = null, $sid = 0)
{
static $loaded = false;
if (!$loaded) {
if (!defined('SOBI_CMS')) {
define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15'));
}
defined('SOBIPRO') || define('SOBIPRO', true);
defined('SOBI_TASK') || define('SOBI_TASK', 'task');
defined('SOBI_DEFLANG') || define('SOBI_DEFLANG', $lang);
defined('SOBI_ACL') || define('SOBI_ACL', 'front');
defined('SOBI_ROOT') || define('SOBI_ROOT', $root);
defined('SOBI_MEDIA') || define('SOBI_MEDIA', implode('/', array($root, 'media', 'sobipro')));
defined('SOBI_PATH') || define('SOBI_PATH', SOBI_ROOT . '/components/com_sobipro');
defined('SOBI_LIVE_PATH') || define('SOBI_LIVE_PATH', 'components/com_sobipro');
require_once SOBI_PATH . '/lib/base/fs/loader.php';
SPLoader::loadController('sobipro');
SPLoader::loadController('interface');
SPLoader::loadClass('base.exception');
SPLoader::loadClass('base.const');
SPLoader::loadClass('base.object');
SPLoader::loadClass('base.filter');
SPLoader::loadClass('base.request');
SPLoader::loadClass('cms.base.lang');
SPLoader::loadClass('models.dbobject');
SPLoader::loadClass('base.factory');
SPLoader::loadClass('base.config');
SPLoader::loadClass('cms.base.fs');
// in case it is a CLI call
if (isset($_SERVER['REQUEST_URI'])) {
SPFactory::config()->set('live_site', JURI::root());
}
$loaded = true;
}
if ($sid) {
$section = null;
if ($sid) {
$path = array();
$id = $sid;
$path[] = (int) $id;
while ($id > 0) {
try {
$id = SPFactory::db()->select('pid', 'spdb_relations', array('id' => $id))->loadResult();
if ($id) {
$path[] = (int) $id;
}
} catch (SPException $x) {
Sobi::Error('ExtCoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
}
$path = array_reverse($path);
$section = SPFactory::object($path[0]);
}
/* set current section in the registry */
SPFactory::registry()->set('current_section', $section->id);
$_config =& SPFactory::config();
/* load basic configuration settings */
$_config->addIniFile('etc.config', true);
$_config->addTable('spdb_config', $sid);
/* initialise interface config setting */
SPFactory::mainframe()->getBasicCfg();
/* initialise config */
$_config->init();
}
}
示例12: validateVisibility
public static function validateVisibility(&$data)
{
SPLoader::loadClass('env.browser');
$humanity = SPBrowser::getInstance()->get('humanity');
$display = Sobi::Cfg('mail_protection.show');
if (!($humanity >= $display)) {
$data['_data'] = array();
}
}
示例13: fields
/**
* Enter description here...
*
*/
protected function fields()
{
SPLoader::loadClass('html.tabs');
SPFactory::header()->addCssFile('tabs', true);
$t = new SPHtml_Tabs(true, null);
$tabs = $this->get('fields');
if (count($tabs)) {
$t->startPane('fields_' . $this->get('task'));
foreach ($tabs as $tab => $keys) {
$t->startTab(Sobi::Txt($tab), str_replace(' ', '_', $tab));
echo '<table class="admintable" style="width: 100%;">';
$c = 0;
foreach ($keys as $key => $params) {
$class = $c % 2;
$c++;
$params = explode('|', $params);
$p = array();
/* at first we need the label */
$label = Sobi::Txt(array_shift($params));
$label2 = null;
if (strstr($label, ':')) {
$label = explode(':', $label);
$label2 = $label[1];
$label = $label[0];
}
/* get the field type */
$p[0] = array_shift($params);
if (preg_match('/^section.*/', $key)) {
/* put the field name */
$p[1] = $key;
/* get the current value */
$p[2] = $this->get($key);
} elseif (!strstr($key, 'spacer')) {
/* put the field name */
$p[1] = 'spcfg_' . $key;
/* get the current value */
$p[2] = Sobi::Cfg($key, '');
}
if (strstr($key, 'spacer')) {
if ($key == 'spacer_pby') {
$this->pby();
} else {
echo "<tr class=\"row{$class}\">";
echo '<th colspan="2" class="spConfigTableHeader">';
$this->txt($label);
echo '</th>';
echo '</tr>';
}
} else {
if (strstr($key, '_array') && count($p[2]) && $p[2]) {
$p[2] = implode(',', $p[2]);
}
/* and all other parameters */
if (count($params)) {
foreach ($params as $param) {
$p[] = $param;
}
}
echo "<tr class=\"row{$class}\">";
echo '<td class="key" style="min-width:200px;">';
$this->txt($label);
echo '</td>';
echo '<td>';
$this->parseField($p);
if ($label2) {
$this->txt($label2);
}
echo '</td>';
echo '</tr>';
}
}
echo '</table>';
$t->endTab();
}
$t->endPane();
}
}
示例14: delImgs
private function delImgs()
{
$files = SPConfig::unserialize($this->getRaw());
if (is_array($files) && count($files)) {
SPLoader::loadClass('cms.base.fs');
foreach ($files as $file) {
if (!strlen($file)) {
continue;
}
$file = Sobi::FixPath(SOBI_ROOT . "/{$file}");
// should never happen but who knows ....
if ($file == SOBI_ROOT) {
continue;
}
if (SPFs::exists($file)) {
SPFs::delete($file);
}
}
}
}
示例15: define
* $HeadURL$
*/
define('SOBI_TESTS', false);
defined('_JEXEC') || exit('Restricted access');
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15'));
define('SOBIPRO', true);
define('SOBI_TASK', 'task');
if (SOBI_CMS == 'joomla15') {
define('SOBI_DEFLANG', JFactory::getConfig()->getValue('config.language'));
} else {
define('SOBI_DEFLANG', JComponentHelper::getParams('com_languages')->get('site', 'en-GB'));
}
define('SOBI_ACL', 'front');
define('SOBI_ROOT', JPATH_ROOT);
define('SOBI_MEDIA', implode('/', array(JPATH_ROOT, 'media', 'sobipro')));
define('SOBI_MEDIA_LIVE', JURI::root() . 'media/sobipro');
define('SOBI_PATH', SOBI_ROOT . '/components/com_sobipro');
define('SOBI_LIVE_PATH', 'components/com_sobipro');
require_once SOBI_PATH . '/lib/base/fs/loader.php';
SPLoader::loadController('interface');
SPLoader::loadClass('base.filter');
SPLoader::loadClass('base.request');
// Try to catch direct file calls. Like /directory/piwik.php
if (preg_match('/\\.php$/', SPRequest::task()) || strlen(SPRequest::task()) > 50) {
JError::raiseError(403, 'Unauthorized Access');
}
$class = SPLoader::loadController('sobipro');
$sobi = new $class(SPRequest::task());
$sobi->execute();
//SPConfig::debOut( SPRequest::task() );