本文整理汇总了PHP中SPLang类的典型用法代码示例。如果您正苦于以下问题:PHP SPLang类的具体用法?PHP SPLang怎么用?PHP SPLang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SPLang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
}
}
}
示例2: execute
/**
*/
public function execute()
{
$r = false;
switch ($this->_task) {
case 'chooser':
case 'expand':
SPLoader::loadClass('html.input');
$r = true;
$this->chooser($this->_task == 'expand');
break;
case 'parents':
$r = true;
$this->parents();
break;
case 'icon':
$r = true;
$this->iconChooser();
break;
default:
/* 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__);
} else {
$r = true;
}
break;
}
return $r;
}
示例3: save
public function save(&$attr)
{
if (($attr['resize'] || $attr['crop']) && !($attr['resizeWidth'] && $attr['resizeHeight'])) {
throw new SPException(SPLang::e('IMG_FIELD_RESIZE_NO_SIZE'));
}
parent::save($attr);
}
示例4: 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)));
}
}
示例5: screen
private function screen()
{
$bankData = SPLang::getValue('bankdata', 'application', Sobi::Section());
if (!strlen($bankData)) {
SPLang::getValue('bankdata', 'application');
}
$tile = Sobi::Txt('APP.BANK_TRANSFER_NAME');
$this->getView('bank_transfer')->assign($tile, 'title')->assign($bankData, 'bankdata')->determineTemplate('extensions', 'bank-transfer')->display();
}
示例6: 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;
}
示例7: save
public function save(&$attr)
{
$data = array('key' => $this->nid . '-viewInfo', 'value' => $attr['viewInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$data = array('key' => $this->nid . '-entryInfo', 'value' => $attr['entryInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$attr['required'] = 0;
$attr['fee'] = 0;
$attr['isFree'] = 1;
parent::save($attr);
}
示例8: search
protected function search()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
// $selected = SPRequest::int( 'selected', 0 );
$ssid = SPRequest::base64('ssid');
$query = SPRequest::string('q', null);
$session = SPFactory::user()->getUserState('userSelector', null, array());
$setting = $session[$ssid];
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLim = Sobi::Cfg('user_selector.entries_limit', 18);
$eLimStart = ($site - 1) * $eLim;
$params = array();
if ($query) {
$q = '%' . $query . '%';
$params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
}
try {
$count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
$data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
} catch (SPException $x) {
echo $x->getMessage();
exit;
}
$response = array('sites' => ceil($count / $eLim), 'site' => $site);
if (count($data)) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $setting['format'], $replacements);
$placeholders = array();
if (isset($replacements[0]) && count($replacements[0])) {
foreach ($replacements[0] as $placeholder) {
$placeholders[] = str_replace('%', null, $placeholder);
}
}
if (count($replacements)) {
foreach ($data as $index => $user) {
$txt = $setting['format'];
foreach ($placeholders as $attribute) {
if (isset($user[$attribute])) {
$txt = str_replace('%' . $attribute, $user[$attribute], $txt);
}
}
$data[$index]['text'] = $txt;
}
}
$response['users'] = $data;
}
SPFactory::mainframe()->cleanBuffer();
echo json_encode($response);
exit;
}
示例9: display
/**
* @return string
*/
public function display()
{
$this->_view[] = "\n <!-- Sobi Pro - admin side menu start -->";
$this->_view[] = "\n<div id=\"SPaccordionTabs\" class=\"SPmenuTabs\">";
$this->_view[] = '<div id="SPMenuCtrl">';
$this->_view[] = ' <button class="btn btn-mini btn-sobipro" id="SPMenuCtrlBt" type="button">-</button>';
$this->_view[] = '</div>';
$media = Sobi::Cfg('img_folder_live');
$this->_view[] = "\n<div class='well well-small'><a href=\"http://www.Sigsiu.NET\" target=\"_blank\" title=\"Sigsiu.NET Software Development\"><img src=\"{$media}/sp.png\" alt=\"Sigsiu.NET Software Development\" style=\"border-style:none;\" /></a></div>\n";
$fs = null;
if (count($this->_sections)) {
if ($this->_task == 'section.view') {
// $this->_task = 'section.entries';
$this->_open = 'AMN.ENT_CAT';
}
$this->_view[] = '<div class="accordion" id="SpMenu">';
foreach ($this->_sections as $section => $list) {
$sid = SPLang::nid($section);
$in = false;
if (!$fs) {
$fs = $sid;
}
if (!$this->_open && array_key_exists($this->_task, $list)) {
$this->_open = $sid;
$in = ' in';
}
if ($this->_open && $section == $this->_open) {
$in = ' in';
}
if (!$this->_open && array_key_exists($this->_task, $list)) {
$in = ' in';
}
$this->_view[] = '<div class="accordion-group">';
$this->_view[] = '<div class="accordion-heading">';
$this->_view[] = '<a class="accordion-toggle" data-toggle="collapse" data-parent="#SpMenu" href="#' . $sid . '">';
$this->_view[] = Sobi::Txt($section);
$this->_view[] = '</a>';
$this->_view[] = '</div>';
$this->_view[] = '<div id="' . $sid . '" class="accordion-body collapse' . $in . '">';
$this->_view[] = '<div class="accordion-inner">';
$this->_view[] = $this->section($list, $section);
$this->_view[] = '</div>';
$this->_view[] = '</div>';
$this->_view[] = '</div>';
}
$this->_view[] = '</div>';
}
$this->_view[] = "\n</div>\n";
$this->_view[] = '<div class="brand" style="display: inherit;">© <a href="http://www.sigsiu.net">Sigsiu.NET GmbH</a></div>';
$this->_view[] = "\n<!-- Sobi Pro - admin side menu end -->\n";
return implode("\n", $this->_view);
}
示例10: screen
private function screen()
{
$data = SPFactory::registry()->loadDBSection('paypal_' . Sobi::Section())->get('paypal_' . Sobi::Section());
if (!count($data)) {
$data = SPFactory::registry()->loadDBSection('paypal')->get('paypal');
}
$ppexpl = SPLang::getValue('ppexpl', 'application', Sobi::Section());
$ppsubj = SPLang::getValue('ppsubject', 'application', Sobi::Section());
if (!strlen($ppsubj)) {
$ppsubj = SPLang::getValue('ppsubject', 'application');
}
$this->getView('paypal')->assign($tile, 'title')->assign($data['ppurl']['value'], 'ppurl')->assign($data['ppemail']['value'], 'ppemail')->assign($data['pprurl']['value'], 'pprurl')->assign($data['ppcc']['value'], 'ppcc')->assign($ppexpl, 'ppexpl')->assign($ppsubj, 'ppsubject')->determineTemplate('extensions', 'paypal')->display();
}
示例11: struct
/**
* @return array
* Ausgabe des Feldes in DV and vCard
*/
public function struct()
{
$data = SPLang::getValue($this->nid . '-viewInfo', 'field_information', Sobi::Section());
$attributes = array();
if (strlen($data)) {
$this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spFieldsData';
$this->cssClass = $this->cssClass . ' ' . $this->nid;
$this->cleanCss();
$attributes = array('lang' => Sobi::Lang(), 'class' => $this->cssClass);
} else {
$this->cssClass = strlen($this->cssClass) ? $this->cssClass : 'spField';
}
return array('_complex' => 1, '_data' => $data, '_attributes' => $attributes);
}
示例12: getFunctionsLabel
protected function getFunctionsLabel()
{
if (isset($this->params->interpreter)) {
$interpreter = explode('.', $this->params->interpreter);
$function = array_pop($interpreter);
$obj = SPFactory::Instance(implode('.', $interpreter));
self::$functionsLabel = $obj->{$function}(self::$sid, self::$section);
} elseif (isset($this->params->text)) {
if (isset($this->params->loadTextFile)) {
SPLang::load($this->params->loadTextFile);
}
self::$functionsLabel = Sobi::Txt($this->params->text);
}
}
示例13: js
protected function js()
{
$lang = SPLang::jsLang(true);
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) . ' );';
exit;
}
示例14: saveAttr
/**
* @param $attr
* @return mixed
* @throws SPException
*/
protected function saveAttr(&$attr)
{
if ($this->nid) {
$this->nid = $attr['nid'];
}
if (!isset($attr['viewInfo'])) {
$attr['viewInfo'] = $this->viewInfo;
$attr['entryInfo'] = $this->entryInfo;
}
$data = array('key' => $this->nid . '-viewInfo', 'value' => $attr['viewInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$data = array('key' => $this->nid . '-entryInfo', 'value' => $attr['entryInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$attr['required'] = 0;
$attr['fee'] = 0;
$attr['isFree'] = 1;
return $attr;
}
示例15: screen
private function screen()
{
$view =& SPFactory::View('view', true);
$view->setTemplate('config.help');
if (SPLoader::path('etc.repos.sobipro_core.repository', 'front', true, 'xml')) {
$repository = SPFactory::Instance('services.installers.repository');
$repository->loadDefinition(SPLoader::path("etc.repos.sobipro_core.repository", 'front', true, 'xml'));
try {
$repository->connect();
} catch (SPException $x) {
$view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
}
try {
$response = $repository->help($repository->get('token'), SPRequest::cmd('mid'));
$view->assign($response, 'message');
} catch (SPException $x) {
$view->assign(SPLang::e('REPO_ERR', $x->getMessage()), 'message');
}
} else {
$view->assign(Sobi::Txt('MSG.HELP_ADD_CORE_REPO'), 'message');
}
$view->display();
}