本文整理汇总了PHP中Sobi::Txt方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::Txt方法的具体用法?PHP Sobi::Txt怎么用?PHP Sobi::Txt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::Txt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: menu
protected function menu(&$data)
{
if (Sobi::Cfg('general.top_menu', true)) {
$data['menu'] = array('front' => array('_complex' => 1, '_data' => Sobi::Reg('current_section_name'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('sid' => Sobi::Section())))));
if (Sobi::Can('section.search')) {
$data['menu']['search'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.SEARCH'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'search', 'sid' => Sobi::Section()))));
}
if (Sobi::Can('entry', 'add', 'own', Sobi::Section())) {
$data['menu']['add'] = array('_complex' => 1, '_data' => Sobi::Txt('MN.ADD_ENTRY'), '_attributes' => array('lang' => Sobi::Lang(false), 'url' => Sobi::Url(array('task' => 'entry.add', 'sid' => SPRequest::sid()))));
}
}
}
示例2: upload
protected function upload()
{
$ident = SPRequest::cmd('ident', null, 'post');
$data = SPRequest::file($ident, 'tmp_name');
$secret = md5(Sobi::Cfg('secret'));
if ($data) {
$properties = SPRequest::file($ident);
$fileName = md5(SPRequest::file($ident, 'name') . time() . $secret);
$path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
/** @var $file SPFile */
$file = SPFactory::Instance('base.fs.file');
if (!$file->upload($data, $path)) {
$this->message(array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE'), 'id' => ''));
}
$path = $file->getPathname();
$type = $this->check($path);
$properties['tmp_name'] = $path;
SPFs::write($path . '.var', SPConfig::serialize($properties));
$response = array('type' => 'success', 'text' => Sobi::Txt('FILE_UPLOADED', $properties['name'], $type), 'id' => 'file://' . $fileName, 'data' => array('name' => $properties['name'], 'type' => $properties['type'], 'size' => $properties['size']));
} else {
$response = array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE_NO_DATA'), 'id' => '');
}
// $field = SPRequest::cmd( 'field', null );
$this->message($response);
}
示例3: field
/**
* Shows the field in the edit entry or add entry form
* @param bool $return return or display directly
* @return string
*/
public function field($return = false)
{
if (!$this->enabled) {
return false;
}
$field = null;
$fdata = Sobi::Reg('editcache');
if ($fdata && is_array($fdata)) {
$raw = $this->fromCache($fdata);
} else {
$raw = SPConfig::unserialize($this->getRaw());
}
if ($this->ownLabel) {
$fieldTitle = null;
$params = array('id' => $this->nid, 'size' => $this->labelWidth, 'class' => $this->cssClass . 'Title');
if ($this->labelMaxLength) {
$params['maxlength'] = $this->labelMaxLength;
}
if ($this->labelWidth) {
$params['style'] = "width: {$this->labelWidth}px;";
}
if (strlen($this->labelsLabel)) {
$this->labelsLabel = SPLang::clean($this->labelsLabel);
//$fieldTitle .= "<label for=\"{$this->nid}\" class=\"{$this->cssClass}Title\">{$this->labelsLabel}</label>\n";
$params['placeholder'] = $this->labelsLabel;
}
$fieldTitle .= SPHtml_Input::text($this->nid, is_array($raw) && isset($raw['label']) ? SPLang::clean($raw['label']) : null, $params);
}
$class = $this->required ? $this->cssClass . ' required' : $this->cssClass;
$this->nid .= '_url';
$params = array('id' => $this->nid, 'size' => $this->width, 'class' => $class);
if ($this->maxLength) {
$params['maxlength'] = $this->maxLength;
}
if ($this->width) {
$params['style'] = "width: {$this->width}px;";
}
$label = Sobi::Txt('FD.MAIL_EMAIL_ADDRESS');
if (!$this->ownLabel && $this->labelAsPlaceholder) {
// the field label will be shown only if labelAsPlaceholder is true and no own label for the email is selected
$label = $this->__get('name');
//get the field's label from the model
}
$params['placeholder'] = $label;
$value = is_array($raw) && isset($raw['url']) ? $raw['url'] : null;
if ($value == null) {
if ($this->defaultValue) {
$value = $this->defaultValue;
}
}
$field .= SPHtml_Input::text($this->nid, $value, $params);
if ($this->ownLabel) {
$field = "\n<div class=\"spFieldEmailLabel\">{$fieldTitle}</div><div class=\"spFieldEmail\">{$field}</div>";
}
if (!$return) {
echo $field;
} else {
return $field;
}
}
示例4: getGroupsField
public static function getGroupsField()
{
$db =& JFactory::getDbo();
$db->setQuery('
SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level
FROM #__usergroups AS a
LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt
GROUP BY a.id
ORDER BY a.lft ASC');
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
$gids = array();
foreach ($options as $k => $v) {
$gids[] = get_object_vars($v);
}
$gids[0] = array('value' => 0, 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'level' => 0);
return $gids;
}
示例5: translate
protected function translate()
{
$term = Sobi::Txt(SPRequest::cmd('term'));
Sobi::Trigger('Translate', 'Text', array(&$term));
SPFactory::mainframe()->cleanBuffer()->customHeader();
echo json_encode(array('translation' => $term));
exit;
}
示例6: 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));
}
示例7: 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();
}
示例8: setTitle
/**
* @param string $title
* @return string
*/
public function setTitle($title)
{
$name = $this->get('entry.name');
Sobi::Trigger('setTitle', $this->name(), array(&$title));
$title = Sobi::Txt($title, array('entry_name' => $name));
$this->set($name, 'entry_name');
$title = parent::setTitle($title);
return $title;
}
示例9: setTitle
/**
* @param string $title
* @return string|void
*/
public function setTitle($title)
{
if (strstr(SPRequest::task(), '.add')) {
$title = str_replace('EDIT', 'ADD', $title);
}
$title = Sobi::Txt($title, array('field' => $this->get('field.name'), 'field_type' => $this->get('field.fieldType')));
Sobi::Trigger('setTitle', $this->name(), array(&$title));
SPFactory::header()->setTitle($title);
$this->set($title, 'site_title');
}
示例10: getGroupsField
public static function getGroupsField()
{
$acl =& JFactory::getACL();
$g = $acl->get_group_children_tree(null, 'USERS', false);
$gids = array();
foreach ($g as $k => $v) {
$gids[] = get_object_vars($v);
}
array_unshift($gids, array('value' => '0', 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'disable' => null));
return $gids;
}
示例11: setTitle
/**
* @param string $title
* @return void
*/
public function setTitle($title)
{
$name = $this->get('template_name');
if (!strlen($name)) {
$name = $this->get('file_name');
$title = Sobi::Txt($title, array('path' => $name));
} else {
$title = Sobi::Txt($title, array('template' => $name));
}
Sobi::Trigger('setTitle', $this->name(), array(&$title));
SPFactory::header()->setTitle($title);
$this->set($title, 'site_title');
}
示例12: remove
public function remove($def)
{
$eid = $def->getElementsByTagName('id')->item(0)->nodeValue;
$name = $def->getElementsByTagName('name')->item(0)->nodeValue;
$type = $def->getElementsByTagName('type')->item(0)->nodeValue;
$id = SPFactory::db()->select('extension_id', '#__extensions', array('type' => $type, 'element' => $eid))->loadResult();
jimport('joomla.installer.installer');
if (JInstaller::getInstance()->uninstall($type, $id)) {
SPFactory::db()->delete('spdb_plugins', array('pid' => $eid, 'type' => $type), 1);
return Sobi::Txt('CMS_EXT_REMOVED', $name);
}
return array('msg' => Sobi::Txt('CMS_EXT_NOT_REMOVED', $name), 'msgtype' => 'error');
}
示例13: raw
/**
* @param array $config
* @param array $values
* @return string
*/
private function raw($config, $values)
{
$out = "\n";
$out .= $values['expl'];
$out .= Sobi::Txt('APP.PPP.PAY_TITLE') . ': ';
$out .= $config['message']['url'];
array_shift($config['message']);
$v = array();
foreach ($config['message'] as $field => $value) {
$v[] = $field . '=' . urlencode(SPLang::replacePlaceHolders($value, $values));
}
$out .= implode('&', $v);
return SPLang::clean($out);
}
示例14: execute
public function execute()
{
$this->start = microtime(true);
$sites = $this->getSites();
$responses = array();
$status = 'working';
$message = null;
$this->format = SPRequest::bool('fullFormat') ? self::FORMAT_FULL : self::FORMAT;
// $this->format = SPRequest::bool( 'fullFormat' ) ? self::FORMAT_FULL : self::FORMAT_FULL;
$task = SPRequest::task();
if (in_array($task, array('crawler.init', 'crawler.restart'))) {
if ($task == 'crawler.restart') {
SPFactory::cache()->cleanSection(Sobi::Section());
}
SPFactory::db()->truncate(self::DB_TABLE);
$multiLang = Sobi::Cfg('lang.multimode', false);
if ($multiLang) {
$langs = SPFactory::CmsHelper()->getLanguages();
if ($multiLang && $langs) {
foreach ($langs as $lang) {
$responses[] = $this->getResponse(Sobi::Cfg('live_site') . 'index.php?option=com_sobipro&sid=' . Sobi::Section() . '&lang=' . $lang);
}
}
}
$responses[] = $this->getResponse(Sobi::Cfg('live_site') . 'index.php?option=com_sobipro&sid=' . Sobi::Section());
$sites = $this->getSites();
}
if (!count($sites) && !in_array($task, array('crawler.init', 'crawler.restart'))) {
$message = Sobi::Txt('CRAWL_URL_PARSED_DONE', SPFactory::db()->select('count(*)', self::DB_TABLE)->loadResult());
SPFactory::db()->truncate(self::DB_TABLE);
$this->response(array('status' => 'done', 'data' => array(), 'message' => $message));
}
if (count($sites)) {
$i = 0;
$timeLimit = SPRequest::int('timeLimit', self::TIME_LIMIT, 'get', true);
foreach ($sites as $site) {
if (!strlen($site)) {
continue;
}
$responses[] = $this->getResponse($site);
$i++;
if (microtime(true) - $this->start > $timeLimit) {
break;
}
}
$message = Sobi::Txt('CRAWL_URL_PARSED_WORKING', $i, count($sites));
}
$this->response(array('status' => $status, 'data' => $responses, 'message' => $message));
}
示例15: status
private function status($message, $progress = 0, $interval = 0, $type = SPC::INFO_MSG)
{
if (!strlen($message)) {
$message = Sobi::Txt('PROGRESS_WORKING');
}
$progress = $progress ? $progress : $this->progress;
$interval = $interval ? $interval : $this->interval;
$type = $type ? $type : $this->type;
$this->progress = $progress;
$this->message = $message;
$this->interval = $interval;
$this->type = $type;
$typeText = Sobi::Txt('STATUS_' . $type);
SPFs::write($this->file, json_encode(array('progress' => $progress, 'message' => $message, 'interval' => $interval, 'type' => $type, 'typeText' => $typeText)));
}