本文整理汇总了PHP中JUri::base方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::base方法的具体用法?PHP JUri::base怎么用?PHP JUri::base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(JForm $form = null)
{
parent::__construct($form);
static $resources = true;
if ($resources) {
$resources = false;
$name = basename(realpath(dirname(__FILE__) . "/../.."));
$document = JFactory::getDocument();
// $this->element is not ready on the constructor
//$type = (string)$this->element["type"];
$type = strtolower($this->type);
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $type . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $type . ".css");
}
$scope = JFactory::getApplication()->scope;
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $scope . ".js")) {
$document->addScript(JUri::current() . "?option=" . $name . "&view=loader&filename=" . $scope . "&type=js");
}
if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $scope . ".css")) {
$document->addStyleSheet(JUri::base(true) . "/components/" . $name . "/css/" . $scope . ".css");
}
}
}
示例2: defaults
function defaults()
{
$document = JFactory::getDocument();
$document->addScript(JUri::base(true) . '/media/cbcc/js/jquery/jquery.maskedinput.min.js');
$document->addScript(JUri::base(true) . '/media/cbcc/js/jquery/upload/jquery.fileupload.js');
$document->addScript(JUri::base(true) . '/media/cbcc/js/jquery.colorbox-min.js');
$document->addScript(JUri::base(true) . '/media/cbcc/js/jquery/upload/jquery.iframe-transport.js');
$document->addScript(JUri::base(true) . '/media/cbcc/js/bootstrap.tab.ajax.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/jquery.cookie.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/jstree/jquery.jstree.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/caydonvi.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/dataTables-1.10.0/jquery.dataTables.min.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/dataTables-1.10.0/dataTables.bootstrap.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/dataTables-1.10.0/dataTables.tableTools.min.js');
$document->addScript(JURI::base(true) . '/media/cbcc/js/dataTables-1.10.0/datatables.default.config.js');
$document->addStyleSheet(JURI::base(true) . '/media/cbcc/js/dataTables-1.10.0/css/dataTables.tableTools.css');
$model = Core::model('Thongke/Thongke');
$idUser = JFactory::getUser()->id;
$idRoot = Core::getManageUnit($idUser, 'com_thongke', 'treeview', 'treethongke');
if ($idRoot == null) {
$this->setLayout('hoso_404');
} else {
$root['root_id'] = $idRoot;
$tmp = $model->getThongtin(array('name, type'), 'ins_dept', null, array('id=' . $root['root_id']), null);
$root['root_name'] = $tmp[0]->name;
$root['root_showlist'] = $tmp[0]->type;
}
$this->assignRef('root_info', $root);
}
示例3: display
/**
* Renders the view
*
* @param string $tpl Template name
*
* @return void
*/
public function display($tpl = null)
{
$password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null);
$filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null);
$ajaxUrl = JUri::base() . 'components/com_joomlaupdate/restore.php';
$returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise';
// Set the toolbar information
JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'install');
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE');
// Add toolbar buttons
if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) {
JToolbarHelper::preferences('com_joomlaupdate');
}
// Load mooTools
JHtml::_('behavior.framework', true);
$updateScript = <<<ENDSCRIPT
var joomlaupdate_password = '{$password}';
var joomlaupdate_totalsize = '{$filesize}';
var joomlaupdate_ajax_url = '{$ajaxUrl}';
var joomlaupdate_return_url = '{$returnUrl}';
ENDSCRIPT;
// Load our Javascript
$document = JFactory::getDocument();
$document->addScript('../media/com_joomlaupdate/json2.js');
$document->addScript('../media/com_joomlaupdate/encryption.js');
$document->addScript('../media/com_joomlaupdate/update.js');
JHtml::_('script', 'system/progressbar.js', true, true);
JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
$document->addScriptDeclaration($updateScript);
// Render the view
parent::display($tpl);
}
示例4: __construct
/**
* Class constructor
*
* @param array $options Associative array of options
*
* @since 11.1
*/
public function __construct($options = array())
{
parent::__construct($options);
// Set document type
$this->_type = 'opensearch';
// Set mime type
$this->_mime = 'application/opensearchdescription+xml';
// Add the URL for self updating
$update = new JOpenSearchUrl();
$update->type = 'application/opensearchdescription+xml';
$update->rel = 'self';
$update->template = JRoute::_(JUri::getInstance());
$this->addUrl($update);
// Add the favicon as the default image
// Try to find a favicon by checking the template and root folder
$app = JFactory::getApplication();
$dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
foreach ($dirs as $dir) {
if (file_exists($dir . '/favicon.ico')) {
$path = str_replace(JPATH_BASE . '/', '', $dir);
$path = str_replace('\\', '/', $path);
$favicon = new JOpenSearchImage();
$favicon->data = JUri::base() . $path . '/favicon.ico';
$favicon->height = '16';
$favicon->width = '16';
$favicon->type = 'image/vnd.microsoft.icon';
$this->addImage($favicon);
break;
}
}
}
示例5: frameYTShortcode
function frameYTShortcode($atts = null, $content = null)
{
$atts = ytshortcode_atts(array('style' => 'default', 'align' => 'left', 'class' => ''), $atts, 'yt_frame');
JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/frame/css/frame.css", 'text/css');
JHtml::script("plugins/system/ytshortcodes/shortcodes/frame/js/frame.js");
return '<span class="yt-frame yt-frame-align-' . $atts['align'] . ' yt-frame-style-' . $atts['style'] . '"><span class="yt-frame-inner">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</span></span><div class="clear clearfix"></div>';
}
示例6: login
/**
* Method to log in a user.
*
* @return void
*
* @since 1.6
*/
public function login()
{
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$input = $app->input;
$method = $input->getMethod();
// Populate the data array:
$data = array();
$data['return'] = base64_decode($app->input->post->get('return', '', 'BASE64'));
$data['username'] = $input->{$method}->get('username', '', 'USERNAME');
$data['password'] = $input->{$method}->get('password', '', 'RAW');
$data['secretkey'] = $input->{$method}->get('secretkey', '', 'RAW');
// Don't redirect to an external URL.
if (!JUri::isInternal($data['return'])) {
$data['return'] = '';
}
// Set the return URL if empty.
if (empty($data['return'])) {
$data['return'] = 'index.php?option=com_users&view=profile';
}
// Set the return URL in the user state to allow modification by plugins
$app->setUserState('users.login.form.return', $data['return']);
// Get the log in options.
$options = array();
$options['remember'] = $this->input->getBool('remember', false);
$options['return'] = $data['return'];
// Get the log in credentials.
$credentials = array();
$credentials['username'] = $data['username'];
$credentials['password'] = $data['password'];
$credentials['secretkey'] = $data['secretkey'];
// Perform the log in.
if (true === $app->login($credentials, $options)) {
$user = JFactory::getUser();
// Success
if ($options['remember'] == true) {
$app->setUserState('rememberLogin', true);
}
$app->setUserState('users.login.form.data', array());
foreach ($user->groups as $group) {
if ($group == "2") {
$app->redirect(JUri::base() . "index.php?option=com_business&view=paymentaccount");
// $options['return'] = "index.php?option=com_business&view=paymentaccount";
}
if ($group == "8") {
$app->redirect(JUri::base() . "index.php/admin-business");
// $options['return'] = "index.php?option=com_business&view=paymentaccount";
} else {
$app->redirect(JUri::base() . "index.php/business");
// $options['return'] = "index.php?option=com_business&view=business";
}
}
// $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
} else {
// Login failed !
$data['remember'] = (int) $options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}
示例7: blockquoteYTShortcode
function blockquoteYTShortcode($atts, $content = null)
{
extract(ytshortcode_atts(array("title" => '', "align" => 'none', 'border' => '#666', 'color' => '#fff', 'width' => 'auto'), $atts));
JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/blockquote/css/blockquote.css");
$source_title = $title != '' ? "<small>" . $title . "</small>" : '';
return '<blockquote class="yt-clearfix yt-boxquote pull-' . $align . '" style="width:' . $width . '%;border-color:' . $border . ';color:' . $color . '">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . $source_title . '</blockquote>';
}
示例8: onBrowse
public function onBrowse($tpl = null)
{
AkeebaStrapper::addJSfile('media://com_akeeba/js/fsfilter.js');
$model = $this->getModel();
$task = $model->getState('browse_task', 'normal');
// Add custom submenus
$toolbar = F0FToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
$toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=normal', $task == 'normal');
$toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=tabular', $task == 'tabular');
$media_folder = JUri::base() . '../media/com_akeeba/';
// Get the root URI for media files
$this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/');
// Get a JSON representation of the available roots
$filters = Factory::getFilters();
$root_info = $filters->getInclusions('dir');
$roots = array();
$options = array();
if (!empty($root_info)) {
// Loop all dir definitions
foreach ($root_info as $dir_definition) {
if (is_null($dir_definition[1])) {
// Site root definition has a null element 1. It is always pushed on top of the stack.
array_unshift($roots, $dir_definition[0]);
} else {
$roots[] = $dir_definition[0];
}
$options[] = JHTML::_('select.option', $dir_definition[0], $dir_definition[0]);
}
}
$site_root = $roots[0];
$attribs = 'onchange="akeeba.Fsfilters.activeRootChanged();"';
$this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root');
$this->roots = $roots;
switch ($task) {
case 'normal':
default:
$this->setLayout('default');
// Get a JSON representation of the directory data
$model = $this->getModel();
$json = json_encode($model->make_listing($site_root, array(), ''));
$this->json = $json;
break;
case 'tabular':
$this->setLayout('tabular');
// Get a JSON representation of the tabular filter data
$model = $this->getModel();
$json = json_encode($model->get_filters($site_root));
$this->json = $json;
break;
}
// Get profile ID
$profileid = Platform::getInstance()->get_active_profile();
$this->profileid = $profileid;
// Get profile name
$pmodel = F0FModel::getAnInstance('Profiles', 'AkeebaModel');
$pmodel->setId($profileid);
$profile_data = $pmodel->getItem();
$this->profilename = $this->escape($profile_data->description);
return true;
}
示例9: _getCommand
/**
* Get the JavaScript command for the button
*
* @param string $url URL for popup
*
* @return string JavaScript command string
*
* @since 3.0
*/
private function _getCommand($url)
{
if (substr($url, 0, 4) !== 'http') {
$url = JUri::base() . $url;
}
return $url;
}
示例10: onAdd
public function onAdd($tpl = null)
{
$media_folder = JUri::base() . '../media/com_akeeba/';
// Get a JSON representation of GUI data
$json = AkeebaHelperEscape::escapeJS(Factory::getEngineParamsProvider()->getJsonGuiDefinition(), '"\\');
$this->json = $json;
// Get profile ID
$profileid = Platform::getInstance()->get_active_profile();
$this->profileid = $profileid;
// Get profile name
$profileName = F0FModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
$this->profilename = $profileName;
// Get the root URI for media files
$this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/');
// Are the settings secured?
if (Platform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
$this->securesettings = -1;
} elseif (!Factory::getSecureSettings()->supportsEncryption()) {
$this->securesettings = 0;
} else {
JLoader::import('joomla.filesystem.file');
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/engine/serverkey.php';
if (JFile::exists($filename)) {
$this->securesettings = 1;
} else {
$this->securesettings = 0;
}
}
// Add live help
AkeebaHelperIncludes::addHelp('config');
}
示例11: sectionYTShortcode
function sectionYTShortcode($atts = null, $content = null)
{
$atts = ytshortcode_atts(array('background' => '#ffffff', 'image' => '', 'repeat' => 'repeat', 'parallax' => 'yes', 'speed' => '10', 'max_width' => '960', 'margin' => '0px 0px 0px 0px', 'padding' => '30px 0px 30px 0px', 'border' => 'none', 'color' => '#333333', 'text_align' => 'inharit', 'text_shadow' => 'none', 'url_youtube' => '', 'url_webm' => '', 'url_vimeo' => '', 'font_size' => '12px', 'class' => ''), $atts, 'section');
$id_section = uniqid('sec_') . rand() . time();
$id_video = uniqid('svb_sec_') . rand() . time();
$background = $atts['image'] ? sprintf('%s %s url(\'%s\') repeat %s', $atts['background'], '50% 0', yt_image_media($atts['image']), $atts['parallax'] === 'yes' ? 'fixed' : 'scroll') : $atts['background'];
if ($atts['image'] && $atts['parallax'] === 'yes') {
$atts['class'] .= ' yt-section-parallax';
}
if ($atts['url_youtube']) {
$atts['class'] .= ' yt-panel-clickable';
}
JHtml::_('jquery.framework');
if ($atts['image'] && $atts['parallax'] === 'yes' or $atts['url_youtube']) {
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/section.js");
}
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/modernizr.video.js");
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/swfobject.js");
JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/video_background.js");
JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/css/section.css", 'text/css');
$atts['text_align'] = $atts['text_align'] != 'inherit' ? 'text-align:' . $atts['text_align'] . ';' : '';
$atts['text_shadow'] = $atts['text_shadow'] ? ' -webkit-text-shadow:' . $atts['text_shadow'] . ';-moz-text-shadow:' . $atts['text_shadow'] . ';text-shadow:' . $atts['text_shadow'] . ';' : '';
if ($atts['url_youtube'] != '') {
return '<div class="yt-section-forcefullwidth"><div id="' . $id_section . '" class="yt-section-wrapper" data-id="' . $id_section . '"><div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div><div class="yt-section-overlay"></div><div class="yt-section-video" id="' . $id_video . '" data-id="' . $id_video . '" data-loop="true" data-muted="true" data-autoplay="true" data-ratio="1.77" data-overlay="" data-swfpath="" data-youtube="' . $atts['url_youtube'] . '"><div id="video_background_video_1" style="z-index: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: hidden;"></div></div></div></div></div>';
} else {
if ($atts['url_webm'] != '') {
return '<div class="yt-section-forcefullwidth"><div id="' . $id_section . '" class="yt-section-wrapper" data-id="' . $id_section . '"><div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />"), " ", $content)) . '</div><div class="yt-section-overlay"></div><div class="yt-section-video" id="' . $id_video . '" data-id="' . $id_video . '" data-loop="true" data-muted="true" data-autoplay="true" data-ratio="1.77" data-overlay="" data-swfpath="" data-webm="' . $atts['url_webm'] . '"><div id="video_background_video_1" style="z-index: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: hidden;"><video autoplay="" loop="" onended="this.play()"><source src="' . $atts['url_webm'] . '" type="video/webm"></video></div></div></div></div></div>';
} else {
return '<div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div></div>';
}
}
}
示例12: display
public function display($tpl = null)
{
$this->app = JFactory::getApplication();
$this->option = JFactory::getApplication()->input->get('option');
// Get model state.
$this->state = $this->get('State');
$this->item = $this->get('Item');
// Get params
$this->params = $this->state->get('params');
/** @var $this->params Joomla\Registry\Registry */
$model = $this->getModel();
$userId = JFactory::getUser()->get('id');
if (!$this->item or $model->isRestricted($this->item, $userId)) {
$this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_INVALID_PROJECT'), 'notice');
$this->app->redirect(JRoute::_('index.php?option=com_crowdfunding&view=discover', false));
return;
}
$this->container = Prism\Container::getContainer();
$this->prepareMoneyFormatter($this->container, $this->params);
// Get the path to the images.
$this->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
$this->defaultAvatar = JUri::base() . $this->params->get('integration_avatars_default');
$this->avatarsSize = $this->params->get('integration_avatars_size', 'small');
// Prepare the link that points to project page.
$host = JUri::getInstance()->toString(array('scheme', 'host'));
$this->item->link = $host . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($this->item->slug, $this->item->catslug));
// Prepare the link that points to project image.
$this->item->link_image = $host . '/' . $this->imageFolder . '/' . $this->item->image;
// Get the current screen.
$this->screen = $this->app->input->getCmd('screen', 'home');
$this->prepareDocument();
// Import content plugins
JPluginHelper::importPlugin('content');
switch ($this->screen) {
case 'updates':
$this->prepareUpdatesScreen();
break;
case 'comments':
$this->prepareCommentsScreen();
break;
case 'funders':
$this->prepareFundersScreen();
break;
default:
// Home
break;
}
// Events
$dispatcher = JEventDispatcher::getInstance();
$this->item->event = new stdClass();
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplayMedia', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->onContentAfterDisplayMedia = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->onContentAfterDisplay = trim(implode("\n", $results));
// Count hits
$model->hit($this->item->id);
parent::display($tpl);
}
示例13: display
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
$this->params =& $params;
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->mediafilelist = listHTraininglogsHelper::getMediafilelist();
$wrapper = new stdClass();
$wrapper->load = 'onload="iFrameHeight()"';
$wrapper->url = JUri::base() . 'images/htraininglogs/' . $this->item->user_id . '/media/bigthumbs/' . $this->item->filename;
//echo $wrapper->url;exit;//http://localhost/jo32/images/htraininglogs/413/media/cci080220160003.jpg
if (!file_exists(JPATH_SITE . '/images/htraininglogs/' . $this->item->user_id . '/media/bigthumbs/' . $this->item->filename)) {
$wrapper->url = JUri::base() . 'images/htraininglogs/' . $this->item->user_id . '/media/' . $this->item->filename;
}
//echo $wrapper->url;exit;http://localhost/jo32/images/htraininglogs/413/media/cci080220160003.jpg
$this->wrapper = $wrapper;
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$doc = JFactory::getDocument();
$doc->addStyleSheet(JUri::base(true) . '/media/com_htraininglogs/css/site.stylesheet.css');
parent::display($tpl);
}
示例14: __construct
/**
* Class constructor.
*
* @since 3.1
*/
public function __construct()
{
// Run the parent constructor
parent::__construct();
// Load and set the dispatcher
$this->loadDispatcher();
// Enable sessions by default.
if (is_null($this->config->get('session'))) {
$this->config->set('session', true);
}
// Set the session default name.
if (is_null($this->config->get('session_name'))) {
$this->config->set('session_name', 'installation');
}
// Create the session if a session name is passed.
if ($this->config->get('session') !== false) {
$this->loadSession();
// Register the session with JFactory
JFactory::$session = $this->getSession();
}
// Store the debug value to config based on the JDEBUG flag
$this->config->set('debug', JDEBUG);
// Register the config to JFactory
JFactory::$config = $this->config;
// Register the application to JFactory
JFactory::$application = $this;
// Register the application name
$this->_name = 'installation';
// Register the client ID
$this->_clientId = 2;
// Set the root in the URI one level up.
$parts = explode('/', JUri::base(true));
array_pop($parts);
JUri::root(null, implode('/', $parts));
}
示例15: getLabel
protected function getLabel()
{
$cn = basename(realpath(dirname(__FILE__) . '/../..'));
$direction = intval(JFactory::getLanguage()->get('rtl', 0));
$left = $direction ? "right" : "left";
$right = $direction ? "left" : "right";
$db = JFactory::getDBO();
$sql = "SELECT value FROM #__" . substr($cn, 4) . "_settings WHERE name = '" . $this->element['triggerkey'] . "';";
$db->setQuery($sql);
$method = $db->loadResult();
if (!$method) {
$style = 'clear:both; background:#f4f4f4; border:1px solid silver; padding:5px; margin:5px 0;';
$image = '<img style="margin:0; float:' . $left . ';" src="' . JUri::base() . '../media/' . $cn . '/images/exclamation-16.png">';
return '<div style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; line-height:16px;">' . 'Problems with database' . '</span>' . '</div>';
}
if ($method != $this->element['triggervalue']) {
return "";
}
echo '<div class="clr"></div>';
$image = '';
$icon = (string) $this->element['icon'];
if (!empty($icon)) {
$image .= '<img style="margin:0; float:' . $left . ';" src="' . JUri::base() . '../media/' . $cn . '/images/' . $icon . '">';
}
$style = 'background:#f4f4f4; border:1px solid silver; padding:5px; margin:5px 0;';
if ($this->element['default']) {
return '<div style="' . $style . '">' . $image . '<span style="padding-' . $left . ':5px; line-height:16px;">' . 'error' . '</span>' . '</div>';
} else {
return parent::getLabel();
}
echo '<div class="clr"></div>';
}