本文整理汇总了PHP中JUri::root方法的典型用法代码示例。如果您正苦于以下问题:PHP JUri::root方法的具体用法?PHP JUri::root怎么用?PHP JUri::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUri
的用法示例。
在下文中一共展示了JUri::root方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
// Do not allow cache
$app->allowCache(false);
$images = $this->get('images');
$documents = $this->get('documents');
$folders = $this->get('folders');
$videos = $this->get('videos');
$state = $this->get('state');
// Check for invalid folder name
if (empty($state->folder)) {
$dirname = JFactory::getApplication()->input->getPath('folder', '');
if (!empty($dirname)) {
$dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname));
}
}
$this->baseURL = JUri::root();
$this->images =& $images;
$this->documents =& $documents;
$this->folders =& $folders;
$this->state =& $state;
$this->videos =& $videos;
parent::display($tpl);
}
示例2: loadAssets
/**
* Load common assets.
*
* @param boolean $inline Whether to load assets inline or load in header?
*
* @return void
*/
public static function loadAssets($inline = false)
{
// Define common stylesheets
$stylesheets = array();
if (JSNVersion::isJoomlaCompatible('3.0')) {
$stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css';
if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
$stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery.ui.1.9.0.ie.css';
}
} else {
$stylesheets[] = JSN_URL_ASSETS . '/3rd-party/bootstrap/css/bootstrap.min.css';
$stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css';
if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
$stylesheets[] = JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.ie.css';
}
}
$stylesheets[] = JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css';
// Load stylesheets
if (!$inline) {
JSNHtmlAsset::addStyle($stylesheets);
} else {
foreach ($stylesheets as $stylesheet) {
$html[] = '<link type="text/css" href="' . $stylesheet . '" rel="stylesheet" />';
}
echo implode("\n", $html);
}
// Load scripts
if (JSNVersion::isJoomlaCompatible('3.2')) {
JSNHtmlAsset::addScript(JUri::root(true) . '/media/jui/js/jquery.min.js');
}
}
示例3: onPromoteData
function onPromoteData($id)
{
$db = JFactory::getDBO();
$Itemid = JRequest::getInt('Itemid');
$jschk = $this->_chkextension();
if (!empty($jschk)) {
$query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
$db->setQuery($query);
$fieldid = $db->loadresult();
$query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
if ($fieldid) {
$query .= " AND cfv.field_id=" . $fieldid;
}
$db->setQuery($query);
$previewdata = $db->loadObjectlist();
if (!$fieldid) {
$previewdata[0]->bodytext = '';
}
// Include Jomsocial core
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once $jspath . DS . 'libraries' . DS . 'core.php';
$previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
if ($previewdata[0]->image == '') {
$previewdata[0]->image = 'components/com_community/assets/user-Male.png';
}
return $previewdata;
} else {
return '';
}
}
示例4: display
public function display($tpl = null)
{
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
// Do not allow cache
$app->allowCache(false);
JHtml::_('behavior.framework', true);
JFactory::getDocument()->addScriptDeclaration("\r\n\t\twindow.addEvent('domready', function()\r\n\t\t{\r\n\t\t\twindow.parent.document.updateUploader();\r\n\t\t\t\$\$('a.img-preview').each(function(el)\r\n\t\t\t{\r\n\t\t\t\tel.addEvent('click', function(e)\r\n\t\t\t\t{\r\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});");
$images = $this->get('images');
$documents = $this->get('documents');
$folders = $this->get('folders');
$state = $this->get('state');
// Check for invalid folder name
if (empty($state->folder)) {
$dirname = JRequest::getVar('folder', '', '', 'string');
if (!empty($dirname)) {
$dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname));
}
}
$this->baseURL = JUri::root();
$this->images =& $images;
$this->documents =& $documents;
$this->folders =& $folders;
$this->state =& $state;
parent::display($tpl);
}
示例5: getInput
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 1.0
*/
protected function getInput()
{
// Receive ajax URL
$ajaxUrl = isset($this->element['url']) ? (string) $this->element['url'] : null;
if ($ajaxUrl) {
$siteUrl = JUri::root();
$adminUrl = $siteUrl . 'administrator';
$this->ajaxchildOptions['ajaxUrl'] = str_replace(array('{admin}', '{backend}', '{site}', '{frontend}'), array($adminUrl, $adminUrl, $siteUrl, $siteUrl), $ajaxUrl);
}
// Receive child field selector
$childSelector = isset($this->element['child_selector']) ? (string) $this->element['child_selector'] : null;
if ($childSelector) {
$this->ajaxchildOptions['childSelector'] = $childSelector;
}
// Receive parent field selector
$parentSelector = isset($this->element['parent_selector']) ? (string) $this->element['parent_selector'] : null;
if ($parentSelector) {
$this->ajaxchildOptions['parentSelector'] = $parentSelector;
}
// Receive parent request var
$parentVarName = isset($this->element['parent_varname']) ? (string) $this->element['parent_varname'] : null;
if ($parentVarName) {
$this->ajaxchildOptions['parentVarName'] = $parentVarName;
}
return parent::getInput();
}
示例6: onDisplay
function onDisplay($name)
{
$js = "\r\n\t\tfunction oziofunction(menu_id) {\r\n\t\t\tvar tag = '{oziogallery ' + menu_id + '}';\r\n\t\t\tjInsertEditorText(tag, '" . $name . "');\r\n\t\t\tSqueezeBox.close();\r\n\t\t}";
require_once JPATH_SITE . "/components/com_oziogallery3/oziogallery.inc";
$style = "";
$postfix = "";
if (!$GLOBALS["oziogallery3"]["registered"]) {
$style = ".button2-left .oziogallery a { color: #f03030; }";
$postfix = " (Unregistered)";
}
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
$document->addStyleSheet(JUri::root(true) . "/plugins/" . $this->_type . "/" . $this->_name . "/css/style.css");
$document->addStyleDeclaration($style);
JHtml::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->class = 'btn';
$application = JFactory::getApplication();
$prefix = 'administrator/';
if ($application->isAdmin()) {
$prefix = '';
}
$button->set('link', $prefix . 'index.php?option=com_oziogallery3&view=galleries&layout=modal&tmpl=component&function=oziofunction');
$button->set('text', JText::_('BTN_OZIOGALLERY_BUTTON_LABEL') . $postfix);
$button->set('name', 'camera');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例7: onUserAfterSave
/**
* Utility method to act on a user after it has been saved.
*
* This method sends a registration email to new users created in the backend.
*
* @param array $user Holds the new user data.
* @param boolean $isnew True if a new user is stored.
* @param boolean $success True if user was succesfully stored in the database.
* @param string $msg Message.
*
* @return void
* @since 1.6
*/
public function onUserAfterSave($user, $isnew, $success, $msg)
{
// Initialise variables.
$app = JFactory::getApplication();
$config = JFactory::getConfig();
$mail_to_user = $this->params->get('mail_to_user', 1);
if ($isnew) {
// TODO: Suck in the frontend registration emails here as well. Job for a rainy day.
if ($app->isAdmin()) {
if ($mail_to_user) {
// Load user_joomla plugin language (not done automatically).
$lang = JFactory::getLanguage();
$lang->load('plg_user_joomla', JPATH_ADMINISTRATOR);
// Compute the mail subject.
$emailSubject = JText::sprintf('PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', $user['name'], $config->get('sitename'));
// Compute the mail body.
$emailBody = JText::sprintf('PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', $user['name'], $config->get('sitename'), JUri::root(), $user['username'], $user['password_clear']);
// Assemble the email data...the sexy way!
$mail = JFactory::getMailer()->setSender(array($config->get('mailfrom'), $config->get('fromname')))->addRecipient($user['email'])->setSubject($emailSubject)->setBody($emailBody);
if (!$mail->Send()) {
// TODO: Probably should raise a plugin error but this event is not error checked.
JError::raiseWarning(500, JText::_('ERROR_SENDING_EMAIL'));
}
}
}
} else {
// Existing user - nothing to do...yet.
}
}
示例8: getInput
protected function getInput()
{
$document = JFactory::getDocument();
$document->addScript(JUri::root() . 'modules/mod_jxtc_ytpwall/elements/ytplaylist.min.js');
$html = '
<div class="input-append">
<input type="text" class="input-xlarge" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
<i class="icon icon-cog"></i>
</button>
<div class="dropdown-menu keep-open well well-small">
Select playlists from a channel:<br><br>
<input type="text" id="userName" placeholder="YouTube channel name">
<button type="button" class="btn" onClick="ytplquery();" />Query</button>
<div id="ytplerror" style="color:#F00"></div>
<div id="ytplresult"></div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(function() { jQuery(".keep-open").click(function(e) { e.stopPropagation(); }); });
</script>
';
return $html;
}
示例9: getInput
public function getInput()
{
$app = JFactory::getApplication();
$heatmapforcecheck = JRequest::getInt('heatmapforcecheck', 0);
if ($app->isAdmin() && $heatmapforcecheck) {
$cache = JFactory::getCache();
$result = $cache->clean('plg_system_heatmap:accountcheck');
$refresh_uri = JUri::getInstance();
$refresh_uri->delVar('heatmapforcecheck');
$refresh_uri = $refresh_uri->toString();
$app->redirect($refresh_uri);
}
$cache = JFactory::getCache('plg_system_heatmap:accountcheck');
$cache->setCaching(true);
$cache->setLifeTime(86400);
//24h
$domain = urlencode(JUri::root(false));
//$accountCheck = HeatmapAccountChecker::check($domain);
$accountCheck = $cache->call(array('HeatmapAccountChecker', 'check'), $domain);
if ($accountCheck['valid']) {
$msg .= '<span class="text-success">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT_VALID') . '</span>';
} else {
$msg .= '<span class="text-error">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT_NOT_FOUND') . '</span>';
}
$refresh_uri = JUri::getInstance();
$refresh_uri->setVar('heatmapforcecheck', 1);
$refresh_uri = $refresh_uri->toString();
$msg .= '<br><a class="btn" href="' . $refresh_uri . '">' . JText::_('PLG_HEATMAP_CHECK_ACCOUNT') . '</a>';
$lastcheck = isset($accountCheck['lastcheck']) ? $accountCheck['lastcheck'] : JText::_('PLG_HEATMAP_NEVER');
$msg .= '<br>' . JText::_('PLG_HEATMAP_LAST_CHECK') . ' ' . $lastcheck;
if (isset($accountCheck['error']) && $accountCheck['error']) {
$msg .= '<br>' . JText::_('PLG_HEATMAP_ERROR_MSG') . ' <em>' . $accountCheck['error'] . '</em>';
}
return $msg;
}
示例10: display
/**
* CP Values view display method
* @return void
**/
function display($tpl = null)
{
global $option;
$this->_context = $option . 'tags';
// nombre del contexto
$this->cid = JRequest::getVar('cid', 0, '', 'int');
$document = JFactory::getDocument();
$script = JUri::root() . '/administrator/components/com_customproperties/includes/customproperties_ext.js';
$document->addScript($script);
$app =& JFactory::getApplication();
$user = JFactory::getUser();
$aid = $user->get('aid', 0);
$gid = $user->get('gid', 0);
$ce_file = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_customproperties' . DS . 'contentelement.class.php';
require_once $ce_file;
// get the content element
$option = JRequest::getVar('contentname');
if (!$option) {
$ce = getContentElementByName("content");
} else {
$ce = getContentElementByOption($option);
}
$this->assignRef('ce', $ce);
$query = " SELECT DISTINCT f.id AS fid, f.label AS name, v.id AS vid, v.label, v.access_group AS ag\r\n FROM #__custom_properties AS cp\r\n\t\t\tINNER JOIN #__custom_properties_fields AS f\r\n\t\t\tON (cp.field_id = f.id)\r\n\t\t\tINNER JOIN #__custom_properties_values AS v\r\n\t\t\tON (cp.value_id = v.id)\r\n WHERE cp.ref_table = '" . $ce->table . "'\r\n\t\t\tAND cp.content_id = '{$this->cid}'\r\n\t\t\tAND f.published = '1'\r\n\t\t\tAND f.access <= '{$aid}'\r\n ORDER BY f.ordering, v.ordering ";
$database = JFactory::getDBO();
$database->setQuery($query);
$database->getErrorMsg();
$this->assignRef('tags', $database->loadObjectList());
$this->assignRef('app', $app);
$this->assignRef('gid', $gid);
parent::display($tpl);
}
示例11: getList
public function getList()
{
if (!$this->_list) {
$this->_list = array('sitemapindex' => array());
$configs = $this->getService('com://site/sitemap.model.configs')->limit(0)->getList();
foreach ($configs as $config) {
// Get model identifier
$identifier = clone $this->getIdentifier();
$identifier->package = $config->package;
$identifier->name = $config->name;
// Get total
$model = $this->getService($identifier);
$total = $model->getTotal();
$model->sort('modified_on')->direction('desc')->limit(1);
for ($i = 0; $i < $total;) {
// Get first item for lastmod
$item = $model->offset($i)->getList()->top();
$sitemap = new stdClass();
$sitemap->loc = JUri::root() . 'index.php?option=com_sitemap&view=sitemap&urlset_offset=' . $i . '&urlset_limit=500&package=' . $identifier->package . '&name=' . $identifier->name . '&format=xml';
$sitemap->lastmod = self::getLastMod(array('item' => $item));
array_push($this->_list['sitemapindex'], $sitemap);
$i += 500;
}
}
}
return $this->_list;
}
示例12: getInput
protected function getInput()
{
if (version_compare(JVERSION, '3.0.0') == -1) {
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
if (version_compare(PHP_VERSION, '5.2.4') == -1) {
$app->enqueueMessage(JText::sprintf('MOD_PWEBCONTACT_CONFIG_MSG_PHP_VERSION', '5.2.4'), 'error');
}
// jQuery and Bootstrap in Joomla 2.5
if (!class_exists('JHtmlJquery')) {
$error = null;
if (!is_file(JPATH_PLUGINS . '/system/pwebj3ui/pwebj3ui.php')) {
$error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_INSTALL_PWEBLEGACY', '<a href="http://www.perfect-web.co/blog/joomla/62-jquery-bootstrap-in-joomla-25" target="_blank">', '</a>');
} elseif (!JPluginHelper::isEnabled('system', 'pwebj3ui')) {
$error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_ENABLE_PWEBLEGACY', '<a href="index.php?option=com_plugins&view=plugins&filter_search=' . urlencode('Perfect Joomla! 3 User Interface') . '" target="_blank">', '</a>');
} else {
JLoader::import('cms.html.jquery', JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'pwebj3ui' . DIRECTORY_SEPARATOR . 'libraries');
}
if ($error) {
$app->enqueueMessage($error, 'error');
$doc->addScriptDeclaration('window.addEvent("domready", function(){' . 'new Element("div", {class: "pweb-fields-tip", html: \'<span class="badge badge-important">' . $error . '</span>\'}).inject(document.id("jform_params_fields"),"top");' . '});');
}
}
$doc->addStyleSheet(JUri::root(true) . '/media/mod_pwebcontact/css/admin_j25.css');
}
return null;
}
示例13: display
public function display($tpl = null)
{
$user = JFactory::getUser();
$document = JFactory::getDocument();
$url = JUri::root();
$settings = JEMHelper::globalattribs();
// Initialise variables.
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->settings = $settings;
$params = $this->state->get('params');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Load css
JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
$this->user = $user;
# add toolbar
$this->addToolbar();
parent::display($tpl);
}
示例14: display
/**
* Affichage de la vue par défaut
* @see JView::display()
*/
function display($tpl = null)
{
//Chargement des scripts
$document = JFactory::getDocument();
$document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');
$document->addScript(JUri::root() . 'media/com_owncloudconnect/js/owncloudconnect.js');
//On récupère les variables de session
$session = JFactory::getSession();
//On récupère le nom du HOST pour connexion sécurisée via iFrame
$this->ref = urlencode(OwncloudconnectHelper::stringEncrypt($_SERVER['HTTP_HOST']));
//On récupère l'adresse de la plateforme ownCloud
$param = JComponentHelper::getParams('com_owncloudconnect');
$this->owncloud_platformurl = $param->get('owncloud_platformurl');
//On va chercher si l'utilisateur connecté est enregistré dans la table du composant
$this->oc_user = $this->get('Utilisateur');
//Si l'utilisateur peut se connecter à ownCloud, on regarde si d'autres identifiants sont définis, sinon l'utilisateur accède à la plateforme via ses ident en session
if (!isset($this->oc_user->forbid_public) || $this->oc_user->forbid_public == 0) {
if ($this->oc_user && $this->oc_user->oc_login && $this->oc_user->oc_password) {
$this->login = urlencode(OwncloudconnectHelper::stringEncrypt(json_encode(array('login' => $this->oc_user->oc_login, 'pass' => OwncloudconnectHelper::stringDecrypt($this->oc_user->oc_password)))));
} else {
$this->login = urlencode(OwncloudconnectHelper::stringEncrypt(json_encode(array('login' => $session->get('oc_user'), 'pass' => $session->get('oc_password')))));
}
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
parent::display($tpl);
}
示例15: __construct
public function __construct()
{
parent::__construct();
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_rsmembership/tables');
$document = JFactory::getDocument();
$config = RSMembershipConfig::getInstance();
$version = (string) new RSMembershipVersion();
// Load our CSS
$document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/rsmembership.css?v=' . $version);
// Load our JS
$document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/rsmembership.js?v=' . $version);
if (!RSMembershipHelper::isJ3()) {
// Load 2.5 CSS
$document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/j2.css?v=' . $version);
// Load Bootstrap on 2.5.x
if ($config->get('load_bootstrap')) {
$document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/bootstrap.min.css?v=' . $version);
$document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/jquery.min.js?v=' . $version);
$document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/jquery.noconflict.js?v=' . $version);
$document->addScript(JUri::root(true) . '/components/com_rsmembership/assets/js/bootstrap.min.js?v=' . $version);
}
} else {
// Load 3.x CSS
$document->addStyleSheet(JUri::root(true) . '/components/com_rsmembership/assets/css/j3.css?v=' . $version);
// Load Bootstrap on 3.x
if ($config->get('load_bootstrap')) {
JHtml::_('bootstrap.framework');
}
}
}