本文整理汇总了PHP中SPLoader类的典型用法代码示例。如果您正苦于以下问题:PHP SPLoader类的具体用法?PHP SPLoader怎么用?PHP SPLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SPLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: 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}; ");
}
}
示例3: saveToken
public function saveToken($token)
{
$arrdef = SPFactory::Instance('types.array');
$def = $arrdef->fromXML($this->definition, 'repository');
$ndef = array();
$u = false;
$rid = null;
foreach ($def['repository'] as $k => $v) {
if ($u) {
$ndef['token'] = $token;
}
if ($k == 'id') {
$rid = $v;
}
if ($k == 'url') {
$u = true;
}
$ndef[$k] = $v;
}
$path = SPLoader::path("etc.repos.{$rid}.repository", 'front', true, 'xml');
$file = SPFactory::Instance('base.fs.file', $path);
$xdef = SPFactory::Instance('types.array');
$file->content($xdef->toXML($ndef, 'repository'));
$file->save();
}
示例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: install
public function install()
{
$id = $this->xGetString('id');
$name = $this->xGetString('name');
if (SPLoader::dirPath('usr.templates.' . $id) && !SPRequest::bool('force')) {
throw new SPException(SPLang::e('TEMPLATE_INST_DUPLICATE', $name) . ' ' . Sobi::Txt('FORCE_TPL_UPDATE', Sobi::Url(array('task' => 'extensions.install', 'force' => 1, 'root' => basename($this->root) . '/' . basename($this->xmlFile)))));
}
$requirements = $this->xGetChilds('requirements/*');
if ($requirements && $requirements instanceof DOMNodeList) {
SPFactory::Instance('services.installers.requirements')->check($requirements);
}
$language = $this->xGetChilds('language/file');
$folder = @$this->xGetChilds('language/@folder')->item(0)->nodeValue;
if ($language && $language instanceof DOMNodeList && $language->length) {
$langFiles = array();
foreach ($language as $file) {
$adm = false;
if ($file->attributes->getNamedItem('admin')) {
$adm = $file->attributes->getNamedItem('admin')->nodeValue == 'true' ? true : false;
}
$langFiles[$file->attributes->getNamedItem('lang')->nodeValue][] = array('path' => Sobi::FixPath("{$this->root}/{$folder}/" . trim($file->nodeValue)), 'name' => $file->nodeValue, 'adm' => $adm);
}
SPFactory::CmsHelper()->installLang($langFiles, false, true);
}
$path = SPLoader::dirPath('usr.templates.' . $id, 'front', false);
if (SPRequest::bool('force')) {
/** @var $from SPDirectory */
$from = SPFactory::Instance('base.fs.directory', $this->root);
$from->moveFiles($path);
} else {
if (!SPFs::move($this->root, $path)) {
throw new SPException(SPLang::e('CANNOT_MOVE_DIRECTORY', $this->root, $path));
}
}
if (!SPRequest::bool('force')) {
$section = $this->xGetChilds('install');
if ($section instanceof DOMNodeList && $section->length) {
$this->section($id);
}
}
//05 Oct 2015 Kishore
$exec = $this->xGetString('exec');
if ($exec && SPFs::exists($path . DS . $exec)) {
include_once "{$path}/{$exec}";
}
/** @var $dir SPDirectory */
$dir =& SPFactory::Instance('base.fs.directory', $path);
$zip = array_keys($dir->searchFile('.zip', false));
if (count($zip)) {
foreach ($zip as $file) {
SPFs::delete($file);
}
}
Sobi::Trigger('After', 'InstallTemplate', array($id));
$dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('tmp.install'));
$dir->deleteFiles();
return Sobi::Txt('TP.TEMPLATE_HAS_BEEN_INSTALLED', array('template' => $name));
}
示例6: display
public function display()
{
$template = SPLoader::loadTemplate($this->_tpl, 'php');
if ($template) {
include $template;
} else {
throw new SPException(SPLang::e('CANNOT_LOAD_TEMPLATE_FILE_AT', SPLoader::loadTemplate($this->_tpl, 'php', false)));
}
}
示例7: check
protected function check($file)
{
$allowed = SPLoader::loadIniFile('etc.files');
$mType = SPFactory::Instance('services.fileinfo', $file)->mimeType();
if (strlen($mType) && !in_array($mType, $allowed)) {
SPFs::delete($file);
$this->message(array('type' => 'error', 'text' => SPLang::e('FILE_WRONG_TYPE', $mType), 'id' => ''));
}
return $mType;
}
示例8: __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');
}
示例9: __construct
public function __construct()
{
$ident = SPRequest::cmd('session') ? SPRequest::cmd('ProgressMsg' . SPRequest::cmd('session'), null, 'cookie') : SPRequest::cmd('ProgressMsg', null, 'cookie');
$this->file = SPLoader::path('tmp.' . $ident, 'front', false, 'tmp');
if (SPFs::exists($this->file)) {
$content = json_decode(SPFs::read($this->file), true);
$this->message = $content['message'];
$this->type = $content['type'];
$this->progress = $content['progress'];
$this->interval = $content['interval'];
}
}
示例10: _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();
}
示例11: 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;
}
示例12: PaymentMethodView
/**
* This function have to add own string into the given array
* Basically: $methods[ $this->id ] = "Some String To Output";
* Optionally the value can be also SobiPro Arr2XML array.
* Check the documentation for more information
* @param array $methods
* @param SPEntry $entry
* @param array $payment
* @param bool $message
* @return void
*/
public function PaymentMethodView(&$methods, $entry, &$payment, $message = false)
{
$data = SPFactory::registry()->loadDBSection('paypal_' . Sobi::Section())->get('paypal_' . Sobi::Section());
if (!count($data)) {
$data = SPFactory::registry()->loadDBSection('paypal')->get('paypal');
}
$cfg = SPLoader::loadIniFile('etc.paypal');
$rp = $cfg['general']['replace'];
$to = $cfg['general']['replace'] == ',' ? '.' : ',';
$amount = str_replace($rp, $to, $payment['summary']['sum_brutto']);
$values = array('entry' => $entry, 'amount' => preg_replace('/[^0-9\\.,]/', null, $amount), 'ppurl' => SPLang::replacePlaceHolders($data['ppurl']['value'], $entry), 'ppemail' => SPLang::replacePlaceHolders($data['ppemail']['value'], $entry), 'pprurl' => SPLang::replacePlaceHolders($data['pprurl']['value'], $entry), 'ppcc' => SPLang::replacePlaceHolders($data['ppcc']['value'], $entry));
$expl = SPLang::replacePlaceHolders(SPLang::getValue('ppexpl', 'plugin', Sobi::Section()), $values);
$subject = SPLang::replacePlaceHolders(SPLang::getValue('ppsubject', 'plugin', Sobi::Section()), $values);
$values['expl'] = $expl;
$values['subject'] = $subject;
$values['ip'] = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
$methods[$this->id] = array('content' => $message ? $this->raw($cfg, $values) : $this->content($cfg, $values), 'title' => Sobi::Txt('APP.PPP.PAY_TITLE'));
}
示例13: install
public function install()
{
$id = $this->xGetString('id');
$name = $this->xGetString('name');
if (SPLoader::dirPath('usr.templates.' . $id) && !SPRequest::bool('force')) {
throw new SPException(SPLang::e('TEMPLATE_INST_DUPLICATE', $name) . ' ' . Sobi::Txt('FORCE_TPL_UPDATE', Sobi::Url(array('task' => 'extensions.install', 'force' => 1, 'root' => basename($this->root) . '/' . basename($this->xmlFile)))));
}
$requirements = $this->xGetChilds('requirements/*');
if ($requirements && $requirements instanceof DOMNodeList) {
SPFactory::Instance('services.installers.requirements')->check($requirements);
}
$path = SPLoader::dirPath('usr.templates.' . $id, 'front', false);
if (SPRequest::bool('force')) {
/** @var $from SPDirectory */
$from = SPFactory::Instance('base.fs.directory', $this->root);
$from->moveFiles($path);
} else {
if (!SPFs::move($this->root, $path)) {
throw new SPException(SPLang::e('CANNOT_MOVE_DIRECTORY', $this->root, $path));
}
}
if (!SPRequest::bool('force')) {
$section = $this->xGetChilds('install');
if ($section instanceof DOMNodeList && $section->length) {
$this->section($id);
}
}
$exec = $this->xGetString('exec');
if ($exec && SPFs::exists($this->root . DS . $exec)) {
include_once "{$this->root}/{$exec}";
}
/** @var $dir SPDirectory */
$dir =& SPFactory::Instance('base.fs.directory', $path);
$zip = array_keys($dir->searchFile('.zip', false));
if (count($zip)) {
foreach ($zip as $file) {
SPFs::delete($file);
}
}
Sobi::Trigger('After', 'InstallTemplate', array($id));
$dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('tmp.install'));
$dir->deleteFiles();
return Sobi::Txt('TP.TEMPLATE_HAS_BEEN_INSTALLED', array('template' => $name));
}
示例14: validate
public function validate()
{
$type = $this->type == 'SobiProApp' ? 'application' : $this->type;
$schemaDef = SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd');
if (!SPFs::exists($schemaDef) || time() - filemtime($schemaDef) > 60 * 60 * 24 * 7) {
$connection = SPFactory::Instance('services.remote');
$def = "https://xml.sigsiu.net/SobiPro/{$type}.xsd";
$connection->setOptions(array('url' => $def, 'connecttimeout' => 10, 'header' => false, 'returntransfer' => true, 'ssl_verifypeer' => false, 'ssl_verifyhost' => 2));
$schema =& SPFactory::Instance('base.fs.file', SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd'));
$file = $connection->exec();
if (!strlen($file)) {
throw new SPException(SPLang::e('CANNOT_ACCESS_SCHEMA_DEF', $def));
}
$schema->content($file);
$schema->save();
$schemaDef = $schema->filename();
}
if (!$this->definition->schemaValidate($schemaDef)) {
throw new SPException(SPLang::e('CANNOT_VALIDATE_SCHEMA_DEF_AT', str_replace(SOBI_ROOT . DS, null, $this->xmlFile), $def));
}
}
示例15: cachedView
public function cachedView($xml, $template, $cacheId, $config = array())
{
$this->_xml = $xml;
Sobi::Trigger('Start', ucfirst(__FUNCTION__), array(&$this->_xml));
$templatePackage = SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates');
$templateOverride = SPRequest::cmd('sptpl');
if ($templateOverride) {
if (strstr($templateOverride, '.')) {
$templateOverride = str_replace('.', '/', $templateOverride);
}
$template = $templateOverride . '.xsl';
}
if (file_exists(Sobi::FixPath($templatePackage . '/' . $template))) {
$template = Sobi::FixPath($templatePackage . '/' . $template);
} else {
$type = SPFactory::db()->select('oType', 'spdb_object', array('id' => SPRequest::sid()))->loadResult();
$template = $templatePackage . '/' . $type . '/' . $template;
}
SPFactory::registry()->set('current_template', $templatePackage);
$this->_templatePath = $templatePackage;
$this->_template = str_replace('.xsl', null, $template);
$ini = array();
if (count($config)) {
foreach ($config as $file) {
$file = parse_ini_file($file, true);
foreach ($file as $section => $keys) {
if (isset($ini[$section])) {
$ini[$section] = array_merge($ini[$section], $keys);
} else {
$ini[$section] = $keys;
}
}
}
}
$this->setConfig($ini, SPRequest::task('get'));
$this->parseXml();
$this->validateData($cacheId);
Sobi::Trigger('After', ucfirst(__FUNCTION__), array(&$this->_xml));
}