本文整理汇总了PHP中SPFactory::config方法的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory::config方法的具体用法?PHP SPFactory::config怎么用?PHP SPFactory::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPFactory
的用法示例。
在下文中一共展示了SPFactory::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBasicCfg
/**
* Gets basic data from the CMS (e.g Joomla) and stores in the #SPConfig instance
*/
public function getBasicCfg()
{
parent::getBasicCfg();
if (defined('SOBIPRO_ADM')) {
SPFactory::config()->change('adm_img_folder_live', Sobi::FixPath(JURI::root() . '/' . SOBI_ADM_FOLDER . '/templates/' . JFactory::getApplication()->getTemplate() . '/images/admin'), 'general');
}
}
示例2: save
public function save(&$attr)
{
parent::save($attr);
if ($attr['method'] == 'fixed') {
if (!$attr['fixedCid']) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
} else {
$cids = explode(',', $attr['fixedCid']);
if (count($cids)) {
foreach ($cids as $cid) {
$catId = (int) $cid;
if (!$catId) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
}
if ($catId == Sobi::Section()) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
} else {
$parents = SPFactory::config()->getParentPath($catId);
if (!isset($parents[0]) || $parents[0] != Sobi::Section()) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID_SECTION', $catId));
}
}
}
} else {
throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
}
}
}
}
示例3: __construct
public function __construct()
{
$cfg = SPFactory::config();
$this->setSender(array($cfg->get('mail.mailfrom'), $cfg->get('mail.fromname')));
switch ($cfg->get('mail.mailer')) {
case 'smtp':
$this->useSMTP((int) ($cfg->get('mail.smtpauth') != 0), $cfg->get('mail.smtphost'), $cfg->get('mail.smtpuser'), $cfg->get('mail.smtppass'), $cfg->get('mail.smtpsecure'), $cfg->get('mail.smtpport'));
break;
case 'sendmail':
$this->IsSendmail();
break;
default:
$this->IsMail();
break;
}
}
示例4: getInput
protected function getInput()
{
if (!self::$sid) {
self::$sid = isset($this->params->sid) ? $this->params->sid : $this->value;
$link = $this->form->getValue('link');
if (!self::$sid && strlen($link)) {
parse_str($link, $request);
if (isset($request['sid']) && $request['sid']) {
self::$sid = $request['sid'];
}
}
$path = SPFactory::config()->getParentPath(self::$sid);
self::$section = $path[0];
$this->getFunctionsLabel();
}
return $this->fieldname == 'sid' ? $this->loadSection() : $this->loadAdvanced();
}
示例5: toolTip
/**
* legacy function
* @deprecated
* @param string $tooltip
* @param string $title
* @param int $width
* @param string $image
* @param string $text
* @param string $href
* @param bool $link
* @param string $position
* @return string
*/
public static function toolTip($tooltip, $title = null, $image = null, $width = null, $text = null, $href = null, $target = '_blank')
{
$class = SPFactory::config()->key('html.tooltip_class', 'editlinktip hasTip');
while (strstr($text, "\\'")) {
$text = stripcslashes($text);
}
while (strstr($text, "\\'")) {
$text = stripcslashes($text);
}
while (strstr($title, "\\'")) {
$title = stripcslashes($title);
}
if (!$text || $image) {
$tip = "<img src=\"{$image}\" alt=\"{$title}\"/>";
$tip = "<span class=\"{$class}\" title=\"{$title}::{$tooltip}\">{$tip}</span>";
} else {
$tip = "<span class=\"{$class}\" title=\"{$title}::{$tooltip}\">{$text}</span>";
}
if ($href) {
$tip = "<a href=\"{$href}\" target=\"{$target}\">{$tip}</a>";
}
return $tip;
}
示例6: js
protected function js()
{
$lang = SPLang::jsLang();
if (count($lang)) {
foreach ($lang as $term => $text) {
unset($lang[$term]);
$term = str_replace('SP.JS_', null, $term);
$lang[$term] = $text;
}
}
if (!SPRequest::int('deb')) {
SPFactory::mainframe()->cleanBuffer();
header('Content-type: text/javascript');
}
echo 'SobiPro.setLang( ' . json_encode($lang) . ' );';
echo "\n";
exit('SobiPro.setIcons( ' . json_encode(SPFactory::config()->icons()) . ' );');
}
示例7: loadTable
/**
* Full init
*/
public function loadTable($cache = false)
{
if ($this->id && !$cache) {
$cats = $this->getCategories(true);
$this->section = Sobi::Section();
if (isset($cats[0])) {
$sid = SPFactory::config()->getParentPath($cats[0], false);
$this->section = isset($sid[0]) && $sid[0] ? $sid[0] : Sobi::Section();
}
// we need to get some information from the object table
$this->valid = $this->valid && count($this->categories) > 0;
$this->loadFields(Sobi::Section(), true);
Sobi::Trigger($this->name(), ucfirst(__FUNCTION__), array(&$this->fields));
if (count($this->fields)) {
foreach ($this->fields as $field) {
/* create field aliases */
$this->fieldsIds[$field->get('id')] = $field;
$this->fieldsNids[$field->get('nid')] = $field;
}
}
$this->primary =& $this->parent;
$this->url = Sobi::Url(array('title' => Sobi::Cfg('sef.alias', true) ? $this->get('nid') : $this->get('name'), 'pid' => $this->get('primary'), 'sid' => $this->id), false, true, true, true);
Sobi::Trigger($this->name(), ucfirst(__FUNCTION__), array(&$this->fieldsIds, &$this->fieldsNids));
}
if ($this->id) {
$counter = SPFactory::db()->select('counter', 'spdb_counter', array('sid' => $this->id))->loadResult();
if ($counter !== null) {
$this->counter = $counter;
}
}
if (!strlen($this->name)) {
$this->name = Sobi::Txt('ENTRY_NO_NAME');
}
if ($this->owner && $this->owner == Sobi::My('id')) {
$stop = true;
SPFactory::registry()->set('break_cache_view', $stop);
}
$this->translate();
// if the visitor can't see unapproved entries we are showing the approved version anyway
if (SPRequest::task() != 'entry.edit' && SPRequest::task() != 'entry.submit' && SPRequest::task() != 'entry.save' && !$this->approved && !Sobi::Can('entry', 'edit', '*', Sobi::Section())) {
$this->approved = 1;
}
}
示例8: browse
private function browse()
{
/** @var $view SPExtensionsView */
$view = SPFactory::View('extensions', true);
$def = SPFactory::Instance('types.array');
$list = null;
$apps = array();
if (SPFs::exists(SPLoader::path('etc.extensions', 'front', false, 'xml'))) {
$list = $def->fromXML(DOMDocument::load(SPLoader::path('etc.extensions', 'front', false, 'xml')), 'extensionslist');
}
if (!count($list)) {
SPFactory::message()->warning('EX.MSG_UPDATE_FIRST');
$status = array('label' => Sobi::Txt('EX.LAST_UPDATED', Sobi::Txt('UNKNOWN')), 'type' => SPC::ERROR_MSG);
$view->assign($status, 'last-update');
} else {
try {
$installed = SPFactory::db()->select('*', 'spdb_plugins')->loadAssocList();
} catch (SPException $x) {
}
$status = array('label' => Sobi::Txt('EX.LAST_UPDATED', SPFactory::config()->date($list['extensionslist']['created'])), 'type' => SPC::INFO_MSG);
$view->assign($status, 'last-update');
$list = $list['extensionslist']['extensions'];
if (count($list)) {
foreach ($list as $pid => $plugin) {
$plugin['installed'] = -1;
$plugin['action'] = array('text' => Sobi::Txt('EX.INSTALL_APP'), 'class' => 'install');
$eid = $pid;
if ($plugin['type'] == 'language') {
$eid = explode('-', $pid);
$eid[0] = strtolower($eid[0]);
$eid[1] = strtoupper($eid[1]);
$eid = implode('-', $eid);
}
if (count($installed)) {
foreach ($installed as $ex) {
if ($eid == $ex['pid'] || str_replace('_', '-', $ex['pid']) == $eid) {
$plugin['installed'] = -2;
$plugin['action'] = array('text' => Sobi::Txt('EX.REINSTALL_APP'), 'class' => 'reinstall');
if (version_compare($plugin['version'], $ex['version'], '>')) {
$plugin['installed'] = -3;
$plugin['action'] = array('text' => Sobi::Txt('EX.UPDATE_APP'), 'class' => 'update');
}
}
}
}
if ($plugin['type'] == 'update') {
$compare = version_compare($plugin['version'], implode('.', SPFactory::CmsHelper()->myVersion()));
if ($compare <= 0) {
$plugin['installed'] = -1;
$eid = $eid . '.disabled';
$plugin['action'] = array('text' => Sobi::Txt('EX.APP_UPDATE_DISABLED'), 'class' => 'disabled');
} else {
$plugin['installed'] = -3;
$plugin['action'] = array('text' => Sobi::Txt('EX.UPDATE_CORE'), 'class' => 'update');
}
}
$plugin['pid'] = $eid;
$plugin['eid'] = $plugin['repository'] . '.' . $plugin['type'] . '.' . $plugin['pid'];
$list[$eid] = $plugin;
$index = in_array($plugin['type'], array('application', 'field', 'update', 'template', 'language')) ? $plugin['type'] . 's' : 'others';
$apps[$index][] = $plugin;
}
if (isset($apps['updates'])) {
usort($apps['updates'], function ($from, $to) {
return version_compare($to['version'], $from['version']) > 0;
});
}
}
}
$repos = array();
$dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('etc.repos'));
$xml = array_keys($dir->searchFile('repository.xml', false, 2));
foreach ($xml as $def) {
$repository = SPFactory::Instance('services.installers.repository');
$repository->loadDefinition($def);
$repos[] = $repository->getDef();
}
$view->assign($this->_task, 'task')->assign($this->menu(), 'menu')->assign($apps, 'extensions')->assign($repos, 'repositories')->assign($list, 'full-list')->determineTemplate('extensions', $this->_task);
Sobi::Trigger($this->_task, $this->name(), array(&$view));
$view->display();
Sobi::Trigger('After' . ucfirst($this->_task), $this->name(), array(&$view));
}
示例9: CssFile
/**
* @author Radek Suski
* @version 1.0
* @param string $path
* @param bool $adm
* @param bool $checkExist
* @param bool $toLive
* @param string $ext
* @param bool $count
* @internal param string $root
* @internal param bool $existCheck
* @return string
*/
public static function CssFile($path, $adm = false, $checkExist = true, $toLive = true, $ext = 'css', $count = false)
{
if (strstr($path, 'root.')) {
$file = self::translatePath(str_replace('root.', null, $path), 'root', $checkExist, $ext, $count);
} elseif (strstr($path, 'front.')) {
$file = self::translatePath(str_replace('front.', null, $path), 'front', $checkExist, $ext, $count);
} elseif (strstr($path, 'absolute.')) {
$file = self::translatePath(str_replace('absolute.', null, $path), 'absolute', $checkExist, $ext, $count);
} else {
$root = $adm ? 'adm.' : null;
$file = self::translatePath($root . $path, 'css', $checkExist, $ext, $count);
}
if ($toLive) {
$file = str_replace(SOBI_ROOT, SPFactory::config()->get('live_site'), $file);
$file = str_replace('\\', '/', $file);
}
return Sobi::FixPath($file);
}
示例10: getItemid
/**
* @param $url
* @return bool
*/
protected function getItemid(&$url)
{
$sid = isset($url['pid']) && $url['pid'] ? $url['pid'] : $url['sid'];
if (!(int) $sid) {
return false;
}
$url['Itemid'] = 0;
// Thu, Feb 27, 2014 16:28:22 - iy is probably the right solution
// but NTaRS
$menu = JFactory::getApplication('site')->getMenu('site');
// Thu, Mar 6, 2014 12:42:01 - let's check
// $menu = JApplication::getMenu( 'site' );
if (isset($url['task'])) {
$task = $url['task'] == 'search.results' ? 'search' : $url['task'];
$link = 'index.php?option=com_sobipro&task=' . $task . '&sid=' . $sid;
} else {
$link = 'index.php?option=com_sobipro&sid=' . $sid;
}
$item = $menu->getItems('link', $link, true);
if ($item && count($item)) {
$url['Itemid'] = $item->id;
} else {
$path = SPFactory::config()->getParentPath($sid);
if (count($path)) {
foreach ($path as $sid) {
$item = $menu->getItems('link', 'index.php?option=com_sobipro&sid=' . $sid, true);
if ($item && count($item)) {
$url['Itemid'] = $item->id;
}
}
}
}
// if we still don't have an Itemid it means that there is no link to SobiPro section
if (!$url['Itemid'] && !defined('SOBIPRO_ADM')) {
SPFactory::message()->warning(Sobi::Txt('ITEMID_MISSING_WARN', 'https://www.sigsiu.net/help_screen/joomla.menu', $sid), false, false)->setSystemMessage('SEF-URL');
}
}
示例11: cloneTpl
private function cloneTpl()
{
$dir = $this->dir(SPRequest::cmd('templateName'));
$newName = SPRequest::word('templateNewName', 'Duplicated Template', 'post');
$dirName = SPLang::nid($newName);
$dirNameOrg = $dirName;
$c = 1;
while (SPFs::exists(SPLoader::dirPath('usr.templates.' . $dirName, 'front', false))) {
$dirName = $dirNameOrg . '-' . $c++;
}
$newPath = SPLoader::dirPath('usr.templates.' . $dirName, 'front', false);
if (!SPFs::copy($dir, $newPath)) {
throw new SPException(SPLang::e('COULD_NOT_COPY_DIRECTORY', $dir, $newPath));
}
$defFile = SPLoader::path($newPath . '.template', 'absolute', true, 'xml');
if ($defFile) {
$fc = SPLoader::loadClass('base.fs.file');
$def = new DOMDocument();
$def->load($defFile);
$xdef = new DOMXPath($def);
$oldName = $xdef->query('/template/name')->item(0)->nodeValue;
$oldDesc = $xdef->query('/template/description')->item(0)->nodeValue;
$date = SPFactory::config()->date(time());
$xdef->query('/template/name')->item(0)->nodeValue = $newName;
$xdef->query('/template/creationDate')->item(0)->nodeValue = $date;
$xdef->query('/template/id')->item(0)->nodeValue = $dirName;
$newDesc = Sobi::Txt('TP.CLONE_NOTE', array('name' => $oldName, 'date' => $date));
$xdef->query('/template/description')->item(0)->nodeValue = "{$newDesc}\n{$oldDesc}";
$file = new $fc($defFile);
$file->content($def->saveXML());
$file->save();
}
$this->response(Sobi::Url(array('task' => 'template.info', 'template' => str_replace(SOBI_PATH . DS . 'usr' . DS . 'templates' . DS, null, $dirName))), Sobi::Txt('TP.DUPLICATED'), false, 'success');
}
示例12: dateGetter
/**
* @param $name - field name
* @param $value - field value
* @param null $class
* @param string $dateFormat - date format in PHP
* @param null $params - additional parameters
* @internal param string $icon - field icon
* @return string
*/
public static function dateGetter($name, $value, $class = null, $dateFormat = 'Y-m-d H:i:s', $params = null)
{
self::createLangFile();
$value = strtotime($value);
$valueDisplay = $value ? SPFactory::config()->date($value, null, $dateFormat) : null;
$params = self::checkArray($params);
if (!isset($params['id'])) {
$params['id'] = SPLang::nid($name);
}
if ($class) {
$params['class'] = $class;
}
$params = self::params($params);
$f = "\n";
$f .= '<div class="spOutput">';
$f .= "\n\t";
$f .= '<span ' . $params . '>' . $valueDisplay . '</span>';
$f .= "\n";
$f .= '</div>';
$f .= "\n";
Sobi::Trigger('Field', ucfirst(__FUNCTION__), array(&$f));
return "\n<!-- Date Getter '{$name}' Output -->{$f}<!-- Date Getter '{$name}' End -->\n\n";
}
示例13: array
?>
</td>
</tr>
<tr class="row<?php
echo ++$row % 2;
?>
">
<td class="key">
<?php
$this->txt('FM.CSS_CLASS');
?>
</td>
<td>
<?php
$params = array('id' => 'field_css', 'size' => 15, 'maxlength' => 50, 'class' => 'inputbox', 'style' => 'text-align:center;');
if ($this->get('field.id') == SPFactory::config()->nameField()->get('id')) {
$params['readonly'] = 'readonly';
}
$this->field('text', 'field.cssClass', 'value:field.cssClass', $params);
?>
</td>
</tr>
<tr class="row<?php
echo ++$row % 2;
?>
">
<td class="key">
<?php
$this->txt('FM.ADM_FIELD');
?>
</td>
示例14: createConfig
/**
* initialise config object
* @return void
*/
private function createConfig()
{
$this->_config =& SPFactory::config();
/* load basic configuration settings */
$this->_config->addIniFile('etc.config', true);
$this->_config->addIniFile('etc.adm.config', true);
$this->_config->addTable('spdb_config', $this->_section);
/* initialise interface config setting */
$this->_mainframe->getBasicCfg();
/* initialise config */
$this->_config->init();
}
示例15: datetime
/**
* Returns ip value of requested variable
*
* @param string $name variable name
* @param string $default default value
* @param string $method request method
* @return string
*/
public static function datetime($name, $default = null, $method = 'REQUEST')
{
$config =& SPFactory::config();
$config->addIniFile('etc.calendar');
self::$val = self::string($name, $default, false, $method);
if (self::$val) {
self::$val = SPFactory::config()->rdate(self::$val);
self::$val = date('Y-m-d H:i:s', self::$val);
} else {
self::$val = SPFactory::db()->getNullDate();
}
return self::$val;
}