本文整理汇总了PHP中Sobi::Url方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::Url方法的具体用法?PHP Sobi::Url怎么用?PHP Sobi::Url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::Url方法的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: display
/**
*
*/
public function display()
{
$sections =& $this->get('sections');
$_sections = array();
if (count($sections)) {
foreach ($sections as $section) {
$name = $section->get('name');
$id = $section->get('id');
$url = Sobi::Url(array('sid' => $id));
$_section = array();
$_section['id'] = $id;
$_section['nid'] = $section->get('nid');
$_section['name'] = "<a href=\"{$url}\">{$name}</a>";
// $_section[ 'entries_counter' ] = $section->countChilds( 'entry' );
// $_section[ 'categories_counter' ] = $section->countChilds( 'category' );
// $_section[ 'state' ] = SPLists::state( $section );
// $_section[ 'checkbox' ] = SPLists::checkedOut( $section, 'sid' );
$_section['createdTime'] = $section->get('createdTime');
$_section['metaDesc'] = $section->get('metaDesc');
$_section['metaKey'] = $section->get('metaKey');
$_section['description'] = $section->get('description');
$_section['url'] = $url;
$_sections[] = $_section;
}
}
$this->set($_sections, 'sections');
parent::display();
}
示例3: 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));
}
示例4: edit
/**
*/
private function edit()
{
$id = $this->get('entry.id');
if ($id) {
$this->addHidden($id, 'entry.id');
}
$sid = SPRequest::int('pid') ? SPRequest::int('pid') : SPRequest::sid();
$this->assign(Sobi::Url(array('task' => 'category.chooser', 'sid' => $sid, 'out' => 'html', 'multiple' => 1), true), 'cat_chooser_url');
}
示例5: errors
private function errors()
{
$errors = $this->get('errors');
$levels = $this->get('levels');
$icons = array('error' => Sobi::Cfg('list_icons.err_err'), 'warning' => Sobi::Cfg('list_icons.err_warn'), 'notice' => Sobi::Cfg('list_icons.err_notice'), 'details' => Sobi::Cfg('list_icons.err_details'));
/* create the header */
if (count($errors)) {
foreach ($errors as $i => $error) {
$error['errFile'] = str_replace(SOBI_ADM_PATH, null, $error['errFile']);
$error['errFile'] = str_replace(SOBI_PATH, null, $error['errFile']);
$error['errFile'] = str_replace(SOBI_ROOT, null, $error['errFile']);
$error['errFile'] = $error['errFile'] . ': ' . $error['errLine'];
if ($error['errReq']) {
$error['errReq'] = "<a href=\"{$error['errReq']}\" target=\"_blank\">{$error['errReq']}</a>";
}
$level = $levels[$error['errNum']];
switch ($error['errNum']) {
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
case E_RECOVERABLE_ERROR:
$error['errNum'] = "<img src=\"{$icons['error']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
$error['errNum'] = "<img src=\"{$icons['warning']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
break;
case E_NOTICE:
case E_USER_NOTICE:
case E_STRICT:
case E_USER_WARNING:
case E_DEPRECATED:
case E_USER_DEPRECATED:
$error['errNum'] = "<img src=\"{$icons['notice']}\" alt=\"{$level}\" title=\"{$level}\"/><br/>{$level}";
break;
}
$error['errMsg'] = str_replace(SOBI_ROOT, null, $error['errMsg']);
$error['errMsg'] = str_replace('href=\'function.', 'target="_blank" href=\'http://php.net/manual/en/function.', $error['errMsg']);
$dh = Sobi::Url(array('task' => 'error.details', 'eid' => $error['eid']));
$error['details'] = "<a href=\"{$dh}\"><img src=\"{$icons['details']}\"/></a>";
$errors[$i] = $error;
}
}
// Sobi::Error( 'H', date( DATE_RFC1123 ), SPC::ERROR );
$this->assign($errors, 'errors');
}
示例6: 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;
}
示例7: 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));
}
示例8: delete
/**
*/
public function delete()
{
$childs = $this->getChilds('all', true);
Sobi::Trigger('Section', ucfirst(__FUNCTION__), array(&$this->id));
if (count($childs)) {
Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), Sobi::Txt('SEC.DEL_WARN'), SPC::ERROR_MSG, true);
} else {
Sobi::Trigger('delete', $this->name(), array(&$this));
$db = SPFactory::db();
try {
$db->delete('spdb_relations', "id = {$this->id} OR pid = {$this->id}");
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
try {
$db->delete('spdb_config', array('section' => $this->id));
$db->delete('spdb_plugin_section', array('section' => $this->id));
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
try {
$fids = $db->select('fid', 'spdb_field', array('section' => $this->id))->loadResultArray();
if (count($fids)) {
foreach ($fids as $fid) {
try {
$db->select('*', $db->join(array(array('table' => 'spdb_field', 'as' => 'sField', 'key' => 'fieldType'), array('table' => 'spdb_field_types', 'as' => 'sType', 'key' => 'tid'))), array('fid' => $fid));
$f = $db->loadObject();
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
$field =& SPFactory::Model('field', true);
$field->extend($f);
$field->delete();
}
}
} catch (SPException $x) {
Sobi::Error($this->name(), SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
parent::delete();
Sobi::Trigger('afterDelete', $this->name(), array(&$this));
}
}
示例9: chooser
public function chooser()
{
$pid = $this->get('category.parent');
$path = null;
if (!$pid) {
$pid = SPRequest::sid();
}
$this->assign($pid, 'parent');
$id = $this->get('category.id');
$id = $id ? $id : $pid;
if ($id) {
$path = $this->parentPath($id);
}
$this->assign($path, 'parent_path');
$this->assign(Sobi::Url(array('task' => 'category.parents', 'out' => 'json', 'format' => 'raw'), true), 'parent_ajax_url');
/* @TODO */
$tpl = str_replace(implode('/', array('usr', 'templates', 'category')), 'views/tpl/', $this->_template . '.php');
Sobi::Trigger('Display', $this->name(), array(&$this));
include $tpl;
Sobi::Trigger('AfterDisplay', $this->name());
}
示例10: display
/**
*
*/
public function display()
{
$this->_type = 'frontpage';
$type = $this->key('template_type', 'xslt');
if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
$type = 'php';
}
if ($type == 'xslt') {
$sections = $this->get('sections');
$data = array();
if (count($sections)) {
foreach ($sections as $section) {
$s = array('name' => array('_complex' => 1, '_data' => $section->get('name'), '_attributes' => array('lang' => Sobi::Lang(false))), 'description' => array('_complex' => 1, '_cdata' => 1, '_data' => $section->get('description'), '_attributes' => array('lang' => Sobi::Lang(false))), 'createdTime' => $section->get('createdTime'), 'meta' => array('description' => $section->get('metaDesc'), 'keys' => $this->metaKeys($section), 'author' => $section->get('metaAuthor'), 'robots' => $section->get('metaRobots')), 'owner' => $section->get('owner'), 'version' => $section->get('version'), 'validSince' => $section->get('validSince'), 'validUntil' => $section->get('validUntil'), 'url' => Sobi::Url(array('sid' => $section->get('id'))));
$data[] = array('_complex' => 1, '_data' => $s, '_attributes' => array('id' => $section->get('id'), 'nid' => $section->get('nid')));
}
}
$this->assign($data, 'sections');
Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
}
parent::display();
}
示例11: getLink
private function getLink($button)
{
$link = '#';
if (isset($button['type'])) {
switch ($button['type']) {
case 'help':
$link = 'https://www.sigsiu.net/help_screen/' . Sobi::Reg('help_task', SPRequest::task());
break;
case 'url':
if (isset($button['sid']) && $button['sid'] == 'true') {
$link = Sobi::Url(array('task' => $button['task'], 'sid' => SPRequest::sid('request', SPRequest::int('pid'), true)));
} else {
$link = Sobi::Url($button['task'] ? $button['task'] : $button['url']);
}
break;
}
}
return $link;
}
示例12: getContentPermalink
public function getContentPermalink()
{
// $sid = SPRequest::sid();
$sid = $this->getContentId();
// $pid = SPRequest::int( 'pid' ) ? SPRequest::int( 'pid' ) : Sobi::Section();
$pid = JRequest::getInt('pid') ? JRequest::getInt('pid') : Sobi::Section();
$link = Sobi::Url(array('pid' => $pid, 'sid' => $sid, 'title' => $this->_item->title));
$link = $this->prepareLink($link);
// end untested codes
return $link;
}
示例13: getBack
/**
* @return string
*/
public function getBack()
{
$r = Sobi::GetUserState('back_url', Sobi::Url());
if (!$r) {
$r = SPRequest::string('HTTP_REFERER', self::url(), false, 'SERVER');
}
return $r;
}
示例14: routeTask
/**
* Route by task
* @return bool
*/
private function routeTask()
{
$r = true;
if (strstr($this->_task, '.')) {
/* task consist of the real task and the object type */
$task = explode('.', $this->_task);
$obj = trim(array_shift($task));
$task = trim(implode('.', $task));
/* load the controller class definition and get the class name */
$ctrl = SPLoader::loadController($obj, true);
/* route task for multiple objects - e.g removing or publishing elements from a list */
$sids = SPRequest::arr('sid');
$csids = SPRequest::arr('c_sid');
$esids = SPRequest::arr('e_sid');
if (count($sids) || count($csids) || count($esids)) {
$sid = array_key_exists('sid', $_REQUEST) && is_array($_REQUEST['sid']) ? 'sid' : (array_key_exists('c_sid', $_REQUEST) ? 'c_sid' : 'e_sid');
if (count(SPRequest::arr($sid))) {
/* @var SPdb $db */
$db =& SPFactory::db();
$objects = null;
try {
$db->select('*', 'spdb_object', array('id' => SPRequest::arr($sid)));
$objects = $db->loadObjectList();
} catch (SPException $x) {
Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
$r = false;
}
/** @noinspection PhpUndefinedVariableInspection */
if (count($objects)) {
$this->_ctrl = array();
foreach ($objects as $object) {
$o = $this->extendObj($object, $obj, $ctrl, $task);
if ($o) {
$this->_ctrl[] = $o;
}
}
if (!count($this->_ctrl)) {
Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
}
} else {
Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
$r = false;
//break;
}
} else {
Sobi::Error('CoreCtrl', SPLang::e('IDENTIFIER_EXPECTED'), SPC::WARNING, 0, __LINE__, __FILE__);
Sobi::Redirect(Sobi::GetUserState('back_url', Sobi::Url()), SPLang::e('IDENTIFIER_EXPECTED'), SPC::ERROR_MSG);
$r = false;
//break;
}
} else {
/* set controller and model */
try {
$ctrl = new $ctrl();
$this->setController($ctrl);
if ($ctrl instanceof SPController) {
$model = SPLoader::loadModel($obj, false, false);
if ($model) {
$this->_ctrl->setModel($model);
}
}
} catch (SPException $x) {
Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
if ($this->_sid) {
$this->_model =& SPFactory::object($this->_sid);
}
/* if the basic object we got from the #getSection method is the same one ... */
if ($this->_model instanceof stdClass && $this->_model->oType == $obj) {
/*... extend the empty model of these data we've already got */
/** @noinspection PhpParamsInspection */
$this->_ctrl->extend($this->_model);
}
/* ... and so on... */
$this->_ctrl->setTask($task);
}
} else {
/** Special controllers not inherited from object and without model */
$task = $this->_task;
$ctrl = SPLoader::loadController($task, true);
try {
$this->setController(new $ctrl());
} catch (SPException $x) {
Sobi::Error('CoreCtrl', SPLang::e('Cannot set controller. %s.', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
}
return $r;
}
示例15: defined
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3
* as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
* See http://www.gnu.org/licenses/gpl.html and http://sobipro.sigsiu.net/licenses.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* $Date$
* $Revision$
* $Author$
* $HeadURL$
*/
defined('SOBIPRO') || exit('Restricted access');
?>
<div style="padding: 10px;">
<?php
$c = $this->count('sections');
for ($i = 0; $i < $c; $i++) {
?>
<div>
<a href="<?php
echo Sobi::Url(array('sid' => $this->get('sections.id', $i)));
?>
"><?php
$this->show('sections.name', $i);
?>
</a>
</div>
<?php
}
?>
</div>