本文整理汇总了PHP中SPLoader::loadIniFile方法的典型用法代码示例。如果您正苦于以下问题:PHP SPLoader::loadIniFile方法的具体用法?PHP SPLoader::loadIniFile怎么用?PHP SPLoader::loadIniFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPLoader
的用法示例。
在下文中一共展示了SPLoader::loadIniFile方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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'));
}
示例3: mimeFromExt
/**
*
*/
private function mimeFromExt()
{
$ext = SPFs::getExt($this->_path);
if (!count(self::$_exts)) {
self::$_exts = SPLoader::loadIniFile('etc.mime', false);
}
if (!isset(self::$_exts[$ext])) {
Sobi::Error('FileInfo', SPLang::e('Cannot determine the right file type from extension'), SPC::WARNING, 0);
} else {
$this->_mime = self::$_exts[$ext];
}
}
示例4: _jsLang
protected function _jsLang($adm)
{
$front = array();
if ($adm) {
$front = $this->_jsLang(false);
}
$path = $adm ? implode(DS, array(JPATH_ADMINISTRATOR, 'language', 'en-GB', 'en-GB.com_sobipro.js')) : implode(DS, array(SOBI_ROOT, 'language', 'en-GB', 'en-GB.com_sobipro.js'));
if ($this->_lang != 'en-GB' && Sobi::Cfg('lang.engb_preload', true)) {
$strings = SPLoader::loadIniFile(str_replace('en-GB', str_replace('_', '-', $this->_lang), $path), false, false, true, true, true);
$def = SPLoader::loadIniFile($path, false, false, true, true, true);
if (is_array($strings) && count($strings)) {
$def = array_merge($front, $def, $strings);
}
} else {
$def = SPLoader::loadIniFile(str_replace('en-GB', str_replace('_', '-', $this->_lang), $path), false, false, true, true, true);
}
return $def;
}
示例5: array
protected function &createMenu($task = null)
{
if (!$task) {
$task = 'config.' . $this->_task;
}
/* load the menu definition */
if (Sobi::Section()) {
/* create menu */
$menu =& SPFactory::Instance('views.adm.menu', $task, Sobi::Section());
$cfg = SPLoader::loadIniFile('etc.adm.section_menu');
/* create new SigsiuTree */
$tree = SPFactory::Instance('mlo.tree');
/* set link */
$tree->setHref(Sobi::Url(array('sid' => '{sid}')));
$tree->setId('menuTree');
/* set the task to expand the tree */
$tree->setTask('category.expand');
$tree->init(Sobi::Section());
/* add the tree into the menu */
$menu->addCustom('AMN.ENT_CAT', $tree->getTree());
$seClass = SPLoader::loadModel('section');
$cSec = new $seClass();
$cSec->init(Sobi::Section());
} else {
$cfg = SPLoader::loadIniFile('etc.adm.config_menu');
/* create menu */
$menu =& SPFactory::Instance('views.adm.menu', $task);
}
Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
if (count($cfg)) {
foreach ($cfg as $section => $keys) {
$menu->addSection($section, $keys);
}
}
if (!Sobi::Section()) {
$menu->addCustom('GB.CFG.GLOBAL_TEMPLATES', $this->listTemplates());
}
Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
return $menu;
}
示例6: view
/**
*/
protected function view($allEntries, $term = null)
{
if ($allEntries) {
SPRequest::set('task', 'section.entries');
} else {
SPRequest::set('task', 'section.view');
}
/* @var SPdb $db */
$db = SPFactory::db();
$c = array();
$e = array();
if (!Sobi::Section()) {
Sobi::Error('Section', SPLang::e('Missing section identifier'), SPC::ERROR, 500, __LINE__, __FILE__);
}
$this->_model->init(Sobi::Section());
/* get the lists ordering and limits */
$eLimit = Sobi::GetUserState('entries.limit', 'elimit', Sobi::Cfg('admin.entries-limit', 25));
$cLimit = Sobi::GetUserState('categories.limit', 'climit', Sobi::Cfg('admin.categories-limit', 15));
$eLimStart = SPRequest::int('eSite', 0);
$cLimStart = SPRequest::int('cSite', 0);
/* get child categories and entries */
/* @todo: need better method - the query can be very large with lot of entries */
if (!$allEntries) {
$e = $this->_model->getChilds();
$c = $this->_model->getChilds('category');
} elseif (!($term && $allEntries)) {
$c = $this->_model->getChilds('category', true);
$c[] = Sobi::Section();
if (count($c)) {
try {
$e1 = $db->dselect('id', 'spdb_relations', array('pid' => $c, 'oType' => 'entry'))->loadResultArray();
$e2 = $db->dselect('sid', 'spdb_field_data', array('section' => Sobi::Section(), 'fid' => Sobi::Cfg('entry.name_field')))->loadResultArray();
$e = array_merge($e1, $e2);
$e = array_unique($e);
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
}
} else {
try {
$e = $db->dselect('sid', 'spdb_field_data', array('section' => Sobi::Section(), 'fid' => Sobi::Cfg('entry.name_field'), 'baseData' => "%{$term}%"))->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
}
// just in case the given site is grater than all existing sites
$cCount = count($c);
$cPages = ceil($cCount / $cLimit);
if ($cLimStart > $cPages) {
$cLimStart = $cPages;
SPRequest::set('cSite', $cPages);
}
$eCount = count($e);
$ePages = ceil($eCount / $eLimit);
if ($eLimStart > $ePages) {
$eLimStart = $ePages;
SPRequest::set('eSite', $ePages);
}
$entries = array();
$categories = array();
/* if there are entries in the root */
if (count($e)) {
try {
$Limit = $eLimit > 0 ? $eLimit : 0;
$LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
$eOrder = $this->parseOrdering('entries', 'eorder', 'position.asc', $Limit, $LimStart, $e);
$results = $db->select('id', 'spdb_object', array('id' => $e, 'oType' => 'entry'), $eOrder, $Limit, $LimStart)->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
foreach ($results as $i => $entry) {
$entries[$i] = $entry;
}
}
/* if there are categories in the root */
if (count($c)) {
try {
$LimStart = $cLimStart ? ($cLimStart - 1) * $cLimit : $cLimStart;
$Limit = $cLimit > 0 ? $cLimit : 0;
$cOrder = $this->parseOrdering('categories', 'corder', 'order.asc', $Limit, $LimStart, $c);
$results = $db->select('id', 'spdb_object', array('id' => $c, 'oType' => 'category'), $cOrder, $Limit, $LimStart)->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
foreach ($results as $i => $category) {
$categories[$i] = SPFactory::Category($category);
}
}
/* create menu */
$mClass = SPLoader::loadClass('views.adm.menu');
$menu = new $mClass('section.' . $this->_task, Sobi::Section());
/* load the menu definition */
$cfg = SPLoader::loadIniFile('etc.adm.section_menu');
Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
if (count($cfg)) {
foreach ($cfg as $section => $keys) {
$menu->addSection($section, $keys);
}
//.........这里部分代码省略.........
示例7: menu
private function menu()
{
/* create menu */
$menu = SPFactory::Instance('views.adm.menu', 'extensions.' . $this->_task);
$cfg = SPLoader::loadIniFile('etc.adm.config_menu');
Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
if (count($cfg)) {
foreach ($cfg as $section => $keys) {
$menu->addSection($section, $keys);
}
}
$menu->addCustom('GB.CFG.GLOBAL_TEMPLATES', $this->listTemplates());
Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
return $menu;
}
示例8: display
/**
* @param string $out - output type
* @param array $functions - array with PHP function to register
* @throws SPException
* @return mixed|string
*/
public function display($out = 'html', $functions = array())
{
$class = SPLoader::loadClass('helpers.template');
$methods = get_class_methods($class);
if (count($methods)) {
foreach ($methods as $method) {
$functions[] = $class . '::' . $method;
}
}
/* standard function registered via the core ini file */
$stdFunctions = SPLoader::loadIniFile('etc.template_functions');
if (count($stdFunctions)) {
foreach ($stdFunctions as $class => $fns) {
if (strstr($class, '.')) {
$class = SPLoader::loadClass($class, false, 'sp-root');
}
if (count($fns)) {
foreach ($fns as $method => $state) {
if ($state) {
$functions[] = $class == 'functions' ? $method : $class . '::' . $method;
}
}
}
}
}
Sobi::Trigger('TemplateEngine', 'RegisterFunctions', array(&$functions));
$this->createXML();
if (SPRequest::cmd('xml') && Sobi::Cfg('debug.xml_raw', false) && (!Sobi::Cfg('debug.xml_ip', null) || Sobi::Cfg('debug.xml_ip') == SPRequest::ip('REMOTE_ADDR', 0, 'SERVER'))) {
SPFactory::mainframe()->cleanBuffer();
echo $this->_xml->saveXML();
exit;
} elseif (SPRequest::cmd('xml')) {
Sobi::Error('Debug', 'You have no permission to access this site', SPC::ERROR, 403, __LINE__, __FILE__);
}
$template = SPLoader::loadTemplate($this->_tpl, 'xsl');
if (!$template) {
$template = SPLoader::loadTemplate($this->_tpl, 'xslt');
}
if (Sobi::Cfg('cache.xml_enabled')) {
SPFactory::cache()->addView($this->_xml, $template, $this->_cacheData);
}
if ($template) {
try {
if (!($style = DOMDocument::load($template))) {
Sobi::Error('template', SPLang::e('CANNOT_PARSE_TEMPLATE_FILE', $template), SPC::ERROR, 500, __LINE__, __FILE__);
}
} catch (DOMException $x) {
Sobi::Error('template', SPLang::e('CANNOT_LOAD_TEMPLATE_FILE', $template, $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
Sobi::Trigger('TemplateEngine', 'LoadStyle', array(&$style));
$processor = new XSLTProcessor();
$processor->setParameter('block', 'xmlns', 'http://www.w3.org/1999/xhtml');
$processor->registerPHPFunctions($functions);
SPException::catchErrors(SPC::WARNING);
try {
$processor->importStylesheet($style);
} catch (SPException $x) {
Sobi::Error('template', SPLang::e('CANNOT_PARSE_TEMPLATE_FILE', $template) . $x->getMessage(), SPC::ERROR, 500, __LINE__, __FILE__);
}
SPException::catchErrors(0);
if ($out == 'html') {
$doc = $processor->transformToDoc($this->_xml);
$doc->formatOutput = true;
return $this->cleanOut($doc->saveXML());
} else {
$doc = $processor->transformToDoc($this->_xml);
$doc->formatOutput = true;
return $doc->saveXML();
}
} else {
throw new SPException(SPLang::e('CANNOT_LOAD_TEMPLATE_FILE_AT', SPLoader::loadTemplate($this->_tpl, 'xsl', false)));
}
}
示例9: loadConfig
/**
* @param string $path
* @deprecated since 1.1
*/
public function loadConfig($path)
{
SPFactory::header()->addCssFile('adm.legacy')->addJsFile(array('adm.legacy', 'menu'));
$this->_legacy = true;
if (strlen($path)) {
$this->_config = SPLoader::loadIniFile($path, true, true, true);
}
Sobi::Trigger('beforeLoadConfig', $this->name(), array(&$this->_config));
if (isset($this->_config['css_files'])) {
foreach ($this->_config['css_files'] as $file) {
$this->loadCSSFile($file);
}
unset($this->_config['css_files']);
}
if (isset($this->_config['js_files'])) {
foreach ($this->_config['js_files'] as $file) {
$this->loadJsFile($file);
}
unset($this->_config['js_files']);
}
if ($this->key('site_title')) {
$this->setTitle($this->key('site_title'));
}
if (isset($this->_config['toolbar'])) {
/* in case we are adding new entry/category/field we have to remove the 'duplicate' button
and the separators after and before*/
if ($this->get('task') == 'add' || $this->get('task') == 'new') {
$previous = null;
$next = false;
foreach ($this->_config['toolbar'] as $key => $value) {
$previous = $key;
if ($key == 'duplicate') {
if ($next && isset($this->_config['toolbar'][$key])) {
unset($this->_config['toolbar'][$key]);
break;
}
unset($this->_config['toolbar']['duplicate']);
if ($previous && isset($this->_config['toolbar'][$previous])) {
unset($this->_config['toolbar'][$previous]);
}
$next = true;
}
}
}
$menu = array();
foreach ($this->_config['toolbar'] as $type => $settings) {
$type = preg_replace('/\\_{1}[a-zA-Z0-9]$/', null, $type);
$cfg = $this->parseMenu(explode('|', $settings));
$menu[] = array('type' => $type, 'settings' => $cfg);
}
$this->legacyToolbar($menu);
unset($this->_config['toolbar']);
}
if (!isset($this->_config['submenu'])) {
$this->_config['submenu'] = SPLoader::loadIniFile('etc.adm.submenu', false);
}
if (isset($this->_config['submenu'])) {
//// SPLoader::loadClass( 'cms.html.admin_menu' );
// foreach ( $this->_config[ 'submenu' ] as $type => $settings ) {
//// $type = preg_replace( '/\_{1}[a-zA-Z0-9]$/', null, $type );
// $cfg = $this->parseMenu( explode( '|', $settings ) );
// call_user_func_array( array( 'SPAdmMenu', 'addSubMenuEntry' ), $cfg );
// }
unset($this->_config['submenu']);
}
if (isset($this->_config['hidden'])) {
foreach ($this->_config['hidden'] as $name => $defValue) {
$this->addHidden(SPRequest::string($name, $defValue), $name);
}
}
Sobi::Trigger('afterLoadConfig', $this->name(), array(&$this->_config));
}
示例10: addIniFile
/**
* getting config values from ini file
*
* @param string $path
* @param bool $sections
* @param string $defSection
* @return bool
*/
public function addIniFile($path, $sections = true, $adm = false, $defSection = 'general')
{
if (!($arr = SPLoader::loadIniFile($path, $sections, $adm))) {
Sobi::Error('config', sprintf('CANNOT_PARSE_INI_FILE', $path), SPC::WARNING, 0, __LINE__, __CLASS__);
return false;
}
if (is_array($arr) && !empty($arr)) {
if ($sections) {
foreach ($arr as $section => $values) {
if (!isset($this->_store[$section])) {
$this->_store[$section] = array();
}
$currSec =& $this->_store[$section];
if (!empty($values)) {
foreach ($values as $k => $v) {
$_c = explode('_', $k);
if ($_c[count($_c) - 1] == 'array') {
$v = explode('|', $v);
}
$currSec[$k] = $this->structuralData($v);
}
}
}
} else {
$currSec =& $this->_store[$defSection];
foreach ($arr as $k => $v) {
$currSec[$k] = $v;
}
}
return true;
} else {
Sobi::Error('config', SPLang::e('EMPTY_INIFILE', $path), SPC::WARNING, 0, __LINE__, __CLASS__);
return false;
}
}
示例11: listFields
/**
* List all fields in this section
*/
private function listFields()
{
/* @var SPdb $db */
$ord = $this->parseOrdering('forder', 'position.asc');
SPLoader::loadClass('html.input');
Sobi::ReturnPoint();
/* create menu */
$sid = Sobi::Reg('current_section');
$menu = SPFactory::Instance('views.adm.menu', 'field.list', $sid);
$cfg = SPLoader::loadIniFile('etc.adm.section_menu');
Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
if (count($cfg)) {
foreach ($cfg as $section => $keys) {
$menu->addSection($section, $keys);
}
}
Sobi::Trigger('AfterCreate', 'AdmMenu', array(&$menu));
/* create new SigsiuTree */
$tree = SPLoader::loadClass('mlo.tree');
$tree = new $tree(Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
/* set link */
$tree->setHref(Sobi::Url(array('sid' => '{sid}')));
$tree->setId('menuTree');
/* set the task to expand the tree */
$tree->setTask('category.expand');
$tree->init($sid);
/* add the tree into the menu */
$menu->addCustom('AMN.ENT_CAT', $tree->getTree());
try {
$results = SPFactory::db()->select('*', 'spdb_field', array('section' => $sid), $ord)->loadObjectList();
} catch (SPException $x) {
// SPConfig::debOut(SPFactory::db()->getQuery());
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
$fields = array();
if (count($results)) {
foreach ($results as $result) {
$field = SPFactory::Model('field', true);
$field->extend($result);
$fields[] = $field;
}
}
$fieldTypes = $this->getFieldTypes();
$subMenu = array();
foreach ($fieldTypes as $type => $group) {
asort($group);
$subMenu[] = array('label' => $type, 'element' => 'nav-header');
foreach ($group as $t => $l) {
$subMenu[] = array('type' => null, 'task' => 'field.add.' . $t, 'label' => $l, 'icon' => 'tasks', 'element' => 'button');
}
}
SPFactory::View('field', true)->addHidden($sid, 'sid')->assign($fields, 'fields')->assign($subMenu, 'fieldTypes')->assign(Sobi::Section(true), 'section')->assign($menu, 'menu')->assign(Sobi::GetUserState('fields.order', 'forder', 'position.asc'), 'ordering')->assign($this->_task, 'task')->determineTemplate('field', 'list')->display();
}
示例12: view
/**
*/
protected function view()
{
/* @var SPdb $db */
$db = SPFactory::db();
SPRequest::set('task', 'category.view');
/* get the lists ordering and limits */
$eLimit = Sobi::GetUserState('entries.limit', 'elimit', Sobi::Cfg('admin.entries-limit', 25));
$cLimit = Sobi::GetUserState('categories.limit', 'climit', Sobi::Cfg('admin.categories-limit', 15));
$eLimStart = SPRequest::int('eSite', 0);
$cLimStart = SPRequest::int('cSite', 0);
/* get child categories and entries */
$e = $this->_model->getChilds();
$c = $this->_model->getChilds('category');
// just in case the given site is grater than all existing sites
$cCount = count($c);
$cPages = ceil($cCount / $cLimit);
if ($cLimStart > $cPages) {
$cLimStart = $cPages;
SPRequest::set('cSite', $cPages);
}
$eCount = count($e);
$ePages = ceil($eCount / $eLimit);
if ($eLimStart > $ePages) {
$eLimStart = $ePages;
SPRequest::set('eSite', $ePages);
}
$entries = array();
$categories = array();
SPLoader::loadClass('models.dbobject');
/* if there are categories in the root */
if (count($c)) {
try {
$LimStart = $cLimStart ? ($cLimStart - 1) * $cLimit : $cLimStart;
$Limit = $cLimit > 0 ? $cLimit : 0;
$cOrder = $this->parseOrdering('categories', 'corder', 'position.asc', $Limit, $LimStart, $c);
$db->select('*', 'spdb_object', array('id' => $c, 'oType' => 'category'), $cOrder, $Limit, $LimStart);
$results = $db->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
foreach ($results as $i => $category) {
$categories[$i] = SPFactory::Category($category);
// new $cClass();
//$categories[ $i ]->extend( $category );
}
}
/* if there are entries in the root */
if (count($e)) {
try {
$LimStart = $eLimStart ? ($eLimStart - 1) * $eLimit : $eLimStart;
$Limit = $eLimit > 0 ? $eLimit : 0;
$eOrder = $this->parseOrdering('entries', 'eorder', 'position.asc', $Limit, $LimStart, $e);
$entries = $db->select('*', 'spdb_object', array('id' => $e, 'oType' => 'entry'), $eOrder, $Limit, $LimStart)->loadResultArray();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
}
$entriesName = SPFactory::config()->nameField()->get('name');
$entriesField = SPFactory::config()->nameField()->get('nid');
/* create menu */
SPLoader::loadClass('views.adm.menu');
$menu = new SPAdmSiteMenu('section.' . $this->_task, SPRequest::sid());
/* load the menu definition */
$cfg = SPLoader::loadIniFile('etc.adm.section_menu');
Sobi::Trigger('Create', 'AdmMenu', array(&$cfg));
if (count($cfg)) {
foreach ($cfg as $section => $keys) {
$menu->addSection($section, $keys);
}
}
/* create new SigsiuTree */
$tree = SPLoader::loadClass('mlo.tree');
$tree = new $tree(Sobi::GetUserState('categories.order', 'corder', 'position.asc'));
/* set link */
$tree->setHref(Sobi::Url(array('sid' => '{sid}')));
$tree->setId('menuTree');
/* set the task to expand the tree */
$tree->setTask('category.expand');
$tree->init(Sobi::Reg('current_section'), SPRequest::sid());
/* add the tree into the menu */
$menu->addCustom('AMN.ENT_CAT', $tree->getTree());
/* get view class */
$view = SPFactory::View('category', true);
$view->assign($eLimit, '$eLimit')->assign($eLimit, 'entries-limit')->assign($cLimit, 'categories-limit')->assign(SPRequest::int('eSite', 1), 'entries-site')->assign(SPRequest::int('cSite', 1), 'categories-site')->assign($cCount, 'categories-count')->assign($eCount, 'entries-count')->assign($this->_task, 'task')->assign($this->_model, 'category')->assign($categories, 'categories')->assign($entries, 'entries')->assign($this->customCols(), 'fields')->assign($entriesName, 'entries_name')->assign($entriesField, 'entries_field')->assign($menu, 'menu')->assign(Sobi::GetUserState('entries.eorder', 'eorder', 'position.asc'), 'eorder')->assign(Sobi::GetUserState('categories.corder', 'corder', 'position.asc'), 'corder')->assign($this->_model->get('name'), 'category_name')->addHidden(Sobi::Section(), 'pid')->addHidden(SPRequest::sid(), 'sid');
Sobi::Trigger('Category', 'View', array(&$view));
$view->display();
}
示例13: tplCfg
/**
*/
protected function tplCfg($path, $task = null)
{
$file = explode('.', $path);
$files = array();
if (strstr($file[0], 'cms:')) {
$file[0] = str_replace('cms:', null, $file[0]);
$file = SPFactory::mainframe()->path(implode('.', $file));
$path = SPLoader::dirPath($file, 'root', true);
$this->_tCfg = SPLoader::loadIniFile("{$path}.config", true, false, false, true);
$files[] = SPLoader::iniStorage();
} else {
$this->_tCfg = SPLoader::loadIniFile("usr.templates.{$path}.config");
$files[] = SPLoader::iniStorage();
$path = SPLoader::dirPath('usr.templates.' . $path, 'front', true);
}
if (!$task) {
$task = $this->_task == 'add' || $this->_task == 'submit' ? 'edit' : $this->template;
}
if (SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'ini')) {
$taskCfg = SPLoader::loadIniFile("{$path}.{$this->templateType}.{$task}", true, false, false, true);
$files[] = SPLoader::iniStorage();
foreach ($taskCfg as $section => $keys) {
if (isset($this->_tCfg[$section])) {
$this->_tCfg[$section] = array_merge($this->_tCfg[$section], $keys);
} else {
$this->_tCfg[$section] = $keys;
}
}
}
if (count($files)) {
foreach ($files as $i => $file) {
$files[$i] = array('file' => str_replace(SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates'), null, $file), 'checksum' => md5_file($file));
}
SPFactory::registry()->set('template_config', $files);
}
if (SPLoader::translatePath("{$path}.config", 'absolute', true, 'json')) {
$config = json_decode(SPFs::read(SPLoader::translatePath("{$path}.config", 'absolute', true, 'json')), true);
$settings = array();
foreach ($config as $section => $setting) {
$settings[str_replace('-', '.', $section)] = $setting;
}
if (SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'json')) {
$subConfig = json_decode(SPFs::read(SPLoader::translatePath("{$path}.{$this->templateType}.{$task}", 'absolute', true, 'json')), true);
if (count($subConfig)) {
foreach ($subConfig as $section => $subSettings) {
foreach ($subSettings as $k => $v) {
$settings[str_replace('-', '.', $section)][$k] = $v;
}
}
}
}
if (isset($settings['general'])) {
foreach ($settings['general'] as $k => $v) {
$this->_tCfg['general'][$k] = $v;
}
}
$task = SPRequest::task() == 'entry.add' ? 'entry.edit' : SPRequest::task();
if (isset($settings[$task])) {
foreach ($settings[$task] as $k => $v) {
$this->_tCfg['general'][$k] = $v;
}
}
}
Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_tCfg));
SPFactory::registry()->set('current_template', $path);
}